1echo off 2REM 3REM This Windows batch file builds this repository for the following targets: 4REM 64/32-bit Release/Debug 5REM It uses CMake to genererate the project files and then invokes msbuild 6REM to build them. 7REM The update_external_sources.bat batch file must be executed before running 8REM this batch file 9REM 10REM Arguments: 11REM None: Runs CMake and builds all 4 combinations 12REM Argument contains: 13REM cmake (case insensitive): Deletes build and build32 and runs just CMake on both 14REM 32: Deletes build32, runs CMake and builds 32-bit versions 15REM 64: Deletes build, runs CMake and builds 64-bit versions 16REM Example: 17REM build_windows_targets.bat 64 18REM deletes build, creates build, runs CMake and compiles 64-bit Debug and Release. 19 20set do_cmake=0 21set do_32=1 22set do_64=1 23if "%1"=="" goto no_args 24set do_cmake=0 25set do_32=0 26set do_64=0 27for %%a in (%*) do ( 28 echo.%%a | %WINDIR%\system32\find.exe /I "cmake">Nul && (set do_cmake=1) 29 echo.%%a | %WINDIR%\system32\find.exe "32">Nul && (set do_32=1) 30 echo.%%a | %WINDIR%\system32\find.exe "64">Nul && (set do_64=1) 31) 32:no_args 33if %do_cmake%==0 ( 34 if %do_32%==0 ( 35 if %do_64%==0 ( 36 echo No valid parameters specified. 37 exit /b 1 38 ) 39 ) 40) 41 42REM Determine the appropriate CMake strings for the current version of Visual Studio 43echo Determining VS version 44python .\determine_vs_version.py > vsversion.tmp 45set /p VS_VERSION=< vsversion.tmp 46echo Detected Visual Studio Version as %VS_VERSION% 47del /Q /F vsversion.tmp 48 49if %do_cmake%==1 ( 50 rmdir /Q /S build 51 rmdir /Q /S build32 52 mkdir build 53 pushd build 54 echo Generating 64-bit CMake files for Visual Studio %VS_VERSION% 55 cmake -G "Visual Studio %VS_VERSION% Win64" .. 56 popd 57 mkdir build32 58 pushd build32 59 echo Generating 32-bit CMake files for Visual Studio %VS_VERSION% 60 cmake -G "Visual Studio %VS_VERSION%" .. 61 popd 62) 63 64REM ******************************************* 65REM 64-bit build 66REM ******************************************* 67if %do_64%==1 ( 68 rmdir /Q /S build 69 mkdir build 70 pushd build 71 echo Generating 64-bit CMake files for Visual Studio %VS_VERSION% 72 cmake -G "Visual Studio %VS_VERSION% Win64" .. 73 echo Building 64-bit Debug 74 msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug /maxcpucount /verbosity:quiet 75 if errorlevel 1 ( 76 echo. 77 echo 64-bit Debug build failed! 78 popd 79 exit /b 1 80 ) 81 82 echo Building 64-bit Release 83 msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release /maxcpucount /verbosity:quiet 84 if errorlevel 1 ( 85 echo. 86 echo 64-bit Release build failed! 87 popd 88 exit /b 1 89 ) 90 popd 91) 92 93REM ******************************************* 94REM 32-bit build 95REM ******************************************* 96 97if %do_32%==1 ( 98 rmdir /Q /S build32 99 mkdir build32 100 pushd build32 101 echo Generating 32-bit CMake files for Visual Studio %VS_VERSION% 102 cmake -G "Visual Studio %VS_VERSION%" .. 103 echo Building 32-bit Debug 104 msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug /maxcpucount /verbosity:quiet 105 if errorlevel 1 ( 106 echo. 107 echo 32-bit Debug build failed! 108 popd 109 exit /b 1 110 ) 111 112 echo Building 32-bit Release 113 msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release /maxcpucount /verbosity:quiet 114 if errorlevel 1 ( 115 echo. 116 echo 32-bit Release build failed! 117 popd 118 exit /b 1 119 ) 120 popd 121) 122exit /b 0 123