4 :: build-all-msvc.bat --
\r
6 :: Multi-Platform Build Tool for MSVC
\r
10 REM This batch script is used to build the SQLite DLL for multiple platforms
\r
11 REM and configurations using MSVC. The built SQLite DLLs, their associated
\r
12 REM import libraries, and optionally their symbols files, are placed within
\r
13 REM the directory specified on the command line, in sub-directories named for
\r
14 REM their respective platforms and configurations. This batch script must be
\r
15 REM run from inside a Visual Studio Command Prompt for the desired version of
\r
16 REM Visual Studio ^(the initial platform configured for the command prompt does
\r
17 REM not really matter^). Exactly one command line argument is required, the
\r
18 REM name of an existing directory to be used as the final destination directory
\r
19 REM for the generated output files, which will be placed in sub-directories
\r
20 REM created therein. Ideally, the directory specified should be empty.
\r
24 REM CD /D C:\dev\sqlite\core
\r
25 REM CALL tool\build-all-msvc.bat C:\Temp
\r
27 REM In the example above, "C:\dev\sqlite\core" represents the root of the
\r
28 REM source tree for SQLite and "C:\Temp" represents the final destination
\r
29 REM directory for the generated output files.
\r
31 REM Please note that the SQLite build process performed by the Makefile
\r
32 REM associated with this batch script requires a Tcl shell to be present
\r
33 REM in a directory contained in the PATH environment variable unless a
\r
34 REM pre-existing amalgamation file is used.
\r
36 REM There are several environment variables that may be set to modify the
\r
37 REM behavior of this batch script and its associated Makefile. The list of
\r
38 REM platforms to build may be overriden by using the PLATFORMS environment
\r
39 REM variable, which should contain a list of platforms ^(e.g. x86 x86_amd64
\r
40 REM x86_arm^). All platforms must be supported by the version of Visual Studio
\r
41 REM being used. The list of configurations to build may be overridden by
\r
42 REM setting the CONFIGURATIONS environment variable, which should contain a
\r
43 REM list of configurations to build ^(e.g. Debug Retail^). Neither of these
\r
44 REM variable values may contain any double quotes, surrounding or embedded.
\r
46 REM Finally, the NCRTLIBPATH, NUCRTLIBPATH, and NSDKLIBPATH environment
\r
47 REM variables may be set to specify the location of the CRT, Universal CRT, and
\r
48 REM Windows SDK, respectively, that may be needed to compile executables native
\r
49 REM to the architecture of the build machine during any cross-compilation that
\r
50 REM may be necessary, depending on the platforms to be built. These values in
\r
51 REM these three variables should be surrounded by double quotes if they contain
\r
54 REM There are a few other environment variables that impact the build process
\r
55 REM when set ^(to anything^), they are:
\r
57 REM USE_AUTOCONF_MAKEFILE
\r
59 REM When set, the "autoconf" Makefile for MSVC will be used instead of the main
\r
60 REM Makefile for MSVC. It must exist at "%ROOT%\autoconf\Makefile.msc".
\r
64 REM When set, the "clean" target will not be used during each build iteration.
\r
65 REM However, the target binaries, if any, will still be deleted manually prior
\r
66 REM to being rebuilt. Setting this environment variable is only rarely needed
\r
67 REM and could cause issues in some circumstances; therefore, setting it is not
\r
72 REM When set, copying of symbol files ^(*.pdb^) created during the build will
\r
73 REM be skipped and they will not appear in the final destination directory.
\r
74 REM Setting this environment variable is never strictly needed and could cause
\r
75 REM issues in some circumstances; therefore, setting it is not recommended.
\r
79 REM When set, disables use of MEMDEBUG when building binaries for the "Debug"
\r
84 REM When set, the command line shell will be built for each selected platform
\r
85 REM and configuration as well. In addition, the command line shell binaries
\r
86 REM will be copied, with their symbols, to the final destination directory.
\r
88 REM USE_WINV63_NSDKLIBPATH
\r
90 REM When set, modifies how the NSDKLIBPATH environment variable is built, based
\r
91 REM on the WindowsSdkDir environment variable. It forces this batch script to
\r
92 REM assume the Windows 8.1 SDK location should be used.
\r
94 REM USE_WINV100_NSDKLIBPATH
\r
96 REM When set, modifies how the NSDKLIBPATH environment variable is built, based
\r
97 REM on the WindowsSdkDir environment variable. It causes this batch script to
\r
98 REM assume the Windows 10.0 SDK location should be used.
\r
101 REM NMAKE_ARGS_DEBUG
\r
102 REM NMAKE_ARGS_RETAIL
\r
104 REM When set, these values are expanded and passed to the NMAKE command line,
\r
105 REM after its other arguments. These may be used to specify additional NMAKE
\r
106 REM options, for example:
\r
108 REM SET NMAKE_ARGS=FOR_WINRT=1
\r
109 REM SET NMAKE_ARGS_DEBUG=MEMDEBUG=1
\r
110 REM SET NMAKE_ARGS_RETAIL=WIN32HEAP=1
\r
112 REM Using the above command before running this tool will cause the compiled
\r
113 REM binaries to target the WinRT environment, which provides a subset of the
\r
117 REM DLL_PDB_FILE_NAME
\r
120 REM EXE_PDB_FILE_NAME
\r
122 REM When set, these values will override the associated target file name used
\r
127 REM SET __ECHO=ECHO
\r
128 REM SET __ECHO2=ECHO
\r
129 REM SET __ECHO3=ECHO
\r
130 IF NOT DEFINED _AECHO (SET _AECHO=REM)
\r
131 IF NOT DEFINED _CECHO (SET _CECHO=REM)
\r
132 IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
\r
133 IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
\r
134 IF NOT DEFINED _VECHO (SET _VECHO=REM)
\r
137 IF DEFINED __ECHO SET REDIRECT=^^^>
\r
139 %_AECHO% Running %0 %*
\r
143 %_VECHO% DFlags = '%DFLAGS%'
\r
145 SET FFLAGS=/V /F /G /H /I /R /Y /Z
\r
147 %_VECHO% FFlags = '%FFLAGS%'
\r
150 SET ROOT=%ROOT:\\=\%
\r
152 %_VECHO% Root = '%ROOT%'
\r
155 REM NOTE: The first and only argument to this batch file should be the output
\r
156 REM directory where the platform-specific binary directories should be
\r
159 SET BINARYDIRECTORY=%1
\r
161 IF NOT DEFINED BINARYDIRECTORY (
\r
165 %_VECHO% BinaryDirectory = '%BINARYDIRECTORY%'
\r
174 REM NOTE: From this point, we need a clean error level. Reset it now.
\r
176 CALL :fn_ResetErrorLevel
\r
179 REM NOTE: Change the current directory to the root of the source tree, saving
\r
180 REM the current directory on the directory stack.
\r
182 %_CECHO2% PUSHD "%ROOT%"
\r
183 %__ECHO2% PUSHD "%ROOT%"
\r
186 ECHO Could not change directory to "%ROOT%".
\r
191 REM NOTE: This batch file requires the ComSpec environment variable to be set,
\r
192 REM typically to something like "C:\Windows\System32\cmd.exe".
\r
194 IF NOT DEFINED ComSpec (
\r
195 ECHO The ComSpec environment variable must be defined.
\r
200 REM NOTE: This batch file requires the VcInstallDir environment variable to be
\r
201 REM set. Tyipcally, this means this batch file needs to be run from an
\r
202 REM MSVC command prompt.
\r
204 IF NOT DEFINED VCINSTALLDIR (
\r
205 ECHO The VCINSTALLDIR environment variable must be defined.
\r
210 REM NOTE: If the list of platforms is not already set, use the default list.
\r
212 IF NOT DEFINED PLATFORMS (
\r
213 SET PLATFORMS=x86 x86_amd64 x86_arm
\r
216 %_VECHO% Platforms = '%PLATFORMS%'
\r
219 REM NOTE: If the list of configurations is not already set, use the default
\r
222 IF NOT DEFINED CONFIGURATIONS (
\r
223 SET CONFIGURATIONS=Debug Retail
\r
226 %_VECHO% Configurations = '%CONFIGURATIONS%'
\r
229 REM NOTE: If the command used to invoke NMAKE is not already set, use the
\r
232 IF NOT DEFINED NMAKE_CMD (
\r
233 IF DEFINED USE_AUTOCONF_MAKEFILE (
\r
234 SET NMAKE_CMD=nmake -B -f autoconf\Makefile.msc
\r
236 SET NMAKE_CMD=nmake -B -f Makefile.msc
\r
240 %_VECHO% NmakeCmd = '%NMAKE_CMD%'
\r
241 %_VECHO% NmakeArgs = '%NMAKE_ARGS%'
\r
242 %_VECHO% NmakeArgsDebug = '%NMAKE_ARGS_DEBUG%'
\r
243 %_VECHO% NmakeArgsRetail = '%NMAKE_ARGS_RETAIL%'
\r
246 REM NOTE: Setup environment variables to translate between the MSVC platform
\r
247 REM names and the names to be used for the platform-specific binary
\r
254 SET x86_amd64_NAME=x64
\r
255 SET x86_arm_NAME=ARM
\r
256 SET x86_x64_NAME=x64
\r
258 %_VECHO% amd64_Name = '%amd64_NAME%'
\r
259 %_VECHO% arm_Name = '%arm_NAME%'
\r
260 %_VECHO% x64_Name = '%x64_NAME%'
\r
261 %_VECHO% x86_Name = '%x86_NAME%'
\r
262 %_VECHO% x86_amd64_Name = '%x86_amd64_NAME%'
\r
263 %_VECHO% x86_arm_Name = '%x86_arm_NAME%'
\r
264 %_VECHO% x86_x64_Name = '%x86_x64_NAME%'
\r
267 REM NOTE: Check for the external tools needed during the build process ^(i.e.
\r
268 REM those that do not get compiled as part of the build process itself^)
\r
269 REM along the PATH.
\r
271 IF DEFINED TCLSH_CMD (
\r
272 SET TCLSH_FILE=%TCLSH_CMD%
\r
274 SET TCLSH_FILE=tclsh.exe
\r
277 FOR %%T IN (%TCLSH_FILE%) DO (
\r
278 SET %%T_PATH=%%~dp$PATH:T
\r
282 REM NOTE: A Tcl shell executable is required during the SQLite build process
\r
283 REM unless a pre-existing amalgamation file is used.
\r
285 IF NOT DEFINED %TCLSH_FILE%_PATH (
\r
286 ECHO The Tcl shell executable "%TCLSH_FILE%" is required to be in the PATH.
\r
291 REM NOTE: Setup the default names for the build targets we are creating. Any
\r
292 REM ^(or all^) of these may end up being overridden.
\r
294 IF NOT DEFINED DLL_FILE_NAME (
\r
295 SET DLL_FILE_NAME=sqlite3.dll
\r
298 IF NOT DEFINED DLL_PDB_FILE_NAME (
\r
299 SET DLL_PDB_FILE_NAME=sqlite3.pdb
\r
302 IF NOT DEFINED LIB_FILE_NAME (
\r
303 SET LIB_FILE_NAME=sqlite3.lib
\r
306 IF NOT DEFINED EXE_FILE_NAME (
\r
307 SET EXE_FILE_NAME=sqlite3.exe
\r
310 IF NOT DEFINED EXE_PDB_FILE_NAME (
\r
311 SET EXE_PDB_FILE_NAME=sqlite3sh.pdb
\r
315 REM NOTE: Set the TOOLPATH variable to contain all the directories where the
\r
316 REM external tools were found in the search above.
\r
318 CALL :fn_CopyVariable %TCLSH_FILE%_PATH TOOLPATH
\r
320 %_VECHO% ToolPath = '%TOOLPATH%'
\r
323 REM NOTE: Setting the Windows SDK library path is only required for MSVC
\r
324 REM 2012, 2013, and 2015.
\r
326 CALL :fn_UnsetVariable SET_NSDKLIBPATH
\r
329 REM NOTE: Setting the Universal CRT library path is only required for MSVC
\r
332 CALL :fn_UnsetVariable SET_NUCRTLIBPATH
\r
335 REM NOTE: Check for MSVC 2012, 2013, and 2015 specially because the Windows
\r
336 REM SDK directory handling is slightly different for those versions.
\r
338 IF "%VisualStudioVersion%" == "11.0" (
\r
340 REM NOTE: If the Windows SDK library path has already been set, do not set
\r
341 REM it to something else later on.
\r
343 IF NOT DEFINED NSDKLIBPATH (
\r
344 SET SET_NSDKLIBPATH=1
\r
346 ) ELSE IF "%VisualStudioVersion%" == "12.0" (
\r
348 REM NOTE: If the Windows SDK library path has already been set, do not set
\r
349 REM it to something else later on.
\r
351 IF NOT DEFINED NSDKLIBPATH (
\r
352 SET SET_NSDKLIBPATH=1
\r
354 ) ELSE IF "%VisualStudioVersion%" == "14.0" (
\r
356 REM NOTE: If the Windows SDK library path has already been set, do not set
\r
357 REM it to something else later on.
\r
359 IF NOT DEFINED NSDKLIBPATH (
\r
360 SET SET_NSDKLIBPATH=1
\r
364 REM NOTE: If the Universal CRT library path has already been set, do not set
\r
365 REM it to something else later on.
\r
367 IF NOT DEFINED NUCRTLIBPATH (
\r
368 SET SET_NUCRTLIBPATH=1
\r
373 REM NOTE: This is the name of the sub-directory where the UCRT libraries may
\r
374 REM be found. It is only used when compiling against the UCRT.
\r
376 IF DEFINED UCRTVersion (
\r
377 SET NUCRTVER=%UCRTVersion%
\r
379 SET NUCRTVER=10.0.10586.0
\r
383 REM NOTE: This is the name of the sub-directory where the Windows 10.0 SDK
\r
384 REM libraries may be found. It is only used when compiling with the
\r
385 REM Windows 10.0 SDK.
\r
387 IF DEFINED WindowsSDKLibVersion (
\r
388 SET WIN10SDKVER=%WindowsSDKLibVersion:\=%
\r
390 SET WIN10SDKVER=%NUCRTVER%
\r
394 REM NOTE: Check if this is the Windows Phone SDK. If so, a different batch
\r
395 REM file is necessary to setup the build environment. Since the variable
\r
396 REM values involved here may contain parenthesis, using GOTO instead of
\r
397 REM an IF block is required.
\r
399 IF DEFINED WindowsPhoneKitDir GOTO set_vcvarsall_phone
\r
400 SET VCVARSALL=%VCINSTALLDIR%\vcvarsall.bat
\r
401 GOTO set_vcvarsall_done
\r
402 :set_vcvarsall_phone
\r
403 SET VCVARSALL=%VCINSTALLDIR%\WPSDK\WP80\vcvarsphoneall.bat
\r
404 :set_vcvarsall_done
\r
405 SET VCVARSALL=%VCVARSALL:\\=\%
\r
408 REM NOTE: This is the outer loop. There should be exactly one iteration per
\r
411 FOR %%P IN (%PLATFORMS%) DO (
\r
413 REM NOTE: Using the MSVC platform name, lookup the simpler platform name to
\r
414 REM be used for the name of the platform-specific binary directory via
\r
415 REM the environment variables setup earlier.
\r
417 CALL :fn_CopyVariable %%P_NAME PLATFORMNAME
\r
420 REM NOTE: This is the second loop. There should be exactly one iteration.
\r
421 REM This loop is necessary because the PlatformName environment
\r
422 REM variable was set above and that value is needed by some of the
\r
423 REM commands contained in the inner loop. If these commands were
\r
424 REM directly contained in the outer loop, the PlatformName environment
\r
425 REM variable would be stuck with its initial empty value instead.
\r
427 FOR /F "tokens=2* delims==" %%D IN ('SET PLATFORMNAME') DO (
\r
429 REM NOTE: Attempt to clean the environment of all variables used by MSVC
\r
430 REM and/or Visual Studio. This block may need to be updated in the
\r
431 REM future to account for additional environment variables.
\r
433 CALL :fn_UnsetVariable CommandPromptType
\r
434 CALL :fn_UnsetVariable DevEnvDir
\r
435 CALL :fn_UnsetVariable DNX_HOME
\r
436 CALL :fn_UnsetVariable ExtensionSdkDir
\r
437 CALL :fn_UnsetVariable Framework35Version
\r
438 CALL :fn_UnsetVariable Framework40Version
\r
439 CALL :fn_UnsetVariable FrameworkDir
\r
440 CALL :fn_UnsetVariable FrameworkDir32
\r
441 CALL :fn_UnsetVariable FrameworkVersion
\r
442 CALL :fn_UnsetVariable FrameworkVersion32
\r
443 CALL :fn_UnsetVariable FSHARPINSTALLDIR
\r
444 CALL :fn_UnsetVariable INCLUDE
\r
445 CALL :fn_UnsetVariable LIB
\r
446 CALL :fn_UnsetVariable LIBPATH
\r
447 CALL :fn_UnsetVariable NETFXSDKDir
\r
448 CALL :fn_UnsetVariable Platform
\r
449 CALL :fn_UnsetVariable UCRTVersion
\r
450 CALL :fn_UnsetVariable UniversalCRTSdkDir
\r
451 REM CALL :fn_UnsetVariable VCINSTALLDIR
\r
452 CALL :fn_UnsetVariable VSINSTALLDIR
\r
453 CALL :fn_UnsetVariable WindowsLibPath
\r
454 CALL :fn_UnsetVariable WindowsPhoneKitDir
\r
455 CALL :fn_UnsetVariable WindowsSdkDir
\r
456 CALL :fn_UnsetVariable WindowsSdkDir_35
\r
457 CALL :fn_UnsetVariable WindowsSdkDir_old
\r
458 CALL :fn_UnsetVariable WindowsSDKLibVersion
\r
459 CALL :fn_UnsetVariable WindowsSDKVersion
\r
460 CALL :fn_UnsetVariable WindowsSDK_ExecutablePath_x86
\r
461 CALL :fn_UnsetVariable WindowsSDK_ExecutablePath_x64
\r
464 REM NOTE: Reset the PATH here to the absolute bare minimum required.
\r
469 REM NOTE: This is the inner loop. There are normally two iterations, one
\r
470 REM for each supported build configuration, e.g. Debug or Retail.
\r
472 FOR %%B IN (%CONFIGURATIONS%) DO (
\r
474 REM NOTE: When preparing the debug build, set the DEBUG and MEMDEBUG
\r
475 REM environment variables to be picked up by the MSVC makefile
\r
478 %_AECHO% Building the %%B configuration for platform %%P with name %%D...
\r
480 IF /I "%%B" == "Debug" (
\r
482 REM NOTE: Using this level for the DEBUG environment variable should
\r
483 REM disable all compiler optimizations and prevent use of the
\r
484 REM NDEBUG define. Additionally, both SQLITE_ENABLE_API_ARMOR
\r
485 REM and SQLITE_DEBUG defines should be enabled.
\r
490 REM NOTE: Setting this to non-zero should enable the SQLITE_MEMDEBUG
\r
493 IF NOT DEFINED NOMEMDEBUG (
\r
497 CALL :fn_UnsetVariable DEBUG
\r
498 CALL :fn_UnsetVariable MEMDEBUG
\r
502 REM NOTE: Copy the extra NMAKE arguments for this configuration into the
\r
503 REM common variable used by the actual commands.
\r
505 CALL :fn_CopyVariable NMAKE_ARGS_%%B NMAKE_ARGS_CFG
\r
508 REM NOTE: Launch a nested command shell to perform the following steps:
\r
510 REM 1. Setup the MSVC environment for this platform using the
\r
511 REM official batch file.
\r
513 REM 2. Make sure that no stale build output files are present.
\r
515 REM 3. Build the "sqlite3.dll" and "sqlite3.lib" binaries for this
\r
518 REM 4. Copy the "sqlite3.dll" and "sqlite3.lib" binaries for this
\r
519 REM platform to the platform-specific directory beneath the
\r
520 REM binary directory.
\r
522 REM 5. Unless prevented from doing so, copy the "sqlite3.pdb"
\r
523 REM symbols file for this platform to the platform-specific
\r
524 REM directory beneath the binary directory.
\r
528 REM NOTE: Attempt to setup the MSVC environment for this platform.
\r
530 %_CECHO3% CALL "%VCVARSALL%" %%P
\r
531 %__ECHO3% CALL "%VCVARSALL%" %%P
\r
534 ECHO Failed to call "%VCVARSALL%" for platform %%P.
\r
539 REM NOTE: If this batch file is not running in "what-if" mode, check to
\r
540 REM be sure we were actually able to setup the MSVC environment
\r
541 REM as current versions of their official batch file do not set
\r
542 REM the exit code upon failure.
\r
544 IF NOT DEFINED __ECHO3 (
\r
545 IF NOT DEFINED WindowsPhoneKitDir (
\r
546 IF NOT DEFINED WindowsSdkDir (
\r
547 ECHO Cannot build, Windows SDK not found for platform %%P.
\r
554 REM NOTE: When using MSVC 2012, 2013, or 2015, the native SDK path
\r
555 REM cannot simply be the "lib" sub-directory beneath the location
\r
556 REM specified in the WindowsSdkDir environment variable because
\r
557 REM that location does not actually contain the necessary library
\r
558 REM files for x86. This must be done for each iteration because
\r
559 REM it relies upon the WindowsSdkDir environment variable being
\r
560 REM set by the batch file used to setup the MSVC environment.
\r
562 IF DEFINED SET_NSDKLIBPATH (
\r
564 REM NOTE: The Windows Phone SDK has a slightly different directory
\r
565 REM structure and must be handled specially here.
\r
567 IF DEFINED WindowsPhoneKitDir (
\r
568 CALL :fn_CopyVariable WindowsPhoneKitDir NSDKLIBPATH
\r
569 CALL :fn_AppendVariable NSDKLIBPATH \lib\x86
\r
570 ) ELSE IF DEFINED WindowsSdkDir (
\r
571 CALL :fn_CopyVariable WindowsSdkDir NSDKLIBPATH
\r
574 REM NOTE: The Windows 8.x and Windows 10.0 SDKs have a slightly
\r
575 REM different directory naming conventions.
\r
577 IF DEFINED USE_WINV100_NSDKLIBPATH (
\r
578 CALL :fn_AppendVariable NSDKLIBPATH \..\10\lib\%WIN10SDKVER%\um\x86
\r
579 CALL :fn_CopyVariable WindowsSdkDir PSDKLIBPATH
\r
580 CALL :fn_AppendVariable PSDKLIBPATH lib\%WIN10SDKVER%\um\%%D
\r
581 ) ELSE IF DEFINED USE_WINV63_NSDKLIBPATH (
\r
582 CALL :fn_AppendVariable NSDKLIBPATH \lib\winv6.3\um\x86
\r
583 ) ELSE IF "%VisualStudioVersion%" == "12.0" (
\r
584 CALL :fn_AppendVariable NSDKLIBPATH \..\8.0\lib\win8\um\x86
\r
585 ) ELSE IF "%VisualStudioVersion%" == "14.0" (
\r
586 CALL :fn_AppendVariable NSDKLIBPATH \..\8.0\lib\win8\um\x86
\r
588 CALL :fn_AppendVariable NSDKLIBPATH \lib\win8\um\x86
\r
594 REM NOTE: When using MSVC 2015, setting the Universal CRT library path
\r
595 REM for x86 may be required as well. This must also be done for
\r
596 REM each iteration because it relies upon the UniversalCRTSdkDir
\r
597 REM environment variable being set by the batch file used to
\r
598 REM setup the MSVC environment.
\r
600 IF DEFINED SET_NUCRTLIBPATH (
\r
601 IF DEFINED UniversalCRTSdkDir (
\r
602 CALL :fn_CopyVariable UniversalCRTSdkDir NUCRTLIBPATH
\r
603 CALL :fn_AppendVariable NUCRTLIBPATH \lib\%NUCRTVER%\ucrt\x86
\r
608 REM NOTE: Unless prevented from doing so, invoke NMAKE with the MSVC
\r
609 REM makefile to clean any stale build output from previous
\r
610 REM iterations of this loop and/or previous runs of this batch
\r
613 IF NOT DEFINED NOCLEAN (
\r
614 CALL :fn_MakeClean %%D
\r
617 ECHO Failed to clean for platform %%P.
\r
622 REM NOTE: Even when the cleaning step has been disabled, we still
\r
623 REM need to remove the build output for all the files we are
\r
624 REM specifically wanting to build for each platform.
\r
626 %_AECHO% Cleaning final core library output files only...
\r
627 %__ECHO% DEL /Q *.lo "%DLL_FILE_NAME%" "%LIB_FILE_NAME%" "%DLL_PDB_FILE_NAME%" 2%REDIRECT% NUL
\r
631 REM NOTE: Call NMAKE with the MSVC makefile to build the "sqlite3.dll"
\r
632 REM binary. The x86 compiler will be used to compile the native
\r
633 REM command line tools needed during the build process itself.
\r
634 REM Also, disable looking for and/or linking to the native Tcl
\r
635 REM runtime library.
\r
637 CALL :fn_MakeDll %%D
\r
640 ECHO Failed to build %%B "%DLL_FILE_NAME%" for platform %%P.
\r
645 REM NOTE: Copy the "sqlite3.dll" file to the appropriate directory for
\r
646 REM the build and platform beneath the binary directory.
\r
648 %__ECHO% XCOPY "%DLL_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
\r
651 ECHO Failed to copy "%DLL_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
\r
656 REM NOTE: Copy the "sqlite3.lib" file to the appropriate directory for
\r
657 REM the build and platform beneath the binary directory.
\r
659 %__ECHO% XCOPY "%LIB_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
\r
662 ECHO Failed to copy "%LIB_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
\r
667 REM NOTE: Copy the "sqlite3.pdb" file to the appropriate directory for
\r
668 REM the build and platform beneath the binary directory unless we
\r
669 REM are prevented from doing so.
\r
671 IF NOT DEFINED NOSYMBOLS (
\r
672 IF EXIST "%DLL_PDB_FILE_NAME%" (
\r
673 %__ECHO% XCOPY "%DLL_PDB_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
\r
676 ECHO Failed to copy "%DLL_PDB_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
\r
683 REM NOTE: If requested, also build the shell executable.
\r
685 IF DEFINED BUILD_ALL_SHELL (
\r
687 REM NOTE: If necessary, make sure any previous build output for the
\r
688 REM shell executable is deleted.
\r
690 IF DEFINED NOCLEAN (
\r
692 REM NOTE: Even when the cleaning step has been disabled, we still
\r
693 REM need to remove the build output for all the files we are
\r
694 REM specifically wanting to build for each platform.
\r
696 %_AECHO% Cleaning final shell executable output files only...
\r
697 %__ECHO% DEL /Q "%EXE_FILE_NAME%" "%EXE_PDB_FILE_NAME%" 2%REDIRECT% NUL
\r
701 REM NOTE: Call NMAKE with the MSVC makefile to build the "sqlite3.exe"
\r
702 REM binary. The x86 compiler will be used to compile the native
\r
703 REM command line tools needed during the build process itself.
\r
704 REM Also, disable looking for and/or linking to the native Tcl
\r
705 REM runtime library.
\r
707 CALL :fn_MakeExe %%D
\r
710 ECHO Failed to build %%B "%EXE_FILE_NAME%" for platform %%P.
\r
715 REM NOTE: Copy the "sqlite3.exe" file to the appropriate directory
\r
716 REM for the build and platform beneath the binary directory.
\r
718 %__ECHO% XCOPY "%EXE_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
\r
721 ECHO Failed to copy "%EXE_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
\r
726 REM NOTE: Copy the "sqlite3sh.pdb" file to the appropriate directory
\r
727 REM for the build and platform beneath the binary directory
\r
728 REM unless we are prevented from doing so.
\r
730 IF NOT DEFINED NOSYMBOLS (
\r
731 IF EXIST "%EXE_PDB_FILE_NAME%" (
\r
732 %__ECHO% XCOPY "%EXE_PDB_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
\r
735 ECHO Failed to copy "%EXE_PDB_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\".
\r
746 REM NOTE: Handle any errors generated during the nested command shell.
\r
754 REM NOTE: Restore the saved current directory from the directory stack.
\r
760 ECHO Could not restore directory.
\r
765 REM NOTE: If we get to this point, we have succeeded.
\r
770 %__ECHO% %NMAKE_CMD% clean "PLATFORM=%1" XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% %NMAKE_ARGS_CFG%
\r
774 %__ECHO% %NMAKE_CMD% "%DLL_FILE_NAME%" "PLATFORM=%1" XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% %NMAKE_ARGS_CFG%
\r
778 %__ECHO% %NMAKE_CMD% "%EXE_FILE_NAME%" "PLATFORM=%1" XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% %NMAKE_ARGS_CFG%
\r
783 SET __ECHO_CMD=ECHO %%%2%%
\r
784 FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
\r
785 IF NOT "%%V" == "" (
\r
786 IF NOT "%%V" == "%%%2%%" (
\r
787 %_VECHO% %1 = '%%V'
\r
794 :fn_ResetErrorLevel
\r
799 VERIFY MAYBE 2> NUL
\r
803 IF NOT DEFINED %1 GOTO :EOF
\r
804 IF "%2" == "" GOTO :EOF
\r
806 SET __ECHO_CMD=ECHO %%%1%%
\r
807 FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
\r
810 ENDLOCAL && SET %2=%VALUE%
\r
823 CALL :fn_ResetErrorLevel
\r
827 SET PATH=%TOOLPATH%;%SystemRoot%\System32;%SystemRoot%
\r
831 SET __ECHO_CMD=ECHO %%%1%%
\r
833 FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
\r
840 CALL :fn_ResetErrorLevel
\r
845 ECHO Usage: %~nx0 ^<binaryDirectory^>
\r
850 CALL :fn_SetErrorLevel
\r
853 ECHO Failure, errors were encountered.
\r
857 CALL :fn_ResetErrorLevel
\r
860 ECHO Success, no errors were encountered.
\r
864 %__ECHO% EXIT /B %ERRORLEVEL%
\r