Skip to content

Commit 2a2bab1

Browse files
committed
[WIP] build sqlite3
- [x] Linux/macOS - [ ] Windows
1 parent 3289c1f commit 2a2bab1

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

library_builders.bat

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,51 @@ exit /b 0
144144
if errorlevel 1 exit 1
145145
exit /b 0
146146

147+
:build_sqlite
148+
if exist sqlite-stamp exit /b 0
149+
150+
set SQLITE_VERSION="3510200"
151+
152+
curl -sLo sqlite-amalgamation-%SQLITE_VERSION%.zip ^
153+
https://www.sqlite.org/2026/sqlite-amalgamation-%SQLITE_VERSION%.zip
154+
if errorlevel 1 exit 1
155+
156+
powershell Expand-Archive sqlite-amalgamation-%SQLITE_VERSION%.zip -DestinationPath '.'
157+
if errorlevel 1 exit 1
158+
159+
cd sqlite-amalgamation-%SQLITE_VERSION%
160+
if errorlevel 1 exit 1
161+
162+
REM Create a minimal CMakeLists.txt
163+
(
164+
echo cmake_minimum_required(VERSION 3.10^)
165+
echo project(sqlite3 C^)
166+
echo add_library(sqlite3 STATIC sqlite3.c^)
167+
echo target_compile_definitions(sqlite3 PRIVATE SQLITE_ENABLE_FTS5 SQLITE_ENABLE_JSON1 SQLITE_ENABLE_RTREE^)
168+
echo set_property(TARGET sqlite3 PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"^)
169+
echo install(TARGETS sqlite3 ARCHIVE DESTINATION lib^)
170+
echo install(FILES sqlite3.h DESTINATION include^)
171+
) > CMakeLists.txt
172+
173+
cmake -S . -B build ^
174+
-DCMAKE_INSTALL_PREFIX=%BUILD_PREFIX%/SQLite3
175+
if errorlevel 1 exit 1
176+
177+
cmake --build build --config Release
178+
if errorlevel 1 exit 1
179+
180+
cmake --install build --config Release
181+
if errorlevel 1 exit 1
182+
183+
:: cleanup
184+
cd ..
185+
rmdir /s /q sqlite-amalgamation-%SQLITE_VERSION%
186+
if errorlevel 1 exit 1
187+
188+
break > sqlite-stamp
189+
if errorlevel 1 exit 1
190+
exit /b 0
191+
147192
:build_zfp
148193
if exist zfp-stamp exit /b 0
149194

@@ -209,6 +254,7 @@ exit /b 0
209254
:main
210255
call :install_buildessentials
211256
call :build_zlib
257+
call :build_sqlite
212258
:: build_bzip2
213259
:: build_szip
214260
call :build_zfp

library_builders.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,32 @@ function build_blosc2 {
173173
touch blosc-stamp2
174174
}
175175

176+
function build_sqlite {
177+
if [ -e sqlite-stamp ]; then return; fi
178+
179+
SQLITE_VERSION="3510200" # "3.51.2"
180+
181+
curl -sLO https://www.sqlite.org/2026/sqlite-autoconf-${SQLITE_VERSION}.tar.gz
182+
file sqlite-autoconf*.tar.gz
183+
tar xzf sqlite-autoconf-${SQLITE_VERSION}.tar.gz
184+
rm sqlite-autoconf*.tar.gz
185+
186+
cd sqlite-autoconf-${SQLITE_VERSION}
187+
188+
./configure \
189+
--disable-shared \
190+
--prefix=${BUILD_PREFIX} \
191+
--all \
192+
--disable-readline
193+
make
194+
${SUDO} make install
195+
196+
cd -
197+
rm -rf sqlite-autoconf*
198+
199+
touch sqlite-stamp
200+
}
201+
176202
function build_zfp {
177203
if [ -e zfp-stamp ]; then return; fi
178204

@@ -316,6 +342,7 @@ fi
316342

317343
install_buildessentials
318344
build_zlib
345+
build_sqlite
319346
build_zfp
320347
build_blosc2
321348
build_hdf5

0 commit comments

Comments
 (0)