From fb4749f8dda053f12e2ad7d5be0918dec5be4938 Mon Sep 17 00:00:00 2001 From: Karl Schultz Date: Thu, 4 Jan 2018 17:14:31 -0700 Subject: build: Allow more control in windows build script build_windows_targets.bat now accepts 'debug' and 'release' parameters to select the building of these configurations. --- build_windows_targets.bat | 146 ++++++++++++++++++++++++++++++---------------- 1 file changed, 97 insertions(+), 49 deletions(-) diff --git a/build_windows_targets.bat b/build_windows_targets.bat index faeab85b..c6e53e19 100644 --- a/build_windows_targets.bat +++ b/build_windows_targets.bat @@ -13,32 +13,72 @@ REM Argument contains: REM cmake (case insensitive): Deletes build and build32 and runs just CMake on both REM 32: Deletes build32, runs CMake and builds 32-bit versions REM 64: Deletes build, runs CMake and builds 64-bit versions -REM Example: +REM debug (case insensitive): Builds just the debug config of a 32 and/or 64-bit build +REM release (case insensitive): Builds just the release config of a 32 and/or 64-bit build +REM Notes: +REM cmake: When specified, generate the CMake build files only - don't compile +REM 32/64: Specifying neither or both builds both +REM debug/release: Specifying neither or both builds both +REM Examples: REM build_windows_targets.bat 64 -REM deletes build, creates build, runs CMake and compiles 64-bit Debug and Release. +REM -- deletes build, creates build, runs CMake and compiles 64-bit Debug and Release. +REM build_windows_targets.bat 64 debug +REM -- deletes build, creates build, runs CMake and compiles 64-bit Debug. + +set arg_cmake=0 +set arg_32=0 +set arg_64=0 +set arg_debug=0 +set arg_release=0 -set do_cmake=0 -set do_32=1 -set do_64=1 -if "%1"=="" goto no_args set do_cmake=0 set do_32=0 set do_64=0 +set do_debug=0 +set do_release=0 + for %%a in (%*) do ( - echo.%%a | %WINDIR%\system32\find.exe /I "cmake">Nul && (set do_cmake=1) - echo.%%a | %WINDIR%\system32\find.exe "32">Nul && (set do_32=1) - echo.%%a | %WINDIR%\system32\find.exe "64">Nul && (set do_64=1) + echo.%%a | %WINDIR%\system32\find.exe /I "cmake">Nul && (set arg_cmake=1) + echo.%%a | %WINDIR%\system32\find.exe "32">Nul && (set arg_32=1) + echo.%%a | %WINDIR%\system32\find.exe "64">Nul && (set arg_64=1) + echo.%%a | %WINDIR%\system32\find.exe /I "debug">Nul && (set arg_debug=1) + echo.%%a | %WINDIR%\system32\find.exe /I "release">Nul && (set arg_release=1) ) -:no_args -if %do_cmake%==0 ( - if %do_32%==0 ( - if %do_64%==0 ( - echo No valid parameters specified. - exit /b 1 - ) + +if %arg_32%==1 ( + set do_32=1 +) +if %arg_64%==1 ( + set do_64=1 +) +if %arg_32%==0 ( + if %arg_64%==0 ( + set do_32=1 + set do_64=1 + ) +) + +if %arg_debug%==1 ( + set do_debug=1 +) +if %arg_release%==1 ( + set do_release=1 +) +if %arg_debug%==0 ( + if %arg_release%==0 ( + set do_debug=1 + set do_release=1 ) ) +if %arg_cmake%==1 ( + set do_cmake=1 + set do_32=0 + set do_64=0 + set do_debug=0 + set do_release=0 +) + REM Determine the appropriate CMake strings for the current version of Visual Studio echo Determining VS version python .\scripts\determine_vs_version.py > vsversion.tmp @@ -70,23 +110,27 @@ if %do_64%==1 ( pushd build echo Generating 64-bit CMake files for Visual Studio %VS_VERSION% cmake -G "Visual Studio %VS_VERSION% Win64" .. - echo Building 64-bit Debug - msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug /maxcpucount /verbosity:quiet - if errorlevel 1 ( - echo. - echo 64-bit Debug build failed! - popd - exit /b 1 - ) + if %do_debug% equ 1 ( + echo Building 64-bit Debug + msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug /maxcpucount /verbosity:quiet + if errorlevel 1 ( + echo. + echo 64-bit Debug build failed! + popd + exit /b 1 + ) + ) - echo Building 64-bit Release - msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release /maxcpucount /verbosity:quiet - if errorlevel 1 ( - echo. - echo 64-bit Release build failed! - popd - exit /b 1 - ) + if %do_release%==1 ( + echo Building 64-bit Release + msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release /maxcpucount /verbosity:quiet + if errorlevel 1 ( + echo. + echo 64-bit Release build failed! + popd + exit /b 1 + ) + ) popd ) @@ -100,23 +144,27 @@ if %do_32%==1 ( pushd build32 echo Generating 32-bit CMake files for Visual Studio %VS_VERSION% cmake -G "Visual Studio %VS_VERSION%" .. - echo Building 32-bit Debug - msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug /maxcpucount /verbosity:quiet - if errorlevel 1 ( - echo. - echo 32-bit Debug build failed! - popd - exit /b 1 - ) - - echo Building 32-bit Release - msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release /maxcpucount /verbosity:quiet - if errorlevel 1 ( - echo. - echo 32-bit Release build failed! - popd - exit /b 1 - ) + if %do_debug%==1 ( + echo Building 32-bit Debug + msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug /maxcpucount /verbosity:quiet + if errorlevel 1 ( + echo. + echo 32-bit Debug build failed! + popd + exit /b 1 + ) + ) + + if %do_release%==1 ( + echo Building 32-bit Release + msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release /maxcpucount /verbosity:quiet + if errorlevel 1 ( + echo. + echo 32-bit Release build failed! + popd + exit /b 1 + ) + ) popd ) exit /b 0 -- cgit v1.2.3