From: drh <> Date: Wed, 16 Aug 2023 17:12:26 +0000 (+0000) Subject: Improved instructions on how to build SQLite on Windows 11 and similar. X-Git-Tag: version-3.43.0~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7335f75daf283467d65a1040c76567095a4e210c;p=thirdparty%2Fsqlite.git Improved instructions on how to build SQLite on Windows 11 and similar. FossilOrigin-Name: 0f6b2b33736ee07f17f3a4e5f077bb4d0e2481c8f81251b8ce6b78510f372237 --- diff --git a/README.md b/README.md index 10262653e7..9c221fff29 100644 --- a/README.md +++ b/README.md @@ -104,9 +104,9 @@ For example: mkdir bld ;# Build will occur in a sibling directory cd bld ;# Change to the build directory ../sqlite/configure ;# Run the configure script - make ;# Run the makefile. + make ;# Builds the "sqlite3" command-line tool make sqlite3.c ;# Build the "amalgamation" source file - make test ;# Run some tests (requires Tcl) + make devtest ;# Run some tests (requires Tcl) See the makefile for additional targets. @@ -119,29 +119,30 @@ show what changes are needed. ## Using MSVC for Windows systems On Windows, all applicable build products can be compiled with MSVC. -First open the command prompt window associated with the desired compiler -version (e.g. "Developer Command Prompt for VS2013"). Next, use NMAKE -with the provided "Makefile.msc" to build one of the supported targets. - -For example, from the parent directory of the source subtree named "sqlite": - - mkdir bld - cd bld - nmake /f ..\sqlite\Makefile.msc TOP=..\sqlite - nmake /f ..\sqlite\Makefile.msc sqlite3.c TOP=..\sqlite - nmake /f ..\sqlite\Makefile.msc sqlite3.dll TOP=..\sqlite - nmake /f ..\sqlite\Makefile.msc sqlite3.exe TOP=..\sqlite - nmake /f ..\sqlite\Makefile.msc test TOP=..\sqlite - -There are several build options that can be set via the NMAKE command -line. For example, to build for WinRT, simply add "FOR_WINRT=1" argument -to the "sqlite3.dll" command line above. When debugging into the SQLite -code, adding the "DEBUG=1" argument to one of the above command lines is -recommended. - -SQLite does not require [Tcl](http://www.tcl.tk/) to run, but a Tcl installation -is required by the makefiles (including those for MSVC). SQLite contains -a lot of generated code and Tcl is used to do much of that code generation. +You will also need a working installation of TCL. +See the [compile-for-windows.md](doc/compile-for-windows.md) document for +additional information about how to install MSVC and TCL and configure your +build environment. + +If you want to run tests, you need to let SQLite know the location of your +TCL library, using a command like this: + + set TCLDIR=c:\Tcl + +SQLite uses "tclsh.exe" as part of the build process, and so that utility +program will need to be somewhere on your %PATH%. The finished SQLite library +does not contain any TCL code, but it does use TCL to help with the build process +and to run tests. + +Build using Makefile.msc. Example: + + nmake /f Makefile.msc + nmake /f Makefile.msc sqlite3.c + nmake /f Makefile.msc devtest + nmake /f Makefile.msc releasetest + +There are many other makefile targets. See comments in Makefile.msc for +details. ## Source Code Tour diff --git a/doc/compile-for-windows.md b/doc/compile-for-windows.md new file mode 100644 index 0000000000..04240a7ddc --- /dev/null +++ b/doc/compile-for-windows.md @@ -0,0 +1,59 @@ +# Notes On Compiling SQLite On Windows 11 + +Here are step-by-step instructions on how to build SQLite from +canonical source on a new Windows 11 PC, as of 2023-08-16: + + 1. Install Microsoft Visual Studio. The free "community edition" + will work fine. Do a standard install for C++ development. + SQLite only needs the + "cl" compiler and the "nmake" build tool. + + 2. Under the "Start" menu, find "All Apps" then go to "Visual Studio 20XX" + and find "x64 Native Tools Command Prompt for VS 20XX". Pin that + application to your task bar, as you will use it a lot. Bring up + an instance of this command prompt and do all of the subsequent steps + in that "x64 Native Tools" command prompt. (Or use "x86" if you want + a 32-bit build.) The subsequent steps will not work in a vanilla + DOS prompt. Nor will they work in PowerShell. + + 3. Install TCL development libraries. This note assumes that you wil + install the TCL development libraries in the "`c:\Tcl`" directory. + Make adjustments + if you want TCL installed somewhere else. SQLite needs both the + "tclsh.exe" command-line tool as part of the build process, and + the "tcl86.lib" library in order to run tests. You will need + TCL version 8.6 or later. +