summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2020-03-24 16:29:54 +0100
committerLeander Beernaert <leander.beernaert@qt.io>2020-03-25 13:52:05 +0100
commit8dcf7d2674bfaa18dc0dfd623c58286bf85260ff (patch)
treef1fa545db0d0c448e6017b3c5878406a610230c7 /src/plugins/sqldrivers
parentd0b30de54299e8e6e8b1df0c138494c17c2b2642 (diff)
CMake: Add support for bundled SQLite library
Change-Id: I4d3f6e3bf04eb2fcf337e2c5dbc04b6e6f8ebe0b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/plugins/sqldrivers')
-rw-r--r--src/plugins/sqldrivers/configure.cmake11
-rw-r--r--src/plugins/sqldrivers/sqlite/.prev_CMakeLists.txt4
-rw-r--r--src/plugins/sqldrivers/sqlite/CMakeLists.txt77
3 files changed, 85 insertions, 7 deletions
diff --git a/src/plugins/sqldrivers/configure.cmake b/src/plugins/sqldrivers/configure.cmake
index 1237c3fb5a..3733afc859 100644
--- a/src/plugins/sqldrivers/configure.cmake
+++ b/src/plugins/sqldrivers/configure.cmake
@@ -2,6 +2,10 @@
#### Inputs
+# input sqlite
+set(INPUT_sqlite "undefined" CACHE STRING "")
+set_property(CACHE INPUT_sqlite PROPERTY STRINGS undefined qt system)
+
#### Libraries
@@ -46,7 +50,12 @@ qt_feature("sql-psql" PRIVATE
)
qt_feature("sql-sqlite" PRIVATE
LABEL "SQLite"
- CONDITION QT_FEATURE_datestring AND SQLite3_FOUND
+ CONDITION QT_FEATURE_datestring
+)
+qt_feature("system-sqlite" PRIVATE
+ LABEL " Using system provided SQLite"
+ AUTODETECT OFF
+ CONDITION QT_FEATURE_sql_sqlite AND SQLite3_FOUND
)
qt_configure_add_summary_section(NAME "Qt Sql Drivers")
qt_configure_add_summary_entry(ARGS "sql-db2")
diff --git a/src/plugins/sqldrivers/sqlite/.prev_CMakeLists.txt b/src/plugins/sqldrivers/sqlite/.prev_CMakeLists.txt
index d258c23821..3f3c1fabbf 100644
--- a/src/plugins/sqldrivers/sqlite/.prev_CMakeLists.txt
+++ b/src/plugins/sqldrivers/sqlite/.prev_CMakeLists.txt
@@ -28,7 +28,7 @@ qt_add_plugin(QSQLiteDriverPlugin
qt_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_system_sqlite
PUBLIC_LIBRARIES
- sqlite
+ SQLite::SQLite3
)
qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_system_sqlite
@@ -51,7 +51,7 @@ qt_extend_target(QSQLiteDriverPlugin CONDITION CMAKE_BUILD_TYPE STREQUAL Release
NDEBUG
)
-qt_extend_target(QSQLiteDriverPlugin CONDITION NOT CONFIG___contains___largefile AND NOT QT_FEATURE_system_sqlite
+qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_largefile AND NOT QT_FEATURE_system_sqlite
DEFINES
SQLITE_DISABLE_LFS
)
diff --git a/src/plugins/sqldrivers/sqlite/CMakeLists.txt b/src/plugins/sqldrivers/sqlite/CMakeLists.txt
index d1453638b3..e2e711bd78 100644
--- a/src/plugins/sqldrivers/sqlite/CMakeLists.txt
+++ b/src/plugins/sqldrivers/sqlite/CMakeLists.txt
@@ -13,8 +13,6 @@ qt_add_plugin(QSQLiteDriverPlugin
DEFINES
QT_NO_CAST_FROM_ASCII
QT_NO_CAST_TO_ASCII
- LIBRARIES # special case
- SQLite::SQLite3 # special case
PUBLIC_LIBRARIES
Qt::Core
Qt::CorePrivate
@@ -28,7 +26,78 @@ qt_add_plugin(QSQLiteDriverPlugin
## Scopes:
#####################################################################
+qt_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_system_sqlite
+ PUBLIC_LIBRARIES
+ SQLite::SQLite3
+)
+
# special case begin
-# Remove non-system-sqlite code
-# qt_extend_target(qsqlite CONDITION QT_FEATURE_system_sqlite
+if (NOT QT_FEATURE_system_sqlite)
+ qt_find_package(Threads REQUIRED PROVIDED_TARGETS Threads::Threads)
+ # On newer compilers compiling sqlite.c produces warnings
+ qt_disable_warnings(QSQLiteDriverPlugin)
+endif()
# special case end
+
+qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_system_sqlite
+ SOURCES
+ ../../../3rdparty/sqlite/sqlite3.c
+ DEFINES
+ SQLITE_ENABLE_COLUMN_METADATA
+ SQLITE_ENABLE_FTS3
+ SQLITE_ENABLE_FTS3_PARENTHESIS
+ SQLITE_ENABLE_FTS5
+ SQLITE_ENABLE_JSON1
+ SQLITE_ENABLE_RTREE
+ SQLITE_OMIT_COMPLETE
+ INCLUDE_DIRECTORIES
+ ../../../3rdparty/sqlite
+ PUBLIC_LIBRARIES # special case
+ Threads::Threads # special case
+)
+
+qt_extend_target(QSQLiteDriverPlugin CONDITION CMAKE_BUILD_TYPE STREQUAL Release AND NOT QT_FEATURE_system_sqlite
+ DEFINES
+ NDEBUG
+)
+
+qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_largefile AND NOT QT_FEATURE_system_sqlite
+ DEFINES
+ SQLITE_DISABLE_LFS
+)
+
+qt_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_posix_fallocate AND NOT QT_FEATURE_system_sqlite
+ DEFINES
+ HAVE_POSIX_FALLOCATE=1
+)
+
+qt_extend_target(QSQLiteDriverPlugin CONDITION WINRT AND NOT QT_FEATURE_system_sqlite
+ DEFINES
+ SQLITE_OS_WINRT
+)
+
+#### Keys ignored in scope 8:.:../../../3rdparty:../../../3rdparty/sqlite.pri:WINRT:
+# QMAKE_CFLAGS = "-Gy"
+
+qt_extend_target(QSQLiteDriverPlugin CONDITION QNX AND NOT QT_FEATURE_system_sqlite
+ DEFINES
+ _QNX_SOURCE
+)
+
+qt_extend_target(QSQLiteDriverPlugin CONDITION UNIX AND NOT QT_FEATURE_system_sqlite AND NOT WINRT AND NOT winphone
+ DEFINES
+ HAVE_USLEEP=1
+)
+
+qt_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_dlopen AND NOT QT_FEATURE_system_sqlite
+ PUBLIC_LIBRARIES
+ ${CMAKE_DL_LIBS}
+)
+
+qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_dlopen AND NOT QT_FEATURE_system_sqlite
+ DEFINES
+ SQLITE_OMIT_LOAD_EXTENSION
+)
+
+#### Keys ignored in scope 13:.:../../../3rdparty:../../../3rdparty/sqlite.pri:INTEGRITY:
+# QMAKE_CFLAGS = "-include" "qplatformdefs.h"