/ Check-in [b2011c13]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Support building the Tcl bindings DLL using MSVC.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b2011c13173114505705d2ff2ba6f476697d51aca0bddd585a9e5a639dca41e2
User & Date: mistachkin 2019-03-27 14:59:56
Context
2019-03-28
01:00
Improvements to the README.md file. No code changes. check-in: bbdbaf84 user: drh tags: trunk
2019-03-27
14:59
Support building the Tcl bindings DLL using MSVC. check-in: b2011c13 user: mistachkin tags: trunk
14:58
Fix harmless compiler warnings seen with MSVC. check-in: 5be64ea8 user: mistachkin tags: trunk
2019-03-23
00:38
Support Tcl libraries with a suffix. Closed-Leaf check-in: 8d015399 user: mistachkin tags: msvcTcl
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

   315    315   !IFNDEF SQLITETCLH
   316    316   SQLITETCLH = sqlite_tcl.h
   317    317   !ENDIF
   318    318   
   319    319   !IFNDEF SQLITETCLDECLSH
   320    320   SQLITETCLDECLSH = sqlite_tclDecls.h
   321    321   !ENDIF
          322  +
          323  +# This is the name to use for the dynamic link library (DLL) containing the
          324  +# Tcl bindings for SQLite.
          325  +#
          326  +!IFNDEF SQLITE3TCLDLL
          327  +SQLITE3TCLDLL = tclsqlite3.dll
          328  +!ENDIF
   322    329   
   323    330   # These are the additional targets that the targets that integrate with the
   324    331   # Tcl library should depend on when compiling, etc.
   325    332   #
   326    333   !IFNDEF SQLITE_TCL_DEP
   327    334   !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
   328    335   SQLITE_TCL_DEP = $(SQLITETCLDECLSH) $(SQLITETCLH)
................................................................................
   491    498   
   492    499   UCRTLIBPATH = $(UCRTLIBPATH:\\=\)
   493    500   
   494    501   # C compiler and options for use in building executables that
   495    502   # will run on the platform that is doing the build.
   496    503   #
   497    504   !IF $(USE_FULLWARN)!=0
   498         -BCC = $(NCC) -nologo -W4 $(CCOPTS) $(BCCOPTS)
          505  +BCC = $(NCC) -nologo -W4 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
   499    506   !ELSE
   500         -BCC = $(NCC) -nologo -W3 $(CCOPTS) $(BCCOPTS)
          507  +BCC = $(NCC) -nologo -W3 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
   501    508   !ENDIF
   502    509   
   503    510   # Check if assembly code listings should be generated for the source
   504    511   # code files to be compiled.
   505    512   #
   506    513   !IF $(USE_LISTINGS)!=0
   507    514   BCC = $(BCC) -FAcs
................................................................................
   849    856   # <<mark>>
   850    857   # The locations of the Tcl header and library files.  Also, the library that
   851    858   # non-stubs enabled programs using Tcl must link against.  These variables
   852    859   # (TCLINCDIR, TCLLIBDIR, and LIBTCL) may be overridden via the environment
   853    860   # prior to running nmake in order to match the actual installed location and
   854    861   # version on this machine.
   855    862   #
          863  +!IFNDEF TCLVERSION
          864  +TCLVERSION = 86
          865  +!ENDIF
          866  +
          867  +!IFNDEF TCLSUFFIX
          868  +TCLSUFFIX =
          869  +!ENDIF
          870  +
   856    871   !IFNDEF TCLDIR
   857    872   TCLDIR = $(TOP)\compat\tcl
   858    873   !ENDIF
   859    874   
   860    875   !IFNDEF TCLINCDIR
   861    876   TCLINCDIR = $(TCLDIR)\include
   862    877   !ENDIF
   863    878   
   864    879   !IFNDEF TCLLIBDIR
   865    880   TCLLIBDIR = $(TCLDIR)\lib
   866    881   !ENDIF
   867    882   
   868    883   !IFNDEF LIBTCL
   869         -LIBTCL = tcl86.lib
          884  +LIBTCL = tcl$(TCLVERSION)$(TCLSUFFIX).lib
   870    885   !ENDIF
   871    886   
   872    887   !IFNDEF LIBTCLSTUB
   873         -LIBTCLSTUB = tclstub86.lib
          888  +LIBTCLSTUB = tclstub$(TCLVERSION)$(TCLSUFFIX).lib
   874    889   !ENDIF
   875    890   
   876    891   !IFNDEF LIBTCLPATH
   877    892   LIBTCLPATH = $(TCLDIR)\bin
   878    893   !ENDIF
   879    894   
   880    895   # The locations of the zlib header and library files.  These variables
................................................................................
  1059   1074   RCC = $(RCC) -I$(ICUINCDIR)
  1060   1075   !ENDIF
  1061   1076   # <</mark>>
  1062   1077   
  1063   1078   # Command line prefixes for compiling code, compiling resources,
  1064   1079   # linking, etc.
  1065   1080   #
  1066         -LTCOMPILE = $(TCC) -Fo$@
         1081  +LTCOMPILE = $(TCC) -Fo$@ -Fd$*.pdb
  1067   1082   LTRCOMPILE = $(RCC) -r
  1068   1083   LTLIB = lib.exe
  1069   1084   LTLINK = $(TCC) -Fe$@
  1070   1085   
  1071   1086   # If requested, link to the RPCRT4 library.
  1072   1087   #
  1073   1088   !IF $(USE_RPCRT4_LIB)!=0
................................................................................
  1077   1092   # If a platform was set, force the linker to target that.
  1078   1093   # Note that the vcvars*.bat family of batch files typically
  1079   1094   # set this for you.  Otherwise, the linker will attempt
  1080   1095   # to deduce the binary type based on the object files.
  1081   1096   !IFDEF PLATFORM
  1082   1097   LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)
  1083   1098   LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)
         1099  +!ELSEIF "$(VISUALSTUDIOVERSION)"=="12.0" || \
         1100  +        "$(VISUALSTUDIOVERSION)"=="14.0" || \
         1101  +        "$(VISUALSTUDIOVERSION)"=="15.0"
         1102  +LTLINKOPTS = /NOLOGO /MACHINE:x86
         1103  +LTLIBOPTS = /NOLOGO /MACHINE:x86
  1084   1104   !ELSE
  1085   1105   LTLINKOPTS = /NOLOGO
  1086   1106   LTLIBOPTS = /NOLOGO
  1087   1107   !ENDIF
  1088   1108   
  1089   1109   # When compiling for use in the WinRT environment, the following
  1090   1110   # linker option must be used to mark the executable as runnable
................................................................................
  1661   1681   # Standard options to testfixture.
  1662   1682   #
  1663   1683   TESTOPTS = --verbose=file --output=test-out.txt
  1664   1684   
  1665   1685   # Extra targets for the "all" target that require Tcl.
  1666   1686   #
  1667   1687   !IF $(NO_TCL)==0
  1668         -ALL_TCL_TARGETS = libtclsqlite3.lib
         1688  +ALL_TCL_TARGETS = $(SQLITE3TCLDLL)
  1669   1689   !ELSE
  1670   1690   ALL_TCL_TARGETS =
  1671   1691   !ENDIF
  1672   1692   # <</mark>>
  1673   1693   
  1674   1694   # This is the default Makefile target.  The objects listed here
  1675   1695   # are what get build when you type just "make" with no arguments.
................................................................................
  1693   1713   shell:	$(SQLITE3EXE)
  1694   1714   
  1695   1715   # <<mark>>
  1696   1716   libsqlite3.lib:	$(LIBOBJ)
  1697   1717   	$(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)
  1698   1718   
  1699   1719   libtclsqlite3.lib:	tclsqlite.lo libsqlite3.lib
  1700         -	$(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCLSTUB) $(TLIBS)
         1720  +	$(LTLIB) $(LTLIBOPTS) $(TCLLIBPATHS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCLSTUB) $(TLIBS)
         1721  +
         1722  +tclsqlite3.def:	tclsqlite.lo
         1723  +	echo EXPORTS > tclsqlite3.def
         1724  +	dumpbin /all tclsqlite.lo \
         1725  +		| $(TCLSH_CMD) $(TOP)\tool\replace.tcl include "^\s+/EXPORT:_?((?:Sqlite3|Tclsqlite3)_[^@]*)(?:@\d+)?$$" \1 \
         1726  +		| sort >> tclsqlite3.def
         1727  +
         1728  +pkgIndex.tcl:	$(TOP)\VERSION
         1729  +	for /F %%V in ('type "$(TOP)\VERSION"') do ( \
         1730  +		echo package ifneeded sqlite3 @version@ [list load [file join $$dir $(SQLITE3TCLDLL)] sqlite3] \
         1731  +			| $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact @version@ %%V > pkgIndex.tcl \
         1732  +	)
         1733  +
         1734  +$(SQLITE3TCLDLL):	libtclsqlite3.lib $(LIBRESOBJS) tclsqlite3.def pkgIndex.tcl
         1735  +	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /DEF:tclsqlite3.def /OUT:$@ libtclsqlite3.lib $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
  1701   1736   # <</mark>>
  1702   1737   
  1703   1738   $(SQLITE3DLL):	$(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
  1704   1739   	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
  1705   1740   
  1706   1741   # <<block2>>
  1707   1742   sqlite3.def:	libsqlite3.lib
................................................................................
  1833   1868   	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c opcodes.c
  1834   1869   # <</mark>>
  1835   1870   
  1836   1871   # Rule to build the Win32 resources object file.
  1837   1872   #
  1838   1873   !IF $(USE_RC)!=0
  1839   1874   # <<block1>>
  1840         -$(LIBRESOBJS):	$(TOP)\src\sqlite3.rc $(SQLITE3H)
         1875  +$(LIBRESOBJS):	$(TOP)\src\sqlite3.rc $(SQLITE3H) $(TOP)\VERSION
  1841   1876   	echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
  1842   1877   	for /F %%V in ('type "$(TOP)\VERSION"') do ( \
  1843   1878   		echo #define SQLITE_RESOURCE_VERSION %%V \
  1844   1879   			| $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact . ^, >> sqlite3rc.h \
  1845   1880   	)
  1846   1881   	echo #endif >> sqlite3rc.h
  1847   1882   	$(LTRCOMPILE) -fo $(LIBRESOBJS) $(TOP)\src\sqlite3.rc
................................................................................
  2510   2545   # <</mark>>
  2511   2546   
  2512   2547   clean:
  2513   2548   	del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
  2514   2549   	del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
  2515   2550   	del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL
  2516   2551   # <<mark>>
         2552  +	del /Q $(SQLITE3TCLDLL) pkgIndex.tcl 2>NUL
  2517   2553   	del /Q opcodes.c opcodes.h 2>NUL
  2518   2554   	del /Q lemon.* lempar.c parse.* 2>NUL
  2519   2555   	del /Q mksourceid.* mkkeywordhash.* keywordhash.h 2>NUL
  2520   2556   	del /Q notasharedlib.* 2>NUL
  2521   2557   	-rmdir /Q/S .deps 2>NUL
  2522   2558   	-rmdir /Q/S .libs 2>NUL
  2523   2559   	-rmdir /Q/S tsrc 2>NUL

Changes to autoconf/Makefile.msc.

   429    429   
   430    430   UCRTLIBPATH = $(UCRTLIBPATH:\\=\)
   431    431   
   432    432   # C compiler and options for use in building executables that
   433    433   # will run on the platform that is doing the build.
   434    434   #
   435    435   !IF $(USE_FULLWARN)!=0
   436         -BCC = $(NCC) -nologo -W4 $(CCOPTS) $(BCCOPTS)
          436  +BCC = $(NCC) -nologo -W4 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
   437    437   !ELSE
   438         -BCC = $(NCC) -nologo -W3 $(CCOPTS) $(BCCOPTS)
          438  +BCC = $(NCC) -nologo -W3 -Fd$*.pdb $(CCOPTS) $(BCCOPTS)
   439    439   !ENDIF
   440    440   
   441    441   # Check if assembly code listings should be generated for the source
   442    442   # code files to be compiled.
   443    443   #
   444    444   !IF $(USE_LISTINGS)!=0
   445    445   BCC = $(BCC) -FAcs
................................................................................
   804    804   BCC = $(BCC) -Zi
   805    805   !ENDIF
   806    806   
   807    807   
   808    808   # Command line prefixes for compiling code, compiling resources,
   809    809   # linking, etc.
   810    810   #
   811         -LTCOMPILE = $(TCC) -Fo$@
          811  +LTCOMPILE = $(TCC) -Fo$@ -Fd$*.pdb
   812    812   LTRCOMPILE = $(RCC) -r
   813    813   LTLIB = lib.exe
   814    814   LTLINK = $(TCC) -Fe$@
   815    815   
   816    816   # If requested, link to the RPCRT4 library.
   817    817   #
   818    818   !IF $(USE_RPCRT4_LIB)!=0
................................................................................
   822    822   # If a platform was set, force the linker to target that.
   823    823   # Note that the vcvars*.bat family of batch files typically
   824    824   # set this for you.  Otherwise, the linker will attempt
   825    825   # to deduce the binary type based on the object files.
   826    826   !IFDEF PLATFORM
   827    827   LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)
   828    828   LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)
          829  +!ELSEIF "$(VISUALSTUDIOVERSION)"=="12.0" || \
          830  +        "$(VISUALSTUDIOVERSION)"=="14.0" || \
          831  +        "$(VISUALSTUDIOVERSION)"=="15.0"
          832  +LTLINKOPTS = /NOLOGO /MACHINE:x86
          833  +LTLIBOPTS = /NOLOGO /MACHINE:x86
   829    834   !ELSE
   830    835   LTLINKOPTS = /NOLOGO
   831    836   LTLIBOPTS = /NOLOGO
   832    837   !ENDIF
   833    838   
   834    839   # When compiling for use in the WinRT environment, the following
   835    840   # linker option must be used to mark the executable as runnable