Mark Young | 1aacfe1 | 2016-01-28 14:39:19 -0700 | [diff] [blame] | 1 | echo off |
| 2 | REM |
Karl Schultz | c85cf40 | 2016-03-22 12:05:31 -0600 | [diff] [blame] | 3 | REM This Windows batch file builds this repository for the following targets: |
Karl Schultz | d04d447 | 2016-04-11 13:29:05 -0600 | [diff] [blame] | 4 | REM 64/32-bit Release/Debug |
Karl Schultz | c85cf40 | 2016-03-22 12:05:31 -0600 | [diff] [blame] | 5 | REM It uses CMake to genererate the project files and then invokes msbuild |
| 6 | REM to build them. |
| 7 | REM The update_external_sources.bat batch file must be executed before running |
| 8 | REM this batch file |
Mark Young | 1aacfe1 | 2016-01-28 14:39:19 -0700 | [diff] [blame] | 9 | REM |
Karl Schultz | d04d447 | 2016-04-11 13:29:05 -0600 | [diff] [blame] | 10 | REM Arguments: |
| 11 | REM None: Runs CMake and builds all 4 combinations |
| 12 | REM Argument contains: |
| 13 | REM cmake (case insensitive): Deletes build and build32 and runs just CMake on both |
| 14 | REM 32: Deletes build32, runs CMake and builds 32-bit versions |
| 15 | REM 64: Deletes build, runs CMake and builds 64-bit versions |
Karl Schultz | 8e1425e | 2018-01-04 17:14:31 -0700 | [diff] [blame] | 16 | REM debug (case insensitive): Builds just the debug config of a 32 and/or 64-bit build |
| 17 | REM release (case insensitive): Builds just the release config of a 32 and/or 64-bit build |
| 18 | REM Notes: |
| 19 | REM cmake: When specified, generate the CMake build files only - don't compile |
| 20 | REM 32/64: Specifying neither or both builds both |
| 21 | REM debug/release: Specifying neither or both builds both |
| 22 | REM Examples: |
Karl Schultz | d04d447 | 2016-04-11 13:29:05 -0600 | [diff] [blame] | 23 | REM build_windows_targets.bat 64 |
Karl Schultz | 8e1425e | 2018-01-04 17:14:31 -0700 | [diff] [blame] | 24 | REM -- deletes build, creates build, runs CMake and compiles 64-bit Debug and Release. |
| 25 | REM build_windows_targets.bat 64 debug |
| 26 | REM -- deletes build, creates build, runs CMake and compiles 64-bit Debug. |
Karl Schultz | d04d447 | 2016-04-11 13:29:05 -0600 | [diff] [blame] | 27 | |
Karl Schultz | 8e1425e | 2018-01-04 17:14:31 -0700 | [diff] [blame] | 28 | set arg_cmake=0 |
| 29 | set arg_32=0 |
| 30 | set arg_64=0 |
| 31 | set arg_debug=0 |
| 32 | set arg_release=0 |
| 33 | |
Karl Schultz | d04d447 | 2016-04-11 13:29:05 -0600 | [diff] [blame] | 34 | set do_cmake=0 |
| 35 | set do_32=0 |
| 36 | set do_64=0 |
Karl Schultz | 8e1425e | 2018-01-04 17:14:31 -0700 | [diff] [blame] | 37 | set do_debug=0 |
| 38 | set do_release=0 |
| 39 | |
Karl Schultz | d04d447 | 2016-04-11 13:29:05 -0600 | [diff] [blame] | 40 | for %%a in (%*) do ( |
Karl Schultz | 8e1425e | 2018-01-04 17:14:31 -0700 | [diff] [blame] | 41 | echo.%%a | %WINDIR%\system32\find.exe /I "cmake">Nul && (set arg_cmake=1) |
| 42 | echo.%%a | %WINDIR%\system32\find.exe "32">Nul && (set arg_32=1) |
| 43 | echo.%%a | %WINDIR%\system32\find.exe "64">Nul && (set arg_64=1) |
| 44 | echo.%%a | %WINDIR%\system32\find.exe /I "debug">Nul && (set arg_debug=1) |
| 45 | echo.%%a | %WINDIR%\system32\find.exe /I "release">Nul && (set arg_release=1) |
Karl Schultz | d04d447 | 2016-04-11 13:29:05 -0600 | [diff] [blame] | 46 | ) |
Karl Schultz | 8e1425e | 2018-01-04 17:14:31 -0700 | [diff] [blame] | 47 | |
| 48 | if %arg_32%==1 ( |
| 49 | set do_32=1 |
| 50 | ) |
| 51 | if %arg_64%==1 ( |
| 52 | set do_64=1 |
| 53 | ) |
| 54 | if %arg_32%==0 ( |
| 55 | if %arg_64%==0 ( |
| 56 | set do_32=1 |
| 57 | set do_64=1 |
Karl Schultz | d04d447 | 2016-04-11 13:29:05 -0600 | [diff] [blame] | 58 | ) |
| 59 | ) |
Mark Young | 1aacfe1 | 2016-01-28 14:39:19 -0700 | [diff] [blame] | 60 | |
Karl Schultz | 8e1425e | 2018-01-04 17:14:31 -0700 | [diff] [blame] | 61 | if %arg_debug%==1 ( |
| 62 | set do_debug=1 |
| 63 | ) |
| 64 | if %arg_release%==1 ( |
| 65 | set do_release=1 |
| 66 | ) |
| 67 | if %arg_debug%==0 ( |
| 68 | if %arg_release%==0 ( |
| 69 | set do_debug=1 |
| 70 | set do_release=1 |
| 71 | ) |
| 72 | ) |
| 73 | |
| 74 | if %arg_cmake%==1 ( |
| 75 | set do_cmake=1 |
| 76 | set do_32=0 |
| 77 | set do_64=0 |
| 78 | set do_debug=0 |
| 79 | set do_release=0 |
| 80 | ) |
| 81 | |
Mark Young | 1aacfe1 | 2016-01-28 14:39:19 -0700 | [diff] [blame] | 82 | REM Determine the appropriate CMake strings for the current version of Visual Studio |
| 83 | echo Determining VS version |
Mark Lobodzinski | 6cde2f0 | 2016-11-18 14:12:01 -0700 | [diff] [blame] | 84 | python .\scripts\determine_vs_version.py > vsversion.tmp |
Mark Young | 1aacfe1 | 2016-01-28 14:39:19 -0700 | [diff] [blame] | 85 | set /p VS_VERSION=< vsversion.tmp |
| 86 | echo Detected Visual Studio Version as %VS_VERSION% |
Mark Young | 1aacfe1 | 2016-01-28 14:39:19 -0700 | [diff] [blame] | 87 | del /Q /F vsversion.tmp |
| 88 | |
Karl Schultz | d04d447 | 2016-04-11 13:29:05 -0600 | [diff] [blame] | 89 | if %do_cmake%==1 ( |
| 90 | rmdir /Q /S build |
| 91 | rmdir /Q /S build32 |
| 92 | mkdir build |
| 93 | pushd build |
| 94 | echo Generating 64-bit CMake files for Visual Studio %VS_VERSION% |
| 95 | cmake -G "Visual Studio %VS_VERSION% Win64" .. |
| 96 | popd |
| 97 | mkdir build32 |
| 98 | pushd build32 |
| 99 | echo Generating 32-bit CMake files for Visual Studio %VS_VERSION% |
| 100 | cmake -G "Visual Studio %VS_VERSION%" .. |
| 101 | popd |
| 102 | ) |
Mark Young | 1aacfe1 | 2016-01-28 14:39:19 -0700 | [diff] [blame] | 103 | |
| 104 | REM ******************************************* |
Karl Schultz | c85cf40 | 2016-03-22 12:05:31 -0600 | [diff] [blame] | 105 | REM 64-bit build |
Mark Young | 1aacfe1 | 2016-01-28 14:39:19 -0700 | [diff] [blame] | 106 | REM ******************************************* |
Karl Schultz | d04d447 | 2016-04-11 13:29:05 -0600 | [diff] [blame] | 107 | if %do_64%==1 ( |
| 108 | rmdir /Q /S build |
| 109 | mkdir build |
| 110 | pushd build |
| 111 | echo Generating 64-bit CMake files for Visual Studio %VS_VERSION% |
| 112 | cmake -G "Visual Studio %VS_VERSION% Win64" .. |
Karl Schultz | 8e1425e | 2018-01-04 17:14:31 -0700 | [diff] [blame] | 113 | if %do_debug% equ 1 ( |
| 114 | echo Building 64-bit Debug |
| 115 | msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug /maxcpucount /verbosity:quiet |
| 116 | if errorlevel 1 ( |
| 117 | echo. |
| 118 | echo 64-bit Debug build failed! |
| 119 | popd |
| 120 | exit /b 1 |
| 121 | ) |
| 122 | ) |
Mark Young | 1aacfe1 | 2016-01-28 14:39:19 -0700 | [diff] [blame] | 123 | |
Karl Schultz | 8e1425e | 2018-01-04 17:14:31 -0700 | [diff] [blame] | 124 | if %do_release%==1 ( |
| 125 | echo Building 64-bit Release |
| 126 | msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release /maxcpucount /verbosity:quiet |
| 127 | if errorlevel 1 ( |
| 128 | echo. |
| 129 | echo 64-bit Release build failed! |
| 130 | popd |
| 131 | exit /b 1 |
| 132 | ) |
| 133 | ) |
Karl Schultz | d04d447 | 2016-04-11 13:29:05 -0600 | [diff] [blame] | 134 | popd |
| 135 | ) |
Mark Young | 1aacfe1 | 2016-01-28 14:39:19 -0700 | [diff] [blame] | 136 | |
| 137 | REM ******************************************* |
Karl Schultz | c85cf40 | 2016-03-22 12:05:31 -0600 | [diff] [blame] | 138 | REM 32-bit build |
Mark Young | 1aacfe1 | 2016-01-28 14:39:19 -0700 | [diff] [blame] | 139 | REM ******************************************* |
Mark Young | 1aacfe1 | 2016-01-28 14:39:19 -0700 | [diff] [blame] | 140 | |
Karl Schultz | d04d447 | 2016-04-11 13:29:05 -0600 | [diff] [blame] | 141 | if %do_32%==1 ( |
| 142 | rmdir /Q /S build32 |
| 143 | mkdir build32 |
| 144 | pushd build32 |
| 145 | echo Generating 32-bit CMake files for Visual Studio %VS_VERSION% |
| 146 | cmake -G "Visual Studio %VS_VERSION%" .. |
Karl Schultz | 8e1425e | 2018-01-04 17:14:31 -0700 | [diff] [blame] | 147 | if %do_debug%==1 ( |
| 148 | echo Building 32-bit Debug |
| 149 | msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Debug /maxcpucount /verbosity:quiet |
| 150 | if errorlevel 1 ( |
| 151 | echo. |
| 152 | echo 32-bit Debug build failed! |
| 153 | popd |
| 154 | exit /b 1 |
| 155 | ) |
| 156 | ) |
| 157 | |
| 158 | if %do_release%==1 ( |
| 159 | echo Building 32-bit Release |
| 160 | msbuild ALL_BUILD.vcxproj /p:Platform=x86 /p:Configuration=Release /maxcpucount /verbosity:quiet |
| 161 | if errorlevel 1 ( |
| 162 | echo. |
| 163 | echo 32-bit Release build failed! |
| 164 | popd |
| 165 | exit /b 1 |
| 166 | ) |
| 167 | ) |
Karl Schultz | d04d447 | 2016-04-11 13:29:05 -0600 | [diff] [blame] | 168 | popd |
| 169 | ) |
Jeff Juliano | a7aaf9f | 2016-09-02 08:24:25 -0400 | [diff] [blame] | 170 | exit /b 0 |