From 0473972c46a920b82ea7090b95dfed3127aefbe4 Mon Sep 17 00:00:00 2001 From: Geoff McLane Date: Mon, 28 Sep 2020 16:07:35 +0200 Subject: [PATCH] Update cmake/32 and win64/64 builds --- build/cmake/build-me.bat | 21 +++- build/win64/.gitignore | 2 + build/win64/build-me-v14.bat | 202 +++++++++++++++++++++++++++++++++++ build/win64/build-me.bat | 183 +++++++++++++------------------ 4 files changed, 296 insertions(+), 112 deletions(-) create mode 100644 build/win64/build-me-v14.bat diff --git a/build/cmake/build-me.bat b/build/cmake/build-me.bat index c4130f3..fbf853f 100644 --- a/build/cmake/build-me.bat +++ b/build/cmake/build-me.bat @@ -4,11 +4,15 @@ @set TMPPRJ=tidy @set TMPSRC=..\.. @set TMPBGN=%TIME% -@set TMPINS=..\..\..\software +@set TMPINS=D:\Projects\3rdParty @set TMPLOG=bldlog-1.txt @set DOPAUSE=1 +@set TMPGEN=Visual Studio 16 2019 +@set TMPBR=next +@set TMPINDBG=0 -@set TMPOPTS=-DCMAKE_INSTALL_PREFIX=%TMPINS% +@set TMPOPTS=-G "%TMPGEN%" -A Win32 +@set TMPOPTS=%TMPOPTS% -DCMAKE_INSTALL_PREFIX=%TMPINS% @set TMPOPTS=%TMPOPTS% -DBUILD_SHARED_LIB=ON :RPT @@ -23,9 +27,11 @@ :GOTCMD @call chkmsvc %TMPPRJ% -@call chkbranch next +@if "%TMPBR%x" == "x" goto DNBR +@call chkbranch %TMPBR% +:DNBR -@echo Build %DATE% %TIME% > %TMPLOG% +@echo Build %TMPPRJ% 32-bits %DATE% %TIME%, in %CD%, to %TMPLOG% > %TMPLOG% @if NOT EXIST %TMPSRC%\nul goto NOSRC @@ -57,6 +63,11 @@ @call elapsed %TMPBGN% @echo Appears a successful build... see %TMPLOG% @echo Note install location %TMPINS% +@if "%TMPINDBG%x" == "1x" ( +@echo Will install Debug and Release +) else { +@echo Will only intall Release +) @echo. @REM ############################################## @@ -86,10 +97,12 @@ :DOINST @echo Proceeding with INSTALL... @echo. +@if NOT "%TMPINDBG%x" == "1x" goto DNDBGIN @echo Doing: 'cmake --build . --config Debug --target INSTALL' @echo Doing: 'cmake --build . --config Debug --target INSTALL' >> %TMPLOG% 2>&1 @cmake --build . --config Debug --target INSTALL >> %TMPLOG% 2>&1 @if ERRORLEVEL 1 goto ERR4 +:DNDBGIN @echo Doing: 'cmake --build . --config Release --target INSTALL' @echo Doing: 'cmake --build . --config Release --target INSTALL' >> %TMPLOG% 2>&1 diff --git a/build/win64/.gitignore b/build/win64/.gitignore index 8506e35..973d9ed 100644 --- a/build/win64/.gitignore +++ b/build/win64/.gitignore @@ -21,3 +21,5 @@ install_manifest.txt _CPack_Packages/* dir *.VC.db +.vs/* +tidy.pc diff --git a/build/win64/build-me-v14.bat b/build/win64/build-me-v14.bat new file mode 100644 index 0000000..4cb8374 --- /dev/null +++ b/build/win64/build-me-v14.bat @@ -0,0 +1,202 @@ +@setlocal +@REM 20170702 - Check branch +@set TMPBR=next +@REM 20161002 - Change to msvc140 build +@set VCVERS=14 +@set GENERATOR=Visual Studio %VCVERS% Win64 +@REM 20160324 - Change to relative, and use choice +@set TMPPRJ=tidy +@echo Build %TMPPRJ% project, in 64-bits +@set TMPLOG=bldlog-1.txt +@set BLDDIR=%CD% +@set TMPROOT=..\..\.. +@set SET_BAT=%ProgramFiles(x86)%\Microsoft Visual Studio %VCVERS%.0\VC\vcvarsall.bat +@if NOT EXIST "%SET_BAT%" goto NOBAT +@REM if NOT EXIST %TMPROOT%\nul goto NOROOT +@set TMPSRC=..\.. +@if NOT EXIST %TMPSRC%\CMakeLists.txt goto NOCM +@set DOPAUSE=1 + +@if /I "%PROCESSOR_ARCHITECTURE%" EQU "AMD64" ( +@set TMPINST=%TMPROOT%\software.x64 +) ELSE ( + @if /I "%PROCESSOR_ARCHITECTURE%" EQU "x86_64" ( +@set TMPINST=%TMPROOT%\software.x64 + ) ELSE ( +@echo ERROR: Appears 64-bit is NOT available... aborting... +@goto ISERR + ) +) +@if NOT EXIST %TMPINST%\nul goto NOINST + +@echo Doing build output to %TMPLOG% +@echo Doing build output to %TMPLOG% > %TMPLOG% + +@echo Doing: 'call "%SET_BAT%" %PROCESSOR_ARCHITECTURE%' +@echo Doing: 'call "%SET_BAT%" %PROCESSOR_ARCHITECTURE%' >> %TMPLOG% +@call "%SET_BAT%" %PROCESSOR_ARCHITECTURE% >> %TMPLOG% 2>&1 +@if ERRORLEVEL 1 goto ERR0 +@REM call setupqt64 +@cd %BLDDIR% + +@REM :DNARCH + +@REM ############################################ +@REM NOTE: SPECIAL INSTALL LOCATION +@REM Adjust to suit your environment +@REM ########################################## +@REM set TMPINST=F:\Projects\software.x64 +@set TMPOPTS=-DCMAKE_INSTALL_PREFIX=%TMPINST% +@set TMPOPTS=%TMPOPTS% -G "%GENERATOR%" +@REM set TMPOPTS=%TMPOPTS% -DTIDY_CONFIG_FILE="C:\MDOS\tidy5.cfg" +@REM set TMPOPTS=%TMPOPTS% -DTIDY_USER_CONFIG_FILE="C:\MDOS\tidy5.cfg" +@set TMPOPTS=%TMPOPTS% -DBUILD_SHARED_LIB:BOOL=OFF + +:RPT +@if "%~1x" == "x" goto GOTCMD +@if "%~1x" == "NOPAUSEx" ( + @set DOPAUSE=0 +) else ( + @set TMPOPTS=%TMPOPTS% %1 +) +@shift +@goto RPT +:GOTCMD + +@call chkmsvc %TMPPRJ% +@call chkbranch %TMPBR% +@if ERRORLEVEL 1 goto BADBR +:GOTBR + +@echo Begin %DATE% %TIME%, output to %TMPLOG% +@echo Begin %DATE% %TIME% >> %TMPLOG% + +@echo Doing: 'cmake %TMPSRC% %TMPOPTS%' +@echo Doing: 'cmake %TMPSRC% %TMPOPTS%' >> %TMPLOG% +@cmake %TMPSRC% %TMPOPTS% >> %TMPLOG% 2>&1 +@if ERRORLEVEL 1 goto ERR1 + +@echo Doing: 'cmake --build . --config debug' +@echo Doing: 'cmake --build . --config debug' >> %TMPLOG% +@cmake --build . --config debug >> %TMPLOG% +@if ERRORLEVEL 1 goto ERR2 + +@echo Doing: 'cmake --build . --config release' +@echo Doing: 'cmake --build . --config release' >> %TMPLOG% +@cmake --build . --config release >> %TMPLOG% 2>&1 +@if ERRORLEVEL 1 goto ERR3 +:DNREL + +@echo Appears a successful build +@echo Note install location %TMPINST% +@echo. + +@REM ############################################## +@REM Check if should continue with install +@REM ############################################## +@if "%DOPAUSE%x" == "0x" goto DOINST +@choice /? >nul 2>&1 +@if ERRORLEVEL 1 goto NOCHOICE +@choice /D N /T 10 /M "Pausing for 10 seconds. Def=N" +@if ERRORLEVEL 2 goto GOTNO +@goto DOINST +:NOCHOICE +@echo Appears OS does not have the 'choice' command! +@ask *** CONTINUE with install? *** Only y continues +@if ERRORLEVEL 2 goto NOASK +@if ERRORLEVEL 1 goto DOINST +@echo Skipping install to %TMPINST% at this time... +@echo. +@goto END +:NOASK +@echo 'ask' utility not found in path... +@echo. +@echo *** CONTINUE with install? *** Only Ctrl+c aborts... +@echo. +@pause + +:DOINST +@echo Proceeding with INSTALL... +@echo. +@REM cmake -P cmake_install.cmake +@echo Doing: 'cmake --build . --config debug --target INSTALL' +@echo Doing: 'cmake --build . --config debug --target INSTALL' >> %TMPLOG% +@cmake --build . --config debug --target INSTALL >> %TMPLOG% 2>&1 + +@echo Doing: 'cmake --build . --config release --target INSTALL' +@echo Doing: 'cmake --build . --config release --target INSTALL' >> %TMPLOG% +@cmake --build . --config release --target INSTALL >> %TMPLOG% 2>&1 + +@fa4 " -- " %TMPLOG% + +@echo Done build and install of %TMPPRJ%... + +@goto END + +:GOTNO +@echo. +@echo No install at this time, but there may be an updexe.bat to copy the EXE to c:\MDOS... +@echo. +@goto END + +:NOBAT +@echo Can NOT locate MSVC setup batch "%SET_BAT%"! *** FIX ME *** +@goto ISERR + +@REM :NOROOT +@REM @echo Can NOT locate %TMPROOT%! *** FIX ME *** +@REM @goto ISERR + +:NOCM +@echo Can NOT locate %TMPSRC%\CMakeLists.txt! *** FIX ME *** +@goto ISERR + +:NOINST +@echo Can NOT locate directory %TMPINST%! *** FIX ME *** +@goto ISERR + +:ERR0 +@echo MSVC 10 setup error +@goto ISERR + +:ERR1 +@echo cmake config, generation error +@goto ISERR + +:ERR2 +@echo debug build error +@goto ISERR + +:ERR3 +@fa4 "mt.exe : general error c101008d:" %TMPLOG% >nul +@if ERRORLEVEL 1 goto ERR32 +:ERR33 +@echo release build error +@goto ISERR +:ERR32 +@echo Stupid error... trying again... +@echo Doing: 'cmake --build . --config release' +@echo Doing: 'cmake --build . --config release' >> %TMPLOG% +@cmake --build . --config release >> %TMPLOG% 2>&1 +@if ERRORLEVEL 1 goto ERR33 +@goto DNREL + +:BADBR +@call git checkout %TMPBR% +@call chkbranch %TMPBR% +@if ERRORLEVEL 1 goto BADBR2 +@goto GOTBR +:BADBR2 +@call shwbranch +@echo Not on correct branch %TMPBR% +@goto ISERR + +:ISERR +@endlocal +@exit /b 1 + +:END +@endlocal +@exit /b 0 + +@REM eof diff --git a/build/win64/build-me.bat b/build/win64/build-me.bat index 4cb8374..659aeaa 100644 --- a/build/win64/build-me.bat +++ b/build/win64/build-me.bat @@ -1,56 +1,19 @@ @setlocal -@REM 20170702 - Check branch -@set TMPBR=next -@REM 20161002 - Change to msvc140 build -@set VCVERS=14 -@set GENERATOR=Visual Studio %VCVERS% Win64 -@REM 20160324 - Change to relative, and use choice + +@set TMPVER=1 @set TMPPRJ=tidy -@echo Build %TMPPRJ% project, in 64-bits -@set TMPLOG=bldlog-1.txt -@set BLDDIR=%CD% -@set TMPROOT=..\..\.. -@set SET_BAT=%ProgramFiles(x86)%\Microsoft Visual Studio %VCVERS%.0\VC\vcvarsall.bat -@if NOT EXIST "%SET_BAT%" goto NOBAT -@REM if NOT EXIST %TMPROOT%\nul goto NOROOT @set TMPSRC=..\.. -@if NOT EXIST %TMPSRC%\CMakeLists.txt goto NOCM +@set TMPBGN=%TIME% +@set TMPINS=D:\Projects\3rdParty.x64 +@set TMPLOG=bldlog-1.txt @set DOPAUSE=1 +@set TMPGEN=Visual Studio 16 2019 +@set TMPBR=next +@set TMPINDBG=0 -@if /I "%PROCESSOR_ARCHITECTURE%" EQU "AMD64" ( -@set TMPINST=%TMPROOT%\software.x64 -) ELSE ( - @if /I "%PROCESSOR_ARCHITECTURE%" EQU "x86_64" ( -@set TMPINST=%TMPROOT%\software.x64 - ) ELSE ( -@echo ERROR: Appears 64-bit is NOT available... aborting... -@goto ISERR - ) -) -@if NOT EXIST %TMPINST%\nul goto NOINST - -@echo Doing build output to %TMPLOG% -@echo Doing build output to %TMPLOG% > %TMPLOG% - -@echo Doing: 'call "%SET_BAT%" %PROCESSOR_ARCHITECTURE%' -@echo Doing: 'call "%SET_BAT%" %PROCESSOR_ARCHITECTURE%' >> %TMPLOG% -@call "%SET_BAT%" %PROCESSOR_ARCHITECTURE% >> %TMPLOG% 2>&1 -@if ERRORLEVEL 1 goto ERR0 -@REM call setupqt64 -@cd %BLDDIR% - -@REM :DNARCH - -@REM ############################################ -@REM NOTE: SPECIAL INSTALL LOCATION -@REM Adjust to suit your environment -@REM ########################################## -@REM set TMPINST=F:\Projects\software.x64 -@set TMPOPTS=-DCMAKE_INSTALL_PREFIX=%TMPINST% -@set TMPOPTS=%TMPOPTS% -G "%GENERATOR%" -@REM set TMPOPTS=%TMPOPTS% -DTIDY_CONFIG_FILE="C:\MDOS\tidy5.cfg" -@REM set TMPOPTS=%TMPOPTS% -DTIDY_USER_CONFIG_FILE="C:\MDOS\tidy5.cfg" -@set TMPOPTS=%TMPOPTS% -DBUILD_SHARED_LIB:BOOL=OFF +@set TMPOPTS=-G "%TMPGEN%" -A x64 +@set TMPOPTS=%TMPOPTS% -DCMAKE_INSTALL_PREFIX=%TMPINS% +@set TMPOPTS=%TMPOPTS% -DBUILD_SHARED_LIB=ON :RPT @if "%~1x" == "x" goto GOTCMD @@ -64,31 +27,47 @@ :GOTCMD @call chkmsvc %TMPPRJ% +@if "%TMPBR%x" == "x" goto DNBR @call chkbranch %TMPBR% -@if ERRORLEVEL 1 goto BADBR -:GOTBR +:DNBR -@echo Begin %DATE% %TIME%, output to %TMPLOG% -@echo Begin %DATE% %TIME% >> %TMPLOG% +@echo Build %TMPPRJ% 64-bits %DATE% %TIME%, in %CD%, to %TMPLOG% > %TMPLOG% -@echo Doing: 'cmake %TMPSRC% %TMPOPTS%' -@echo Doing: 'cmake %TMPSRC% %TMPOPTS%' >> %TMPLOG% -@cmake %TMPSRC% %TMPOPTS% >> %TMPLOG% 2>&1 +@if NOT EXIST %TMPSRC%\nul goto NOSRC + +@echo Build source %TMPSRC%... all output to build log %TMPLOG% +@echo Build source %TMPSRC%... all output to build log %TMPLOG% >> %TMPLOG% + +@if EXIST build-cmake.bat ( +@call build-cmake >> %TMPLOG% +) + +@if NOT EXIST %TMPSRC%\CMakeLists.txt goto NOCM + +@echo Doing: 'cmake -S %TMPSRC% %TMPOPTS%' +@echo Doing: 'cmake -S %TMPSRC% %TMPOPTS%' >> %TMPLOG% 2>&1 +@cmake -S %TMPSRC% %TMPOPTS% >> %TMPLOG% 2>&1 @if ERRORLEVEL 1 goto ERR1 -@echo Doing: 'cmake --build . --config debug' -@echo Doing: 'cmake --build . --config debug' >> %TMPLOG% -@cmake --build . --config debug >> %TMPLOG% +@echo Doing: 'cmake --build . --config Debug' +@echo Doing: 'cmake --build . --config Debug' >> %TMPLOG% 2>&1 +@cmake --build . --config Debug >> %TMPLOG% 2>&1 @if ERRORLEVEL 1 goto ERR2 -@echo Doing: 'cmake --build . --config release' -@echo Doing: 'cmake --build . --config release' >> %TMPLOG% -@cmake --build . --config release >> %TMPLOG% 2>&1 +@echo Doing: 'cmake --build . --config Release' +@echo Doing: 'cmake --build . --config Release' >> %TMPLOG% 2>&1 +@cmake --build . --config Release >> %TMPLOG% 2>&1 @if ERRORLEVEL 1 goto ERR3 -:DNREL -@echo Appears a successful build -@echo Note install location %TMPINST% +@fa4 "***" %TMPLOG% +@call elapsed %TMPBGN% +@echo Appears a successful build... see %TMPLOG% +@echo Note install location %TMPINS% +@if "%TMPINDBG%x" == "1x" ( +@echo Will install Debug and Release +) else ( +@echo Will only intall Release +) @echo. @REM ############################################## @@ -118,18 +97,22 @@ :DOINST @echo Proceeding with INSTALL... @echo. -@REM cmake -P cmake_install.cmake -@echo Doing: 'cmake --build . --config debug --target INSTALL' -@echo Doing: 'cmake --build . --config debug --target INSTALL' >> %TMPLOG% -@cmake --build . --config debug --target INSTALL >> %TMPLOG% 2>&1 +@if NOT "%TMPINDBG%x" == "1x" goto DNDBGIN +@echo Doing: 'cmake --build . --config Debug --target INSTALL' +@echo Doing: 'cmake --build . --config Debug --target INSTALL' >> %TMPLOG% 2>&1 +@cmake --build . --config Debug --target INSTALL >> %TMPLOG% 2>&1 +@if ERRORLEVEL 1 goto ERR4 +:DNDBGIN -@echo Doing: 'cmake --build . --config release --target INSTALL' -@echo Doing: 'cmake --build . --config release --target INSTALL' >> %TMPLOG% -@cmake --build . --config release --target INSTALL >> %TMPLOG% 2>&1 +@echo Doing: 'cmake --build . --config Release --target INSTALL' +@echo Doing: 'cmake --build . --config Release --target INSTALL' >> %TMPLOG% 2>&1 +@cmake --build . --config Release --target INSTALL >> %TMPLOG% 2>&1 +@if ERRORLEVEL 1 goto ERR5 @fa4 " -- " %TMPLOG% -@echo Done build and install of %TMPPRJ%... +@call elapsed %TMPBGN% +@echo All done... see %TMPLOG% @goto END @@ -139,59 +122,43 @@ @echo. @goto END -:NOBAT -@echo Can NOT locate MSVC setup batch "%SET_BAT%"! *** FIX ME *** +:NOSRC +@echo Can NOT locate source %TMPSRC%! *** FIX ME *** +@echo Can NOT locate source %TMPSRC%! *** FIX ME *** >> %TMPLOG% @goto ISERR -@REM :NOROOT -@REM @echo Can NOT locate %TMPROOT%! *** FIX ME *** -@REM @goto ISERR - :NOCM -@echo Can NOT locate %TMPSRC%\CMakeLists.txt! *** FIX ME *** -@goto ISERR - -:NOINST -@echo Can NOT locate directory %TMPINST%! *** FIX ME *** -@goto ISERR - -:ERR0 -@echo MSVC 10 setup error +@echo Can NOT locate %TMPSRC%\CMakeLists.txt! +@echo Can NOT locate %TMPSRC%\CMakeLists.txt! >> %TMPLOG% @goto ISERR :ERR1 -@echo cmake config, generation error +@echo cmake configuration or generations ERROR +@echo cmake configuration or generations ERROR >> %TMPLOG% @goto ISERR :ERR2 -@echo debug build error +@echo ERROR: Cmake build Debug FAILED! +@echo ERROR: Cmake build Debug FAILED! >> %TMPLOG% @goto ISERR :ERR3 -@fa4 "mt.exe : general error c101008d:" %TMPLOG% >nul -@if ERRORLEVEL 1 goto ERR32 -:ERR33 -@echo release build error +@echo ERROR: Cmake build Release FAILED! +@echo ERROR: Cmake build Release FAILED! >> %TMPLOG% @goto ISERR -:ERR32 -@echo Stupid error... trying again... -@echo Doing: 'cmake --build . --config release' -@echo Doing: 'cmake --build . --config release' >> %TMPLOG% -@cmake --build . --config release >> %TMPLOG% 2>&1 -@if ERRORLEVEL 1 goto ERR33 -@goto DNREL -:BADBR -@call git checkout %TMPBR% -@call chkbranch %TMPBR% -@if ERRORLEVEL 1 goto BADBR2 -@goto GOTBR -:BADBR2 -@call shwbranch -@echo Not on correct branch %TMPBR% +:ERR4 +@echo ERROR: Install Debug FAILED! +@echo ERROR: Install Debug FAILED! >> %TMPLOG% +@goto ISERR + +:ERR5 +@echo ERROR: Install Release FAILED! +@echo ERROR: Install Release FAILED! >> %TMPLOG% @goto ISERR :ISERR +@echo See %TMPLOG% for details... @endlocal @exit /b 1