@echo oFF

@set oldpath=%path%
@set oldinclude=%include%
@set oldlib=%lib%
@set oldlibpath=%libpath%

rem rem  Visual C++  2017  - as of 1/6/2019
if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" call "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"  GOTO CONTINUEPROCESS

if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" call  "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"  x86_amd64
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" GOTO CONTINUEPROCESS

rem rem  Visual C++  2017  - as of 3/14/2019
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" call "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"  GOTO CONTINUEPROCESS

if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" call  "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"  x86_amd64
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" GOTO CONTINUEPROCESS

rem *********************

REM Visual C++ 2015
if exist "%ProgramFiles%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" call "%ProgramFiles%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
if exist "%ProgramFiles%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" GOTO CONTINUEPROCESS

if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" call "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" GOTO CONTINUEPROCESS


:CONTINUEPROCESS


set sys=CGW64VC

rem **************************************************************
rem   make resource vcCGW.RES for MicroSoft / VC
rem **************************************************************




rem **************************************************************
rem   harbour v3.2 with fwh64-1903 16.05 and MicroSoft / VC
rem **************************************************************


echo Compile step > out.txt

DEL CGW64.EXE


:MAKE

CALL f:\utility\RMAKE32 %sys%.RMK   3



IF NOT ERRORLEVEL 1 GOTO PHASE2


ECHO Error?????????????
GOTO END

:PHASE2

echo Link Step > out.txt

link @%sys%.lnk /nologo /subsystem:windows /force:multiple /OUT:CGW64.EXE


IF NOT EXIST CGW64.EXE GOTO MAKE

ECHO Done!

:END



@set path=%oldpath%
@set include=%oldinclude%
@set lib=%oldlib%
@set libpath=%oldlibpath%


