sqlite: Fix qbs build

Exporting the full sqlite interface can lead to run-time conflicts with
the system sqlite that Qt's SQL support pulls in.
So re-build the sources for the unit test, as in the qmake build.

Change-Id: I8394b9c0aa4e21704bc84600f40b8f5d706ad66d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2020-06-16 13:48:14 +02:00
parent 241b24486e
commit 0861ba2fc9
3 changed files with 56 additions and 51 deletions

View File

@@ -3,57 +3,11 @@ import qbs 1.0
QtcLibrary {
name: "Sqlite"
property string exportMacro: qbs.targetOS.contains("windows")
? '__declspec(dllexport)'
: '__attribute__((visibility("default")))'
property string importMacro: qbs.targetOS.contains("windows")
? '__declspec(dllimport)'
: exportMacro
cpp.includePaths: base.concat(["../3rdparty/sqlite", "."])
property stringList sharedDefines: [
"SQLITE_THREADSAFE=2", "SQLITE_ENABLE_FTS5", "SQLITE_ENABLE_UNLOCK_NOTIFY",
"SQLITE_ENABLE_JSON1", "SQLITE_DEFAULT_FOREIGN_KEYS=1", "SQLITE_TEMP_STORE=2",
"SQLITE_DEFAULT_WAL_SYNCHRONOUS=1", "SQLITE_MAX_WORKER_THREADS", "SQLITE_DEFAULT_MEMSTATUS=0",
"SQLITE_OMIT_DEPRECATED", "SQLITE_OMIT_DECLTYPE",
"SQLITE_MAX_EXPR_DEPTH=0", "SQLITE_OMIT_SHARED_CACHE", "SQLITE_USE_ALLOCA",
"SQLITE_ENABLE_MEMORY_MANAGEMENT", "SQLITE_ENABLE_NULL_TRIM", "SQLITE_OMIT_EXPLAIN",
"SQLITE_OMIT_LOAD_EXTENSION", "SQLITE_OMIT_UTF16", "SQLITE_DQS=0",
"SQLITE_ENABLE_STAT4", "HAVE_ISNAN", "HAVE_FDATASYNC", "HAVE_MALLOC_USABLE_SIZE",
"SQLITE_DEFAULT_MMAP_SIZE=268435456", "SQLITE_CORE", "SQLITE_ENABLE_SESSION", "SQLITE_ENABLE_PREUPDATE_HOOK",
"SQLITE_LIKE_DOESNT_MATCH_BLOBS",
]
cpp.defines: base.concat(sharedDefines).concat(["BUILD_SQLITE_LIBRARY",
"SQLITE_API=" + exportMacro])
cpp.optimization: "fast"
cpp.dynamicLibraries: base.concat((qbs.targetOS.contains("unix") && !qbs.targetOS.contains("bsd"))
? ["dl", "pthread"] : [])
Group {
name: "ThirdPartySqlite"
prefix: "../3rdparty/sqlite/"
cpp.warningLevel: "none"
files: [
"sqlite3.c",
"sqlite3.h",
"sqlite3ext.h",
"carray.c"
]
}
Group {
files: [
"*.h",
"*.cpp"
]
}
Depends { name: "sqlite_sources" }
property string exportedIncludeDir: sqlite_sources.includeDir
Export {
cpp.defines: product.sharedDefines.concat("SQLITE_API=" + product.importMacro)
cpp.systemIncludePaths: base.concat([
"../3rdparty/sqlite",
"."
])
Depends { name: "cpp" }
cpp.includePaths: product.exportedIncludeDir
}
}