Sqlite: vendor the SQLite amalgamation for every platform
Ship SQLite 3.49.1 (sqlite3.c/h, public domain) under third_party/sqlite and use it as the default VOID_SQLITE3_AMALGAMATION_DIR, so Void::Sqlite builds the same way on Linux and Windows without a system SQLite3 package or a network fetch. Allowlist Sqlite for the Windows target. Also compare the SQLite native error category by name: on Windows the library and its consumer are separate DLLs, so the category singleton is not shared across the boundary. Verified: Linux Sqlite+Testing 419 tests (416 passed, 3 skipped); Windows cross build under Wine 11 (x86_64-w64-mingw32 GCC 16.2) 419 tests (415 passed, 4 skipped, 0 failed).
This commit is contained in:
1 parent
dcfde7f51d
commit
de1fdcda72
6 files changed
+275196
-1
No files matched your search
@@ -167,6 +167,13 @@ function(void_fetch_dependency DEP_NAME)
|
||||
endif()
|
||||
|
||||
set(_void_sqlite_dir "${VOID_SQLITE3_AMALGAMATION_DIR}")
|
||||
# The vendored amalgamation gives every target the same portable
|
||||
# backend (Windows cross builds have no system SQLite3).
|
||||
if(NOT _void_sqlite_dir AND
|
||||
EXISTS "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../third_party/sqlite/sqlite3.c")
|
||||
set(_void_sqlite_dir
|
||||
"${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../third_party/sqlite")
|
||||
endif()
|
||||
if(NOT _void_sqlite_dir)
|
||||
find_package(SQLite3 QUIET)
|
||||
if(TARGET SQLite3::SQLite3)
|
||||
|
||||
@@ -66,6 +66,7 @@ set(VOID_WINDOWS_MODULES
|
||||
ObservabilityHooks
|
||||
Scheduler
|
||||
Service
|
||||
Sqlite
|
||||
System
|
||||
Testing
|
||||
TestingMock
|
||||
|
||||
@@ -149,7 +149,11 @@ namespace Void::Sqlite
|
||||
sqlite_native_code(const Error& error) noexcept
|
||||
{
|
||||
const std::error_code system = error.system_code();
|
||||
if (system.category() != sqlite_native_error_category()) {
|
||||
// Compare by name: on Windows the library and its consumer are
|
||||
// separate DLLs, so the category singleton is not shared across the
|
||||
// boundary (unlike ELF symbol interposition on Linux).
|
||||
if (std::string_view{system.category().name()} !=
|
||||
sqlite_native_error_category().name()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
const int extended = system.value();
|
||||
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
# SQLite amalgamation
|
||||
|
||||
Vendored SQLite amalgamation (`sqlite3.c`, `sqlite3.h`), version **3.49.1**.
|
||||
|
||||
It lets `Void::Sqlite` build identically on every target (including
|
||||
Windows cross builds) without a system SQLite3 development package or a
|
||||
network fetch. `cmake/Dependencies.cmake` uses this directory as the
|
||||
default `VOID_SQLITE3_AMALGAMATION_DIR`; set that cache variable elsewhere
|
||||
(or point `VOID_SQLITE3_FETCH_URL` at an archive) to override it.
|
||||
|
||||
The amalgamation is public domain
|
||||
(<https://www.sqlite.org/copyright.html>) and is compiled with
|
||||
`SQLITE_THREADSAFE=1`, `SQLITE_ENABLE_FTS5`, `SQLITE_ENABLE_JSON1` and
|
||||
`SQLITE_DQS=0` by the build.
|
||||
Vendored
+261454
File diff suppressed because it is too large.
Load diff
Vendored
+13715
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user