Add detailed comments to the build tools used to generate the VSIX package. Also, allow the build configurations and native library directories to be overridden for the multi-platform build tool for MSVC.

FossilOrigin-Name: 0482c73bfdf80b0c0ce9abea706554d7ddf36f69
This commit is contained in:
mistachkin
2012-10-19 00:23:31 +00:00
parent 2f10fb3f07
commit 7c5dbdfd14
4 changed files with 172 additions and 13 deletions
+79 -2
View File
@@ -6,6 +6,49 @@
:: Multi-Platform Build Tool for MSVC
::
REM
REM This batch script is used to build the SQLite DLL for multiple platforms
REM and configurations using MSVC. The built SQLite DLLs, their associated
REM import libraries, and optionally their symbols files, are placed within
REM the directory specified on the command line, in sub-directories named for
REM their respective platforms and configurations. This batch script must be
REM run from inside a Visual Studio Command Prompt for the desired version of
REM Visual Studio ^(the initial platform configured for the command prompt does
REM not really matter^). Exactly one command line argument is required, the
REM name of an existing directory to be used as the final destination directory
REM for the generated output files, which will be placed in sub-directories
REM created therein. Ideally, the directory specified should be empty.
REM
REM Example:
REM
REM CD /D C:\dev\sqlite\core
REM 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
REM directory for the generated output files.
REM
REM There are several environment variables that may be set to modify the
REM behavior of this batch script and its associated Makefile. The list of
REM platforms to build may be overriden by using the PLATFORMS environment
REM variable, which should contain a list of platforms ^(e.g. x86 x86_amd64
REM x86_arm^). All platforms must be supported by the version of Visual Studio
REM being used. The list of configurations to build may be overridden by
REM setting the CONFIGURATIONS environment variable, which should contain a
REM list of configurations to build ^(e.g. Debug Retail^). Neither of these
REM variable values may contain any double quotes, surrounding or embedded.
REM Finally, the NCRTLIBPATH and NSDKLIBPATH environment variables may be set
REM to specify the location of the CRT and SDK, respectively, needed to compile
REM executables native to the architecture of the build machine during any
REM cross-compilation that may be necessary, depending on the platforms to be
REM built. These values in these two variables should be surrounded by double
REM quotes if they contain spaces.
REM
REM Please note that the SQLite build process performed by the Makefile
REM associated with this batch script requires both Gawk ^(gawk.exe^) and Tcl
REM 8.5 ^(tclsh85.exe^) to be present in a directory contained in the PATH
REM environment variable unless a pre-existing amalgamation file is used.
REM
SETLOCAL
REM SET __ECHO=ECHO
@@ -93,6 +136,16 @@ IF NOT DEFINED PLATFORMS (
%_VECHO% Platforms = '%PLATFORMS%'
REM
REM NOTE: If the list of configurations is not already set, use the default
REM list.
REM
IF NOT DEFINED CONFIGURATIONS (
SET CONFIGURATIONS=Debug Retail
)
%_VECHO% Configurations = '%CONFIGURATIONS%'
REM
REM NOTE: Setup environment variables to translate between the MSVC platform
REM names and the names to be used for the platform-specific binary
@@ -115,6 +168,24 @@ FOR %%T IN (gawk.exe tclsh85.exe) DO (
SET %%T_PATH=%%~dp$PATH:T
)
REM
REM NOTE: The Gawk executable "gawk.exe" is required during the SQLite build
REM process unless a pre-existing amalgamation file is used.
REM
IF NOT DEFINED gawk.exe_PATH (
ECHO The Gawk executable "gawk.exe" is required to be in the PATH.
GOTO errors
)
REM
REM NOTE: The Tcl 8.5 executable "tclsh85.exe" is required during the SQLite
REM build process unless a pre-existing amalgamation file is used.
REM
IF NOT DEFINED tclsh85.exe_PATH (
ECHO The Tcl 8.5 executable "tclsh85.exe" is required to be in the PATH.
GOTO errors
)
REM
REM NOTE: Set the TOOLPATH variable to contain all the directories where the
REM external tools were found in the search above.
@@ -128,7 +199,13 @@ REM NOTE: Check for MSVC 2012 because the Windows SDK directory handling is
REM slightly different for that version.
REM
IF "%VisualStudioVersion%" == "11.0" (
SET SET_NSDKLIBPATH=1
REM
REM NOTE: If the Windows SDK library path has already been set, do not set
REM it to something else later on.
REM
IF NOT DEFINED NSDKLIBPATH (
SET SET_NSDKLIBPATH=1
)
) ELSE (
CALL :fn_UnsetVariable SET_NSDKLIBPATH
)
@@ -182,7 +259,7 @@ FOR %%P IN (%PLATFORMS%) DO (
REM
SET PATH=%TOOLPATH%;%SystemRoot%\System32;%SystemRoot%
FOR %%B IN (Debug Retail) DO (
FOR %%B IN (%CONFIGURATIONS%) DO (
REM
REM NOTE: When preparing the debug build, set the DEBUG and MEMDEBUG
REM environment variables to be picked up by the MSVC makefile
+84 -2
View File
@@ -2,7 +2,85 @@
#
# This script is used to generate a VSIX (Visual Studio Extension) file for
# SQLite usable by Visual Studio.
#
# PREREQUISITES
#
# 1. Tcl 8.4 and later are supported, earlier versions have not been tested.
#
# 2. The "sqlite3.h" file is assumed to exist in the parent directory of the
# directory containing this script. The [optional] second command line
# argument to this script may be used to specify an alternate location.
# This script also assumes that the "sqlite3.h" file corresponds with the
# version of the binaries to be packaged. This assumption is not verified
# by this script.
#
# 3. The temporary directory specified in the TEMP or TMP environment variables
# must refer to an existing directory writable by the current user.
#
# 4. The "zip" and "unzip" command line tools must be located either in a
# directory contained in the PATH environment variable or specified as the
# exact file names to execute in the "ZipTool" and "UnZipTool" environment
# variables, respectively.
#
# 5. The template VSIX file (which is basically a zip file) must be located in
# a "win" directory inside the directory containing this script. It should
# not contain any executable binaries. It should only contain dynamic
# textual content files to be processed using [subst] and/or static content
# files to be copied verbatim.
#
# 6. The executable and other compiled binary files to be packaged into the
# final VSIX file (e.g. DLLs, LIBs, and PDBs) must be located in a single
# directory tree. The top-level directory of the tree must be specified as
# the first command line argument to this script. The second level
# sub-directory names must match those of the build configuration (e.g.
# "Debug" or "Retail"). The third level sub-directory names must match
# those of the platform (e.g. "x86", "x64", and "ARM"). For example, the
# binary files to be packaged would need to be organized as follows when
# packaging the "Debug" and "Retail" build configurations for the "x86" and
# "x64" platforms (in this example, "C:\temp" is the top-level directory as
# specified in the first command line argument):
#
# C:\Temp\Debug\x86\sqlite3.lib
# C:\Temp\Debug\x86\sqlite3.dll
# C:\Temp\Debug\x86\sqlite3.pdb
# C:\Temp\Debug\x64\sqlite3.lib
# C:\Temp\Debug\x64\sqlite3.dll
# C:\Temp\Debug\x64\sqlite3.pdb
# C:\Temp\Retail\x86\sqlite3.lib
# C:\Temp\Retail\x86\sqlite3.dll
# C:\Temp\Retail\x86\sqlite3.pdb
# C:\Temp\Retail\x64\sqlite3.lib
# C:\Temp\Retail\x64\sqlite3.dll
# C:\Temp\Retail\x64\sqlite3.pdb
#
# The above directory tree organization is performed automatically if the
# "tool\build-all-msvc.bat" batch script is used to build the binary files
# to be packaged.
#
# USAGE
#
# Typically, when on Windows, this script is executed using commands similar to
# the following (from a normal Windows command prompt window):
#
# CD /D C:\dev\sqlite\core
# tclsh85 tool\mkvsix.tcl C:\Temp
#
# In the example above, "C:\dev\sqlite\core" represents the root of the source
# tree for SQLite and "C:\Temp" represents the top-level directory containing
# the executable and other compiled binary files, organized into a directory
# tree as described in item 6 of the PREREQUISITES section, above.
#
# This script should work on non-Windows platforms as well, provided that all
# the requirements listed in the PREREQUISITES section are met.
#
# NOTES
#
# The temporary directory is used as a staging area for the final VSIX file.
# The template VSIX file is extracted, its contents processed, and then the
# resulting files are packaged into the final VSIX file.
#
package require Tcl 8.4
proc fail { {error ""} {usage false} } {
if {[string length $error] > 0} then {
puts stdout $error
@@ -245,7 +323,11 @@ if {![regexp -line -- $pattern $data dummy version]} then {
###############################################################################
#
# NOTE: Setup the master file list data, including the necessary flags.
# NOTE: Setup all the master file list data. This includes the source and
# destination file names, build-neutral boolean flags, platform-neutral
# boolean flags, and the dynamic content (subst) boolean flags. There
# is also one set of boolean flags per build configuration, currently
# "Debug" and "Retail", that control which files are skipped for it.
#
if {![info exists fileNames(source)]} then {
set fileNames(source) [list "" "" "" \