mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 1 | @ECHO OFF
|
| 2 |
|
| 3 | ::
|
| 4 | :: build-all-msvc.bat --
|
| 5 | ::
|
| 6 | :: Multi-Platform Build Tool for MSVC
|
| 7 | ::
|
| 8 |
|
mistachkin | 7c5dbdf | 2012-10-19 00:23:31 +0000 | [diff] [blame] | 9 | REM
|
| 10 | REM This batch script is used to build the SQLite DLL for multiple platforms
|
| 11 | REM and configurations using MSVC. The built SQLite DLLs, their associated
|
| 12 | REM import libraries, and optionally their symbols files, are placed within
|
| 13 | REM the directory specified on the command line, in sub-directories named for
|
| 14 | REM their respective platforms and configurations. This batch script must be
|
| 15 | REM run from inside a Visual Studio Command Prompt for the desired version of
|
| 16 | REM Visual Studio ^(the initial platform configured for the command prompt does
|
| 17 | REM not really matter^). Exactly one command line argument is required, the
|
| 18 | REM name of an existing directory to be used as the final destination directory
|
| 19 | REM for the generated output files, which will be placed in sub-directories
|
| 20 | REM created therein. Ideally, the directory specified should be empty.
|
| 21 | REM
|
| 22 | REM Example:
|
| 23 | REM
|
| 24 | REM CD /D C:\dev\sqlite\core
|
mistachkin | b0c99af | 2016-02-19 05:07:56 +0000 | [diff] [blame] | 25 | REM CALL tool\build-all-msvc.bat C:\Temp
|
mistachkin | 7c5dbdf | 2012-10-19 00:23:31 +0000 | [diff] [blame] | 26 | REM
|
| 27 | REM In the example above, "C:\dev\sqlite\core" represents the root of the
|
| 28 | REM source tree for SQLite and "C:\Temp" represents the final destination
|
| 29 | REM directory for the generated output files.
|
| 30 | REM
|
mistachkin | 88eb7fa | 2015-04-19 18:58:29 +0000 | [diff] [blame] | 31 | REM Please note that the SQLite build process performed by the Makefile
|
mistachkin | fcbe99a | 2015-10-12 03:56:21 +0000 | [diff] [blame] | 32 | REM associated with this batch script requires a Tcl shell to be present
|
| 33 | REM in a directory contained in the PATH environment variable unless a
|
| 34 | REM pre-existing amalgamation file is used.
|
mistachkin | 88eb7fa | 2015-04-19 18:58:29 +0000 | [diff] [blame] | 35 | REM
|
mistachkin | 7c5dbdf | 2012-10-19 00:23:31 +0000 | [diff] [blame] | 36 | REM There are several environment variables that may be set to modify the
|
| 37 | REM behavior of this batch script and its associated Makefile. The list of
|
| 38 | REM platforms to build may be overriden by using the PLATFORMS environment
|
| 39 | REM variable, which should contain a list of platforms ^(e.g. x86 x86_amd64
|
| 40 | REM x86_arm^). All platforms must be supported by the version of Visual Studio
|
| 41 | REM being used. The list of configurations to build may be overridden by
|
| 42 | REM setting the CONFIGURATIONS environment variable, which should contain a
|
| 43 | REM list of configurations to build ^(e.g. Debug Retail^). Neither of these
|
| 44 | REM variable values may contain any double quotes, surrounding or embedded.
|
mistachkin | 7c5dbdf | 2012-10-19 00:23:31 +0000 | [diff] [blame] | 45 | REM
|
mistachkin | 88eb7fa | 2015-04-19 18:58:29 +0000 | [diff] [blame] | 46 | REM Finally, the NCRTLIBPATH, NUCRTLIBPATH, and NSDKLIBPATH environment
|
| 47 | REM variables may be set to specify the location of the CRT, Universal CRT, and
|
| 48 | REM Windows SDK, respectively, that may be needed to compile executables native
|
| 49 | REM to the architecture of the build machine during any cross-compilation that
|
| 50 | REM may be necessary, depending on the platforms to be built. These values in
|
| 51 | REM these three variables should be surrounded by double quotes if they contain
|
| 52 | REM spaces.
|
| 53 | REM
|
| 54 | REM There are a few other environment variables that impact the build process
|
| 55 | REM when set ^(to anything^), they are:
|
| 56 | REM
|
mistachkin | b0c99af | 2016-02-19 05:07:56 +0000 | [diff] [blame] | 57 | REM USE_AUTOCONF_MAKEFILE
|
| 58 | REM
|
| 59 | REM When set, the "autoconf" Makefile for MSVC will be used instead of the main
|
| 60 | REM Makefile for MSVC. It must exist at "%ROOT%\autoconf\Makefile.msc".
|
| 61 | REM
|
mistachkin | 88eb7fa | 2015-04-19 18:58:29 +0000 | [diff] [blame] | 62 | REM NOCLEAN
|
| 63 | REM
|
| 64 | REM When set, the "clean" target will not be used during each build iteration.
|
| 65 | REM However, the target binaries, if any, will still be deleted manually prior
|
| 66 | REM to being rebuilt. Setting this environment variable is only rarely needed
|
| 67 | REM and could cause issues in some circumstances; therefore, setting it is not
|
| 68 | REM recommended.
|
| 69 | REM
|
| 70 | REM NOSYMBOLS
|
| 71 | REM
|
| 72 | REM When set, copying of symbol files ^(*.pdb^) created during the build will
|
| 73 | REM be skipped and they will not appear in the final destination directory.
|
| 74 | REM Setting this environment variable is never strictly needed and could cause
|
| 75 | REM issues in some circumstances; therefore, setting it is not recommended.
|
| 76 | REM
|
mistachkin | b9076ba | 2016-02-19 00:47:18 +0000 | [diff] [blame] | 77 | REM NOMEMDEBUG
|
| 78 | REM
|
| 79 | REM When set, disables use of MEMDEBUG when building binaries for the "Debug"
|
| 80 | REM configuration.
|
| 81 | REM
|
mistachkin | 88eb7fa | 2015-04-19 18:58:29 +0000 | [diff] [blame] | 82 | REM BUILD_ALL_SHELL
|
| 83 | REM
|
| 84 | REM When set, the command line shell will be built for each selected platform
|
| 85 | REM and configuration as well. In addition, the command line shell binaries
|
| 86 | REM will be copied, with their symbols, to the final destination directory.
|
| 87 | REM
|
| 88 | REM USE_WINV63_NSDKLIBPATH
|
| 89 | REM
|
| 90 | REM When set, modifies how the NSDKLIBPATH environment variable is built, based
|
| 91 | REM on the WindowsSdkDir environment variable. It forces this batch script to
|
| 92 | REM assume the Windows 8.1 SDK location should be used.
|
| 93 | REM
|
| 94 | REM USE_WINV100_NSDKLIBPATH
|
| 95 | REM
|
| 96 | REM When set, modifies how the NSDKLIBPATH environment variable is built, based
|
| 97 | REM on the WindowsSdkDir environment variable. It causes this batch script to
|
| 98 | REM assume the Windows 10.0 SDK location should be used.
|
mistachkin | 7c5dbdf | 2012-10-19 00:23:31 +0000 | [diff] [blame] | 99 | REM
|
mistachkin | 1c89a77 | 2015-04-19 19:53:43 +0000 | [diff] [blame] | 100 | REM NMAKE_ARGS
|
mistachkin | b0c99af | 2016-02-19 05:07:56 +0000 | [diff] [blame] | 101 | REM NMAKE_ARGS_DEBUG
|
| 102 | REM NMAKE_ARGS_RETAIL
|
mistachkin | 1c89a77 | 2015-04-19 19:53:43 +0000 | [diff] [blame] | 103 | REM
|
mistachkin | b0c99af | 2016-02-19 05:07:56 +0000 | [diff] [blame] | 104 | REM When set, these values are expanded and passed to the NMAKE command line,
|
| 105 | REM after its other arguments. These may be used to specify additional NMAKE
|
| 106 | REM options, for example:
|
mistachkin | 1c89a77 | 2015-04-19 19:53:43 +0000 | [diff] [blame] | 107 | REM
|
| 108 | REM SET NMAKE_ARGS=FOR_WINRT=1
|
mistachkin | b0c99af | 2016-02-19 05:07:56 +0000 | [diff] [blame] | 109 | REM SET NMAKE_ARGS_DEBUG=MEMDEBUG=1
|
| 110 | REM SET NMAKE_ARGS_RETAIL=WIN32HEAP=1
|
mistachkin | 1c89a77 | 2015-04-19 19:53:43 +0000 | [diff] [blame] | 111 | REM
|
mistachkin | de4148e | 2015-10-29 01:11:39 +0000 | [diff] [blame] | 112 | REM Using the above command before running this tool will cause the compiled
|
| 113 | REM binaries to target the WinRT environment, which provides a subset of the
|
| 114 | REM Win32 API.
|
| 115 | REM
|
mistachkin | b9076ba | 2016-02-19 00:47:18 +0000 | [diff] [blame] | 116 | REM DLL_FILE_NAME
|
| 117 | REM DLL_PDB_FILE_NAME
|
| 118 | REM LIB_FILE_NAME
|
| 119 | REM EXE_FILE_NAME
|
| 120 | REM EXE_PDB_FILE_NAME
|
| 121 | REM
|
| 122 | REM When set, these values will override the associated target file name used
|
| 123 | REM for the build.
|
| 124 | REM
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 125 | SETLOCAL
|
| 126 |
|
| 127 | REM SET __ECHO=ECHO
|
| 128 | REM SET __ECHO2=ECHO
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 129 | REM SET __ECHO3=ECHO
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 130 | IF NOT DEFINED _AECHO (SET _AECHO=REM)
|
| 131 | IF NOT DEFINED _CECHO (SET _CECHO=REM)
|
| 132 | IF NOT DEFINED _VECHO (SET _VECHO=REM)
|
| 133 |
|
mistachkin | 44723ce | 2015-03-21 02:22:37 +0000 | [diff] [blame] | 134 | SET REDIRECT=^>
|
| 135 | IF DEFINED __ECHO SET REDIRECT=^^^>
|
| 136 |
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 137 | %_AECHO% Running %0 %*
|
| 138 |
|
| 139 | REM SET DFLAGS=/L
|
| 140 |
|
| 141 | %_VECHO% DFlags = '%DFLAGS%'
|
| 142 |
|
| 143 | SET FFLAGS=/V /F /G /H /I /R /Y /Z
|
| 144 |
|
| 145 | %_VECHO% FFlags = '%FFLAGS%'
|
| 146 |
|
| 147 | SET ROOT=%~dp0\..
|
| 148 | SET ROOT=%ROOT:\\=\%
|
| 149 |
|
| 150 | %_VECHO% Root = '%ROOT%'
|
| 151 |
|
| 152 | REM
|
| 153 | REM NOTE: The first and only argument to this batch file should be the output
|
| 154 | REM directory where the platform-specific binary directories should be
|
| 155 | REM created.
|
| 156 | REM
|
| 157 | SET BINARYDIRECTORY=%1
|
| 158 |
|
| 159 | IF NOT DEFINED BINARYDIRECTORY (
|
| 160 | GOTO usage
|
| 161 | )
|
| 162 |
|
| 163 | %_VECHO% BinaryDirectory = '%BINARYDIRECTORY%'
|
| 164 |
|
| 165 | SET DUMMY=%2
|
| 166 |
|
| 167 | IF DEFINED DUMMY (
|
| 168 | GOTO usage
|
| 169 | )
|
| 170 |
|
| 171 | REM
|
| 172 | REM NOTE: From this point, we need a clean error level. Reset it now.
|
| 173 | REM
|
| 174 | CALL :fn_ResetErrorLevel
|
| 175 |
|
| 176 | REM
|
| 177 | REM NOTE: Change the current directory to the root of the source tree, saving
|
| 178 | REM the current directory on the directory stack.
|
| 179 | REM
|
| 180 | %__ECHO2% PUSHD "%ROOT%"
|
| 181 |
|
| 182 | IF ERRORLEVEL 1 (
|
| 183 | ECHO Could not change directory to "%ROOT%".
|
| 184 | GOTO errors
|
| 185 | )
|
| 186 |
|
| 187 | REM
|
| 188 | REM NOTE: This batch file requires the ComSpec environment variable to be set,
|
| 189 | REM typically to something like "C:\Windows\System32\cmd.exe".
|
| 190 | REM
|
| 191 | IF NOT DEFINED ComSpec (
|
| 192 | ECHO The ComSpec environment variable must be defined.
|
| 193 | GOTO errors
|
| 194 | )
|
| 195 |
|
| 196 | REM
|
| 197 | REM NOTE: This batch file requires the VcInstallDir environment variable to be
|
| 198 | REM set. Tyipcally, this means this batch file needs to be run from an
|
| 199 | REM MSVC command prompt.
|
| 200 | REM
|
| 201 | IF NOT DEFINED VCINSTALLDIR (
|
| 202 | ECHO The VCINSTALLDIR environment variable must be defined.
|
| 203 | GOTO errors
|
| 204 | )
|
| 205 |
|
| 206 | REM
|
| 207 | REM NOTE: If the list of platforms is not already set, use the default list.
|
| 208 | REM
|
| 209 | IF NOT DEFINED PLATFORMS (
|
| 210 | SET PLATFORMS=x86 x86_amd64 x86_arm
|
| 211 | )
|
| 212 |
|
| 213 | %_VECHO% Platforms = '%PLATFORMS%'
|
| 214 |
|
| 215 | REM
|
mistachkin | 7c5dbdf | 2012-10-19 00:23:31 +0000 | [diff] [blame] | 216 | REM NOTE: If the list of configurations is not already set, use the default
|
| 217 | REM list.
|
| 218 | REM
|
| 219 | IF NOT DEFINED CONFIGURATIONS (
|
| 220 | SET CONFIGURATIONS=Debug Retail
|
| 221 | )
|
| 222 |
|
| 223 | %_VECHO% Configurations = '%CONFIGURATIONS%'
|
| 224 |
|
| 225 | REM
|
mistachkin | 220942b | 2014-05-05 21:08:47 +0000 | [diff] [blame] | 226 | REM NOTE: If the command used to invoke NMAKE is not already set, use the
|
| 227 | REM default.
|
| 228 | REM
|
| 229 | IF NOT DEFINED NMAKE_CMD (
|
mistachkin | b0c99af | 2016-02-19 05:07:56 +0000 | [diff] [blame] | 230 | IF DEFINED USE_AUTOCONF_MAKEFILE (
|
| 231 | SET NMAKE_CMD=nmake -B -f autoconf\Makefile.msc
|
| 232 | ) ELSE (
|
| 233 | SET NMAKE_CMD=nmake -B -f Makefile.msc
|
| 234 | )
|
mistachkin | 220942b | 2014-05-05 21:08:47 +0000 | [diff] [blame] | 235 | )
|
| 236 |
|
| 237 | %_VECHO% NmakeCmd = '%NMAKE_CMD%'
|
| 238 | %_VECHO% NmakeArgs = '%NMAKE_ARGS%'
|
mistachkin | b0c99af | 2016-02-19 05:07:56 +0000 | [diff] [blame] | 239 | %_VECHO% NmakeArgsDebug = '%NMAKE_ARGS_DEBUG%'
|
| 240 | %_VECHO% NmakeArgsRetail = '%NMAKE_ARGS_RETAIL%'
|
mistachkin | 220942b | 2014-05-05 21:08:47 +0000 | [diff] [blame] | 241 |
|
| 242 | REM
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 243 | REM NOTE: Setup environment variables to translate between the MSVC platform
|
| 244 | REM names and the names to be used for the platform-specific binary
|
| 245 | REM directories.
|
| 246 | REM
|
mistachkin | 0f80170 | 2012-10-20 08:40:05 +0000 | [diff] [blame] | 247 | SET amd64_NAME=x64
|
| 248 | SET arm_NAME=ARM
|
| 249 | SET x64_NAME=x64
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 250 | SET x86_NAME=x86
|
| 251 | SET x86_amd64_NAME=x64
|
| 252 | SET x86_arm_NAME=ARM
|
mistachkin | 0f80170 | 2012-10-20 08:40:05 +0000 | [diff] [blame] | 253 | SET x86_x64_NAME=x64
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 254 |
|
mistachkin | 0f80170 | 2012-10-20 08:40:05 +0000 | [diff] [blame] | 255 | %_VECHO% amd64_Name = '%amd64_NAME%'
|
| 256 | %_VECHO% arm_Name = '%arm_NAME%'
|
| 257 | %_VECHO% x64_Name = '%x64_NAME%'
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 258 | %_VECHO% x86_Name = '%x86_NAME%'
|
| 259 | %_VECHO% x86_amd64_Name = '%x86_amd64_NAME%'
|
| 260 | %_VECHO% x86_arm_Name = '%x86_arm_NAME%'
|
mistachkin | 0f80170 | 2012-10-20 08:40:05 +0000 | [diff] [blame] | 261 | %_VECHO% x86_x64_Name = '%x86_x64_NAME%'
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 262 |
|
| 263 | REM
|
| 264 | REM NOTE: Check for the external tools needed during the build process ^(i.e.
|
| 265 | REM those that do not get compiled as part of the build process itself^)
|
| 266 | REM along the PATH.
|
| 267 | REM
|
mistachkin | fcbe99a | 2015-10-12 03:56:21 +0000 | [diff] [blame] | 268 | IF DEFINED TCLSH_CMD (
|
| 269 | SET TCLSH_FILE=%TCLSH_CMD%
|
| 270 | ) ELSE (
|
mistachkin | a622d90 | 2016-11-03 21:35:10 +0000 | [diff] [blame] | 271 | SET TCLSH_FILE=tclsh.exe
|
mistachkin | fcbe99a | 2015-10-12 03:56:21 +0000 | [diff] [blame] | 272 | )
|
| 273 |
|
| 274 | FOR %%T IN (%TCLSH_FILE%) DO (
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 275 | SET %%T_PATH=%%~dp$PATH:T
|
| 276 | )
|
| 277 |
|
| 278 | REM
|
mistachkin | fcbe99a | 2015-10-12 03:56:21 +0000 | [diff] [blame] | 279 | REM NOTE: A Tcl shell executable is required during the SQLite build process
|
| 280 | REM unless a pre-existing amalgamation file is used.
|
mistachkin | 7c5dbdf | 2012-10-19 00:23:31 +0000 | [diff] [blame] | 281 | REM
|
mistachkin | fcbe99a | 2015-10-12 03:56:21 +0000 | [diff] [blame] | 282 | IF NOT DEFINED %TCLSH_FILE%_PATH (
|
| 283 | ECHO The Tcl shell executable "%TCLSH_FILE%" is required to be in the PATH.
|
mistachkin | 7c5dbdf | 2012-10-19 00:23:31 +0000 | [diff] [blame] | 284 | GOTO errors
|
| 285 | )
|
| 286 |
|
| 287 | REM
|
mistachkin | b9076ba | 2016-02-19 00:47:18 +0000 | [diff] [blame] | 288 | REM NOTE: Setup the default names for the build targets we are creating. Any
|
| 289 | REM ^(or all^) of these may end up being overridden.
|
| 290 | REM
|
| 291 | IF NOT DEFINED DLL_FILE_NAME (
|
| 292 | SET DLL_FILE_NAME=sqlite3.dll
|
| 293 | )
|
| 294 |
|
| 295 | IF NOT DEFINED DLL_PDB_FILE_NAME (
|
| 296 | SET DLL_PDB_FILE_NAME=sqlite3.pdb
|
| 297 | )
|
| 298 |
|
| 299 | IF NOT DEFINED LIB_FILE_NAME (
|
| 300 | SET LIB_FILE_NAME=sqlite3.lib
|
| 301 | )
|
| 302 |
|
| 303 | IF NOT DEFINED EXE_FILE_NAME (
|
| 304 | SET EXE_FILE_NAME=sqlite3.exe
|
| 305 | )
|
| 306 |
|
| 307 | IF NOT DEFINED EXE_PDB_FILE_NAME (
|
| 308 | SET EXE_PDB_FILE_NAME=sqlite3sh.pdb
|
| 309 | )
|
| 310 |
|
| 311 | REM
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 312 | REM NOTE: Set the TOOLPATH variable to contain all the directories where the
|
| 313 | REM external tools were found in the search above.
|
| 314 | REM
|
mistachkin | fcbe99a | 2015-10-12 03:56:21 +0000 | [diff] [blame] | 315 | CALL :fn_CopyVariable %TCLSH_FILE%_PATH TOOLPATH
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 316 |
|
| 317 | %_VECHO% ToolPath = '%TOOLPATH%'
|
| 318 |
|
| 319 | REM
|
mistachkin | 6bbe3df | 2015-04-19 06:18:10 +0000 | [diff] [blame] | 320 | REM NOTE: Setting the Windows SDK library path is only required for MSVC
|
| 321 | REM 2012, 2013, and 2015.
|
| 322 | REM
|
| 323 | CALL :fn_UnsetVariable SET_NSDKLIBPATH
|
| 324 |
|
| 325 | REM
|
| 326 | REM NOTE: Setting the Universal CRT library path is only required for MSVC
|
| 327 | REM 2015.
|
| 328 | REM
|
| 329 | CALL :fn_UnsetVariable SET_NUCRTLIBPATH
|
| 330 |
|
| 331 | REM
|
| 332 | REM NOTE: Check for MSVC 2012, 2013, and 2015 specially because the Windows
|
| 333 | REM SDK directory handling is slightly different for those versions.
|
mistachkin | fd0ba2a | 2012-07-27 08:21:45 +0000 | [diff] [blame] | 334 | REM
|
| 335 | IF "%VisualStudioVersion%" == "11.0" (
|
mistachkin | 7c5dbdf | 2012-10-19 00:23:31 +0000 | [diff] [blame] | 336 | REM
|
| 337 | REM NOTE: If the Windows SDK library path has already been set, do not set
|
| 338 | REM it to something else later on.
|
| 339 | REM
|
| 340 | IF NOT DEFINED NSDKLIBPATH (
|
| 341 | SET SET_NSDKLIBPATH=1
|
| 342 | )
|
mistachkin | 5042054 | 2013-06-20 18:53:33 +0000 | [diff] [blame] | 343 | ) ELSE IF "%VisualStudioVersion%" == "12.0" (
|
| 344 | REM
|
| 345 | REM NOTE: If the Windows SDK library path has already been set, do not set
|
| 346 | REM it to something else later on.
|
| 347 | REM
|
| 348 | IF NOT DEFINED NSDKLIBPATH (
|
| 349 | SET SET_NSDKLIBPATH=1
|
| 350 | )
|
mistachkin | 6bbe3df | 2015-04-19 06:18:10 +0000 | [diff] [blame] | 351 | ) ELSE IF "%VisualStudioVersion%" == "14.0" (
|
| 352 | REM
|
| 353 | REM NOTE: If the Windows SDK library path has already been set, do not set
|
| 354 | REM it to something else later on.
|
| 355 | REM
|
| 356 | IF NOT DEFINED NSDKLIBPATH (
|
| 357 | SET SET_NSDKLIBPATH=1
|
| 358 | )
|
| 359 |
|
| 360 | REM
|
| 361 | REM NOTE: If the Universal CRT library path has already been set, do not set
|
| 362 | REM it to something else later on.
|
| 363 | REM
|
| 364 | IF NOT DEFINED NUCRTLIBPATH (
|
| 365 | SET SET_NUCRTLIBPATH=1
|
| 366 | )
|
mistachkin | fd0ba2a | 2012-07-27 08:21:45 +0000 | [diff] [blame] | 367 | )
|
| 368 |
|
| 369 | REM
|
mistachkin | a09767b | 2015-08-24 17:18:43 +0000 | [diff] [blame] | 370 | REM NOTE: This is the name of the sub-directory where the UCRT libraries may
|
| 371 | REM be found. It is only used when compiling against the UCRT.
|
| 372 | REM
|
| 373 | IF DEFINED UCRTVersion (
|
| 374 | SET NUCRTVER=%UCRTVersion%
|
| 375 | ) ELSE (
|
mistachkin | 855ed4a | 2015-12-07 23:31:59 +0000 | [diff] [blame] | 376 | SET NUCRTVER=10.0.10586.0
|
mistachkin | a09767b | 2015-08-24 17:18:43 +0000 | [diff] [blame] | 377 | )
|
| 378 |
|
| 379 | REM
|
mistachkin | 9b71414 | 2015-07-28 19:35:26 +0000 | [diff] [blame] | 380 | REM NOTE: This is the name of the sub-directory where the Windows 10.0 SDK
|
| 381 | REM libraries may be found. It is only used when compiling with the
|
| 382 | REM Windows 10.0 SDK.
|
| 383 | REM
|
mistachkin | a09767b | 2015-08-24 17:18:43 +0000 | [diff] [blame] | 384 | IF DEFINED WindowsSDKLibVersion (
|
| 385 | SET WIN10SDKVER=%WindowsSDKLibVersion:\=%
|
| 386 | ) ELSE (
|
| 387 | SET WIN10SDKVER=%NUCRTVER%
|
| 388 | )
|
mistachkin | 9b71414 | 2015-07-28 19:35:26 +0000 | [diff] [blame] | 389 |
|
| 390 | REM
|
mistachkin | 0f80170 | 2012-10-20 08:40:05 +0000 | [diff] [blame] | 391 | REM NOTE: Check if this is the Windows Phone SDK. If so, a different batch
|
| 392 | REM file is necessary to setup the build environment. Since the variable
|
| 393 | REM values involved here may contain parenthesis, using GOTO instead of
|
| 394 | REM an IF block is required.
|
| 395 | REM
|
| 396 | IF DEFINED WindowsPhoneKitDir GOTO set_vcvarsall_phone
|
| 397 | SET VCVARSALL=%VCINSTALLDIR%\vcvarsall.bat
|
| 398 | GOTO set_vcvarsall_done
|
| 399 | :set_vcvarsall_phone
|
| 400 | SET VCVARSALL=%VCINSTALLDIR%\WPSDK\WP80\vcvarsphoneall.bat
|
| 401 | :set_vcvarsall_done
|
mistachkin | f6a2342 | 2014-05-05 20:24:34 +0000 | [diff] [blame] | 402 | SET VCVARSALL=%VCVARSALL:\\=\%
|
mistachkin | 0f80170 | 2012-10-20 08:40:05 +0000 | [diff] [blame] | 403 |
|
| 404 | REM
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 405 | REM NOTE: This is the outer loop. There should be exactly one iteration per
|
| 406 | REM platform.
|
| 407 | REM
|
| 408 | FOR %%P IN (%PLATFORMS%) DO (
|
| 409 | REM
|
| 410 | REM NOTE: Using the MSVC platform name, lookup the simpler platform name to
|
| 411 | REM be used for the name of the platform-specific binary directory via
|
| 412 | REM the environment variables setup earlier.
|
| 413 | REM
|
mistachkin | d744fcc | 2012-10-05 07:36:34 +0000 | [diff] [blame] | 414 | CALL :fn_CopyVariable %%P_NAME PLATFORMNAME
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 415 |
|
| 416 | REM
|
mistachkin | 293566e | 2013-10-31 06:39:15 +0000 | [diff] [blame] | 417 | REM NOTE: This is the second loop. There should be exactly one iteration.
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 418 | REM This loop is necessary because the PlatformName environment
|
| 419 | REM variable was set above and that value is needed by some of the
|
| 420 | REM commands contained in the inner loop. If these commands were
|
| 421 | REM directly contained in the outer loop, the PlatformName environment
|
| 422 | REM variable would be stuck with its initial empty value instead.
|
| 423 | REM
|
| 424 | FOR /F "tokens=2* delims==" %%D IN ('SET PLATFORMNAME') DO (
|
| 425 | REM
|
| 426 | REM NOTE: Attempt to clean the environment of all variables used by MSVC
|
| 427 | REM and/or Visual Studio. This block may need to be updated in the
|
| 428 | REM future to account for additional environment variables.
|
| 429 | REM
|
mistachkin | 7dd9fb6 | 2014-05-05 22:43:17 +0000 | [diff] [blame] | 430 | CALL :fn_UnsetVariable CommandPromptType
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 431 | CALL :fn_UnsetVariable DevEnvDir
|
mistachkin | a09767b | 2015-08-24 17:18:43 +0000 | [diff] [blame] | 432 | CALL :fn_UnsetVariable DNX_HOME
|
mistachkin | fd0ba2a | 2012-07-27 08:21:45 +0000 | [diff] [blame] | 433 | CALL :fn_UnsetVariable ExtensionSdkDir
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 434 | CALL :fn_UnsetVariable Framework35Version
|
mistachkin | f6a2342 | 2014-05-05 20:24:34 +0000 | [diff] [blame] | 435 | CALL :fn_UnsetVariable Framework40Version
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 436 | CALL :fn_UnsetVariable FrameworkDir
|
| 437 | CALL :fn_UnsetVariable FrameworkDir32
|
| 438 | CALL :fn_UnsetVariable FrameworkVersion
|
| 439 | CALL :fn_UnsetVariable FrameworkVersion32
|
mistachkin | fd0ba2a | 2012-07-27 08:21:45 +0000 | [diff] [blame] | 440 | CALL :fn_UnsetVariable FSHARPINSTALLDIR
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 441 | CALL :fn_UnsetVariable INCLUDE
|
| 442 | CALL :fn_UnsetVariable LIB
|
| 443 | CALL :fn_UnsetVariable LIBPATH
|
mistachkin | a09767b | 2015-08-24 17:18:43 +0000 | [diff] [blame] | 444 | CALL :fn_UnsetVariable NETFXSDKDir
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 445 | CALL :fn_UnsetVariable Platform
|
mistachkin | a09767b | 2015-08-24 17:18:43 +0000 | [diff] [blame] | 446 | CALL :fn_UnsetVariable UCRTVersion
|
mistachkin | 6bbe3df | 2015-04-19 06:18:10 +0000 | [diff] [blame] | 447 | CALL :fn_UnsetVariable UniversalCRTSdkDir
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 448 | REM CALL :fn_UnsetVariable VCINSTALLDIR
|
| 449 | CALL :fn_UnsetVariable VSINSTALLDIR
|
mistachkin | a09767b | 2015-08-24 17:18:43 +0000 | [diff] [blame] | 450 | CALL :fn_UnsetVariable WindowsLibPath
|
mistachkin | 0f80170 | 2012-10-20 08:40:05 +0000 | [diff] [blame] | 451 | CALL :fn_UnsetVariable WindowsPhoneKitDir
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 452 | CALL :fn_UnsetVariable WindowsSdkDir
|
mistachkin | fd0ba2a | 2012-07-27 08:21:45 +0000 | [diff] [blame] | 453 | CALL :fn_UnsetVariable WindowsSdkDir_35
|
| 454 | CALL :fn_UnsetVariable WindowsSdkDir_old
|
mistachkin | a09767b | 2015-08-24 17:18:43 +0000 | [diff] [blame] | 455 | CALL :fn_UnsetVariable WindowsSDKLibVersion
|
| 456 | CALL :fn_UnsetVariable WindowsSDKVersion
|
mistachkin | f6a2342 | 2014-05-05 20:24:34 +0000 | [diff] [blame] | 457 | CALL :fn_UnsetVariable WindowsSDK_ExecutablePath_x86
|
| 458 | CALL :fn_UnsetVariable WindowsSDK_ExecutablePath_x64
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 459 |
|
| 460 | REM
|
| 461 | REM NOTE: Reset the PATH here to the absolute bare minimum required.
|
| 462 | REM
|
mistachkin | 6e5688d | 2017-02-27 17:16:27 +0000 | [diff] [blame] | 463 | CALL :fn_ResetPath
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 464 |
|
mistachkin | 293566e | 2013-10-31 06:39:15 +0000 | [diff] [blame] | 465 | REM
|
| 466 | REM NOTE: This is the inner loop. There are normally two iterations, one
|
| 467 | REM for each supported build configuration, e.g. Debug or Retail.
|
| 468 | REM
|
mistachkin | 7c5dbdf | 2012-10-19 00:23:31 +0000 | [diff] [blame] | 469 | FOR %%B IN (%CONFIGURATIONS%) DO (
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 470 | REM
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 471 | REM NOTE: When preparing the debug build, set the DEBUG and MEMDEBUG
|
| 472 | REM environment variables to be picked up by the MSVC makefile
|
| 473 | REM itself.
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 474 | REM
|
mistachkin | 7dd9fb6 | 2014-05-05 22:43:17 +0000 | [diff] [blame] | 475 | %_AECHO% Building the %%B configuration for platform %%P with name %%D...
|
mistachkin | 220942b | 2014-05-05 21:08:47 +0000 | [diff] [blame] | 476 |
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 477 | IF /I "%%B" == "Debug" (
|
mistachkin | 774f42b | 2015-03-21 22:23:46 +0000 | [diff] [blame] | 478 | REM
|
| 479 | REM NOTE: Using this level for the DEBUG environment variable should
|
| 480 | REM disable all compiler optimizations and prevent use of the
|
| 481 | REM NDEBUG define. Additionally, both SQLITE_ENABLE_API_ARMOR
|
| 482 | REM and SQLITE_DEBUG defines should be enabled.
|
| 483 | REM
|
mistachkin | 082be63 | 2015-03-21 22:13:47 +0000 | [diff] [blame] | 484 | SET DEBUG=3
|
mistachkin | 774f42b | 2015-03-21 22:23:46 +0000 | [diff] [blame] | 485 |
|
| 486 | REM
|
| 487 | REM NOTE: Setting this to non-zero should enable the SQLITE_MEMDEBUG
|
| 488 | REM define.
|
| 489 | REM
|
mistachkin | b9076ba | 2016-02-19 00:47:18 +0000 | [diff] [blame] | 490 | IF NOT DEFINED NOMEMDEBUG (
|
| 491 | SET MEMDEBUG=1
|
| 492 | )
|
mistachkin | 0b5ae72 | 2012-07-27 23:03:47 +0000 | [diff] [blame] | 493 | ) ELSE (
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 494 | CALL :fn_UnsetVariable DEBUG
|
| 495 | CALL :fn_UnsetVariable MEMDEBUG
|
| 496 | )
|
| 497 |
|
| 498 | REM
|
mistachkin | b0c99af | 2016-02-19 05:07:56 +0000 | [diff] [blame] | 499 | REM NOTE: Copy the extra NMAKE arguments for this configuration into the
|
| 500 | REM common variable used by the actual commands.
|
| 501 | REM
|
| 502 | CALL :fn_CopyVariable NMAKE_ARGS_%%B NMAKE_ARGS_CFG
|
| 503 |
|
| 504 | REM
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 505 | REM NOTE: Launch a nested command shell to perform the following steps:
|
| 506 | REM
|
| 507 | REM 1. Setup the MSVC environment for this platform using the
|
| 508 | REM official batch file.
|
| 509 | REM
|
| 510 | REM 2. Make sure that no stale build output files are present.
|
| 511 | REM
|
| 512 | REM 3. Build the "sqlite3.dll" and "sqlite3.lib" binaries for this
|
| 513 | REM platform.
|
| 514 | REM
|
| 515 | REM 4. Copy the "sqlite3.dll" and "sqlite3.lib" binaries for this
|
| 516 | REM platform to the platform-specific directory beneath the
|
| 517 | REM binary directory.
|
| 518 | REM
|
mistachkin | 293566e | 2013-10-31 06:39:15 +0000 | [diff] [blame] | 519 | REM 5. Unless prevented from doing so, copy the "sqlite3.pdb"
|
| 520 | REM symbols file for this platform to the platform-specific
|
| 521 | REM directory beneath the binary directory.
|
| 522 | REM
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 523 | "%ComSpec%" /C (
|
mistachkin | 0b5ae72 | 2012-07-27 23:03:47 +0000 | [diff] [blame] | 524 | REM
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 525 | REM NOTE: Attempt to setup the MSVC environment for this platform.
|
mistachkin | 0b5ae72 | 2012-07-27 23:03:47 +0000 | [diff] [blame] | 526 | REM
|
mistachkin | 0f80170 | 2012-10-20 08:40:05 +0000 | [diff] [blame] | 527 | %__ECHO3% CALL "%VCVARSALL%" %%P
|
mistachkin | 391b364 | 2012-07-31 00:43:31 +0000 | [diff] [blame] | 528 |
|
| 529 | IF ERRORLEVEL 1 (
|
mistachkin | 0f80170 | 2012-10-20 08:40:05 +0000 | [diff] [blame] | 530 | ECHO Failed to call "%VCVARSALL%" for platform %%P.
|
mistachkin | 391b364 | 2012-07-31 00:43:31 +0000 | [diff] [blame] | 531 | GOTO errors
|
| 532 | )
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 533 |
|
| 534 | REM
|
| 535 | REM NOTE: If this batch file is not running in "what-if" mode, check to
|
| 536 | REM be sure we were actually able to setup the MSVC environment
|
| 537 | REM as current versions of their official batch file do not set
|
| 538 | REM the exit code upon failure.
|
| 539 | REM
|
mistachkin | 0f80170 | 2012-10-20 08:40:05 +0000 | [diff] [blame] | 540 | IF NOT DEFINED __ECHO3 (
|
| 541 | IF NOT DEFINED WindowsPhoneKitDir (
|
| 542 | IF NOT DEFINED WindowsSdkDir (
|
| 543 | ECHO Cannot build, Windows SDK not found for platform %%P.
|
| 544 | GOTO errors
|
| 545 | )
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 546 | )
|
| 547 | )
|
| 548 |
|
| 549 | REM
|
mistachkin | 6bbe3df | 2015-04-19 06:18:10 +0000 | [diff] [blame] | 550 | REM NOTE: When using MSVC 2012, 2013, or 2015, the native SDK path
|
| 551 | REM cannot simply be the "lib" sub-directory beneath the location
|
mistachkin | 293566e | 2013-10-31 06:39:15 +0000 | [diff] [blame] | 552 | REM specified in the WindowsSdkDir environment variable because
|
| 553 | REM that location does not actually contain the necessary library
|
| 554 | REM files for x86. This must be done for each iteration because
|
| 555 | REM it relies upon the WindowsSdkDir environment variable being
|
| 556 | REM set by the batch file used to setup the MSVC environment.
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 557 | REM
|
| 558 | IF DEFINED SET_NSDKLIBPATH (
|
mistachkin | 293566e | 2013-10-31 06:39:15 +0000 | [diff] [blame] | 559 | REM
|
| 560 | REM NOTE: The Windows Phone SDK has a slightly different directory
|
| 561 | REM structure and must be handled specially here.
|
| 562 | REM
|
mistachkin | 0f80170 | 2012-10-20 08:40:05 +0000 | [diff] [blame] | 563 | IF DEFINED WindowsPhoneKitDir (
|
| 564 | CALL :fn_CopyVariable WindowsPhoneKitDir NSDKLIBPATH
|
| 565 | CALL :fn_AppendVariable NSDKLIBPATH \lib\x86
|
| 566 | ) ELSE IF DEFINED WindowsSdkDir (
|
| 567 | CALL :fn_CopyVariable WindowsSdkDir NSDKLIBPATH
|
mistachkin | 5042054 | 2013-06-20 18:53:33 +0000 | [diff] [blame] | 568 |
|
mistachkin | 293566e | 2013-10-31 06:39:15 +0000 | [diff] [blame] | 569 | REM
|
mistachkin | 88eb7fa | 2015-04-19 18:58:29 +0000 | [diff] [blame] | 570 | REM NOTE: The Windows 8.x and Windows 10.0 SDKs have a slightly
|
mistachkin | 6bbe3df | 2015-04-19 06:18:10 +0000 | [diff] [blame] | 571 | REM different directory naming conventions.
|
mistachkin | 293566e | 2013-10-31 06:39:15 +0000 | [diff] [blame] | 572 | REM
|
mistachkin | 6bbe3df | 2015-04-19 06:18:10 +0000 | [diff] [blame] | 573 | IF DEFINED USE_WINV100_NSDKLIBPATH (
|
mistachkin | a09767b | 2015-08-24 17:18:43 +0000 | [diff] [blame] | 574 | CALL :fn_AppendVariable NSDKLIBPATH \..\10\lib\%WIN10SDKVER%\um\x86
|
| 575 | CALL :fn_CopyVariable WindowsSdkDir PSDKLIBPATH
|
| 576 | CALL :fn_AppendVariable PSDKLIBPATH lib\%WIN10SDKVER%\um\%%D
|
mistachkin | 6bbe3df | 2015-04-19 06:18:10 +0000 | [diff] [blame] | 577 | ) ELSE IF DEFINED USE_WINV63_NSDKLIBPATH (
|
mistachkin | 5042054 | 2013-06-20 18:53:33 +0000 | [diff] [blame] | 578 | CALL :fn_AppendVariable NSDKLIBPATH \lib\winv6.3\um\x86
|
mistachkin | 7dd9fb6 | 2014-05-05 22:43:17 +0000 | [diff] [blame] | 579 | ) ELSE IF "%VisualStudioVersion%" == "12.0" (
|
| 580 | CALL :fn_AppendVariable NSDKLIBPATH \..\8.0\lib\win8\um\x86
|
mistachkin | 6bbe3df | 2015-04-19 06:18:10 +0000 | [diff] [blame] | 581 | ) ELSE IF "%VisualStudioVersion%" == "14.0" (
|
| 582 | CALL :fn_AppendVariable NSDKLIBPATH \..\8.0\lib\win8\um\x86
|
mistachkin | 5042054 | 2013-06-20 18:53:33 +0000 | [diff] [blame] | 583 | ) ELSE (
|
| 584 | CALL :fn_AppendVariable NSDKLIBPATH \lib\win8\um\x86
|
| 585 | )
|
mistachkin | 0f80170 | 2012-10-20 08:40:05 +0000 | [diff] [blame] | 586 | )
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 587 | )
|
| 588 |
|
| 589 | REM
|
mistachkin | 6bbe3df | 2015-04-19 06:18:10 +0000 | [diff] [blame] | 590 | REM NOTE: When using MSVC 2015, setting the Universal CRT library path
|
| 591 | REM for x86 may be required as well. This must also be done for
|
| 592 | REM each iteration because it relies upon the UniversalCRTSdkDir
|
| 593 | REM environment variable being set by the batch file used to
|
| 594 | REM setup the MSVC environment.
|
| 595 | REM
|
| 596 | IF DEFINED SET_NUCRTLIBPATH (
|
| 597 | IF DEFINED UniversalCRTSdkDir (
|
| 598 | CALL :fn_CopyVariable UniversalCRTSdkDir NUCRTLIBPATH
|
mistachkin | a09767b | 2015-08-24 17:18:43 +0000 | [diff] [blame] | 599 | CALL :fn_AppendVariable NUCRTLIBPATH \lib\%NUCRTVER%\ucrt\x86
|
mistachkin | 6bbe3df | 2015-04-19 06:18:10 +0000 | [diff] [blame] | 600 | )
|
| 601 | )
|
| 602 |
|
| 603 | REM
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 604 | REM NOTE: Unless prevented from doing so, invoke NMAKE with the MSVC
|
| 605 | REM makefile to clean any stale build output from previous
|
| 606 | REM iterations of this loop and/or previous runs of this batch
|
| 607 | REM file, etc.
|
| 608 | REM
|
| 609 | IF NOT DEFINED NOCLEAN (
|
mistachkin | b0c99af | 2016-02-19 05:07:56 +0000 | [diff] [blame] | 610 | CALL :fn_MakeClean %%D
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 611 |
|
| 612 | IF ERRORLEVEL 1 (
|
| 613 | ECHO Failed to clean for platform %%P.
|
| 614 | GOTO errors
|
| 615 | )
|
| 616 | ) ELSE (
|
| 617 | REM
|
| 618 | REM NOTE: Even when the cleaning step has been disabled, we still
|
mistachkin | 44723ce | 2015-03-21 02:22:37 +0000 | [diff] [blame] | 619 | REM need to remove the build output for all the files we are
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 620 | REM specifically wanting to build for each platform.
|
| 621 | REM
|
mistachkin | 44723ce | 2015-03-21 02:22:37 +0000 | [diff] [blame] | 622 | %_AECHO% Cleaning final core library output files only...
|
mistachkin | b9076ba | 2016-02-19 00:47:18 +0000 | [diff] [blame] | 623 | %__ECHO% DEL /Q *.lo "%DLL_FILE_NAME%" "%LIB_FILE_NAME%" "%DLL_PDB_FILE_NAME%" 2%REDIRECT% NUL
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 624 | )
|
| 625 |
|
| 626 | REM
|
| 627 | REM NOTE: Call NMAKE with the MSVC makefile to build the "sqlite3.dll"
|
| 628 | REM binary. The x86 compiler will be used to compile the native
|
| 629 | REM command line tools needed during the build process itself.
|
| 630 | REM Also, disable looking for and/or linking to the native Tcl
|
| 631 | REM runtime library.
|
| 632 | REM
|
mistachkin | b0c99af | 2016-02-19 05:07:56 +0000 | [diff] [blame] | 633 | CALL :fn_MakeDll %%D
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 634 |
|
| 635 | IF ERRORLEVEL 1 (
|
mistachkin | b9076ba | 2016-02-19 00:47:18 +0000 | [diff] [blame] | 636 | ECHO Failed to build %%B "%DLL_FILE_NAME%" for platform %%P.
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 637 | GOTO errors
|
| 638 | )
|
| 639 |
|
| 640 | REM
|
| 641 | REM NOTE: Copy the "sqlite3.dll" file to the appropriate directory for
|
| 642 | REM the build and platform beneath the binary directory.
|
| 643 | REM
|
mistachkin | b9076ba | 2016-02-19 00:47:18 +0000 | [diff] [blame] | 644 | %__ECHO% XCOPY "%DLL_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 645 |
|
| 646 | IF ERRORLEVEL 1 (
|
mistachkin | b9076ba | 2016-02-19 00:47:18 +0000 | [diff] [blame] | 647 | ECHO Failed to copy "%DLL_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 648 | GOTO errors
|
| 649 | )
|
| 650 |
|
| 651 | REM
|
| 652 | REM NOTE: Copy the "sqlite3.lib" file to the appropriate directory for
|
| 653 | REM the build and platform beneath the binary directory.
|
| 654 | REM
|
mistachkin | b9076ba | 2016-02-19 00:47:18 +0000 | [diff] [blame] | 655 | %__ECHO% XCOPY "%LIB_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 656 |
|
| 657 | IF ERRORLEVEL 1 (
|
mistachkin | b9076ba | 2016-02-19 00:47:18 +0000 | [diff] [blame] | 658 | ECHO Failed to copy "%LIB_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 659 | GOTO errors
|
| 660 | )
|
| 661 |
|
| 662 | REM
|
| 663 | REM NOTE: Copy the "sqlite3.pdb" file to the appropriate directory for
|
| 664 | REM the build and platform beneath the binary directory unless we
|
| 665 | REM are prevented from doing so.
|
| 666 | REM
|
| 667 | IF NOT DEFINED NOSYMBOLS (
|
mistachkin | a0ca3bc | 2016-03-10 19:08:44 +0000 | [diff] [blame] | 668 | IF EXIST "%DLL_PDB_FILE_NAME%" (
|
| 669 | %__ECHO% XCOPY "%DLL_PDB_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 670 |
|
mistachkin | a0ca3bc | 2016-03-10 19:08:44 +0000 | [diff] [blame] | 671 | IF ERRORLEVEL 1 (
|
| 672 | ECHO Failed to copy "%DLL_PDB_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
|
| 673 | GOTO errors
|
| 674 | )
|
mistachkin | 0ec0744 | 2012-10-12 18:06:07 +0000 | [diff] [blame] | 675 | )
|
| 676 | )
|
mistachkin | 44723ce | 2015-03-21 02:22:37 +0000 | [diff] [blame] | 677 |
|
| 678 | REM
|
| 679 | REM NOTE: If requested, also build the shell executable.
|
| 680 | REM
|
| 681 | IF DEFINED BUILD_ALL_SHELL (
|
| 682 | REM
|
| 683 | REM NOTE: If necessary, make sure any previous build output for the
|
| 684 | REM shell executable is deleted.
|
| 685 | REM
|
| 686 | IF DEFINED NOCLEAN (
|
| 687 | REM
|
| 688 | REM NOTE: Even when the cleaning step has been disabled, we still
|
| 689 | REM need to remove the build output for all the files we are
|
| 690 | REM specifically wanting to build for each platform.
|
| 691 | REM
|
| 692 | %_AECHO% Cleaning final shell executable output files only...
|
mistachkin | b9076ba | 2016-02-19 00:47:18 +0000 | [diff] [blame] | 693 | %__ECHO% DEL /Q "%EXE_FILE_NAME%" "%EXE_PDB_FILE_NAME%" 2%REDIRECT% NUL
|
mistachkin | 44723ce | 2015-03-21 02:22:37 +0000 | [diff] [blame] | 694 | )
|
| 695 |
|
| 696 | REM
|
| 697 | REM NOTE: Call NMAKE with the MSVC makefile to build the "sqlite3.exe"
|
| 698 | REM binary. The x86 compiler will be used to compile the native
|
| 699 | REM command line tools needed during the build process itself.
|
| 700 | REM Also, disable looking for and/or linking to the native Tcl
|
| 701 | REM runtime library.
|
| 702 | REM
|
mistachkin | b0c99af | 2016-02-19 05:07:56 +0000 | [diff] [blame] | 703 | CALL :fn_MakeExe %%D
|
mistachkin | 44723ce | 2015-03-21 02:22:37 +0000 | [diff] [blame] | 704 |
|
| 705 | IF ERRORLEVEL 1 (
|
mistachkin | b9076ba | 2016-02-19 00:47:18 +0000 | [diff] [blame] | 706 | ECHO Failed to build %%B "%EXE_FILE_NAME%" for platform %%P.
|
mistachkin | 44723ce | 2015-03-21 02:22:37 +0000 | [diff] [blame] | 707 | GOTO errors
|
| 708 | )
|
| 709 |
|
| 710 | REM
|
| 711 | REM NOTE: Copy the "sqlite3.exe" file to the appropriate directory
|
| 712 | REM for the build and platform beneath the binary directory.
|
| 713 | REM
|
mistachkin | b9076ba | 2016-02-19 00:47:18 +0000 | [diff] [blame] | 714 | %__ECHO% XCOPY "%EXE_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
|
mistachkin | 44723ce | 2015-03-21 02:22:37 +0000 | [diff] [blame] | 715 |
|
| 716 | IF ERRORLEVEL 1 (
|
mistachkin | b9076ba | 2016-02-19 00:47:18 +0000 | [diff] [blame] | 717 | ECHO Failed to copy "%EXE_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
|
mistachkin | 44723ce | 2015-03-21 02:22:37 +0000 | [diff] [blame] | 718 | GOTO errors
|
| 719 | )
|
| 720 |
|
| 721 | REM
|
| 722 | REM NOTE: Copy the "sqlite3sh.pdb" file to the appropriate directory
|
| 723 | REM for the build and platform beneath the binary directory
|
| 724 | REM unless we are prevented from doing so.
|
| 725 | REM
|
| 726 | IF NOT DEFINED NOSYMBOLS (
|
mistachkin | a0ca3bc | 2016-03-10 19:08:44 +0000 | [diff] [blame] | 727 | IF EXIST "%EXE_PDB_FILE_NAME%" (
|
| 728 | %__ECHO% XCOPY "%EXE_PDB_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
|
mistachkin | 44723ce | 2015-03-21 02:22:37 +0000 | [diff] [blame] | 729 |
|
mistachkin | a0ca3bc | 2016-03-10 19:08:44 +0000 | [diff] [blame] | 730 | IF ERRORLEVEL 1 (
|
| 731 | ECHO Failed to copy "%EXE_PDB_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
|
| 732 | GOTO errors
|
| 733 | )
|
mistachkin | 44723ce | 2015-03-21 02:22:37 +0000 | [diff] [blame] | 734 | )
|
| 735 | )
|
| 736 | )
|
mistachkin | 391b364 | 2012-07-31 00:43:31 +0000 | [diff] [blame] | 737 | )
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 738 | )
|
| 739 | )
|
| 740 |
|
| 741 | REM
|
| 742 | REM NOTE: Handle any errors generated during the nested command shell.
|
| 743 | REM
|
| 744 | IF ERRORLEVEL 1 (
|
| 745 | GOTO errors
|
| 746 | )
|
| 747 | )
|
| 748 |
|
| 749 | REM
|
| 750 | REM NOTE: Restore the saved current directory from the directory stack.
|
| 751 | REM
|
| 752 | %__ECHO2% POPD
|
| 753 |
|
| 754 | IF ERRORLEVEL 1 (
|
| 755 | ECHO Could not restore directory.
|
| 756 | GOTO errors
|
| 757 | )
|
| 758 |
|
| 759 | REM
|
| 760 | REM NOTE: If we get to this point, we have succeeded.
|
| 761 | REM
|
| 762 | GOTO no_errors
|
| 763 |
|
mistachkin | b0c99af | 2016-02-19 05:07:56 +0000 | [diff] [blame] | 764 | :fn_MakeClean
|
mistachkin | c03c2cf | 2016-02-19 19:29:44 +0000 | [diff] [blame] | 765 | %__ECHO% %NMAKE_CMD% clean "PLATFORM=%1" XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% %NMAKE_ARGS_CFG%
|
mistachkin | b0c99af | 2016-02-19 05:07:56 +0000 | [diff] [blame] | 766 | GOTO :EOF
|
| 767 |
|
| 768 | :fn_MakeDll
|
| 769 | %__ECHO% %NMAKE_CMD% "%DLL_FILE_NAME%" "PLATFORM=%1" XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% %NMAKE_ARGS_CFG%
|
| 770 | GOTO :EOF
|
| 771 |
|
| 772 | :fn_MakeExe
|
| 773 | %__ECHO% %NMAKE_CMD% "%EXE_FILE_NAME%" "PLATFORM=%1" XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% %NMAKE_ARGS_CFG%
|
| 774 | GOTO :EOF
|
| 775 |
|
mistachkin | 318d38c | 2015-04-22 01:33:53 +0000 | [diff] [blame] | 776 | :fn_ShowVariable
|
| 777 | SETLOCAL
|
| 778 | SET __ECHO_CMD=ECHO %%%2%%
|
| 779 | FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
|
| 780 | IF NOT "%%V" == "" (
|
| 781 | IF NOT "%%V" == "%%%2%%" (
|
| 782 | %_VECHO% %1 = '%%V'
|
| 783 | )
|
| 784 | )
|
| 785 | )
|
| 786 | ENDLOCAL
|
| 787 | GOTO :EOF
|
| 788 |
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 789 | :fn_ResetErrorLevel
|
| 790 | VERIFY > NUL
|
| 791 | GOTO :EOF
|
| 792 |
|
| 793 | :fn_SetErrorLevel
|
| 794 | VERIFY MAYBE 2> NUL
|
| 795 | GOTO :EOF
|
| 796 |
|
mistachkin | d744fcc | 2012-10-05 07:36:34 +0000 | [diff] [blame] | 797 | :fn_CopyVariable
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 798 | IF NOT DEFINED %1 GOTO :EOF
|
| 799 | IF "%2" == "" GOTO :EOF
|
mistachkin | f201496 | 2013-11-22 00:49:43 +0000 | [diff] [blame] | 800 | SETLOCAL
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 801 | SET __ECHO_CMD=ECHO %%%1%%
|
| 802 | FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
|
| 803 | SET VALUE=%%V
|
| 804 | )
|
| 805 | ENDLOCAL && SET %2=%VALUE%
|
| 806 | GOTO :EOF
|
| 807 |
|
| 808 | :fn_UnsetVariable
|
mistachkin | 02de84e | 2016-02-05 04:39:11 +0000 | [diff] [blame] | 809 | SETLOCAL
|
mistachkin | 5a2412f | 2016-01-27 23:50:14 +0000 | [diff] [blame] | 810 | SET VALUE=%1
|
| 811 | IF DEFINED VALUE (
|
mistachkin | 00029a1 | 2016-01-28 00:04:32 +0000 | [diff] [blame] | 812 | SET VALUE=
|
mistachkin | 02de84e | 2016-02-05 04:39:11 +0000 | [diff] [blame] | 813 | ENDLOCAL
|
| 814 | SET %VALUE%=
|
mistachkin | 02de84e | 2016-02-05 04:39:11 +0000 | [diff] [blame] | 815 | ) ELSE (
|
| 816 | ENDLOCAL
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 817 | )
|
mistachkin | b91d221 | 2016-02-05 04:55:01 +0000 | [diff] [blame] | 818 | CALL :fn_ResetErrorLevel
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 819 | GOTO :EOF
|
| 820 |
|
mistachkin | 6e5688d | 2017-02-27 17:16:27 +0000 | [diff] [blame] | 821 | :fn_ResetPath
|
| 822 | SET PATH=%TOOLPATH%;%SystemRoot%\System32;%SystemRoot%
|
| 823 | GOTO :EOF
|
| 824 |
|
mistachkin | fd0ba2a | 2012-07-27 08:21:45 +0000 | [diff] [blame] | 825 | :fn_AppendVariable
|
| 826 | SET __ECHO_CMD=ECHO %%%1%%
|
| 827 | IF DEFINED %1 (
|
| 828 | FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
|
| 829 | SET %1=%%V%~2
|
| 830 | )
|
| 831 | ) ELSE (
|
| 832 | SET %1=%~2
|
| 833 | )
|
| 834 | SET __ECHO_CMD=
|
| 835 | CALL :fn_ResetErrorLevel
|
| 836 | GOTO :EOF
|
| 837 |
|
mistachkin | 31856a3 | 2012-07-27 07:13:25 +0000 | [diff] [blame] | 838 | :usage
|
| 839 | ECHO.
|
| 840 | ECHO Usage: %~nx0 ^<binaryDirectory^>
|
| 841 | ECHO.
|
| 842 | GOTO errors
|
| 843 |
|
| 844 | :errors
|
| 845 | CALL :fn_SetErrorLevel
|
| 846 | ENDLOCAL
|
| 847 | ECHO.
|
| 848 | ECHO Failure, errors were encountered.
|
| 849 | GOTO end_of_file
|
| 850 |
|
| 851 | :no_errors
|
| 852 | CALL :fn_ResetErrorLevel
|
| 853 | ENDLOCAL
|
| 854 | ECHO.
|
| 855 | ECHO Success, no errors were encountered.
|
| 856 | GOTO end_of_file
|
| 857 |
|
| 858 | :end_of_file
|
| 859 | %__ECHO% EXIT /B %ERRORLEVEL%
|