Page 1 of 1
MSVC buildh32.bat
Posted: Sun Oct 16, 2022 8:08 am
by Jimmy
hi,
there is a file c:\fwh\samples\buildh32.bat
i guess it is for 32 Bit ... but how to use under 32 Bit OS
VisualStudioSetup say "need 64 Bit" ... is there a 32 Bit Version

Re: MSVC buildh32.bat
Posted: Sun Oct 16, 2022 9:13 am
by Antonio Linares
Dear Jimmy,
Are you using Visual Studio Community 2022 ?
Re: MSVC buildh32.bat
Posted: Sun Oct 16, 2022 9:23 am
by Jimmy
Antonio Linares wrote:Are you using Visual Studio Community 2022 ?
Yes on 64 Bit OS
but it seems not possible on 32 Bit OS to install Visual Studio Community 2022
Re: MSVC buildh32.bat
Posted: Sun Oct 16, 2022 3:03 pm
by Antonio Linares
Dear Jimmy,
I use Windows 11 64 bits, sorry I have not tested it lately on Windows 32 bits
Re: MSVC buildh32.bat
Posted: Sun Oct 16, 2022 11:38 pm
by TimStone
You use VS Community 2022 on the 64 bit OS only.
However, you can build both 32 bit and 64 bit versions with that install.
When building my program, I can use the VS IDE to build either one. I use those builds for testing because it is very quick.
For distribution product, I'm not using Buildh32.bat, but with my application, I use a .bat plus .mak file. I have one for 32 bit and one for 64 bit. I use the exact same code source. It is only in configuring, and also selecting either the directory of 32 bit, or 64 bit, libraries. I have no problems with either build.
This is the 32 bit .bat file:
Code: Select all | Expand
@set oldpath=%path%
@set oldinclude=%include%
@set oldlib=%lib%
@set oldlibpath=%libpath%
if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\Hostx86\x86\nmake" -fMLS32.mak
@set path=%oldpath%
@set include=%oldinclude%
@set lib=%oldlib%
@set libpath=%oldlibpath%
@set oldpath=""
@set oldinclude=""
@set oldlib=
@set oldlibpath=
And the setup portion of the .mak file:
Code: Select all | Expand
HBDIR=c:\harbour
FWDIR=c:\fwh
VCDIR="c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\Hostx32\x32"
SDKDIR="c:\Program Files (x86)\Windows Kits\10"
RCDIR="c:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x32"
PRLIB="c:\Projects\Libs"
This is the 64 bit .bat file
Code: Select all | Expand
@set oldpath=%path%
@set oldinclude=%include%
@set oldlib=%lib%
@set oldlibpath=%libpath%
if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_x64
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\Hostx64\x64\nmake" -fMLS64.mak
@set path=%oldpath%
@set include=%oldinclude%
@set lib=%oldlib%
@set libpath=%oldlibpath%
@set oldpath=""
@set oldinclude=""
@set oldlib=
@set oldlibpath=
And the setup section of the 64 bit .mak file:
Code: Select all | Expand
HBDIR=c:\Harbour64
FWDIR=c:\fwh64
VCDIR="c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\Hostx64\x64"
SDKDIR="c:\Program Files (x86)\Windows Kits\10"
RCDIR="c:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64"
PRLIB="c:\Projects\Libs"
When specifying the .prg files, they will be the same for both .mak files, but when specifying the .lib files to be used, you will need to be sure you use the correct directories and file names. For example, Fiveh32.lib vs. Fiveh64.lib. Some .libs will be OK for both.
I hope this helps.
Re: MSVC buildh32.bat
Posted: Mon Oct 17, 2022 6:11 am
by Jimmy
hi Tim,
TimStone wrote:You use VS Community 2022 on the 64 bit OS only.
ah, i understand ... need to use 64 Bit OS to build 32 Bit App

Re: MSVC buildh32.bat
Posted: Mon Oct 17, 2022 7:46 am
by Enrico Maria Giordano
[quote="TimStone"]
Code: Select all | Expand
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\Hostx86\x86\nmake" -fMLS32.mak
Why not "Hostx64" for x86 build?
Re: MSVC buildh32.bat
Posted: Mon Oct 17, 2022 7:47 am
by Antonio Linares
Dear Enrico,
I guess nmake works the same for both architectures
just guessing
Re: MSVC buildh32.bat
Posted: Mon Oct 17, 2022 7:49 am
by Enrico Maria Giordano
Hi Antonio, I don't understand your answer... ?
Re: MSVC buildh32.bat
Posted: Mon Oct 17, 2022 7:51 am
by Enrico Maria Giordano
I meant that you can use Hostx64 for both x64 and x86 build. You only have to run it on a 64bit system.
Re: MSVC buildh32.bat
Posted: Mon Oct 17, 2022 5:16 pm
by TimStone
Enrico,
That works fine. I guess I was just working from habit with the older versions. I just tested to be sure.
Tim