Index: third_party/sqlite/src/tool/build-all-msvc.bat |
diff --git a/third_party/sqlite/src/tool/build-all-msvc.bat b/third_party/sqlite/src/tool/build-all-msvc.bat |
index 8f4c43d22c79029aa05f222bc317d0285ee18050..37aa1bf6fcad8987c7a84c5ff802af4584d4f139 100755 |
--- a/third_party/sqlite/src/tool/build-all-msvc.bat |
+++ b/third_party/sqlite/src/tool/build-all-msvc.bat |
@@ -22,7 +22,7 @@ REM |
REM Example: |
REM |
REM CD /D C:\dev\sqlite\core |
-REM tool\build-all-msvc.bat C:\Temp |
+REM CALL tool\build-all-msvc.bat C:\Temp |
REM |
REM In the example above, "C:\dev\sqlite\core" represents the root of the |
REM source tree for SQLite and "C:\Temp" represents the final destination |
@@ -54,6 +54,11 @@ REM |
REM There are a few other environment variables that impact the build process |
REM when set ^(to anything^), they are: |
REM |
+REM USE_AUTOCONF_MAKEFILE |
+REM |
+REM When set, the "autoconf" Makefile for MSVC will be used instead of the main |
+REM Makefile for MSVC. It must exist at "%ROOT%\autoconf\Makefile.msc". |
+REM |
REM NOCLEAN |
REM |
REM When set, the "clean" target will not be used during each build iteration. |
@@ -69,6 +74,11 @@ REM be skipped and they will not appear in the final destination directory. |
REM Setting this environment variable is never strictly needed and could cause |
REM issues in some circumstances; therefore, setting it is not recommended. |
REM |
+REM NOMEMDEBUG |
+REM |
+REM When set, disables use of MEMDEBUG when building binaries for the "Debug" |
+REM configuration. |
+REM |
REM BUILD_ALL_SHELL |
REM |
REM When set, the command line shell will be built for each selected platform |
@@ -88,17 +98,30 @@ REM on the WindowsSdkDir environment variable. It causes this batch script to |
REM assume the Windows 10.0 SDK location should be used. |
REM |
REM NMAKE_ARGS |
+REM NMAKE_ARGS_DEBUG |
+REM NMAKE_ARGS_RETAIL |
REM |
-REM When set, the value is expanded and passed to the NMAKE command line, after |
-REM its other arguments. This is used to specify additional NMAKE options, for |
-REM example: |
+REM When set, these values are expanded and passed to the NMAKE command line, |
+REM after its other arguments. These may be used to specify additional NMAKE |
+REM options, for example: |
REM |
REM SET NMAKE_ARGS=FOR_WINRT=1 |
+REM SET NMAKE_ARGS_DEBUG=MEMDEBUG=1 |
+REM SET NMAKE_ARGS_RETAIL=WIN32HEAP=1 |
REM |
REM Using the above command before running this tool will cause the compiled |
REM binaries to target the WinRT environment, which provides a subset of the |
REM Win32 API. |
REM |
+REM DLL_FILE_NAME |
+REM DLL_PDB_FILE_NAME |
+REM LIB_FILE_NAME |
+REM EXE_FILE_NAME |
+REM EXE_PDB_FILE_NAME |
+REM |
+REM When set, these values will override the associated target file name used |
+REM for the build. |
+REM |
SETLOCAL |
REM SET __ECHO=ECHO |
@@ -204,11 +227,17 @@ REM NOTE: If the command used to invoke NMAKE is not already set, use the |
REM default. |
REM |
IF NOT DEFINED NMAKE_CMD ( |
- SET NMAKE_CMD=nmake -B -f Makefile.msc |
+ IF DEFINED USE_AUTOCONF_MAKEFILE ( |
+ SET NMAKE_CMD=nmake -B -f autoconf\Makefile.msc |
+ ) ELSE ( |
+ SET NMAKE_CMD=nmake -B -f Makefile.msc |
+ ) |
) |
%_VECHO% NmakeCmd = '%NMAKE_CMD%' |
%_VECHO% NmakeArgs = '%NMAKE_ARGS%' |
+%_VECHO% NmakeArgsDebug = '%NMAKE_ARGS_DEBUG%' |
+%_VECHO% NmakeArgsRetail = '%NMAKE_ARGS_RETAIL%' |
REM |
REM NOTE: Setup environment variables to translate between the MSVC platform |
@@ -239,7 +268,7 @@ REM |
IF DEFINED TCLSH_CMD ( |
SET TCLSH_FILE=%TCLSH_CMD% |
) ELSE ( |
- SET TCLSH_FILE=tclsh85.exe |
+ SET TCLSH_FILE=tclsh.exe |
) |
FOR %%T IN (%TCLSH_FILE%) DO ( |
@@ -256,6 +285,30 @@ IF NOT DEFINED %TCLSH_FILE%_PATH ( |
) |
REM |
+REM NOTE: Setup the default names for the build targets we are creating. Any |
+REM ^(or all^) of these may end up being overridden. |
+REM |
+IF NOT DEFINED DLL_FILE_NAME ( |
+ SET DLL_FILE_NAME=sqlite3.dll |
+) |
+ |
+IF NOT DEFINED DLL_PDB_FILE_NAME ( |
+ SET DLL_PDB_FILE_NAME=sqlite3.pdb |
+) |
+ |
+IF NOT DEFINED LIB_FILE_NAME ( |
+ SET LIB_FILE_NAME=sqlite3.lib |
+) |
+ |
+IF NOT DEFINED EXE_FILE_NAME ( |
+ SET EXE_FILE_NAME=sqlite3.exe |
+) |
+ |
+IF NOT DEFINED EXE_PDB_FILE_NAME ( |
+ SET EXE_PDB_FILE_NAME=sqlite3sh.pdb |
+) |
+ |
+REM |
REM NOTE: Set the TOOLPATH variable to contain all the directories where the |
REM external tools were found in the search above. |
REM |
@@ -434,13 +487,21 @@ FOR %%P IN (%PLATFORMS%) DO ( |
REM NOTE: Setting this to non-zero should enable the SQLITE_MEMDEBUG |
REM define. |
REM |
- SET MEMDEBUG=1 |
+ IF NOT DEFINED NOMEMDEBUG ( |
+ SET MEMDEBUG=1 |
+ ) |
) ELSE ( |
CALL :fn_UnsetVariable DEBUG |
CALL :fn_UnsetVariable MEMDEBUG |
) |
REM |
+ REM NOTE: Copy the extra NMAKE arguments for this configuration into the |
+ REM common variable used by the actual commands. |
+ REM |
+ CALL :fn_CopyVariable NMAKE_ARGS_%%B NMAKE_ARGS_CFG |
+ |
+ REM |
REM NOTE: Launch a nested command shell to perform the following steps: |
REM |
REM 1. Setup the MSVC environment for this platform using the |
@@ -546,7 +607,7 @@ FOR %%P IN (%PLATFORMS%) DO ( |
REM file, etc. |
REM |
IF NOT DEFINED NOCLEAN ( |
- %__ECHO% %NMAKE_CMD% clean |
+ CALL :fn_MakeClean %%D |
IF ERRORLEVEL 1 ( |
ECHO Failed to clean for platform %%P. |
@@ -559,7 +620,7 @@ FOR %%P IN (%PLATFORMS%) DO ( |
REM specifically wanting to build for each platform. |
REM |
%_AECHO% Cleaning final core library output files only... |
- %__ECHO% DEL /Q *.lo sqlite3.dll sqlite3.lib sqlite3.pdb 2%REDIRECT% NUL |
+ %__ECHO% DEL /Q *.lo "%DLL_FILE_NAME%" "%LIB_FILE_NAME%" "%DLL_PDB_FILE_NAME%" 2%REDIRECT% NUL |
) |
REM |
@@ -569,10 +630,10 @@ FOR %%P IN (%PLATFORMS%) DO ( |
REM Also, disable looking for and/or linking to the native Tcl |
REM runtime library. |
REM |
- %__ECHO% %NMAKE_CMD% sqlite3.dll XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% |
+ CALL :fn_MakeDll %%D |
IF ERRORLEVEL 1 ( |
- ECHO Failed to build %%B "sqlite3.dll" for platform %%P. |
+ ECHO Failed to build %%B "%DLL_FILE_NAME%" for platform %%P. |
GOTO errors |
) |
@@ -580,10 +641,10 @@ FOR %%P IN (%PLATFORMS%) DO ( |
REM NOTE: Copy the "sqlite3.dll" file to the appropriate directory for |
REM the build and platform beneath the binary directory. |
REM |
- %__ECHO% XCOPY sqlite3.dll "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS% |
+ %__ECHO% XCOPY "%DLL_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS% |
IF ERRORLEVEL 1 ( |
- ECHO Failed to copy "sqlite3.dll" to "%BINARYDIRECTORY%\%%B\%%D\". |
+ ECHO Failed to copy "%DLL_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\". |
GOTO errors |
) |
@@ -591,10 +652,10 @@ FOR %%P IN (%PLATFORMS%) DO ( |
REM NOTE: Copy the "sqlite3.lib" file to the appropriate directory for |
REM the build and platform beneath the binary directory. |
REM |
- %__ECHO% XCOPY sqlite3.lib "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS% |
+ %__ECHO% XCOPY "%LIB_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS% |
IF ERRORLEVEL 1 ( |
- ECHO Failed to copy "sqlite3.lib" to "%BINARYDIRECTORY%\%%B\%%D\". |
+ ECHO Failed to copy "%LIB_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\". |
GOTO errors |
) |
@@ -604,11 +665,13 @@ FOR %%P IN (%PLATFORMS%) DO ( |
REM are prevented from doing so. |
REM |
IF NOT DEFINED NOSYMBOLS ( |
- %__ECHO% XCOPY sqlite3.pdb "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS% |
+ IF EXIST "%DLL_PDB_FILE_NAME%" ( |
+ %__ECHO% XCOPY "%DLL_PDB_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS% |
- IF ERRORLEVEL 1 ( |
- ECHO Failed to copy "sqlite3.pdb" to "%BINARYDIRECTORY%\%%B\%%D\". |
- GOTO errors |
+ IF ERRORLEVEL 1 ( |
+ ECHO Failed to copy "%DLL_PDB_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\". |
+ GOTO errors |
+ ) |
) |
) |
@@ -627,7 +690,7 @@ FOR %%P IN (%PLATFORMS%) DO ( |
REM specifically wanting to build for each platform. |
REM |
%_AECHO% Cleaning final shell executable output files only... |
- %__ECHO% DEL /Q sqlite3.exe sqlite3sh.pdb 2%REDIRECT% NUL |
+ %__ECHO% DEL /Q "%EXE_FILE_NAME%" "%EXE_PDB_FILE_NAME%" 2%REDIRECT% NUL |
) |
REM |
@@ -637,10 +700,10 @@ FOR %%P IN (%PLATFORMS%) DO ( |
REM Also, disable looking for and/or linking to the native Tcl |
REM runtime library. |
REM |
- %__ECHO% %NMAKE_CMD% sqlite3.exe XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% |
+ CALL :fn_MakeExe %%D |
IF ERRORLEVEL 1 ( |
- ECHO Failed to build %%B "sqlite3.exe" for platform %%P. |
+ ECHO Failed to build %%B "%EXE_FILE_NAME%" for platform %%P. |
GOTO errors |
) |
@@ -648,10 +711,10 @@ FOR %%P IN (%PLATFORMS%) DO ( |
REM NOTE: Copy the "sqlite3.exe" file to the appropriate directory |
REM for the build and platform beneath the binary directory. |
REM |
- %__ECHO% XCOPY sqlite3.exe "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS% |
+ %__ECHO% XCOPY "%EXE_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS% |
IF ERRORLEVEL 1 ( |
- ECHO Failed to copy "sqlite3.exe" to "%BINARYDIRECTORY%\%%B\%%D\". |
+ ECHO Failed to copy "%EXE_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\". |
GOTO errors |
) |
@@ -661,11 +724,13 @@ FOR %%P IN (%PLATFORMS%) DO ( |
REM unless we are prevented from doing so. |
REM |
IF NOT DEFINED NOSYMBOLS ( |
- %__ECHO% XCOPY sqlite3sh.pdb "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS% |
+ IF EXIST "%EXE_PDB_FILE_NAME%" ( |
+ %__ECHO% XCOPY "%EXE_PDB_FILE_NAME%" "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS% |
- IF ERRORLEVEL 1 ( |
- ECHO Failed to copy "sqlite3sh.pdb" to "%BINARYDIRECTORY%\%%B\%%D\". |
- GOTO errors |
+ IF ERRORLEVEL 1 ( |
+ ECHO Failed to copy "%EXE_PDB_FILE_NAME%" to "%BINARYDIRECTORY%\%%B\%%D\". |
+ GOTO errors |
+ ) |
) |
) |
) |
@@ -696,6 +761,18 @@ REM NOTE: If we get to this point, we have succeeded. |
REM |
GOTO no_errors |
+:fn_MakeClean |
+ %__ECHO% %NMAKE_CMD% clean "PLATFORM=%1" XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% %NMAKE_ARGS_CFG% |
+ GOTO :EOF |
+ |
+:fn_MakeDll |
+ %__ECHO% %NMAKE_CMD% "%DLL_FILE_NAME%" "PLATFORM=%1" XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% %NMAKE_ARGS_CFG% |
+ GOTO :EOF |
+ |
+:fn_MakeExe |
+ %__ECHO% %NMAKE_CMD% "%EXE_FILE_NAME%" "PLATFORM=%1" XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% %NMAKE_ARGS_CFG% |
+ GOTO :EOF |
+ |
:fn_ShowVariable |
SETLOCAL |
SET __ECHO_CMD=ECHO %%%2%% |
@@ -729,10 +806,16 @@ GOTO no_errors |
GOTO :EOF |
:fn_UnsetVariable |
- IF NOT "%1" == "" ( |
- SET %1= |
- CALL :fn_ResetErrorLevel |
+ SETLOCAL |
+ SET VALUE=%1 |
+ IF DEFINED VALUE ( |
+ SET VALUE= |
+ ENDLOCAL |
+ SET %VALUE%= |
+ ) ELSE ( |
+ ENDLOCAL |
) |
+ CALL :fn_ResetErrorLevel |
GOTO :EOF |
:fn_AppendVariable |