Sqlite-icu for windows

I would compile SQLite with ICU integrated. To do it on Windows with MSVC, you need several tools:

  • MSVC Build Tools
  • Windows Resource Kit
  • ICU4C binaries (icu4c-VV-WinXX-MSVCyyyy.zip, e.g., icu4c-70_1-Win64-MSVC2019.zip)
    Set USE_ICU=1 and add (ARCH is equal to 64 for x64 and "" for x32; ICU_HOME - path to the top folder containing extracted archive [spaces are not allowed in this path])
    • %ICU_HOME%\bin%ARCH% to PATH
    • %ICU_HOME%\lib%ARCH% to LIB
    • %ICU_HOME%\include to INCLUDE
  • TCL (add TCL\bin folder in the Path)

Download the canonical SQLite source distribution and extract it. Start Build Tools shell, enter the sqlite folder with sources and make files. Set/add variables as indicated above and do nmake /f Makefile.msc all. You can verify your dev settings before building by running this code:

@echo off
:: ============================================================================
:: Collects MSVC environment information.
:: ===========================================================================

:: ================================ BEGIN MAIN ================================
:MAIN
SetLocal EnableExtensions EnableDelayedExpansion

set STDOUTLOG=stdout.log
set STDERRLOG=stderr.log
del "%STDOUTLOG%" 2>nul
del "%STDERRLOG%" 2>nul


(
  echo ======================= SHELL SETTINGS ======================
  echo =============================================================
  echo  DESIRED VALUES:
  echo     EnableExtensions    REG_DWORD    0x1
  echo     DelayedExpansion    REG_DWORD    0x1
  echo.
  echo  ACTUAL  VALUES:
  reg query "HKLM\Software\Microsoft\Command Processor" /s /f nsion
  echo -------------------------------------------------------------
  echo.

  echo ================== CHECKING MSVC VARIABLES ==================
  echo =============================================================
  set ErrorStatus=0
  call :CHECKVAR "VisualStudioVersion" "%VisualStudioVersion%"
  call :CHECKVAR "VSINSTALLDIR" "%VSINSTALLDIR%"
  call :CHECKVAR "VCINSTALLDIR" "%VCINSTALLDIR%"
  call :CHECKVAR "VCToolsInstallDir" "%VCToolsInstallDir%"
  call :CHECKVAR "VCToolsVersion" "%VCToolsVersion%"
  call :CHECKVAR "VSCMD_ARG_HOST_ARCH" "%VSCMD_ARG_HOST_ARCH%"
  call :CHECKVAR "VSCMD_ARG_TGT_ARCH" "%VSCMD_ARG_TGT_ARCH%"
  call :CHECKVAR "VSCMD_VER" "%VSCMD_VER%"
  echo -------------------------------------------------------------
  call :CHECKERRORSTATUS "MSVC VARIABLES"
  echo -------------------------------------------------------------
  echo.

  echo ==================== CHECKING MSVC TOOLS ====================
  echo =============================================================
  set ErrorStatus=0
  call :CHECKTOOL cl
  call :CHECKTOOL nmake
  echo -------------------------------------------------------------
  call :CHECKERRORSTATUS "MSVC TOOLS"
  echo -------------------------------------------------------------
  echo.

  echo ======================= CHECKING TCL ========================
  echo =============================================================
  set ErrorStatus=0
  call :CHECKTOOL tclsh "%TCL_HOME%\bin"
  echo -------------------------------------------------------------
  call :CHECKERRORSTATUS "TCL"
  echo -------------------------------------------------------------
  echo.

  echo ======================= CHECKING ICU ========================
  echo =============================================================
  set ErrorStatus=0
  call :CHECKTOOL uconv "%ICU_HOME%\bin"
  echo -------------------------------------------------------------
  call :CHECKERRORSTATUS "ICU"
  echo -------------------------------------------------------------
  echo.

  echo ============== CHECKING WINDOWS RESOURCE KITS ===============
  echo =============================================================
  set ErrorStatus=0
  call :CHECKSUBSTRING "INCLUDE" "%INCLUDE%" "Windows Kits"
  call :CHECKSUBSTRING "LIB"     "%LIB%"     "Windows Kits"
  call :CHECKSUBSTRING "LIBPATH" "%LIBPATH%" "Windows Kits"
  call :CHECKSUBSTRING "Path"    "%Path%"    "Windows Kits"
  echo -------------------------------------------------------------
  call :CHECKERRORSTATUS "WINDOWS RESOURCE KITS"
  echo -------------------------------------------------------------
  echo.
) 1>>"%STDOUTLOG%" 2>>"%STDERRLOG%"


EndLocal
exit /b 0
:: ================================= END MAIN =================================


:: ============================================================================
:CHECKVAR
:: Call this sub with argument(s):
::   - %1 - Variable name
::   - %2 - Variable value
::
set VarName=%~1
set VarValue=%~2
if "/%VarValue%/"=="//" (
  set ErrorStatus=1
  echo %%%VarName%%% not set.
) else (
  echo %VarName%=%VarValue%
)

exit /b 0


:: ============================================================================
:CHECKTOOL
:: Call this sub with argument(s):
::   - %1 - Tool executable name
::   - %2 - CD before check
::
set CurDir=%CD%
if exist "%~2" cd /d "%~2"
set CommandText=where "%~1"
set Output=
for /f "Usebackq delims=" %%i in (`%CommandText%`) do (
  if "/!Output!/"=="//" (
    set Output=%%i
  )
)
cd /d "%CurDir%"

if "/%Output%/"=="//" (
  set ErrorStatus=1
  echo "%~1" not found.
) else (
  echo %~1=%Output%
)

exit /b 0


:: ============================================================================
:CHECKSUBSTRING
:: Call this sub with argument(s):
::   - %1 - Variable name
::   - %2 - Variable value
::   - %3 - Substring
::
set VarName=%~1
set VarValue=_%~2_
set Substring=%~3

set TestString=!VarValue:%Substring%=!
if "/%TestString%/"=="/%VarValue%/" (
  set ErrorStatus=1
  echo "%VarName%" does not contain %Substring%.
) else (
  echo "%VarName%" - match found.
)

exit /b 0


:: ============================================================================
:CHECKERRORSTATUS
:: Call this sub with argument(s):
::   - %1 - Test name
::
if %ErrorStatus% NEQ 0 (
  echo #################### Test %~1 failed. ####################
) else (
  echo ~~~~~~~~~~~~~~~~~~~~ Test %~1 passed. ~~~~~~~~~~~~~~~~~~~~
)

exit /b 0

Check out this resource for additional documentation and build scripts. You could also ask for binaries by opening an issue in the repo.