Compilar con MSVC y HARBOUR

Compilar con MSVC y HARBOUR

Postby acuellar » Thu Apr 18, 2024 8:17 pm

Buenas estimados

Si aún sigues con BCC y xHarbour/Harbour
Es el momento para cambiarse a lo mejor, con MSVC y HARBOUR Realmente es mucho mas rápido

Descargar HARBOUR para MSVC recien actualizado desde https://github.com/FiveTechSoft/harbour_and_xharbour_builds/blob/master/README.md
Descargar Visual Studio Community desde https://visualstudio.microsoft.com/es/vs/community/

Con VisualStudioSetup.exe instalar Desarrollo para el escritorio con C++

Luego de instalarlo, Si lo quiere hacer portable lo puede hacer con éste Script

CreaPortableMSVC.bat (Cambiar la ruta destino y x86 por x64 a su necesidad)
Code: Select all  Expand view

ROBOCOPY "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx86\x86" D:\Compiler\VS2022\Bin /MIR
ROBOCOPY "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\lib\x86" D:\Compiler\VS2022\Lib *.LIB
ROBOCOPY "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include" D:\Compiler\VS2022\Include *.h
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86" D:\Compiler\VS2022\Bin RC.EXE
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86" D:\Compiler\VS2022\Bin RCDLL.DLL
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt" D:\Compiler\VS2022\Include *.H
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um" D:\Compiler\VS2022\Include *.H
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared" D:\Compiler\VS2022\Include *.H
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\ucrt\x86" D:\Compiler\VS2022\Lib *.LIB
ROBOCOPY "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\x86" D:\Compiler\VS2022\Lib *.LIB
 

Luego de crear su portable VS2022 puede desintalar Visual Studio y recupera sus 10GB que utilizó en la instalación

Para enlazar con el Editor UEstudio use éste Application
Code: Select all  Expand view

# --------- Harbour y FWH configuration --------
# --- general --------------------------------------
# $P  - project name
# $Pp - path to project directory
# $Pn - project name
# --- compile --------------------------------------
# $I  - input full name
# $Ip - input path
# $In - input name
# $Ie - input extension
# $O  - output file
# $Op - path to output file
# $On - output filename (without path)
# $Oe - output extension
# $R  - release/debug setting for compiler
# --- build ----------------------------------------
# $T  - target full name
# $Tp - target path
# $Tn - target name
# $O  - output file
# $Op - path to output file
# $On - output filename (without path)
# $Oe - output extension
# $R  - release/debug setting for linker

[Settings]
Target =
Category&01 = DEFAULT RUN CONFIGURATION
Working Directory =.
Command Line Arguments =

Category&02 = Harbour Options
Automatic Memvar Declaration = no|yes
Variables Are Assumed = no|yes
Generate Preprocessed Output = no|yes
Warning Level = 1|2|3|4|0
User Include Path =
User Defines =

Compiler Options =
Linker Options =

Excluded Files = Excludes

[SettingsInfo]
Target = Provides a space for you to specify an output file and location of the program that the linker creates.
Working Directory = Provides a space for you to specify the directory in which executing occurs. If you do not specify a directory, executing occurs in the directory where the executable is located.
Command Line Arguments = Provides a space for you to specify command-line arguments you want to pass to the program at startup.
Compiler Options = Provides a space for you to specify an additional compiler options.
User Defines = Shows the switches the tool will use to build. Use ';' as delimiter.
Linker Options = Provides a space for you to specify an additional linker options.
Excluded Files = This will exclude the file(s) included in this UE project group from the build.

[SettingsReps]
User Defines = @[;|-D%s]
Automatic Memvar Declaration = no=|yes=/a
Variables Are Assumed = no=|yes=/v
Generate Preprocessed Output = no=|yes=/p
User Include Path = ^^@[;|;%s]
User Include Path&1 = ^^@[;| /i%s]
Use Multi Thread Library = no|yes
Warning Level = @/w%s

[Variables]
FWH = D:\COMPILER\FWH
HPATH = D:\COMPILER\HarbourVS
VSPATH = D:\Compiler\VS2022

HPATHL = $(HPATH)\LIB
VSPATHL = $(VSPATH)\LIB

HOPT = /n /gc0 /q $(Compiler Options) /i$(HPATH)\INCLUDE $(User Include Path&1) $(User Defines) $(Automatic Memvar Declaration) $(Variables Are Assumed) $(Generate Preprocessed Output) $(Warning Level)

COPT = -TP -W3 -c -I$(HPATH)\INCLUDE
LOPT = /nologo /subsystem:windows /force:multiple /NODEFAULTLIB:libucrt /NODEFAULTLIB:msvcrt

LIBS1 = $(FWH)\LIB\FiveH32.lib $(FWH)\LIB\FiveHC32.lib
LIBS2 = $(HPATHL)\hbrtl.lib $(HPATHL)\hbvm.lib $(HPATHL)\gtgui.lib $(HPATHL)\hblang.lib $(HPATHL)\hbmacro.lib $(HPATHL)\hbrdd.lib $(HPATHL)\rddntx.lib $(HPATHL)\rddcdx.lib $(HPATHL)\rddfpt.lib $(HPATHL)\hbsix.lib $(HPATHL)\hbcommon.lib $(HPATHL)\hbpp.lib $(HPATHL)\xhb.lib $(HPATHL)\hbzlib.lib $(HPATHL)\hbcpage.lib $(HPATHL)\hbwin.lib $(HPATHL)\hbct.lib $(HPATHL)\hbcplr.lib $(HPATHL)\hbpcre.lib $(HPATHL)\hbziparc.lib $(HPATHL)\minizip.lib $(HPATHL)\hbmzip.lib $(HPATHL)\hbtip.lib $(HPATHL)\hbzebra.lib
LIBS3 = $(VSPATHL)\user32.lib $(VSPATHL)\gdi32.lib $(VSPATHL)\winspool.lib $(VSPATHL)\comctl32.lib $(VSPATHL)\comdlg32.lib $(VSPATHL)\advapi32.lib $(VSPATHL)\shell32.lib $(VSPATHL)\ole32.lib $(VSPATHL)\oleaut32.lib $(VSPATHL)\mpr.lib $(VSPATHL)\version.lib $(VSPATHL)\msimg32.lib $(VSPATHL)\oledlg.lib $(VSPATHL)\gdiplus.lib $(VSPATHL)\winmm.lib $(VSPATHL)\ws2_32.lib $(VSPATHL)\iphlpapi.lib $(VSPATHL)\ucrt.lib
LIBS = $(LIBS1) $(LIBS2) $(LIBS3)

[Environment]
PATH = $(HPATH)\BIN;$(VSPATH)\BIN;%PATH%
INCLUDE = $(FWH)\INCLUDE;$(HPATH)\INCLUDE;$(VSPATH)\INCLUDE
LIB = $(HPATHL);$(VSPATHL);$(FWH)\LIB
BuildMode = %UESMode%

[General]
TargetExt = .EXE
ReleaseOut = Release
DebugOut = Debug
UseFullPaths = 1
UseDosNames = 0
Excludes = $(Excluded Files)
GenerateEDGroup=$(External Dependencies)
.CPP = .C

[MakeCommands]
run = Execute Application
makef = Show Makefile

[Execute Application]
Title = Execute $T
Cmd0 = $(Command Line Arguments)
Depends = $T
ShowWindow = 1
DisplayConsole = 0

[Show Makefile]
Title=Show makefile
Cmd0=uestudio makefile
ShowWindow=1
DisplayConsole=0

[InsertFiles]

[FileGroups]
FGO = .obj;
FGR = .res;
FGL = .lib;
FGD = .def;

[GroupFormats]
FGO = %s
FGR = %s
FGL = %s

[Build]
Out = $T
Depends = $FGO $FGR
DebugFlag =
ReleaseFlag =
Cmd0 = $(VSPATH)\BIN\LINK $(LOPT) /OUT:$Pp\$T $FGO $FGR $(LIBS1) $(LIBS2) $(LIBS3)
Cmd1 = $Pp\$T

[.PRG]
Out = $In.c
DebugFlag = /b
ReleaseFlag = /l
Cmd0 = $(HPATH)\BIN\harbour $I $(HOPT) $R /o$O

IncFiles = 1
CaseSensitive = 0
IncDirs = .;$(INCLUDE);
IncKeyWords = #include;
Comments = /*.*/.//.eol.

[.C]
Out = $In.obj
Cmd0 = $(VSPATH)\BIN\cl.exe $(COPT) $I

[.RC]
Out = $In.res
Cmd0 = $(VSPATH)\bin\rc -r -fo$O $I

IncFiles = 1
CaseSensitive = 0
IncDirs = .;$(INCLUDE);
IncKeyWords = #include;
Comments = /*.*/.//.eol.
 

Para enlazar con Hbmk use éste Script GoHbmk.bat
Code: Select all  Expand view

Set path=D:\Compiler\VS2022\BIN
D:\Compiler\HarbourVS\bin\hbmk2 prg\proyecto.hbp -comp=msvc -run
 

El proyecto.hbp
Code: Select all  Expand view

-gui
-w0
-ID:\Compiler\FWH\include;D:\Compiler\VS2022\include

programa1.PRG
programa1.RES
-LD:\Compiler\FWH\LIB;D:\Compiler\VS2022\lib
-lfiveh32
-lfivehc32
-lgdiplus
-lOleDlg
-lversion
-lucrt

xhb.hbc
hbct.hbc
hbwin.hbc
hbmzip.hbc
hbziparc.hbc

-ldflag=/NODEFAULTLIB:libucrt
-ldflag=/NODEFAULTLIB:msvcrt
programa.RC
 


Con MSVC pueden incluir la libreria mysqlclient.lib de FWH que es para MySql/MariaDB la cual hace que tu sistema sea 100% portable y no necesite de libmariadb.dll y libmysql.dll (Crece un poco el ejecutable)

Espero les ayude y sea la oportunidad de utilizar estas maravillosas herramientas con las cuales notaran la gran diferencia en la performance de sus sistemas
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1643
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Compilar con MSVC y HARBOUR

Postby miarcod » Mon May 27, 2024 3:45 pm

Hola
Gracias por la información

Estoy intentado usar lo que comentas pero al intentar generar el ejemplo hbhttpd me aparece el error, no se si me aparecerán otros posteriormente

Code: Select all  Expand view

...\contrib\hbhttpd\tests>hbmk2 eshop.prg

hbmk2: Processing local make script: hbmk.hbm
Harbour 3.2.0dev (r2404101339)
Copyright (c) 1999-2021, https://harbour.github.io/
Compiling 'eshop.prg'...
Lines 397, Functions/Procedures 9
Generating C source output to 'C:\Users\Miguel\AppData\Local\Temp\hbmk_mix34m.dir\eshop.c'... Done.
eshop.c
LINK : fatal error LNK1181: no se puede abrir el archivo de entrada 'ssleay32.lib'
hbmk2: Error: Running linker. 1181
link.exe @C:\Users\Miguel\AppData\Local\Temp\luyoee.lnk
 


Podrías indicarme donde puedo conseguir la librería(s) que me falta(n)

Gracias
miarcod
 
Posts: 199
Joined: Tue Oct 11, 2005 2:17 pm

Re: Compilar con MSVC y HARBOUR

Postby Antonio Linares » Mon May 27, 2024 7:38 pm

Miguel,

Que compilador de C estás usando ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Compilar con MSVC y HARBOUR

Postby miarcod » Tue May 28, 2024 5:09 am

Hola

Estoy siguiendo las instrucciones para cambiar al MSVC tal y como se indica en el mensaje e intentando construir el ejemplo

hbhttpd

Soy capaz de construirlo con minigw (Harbour 3.0) y con la version minigw (Harbur 3.2)

Lo que pretendía era montarla con MSVC

Gracias
miarcod
 
Posts: 199
Joined: Tue Oct 11, 2005 2:17 pm

Re: Compilar con MSVC y HARBOUR

Postby sysctrl2 » Wed May 29, 2024 4:00 pm

Alguien YA tiene la "carpeta portable" para compilar con MSVC y HARBOUR
y que la quieran compartir ? :shock:

saludos !
Cesar Cortes Cruz
SysCtrl Software
Mexico

' Sin +- FWH es mejor "
User avatar
sysctrl2
 
Posts: 1020
Joined: Mon Feb 05, 2007 7:15 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 91 guests