summaryrefslogtreecommitdiffstats
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
parentd0b30de54299e8e6e8b1df0c138494c17c2b2642 (diff)
CMake: Add support for bundled SQLite library
Change-Id: I4d3f6e3bf04eb2fcf337e2c5dbc04b6e6f8ebe0b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--configure.cmake9
-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
-rwxr-xr-xutil/cmake/configurejson2cmake.py5
-rw-r--r--util/cmake/helper.py1
-rwxr-xr-xutil/cmake/pro2cmake.py2
7 files changed, 98 insertions, 11 deletions
diff --git a/configure.cmake b/configure.cmake
index 08def15a9f..c11a2a4933 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -651,6 +651,10 @@ qt_feature("neon"
)
qt_feature_definition("neon" "QT_COMPILER_SUPPORTS_NEON" VALUE "1")
qt_feature_config("neon" QMAKE_PRIVATE_CONFIG)
+qt_feature("posix_fallocate" PRIVATE
+ LABEL "POSIX fallocate()"
+ CONDITION TEST_posix_fallocate
+)
qt_feature("alloca_h" PRIVATE
LABEL "alloca.h"
CONDITION TEST_alloca_h
@@ -771,6 +775,11 @@ qt_configure_add_summary_entry(
qt_configure_add_summary_entry(ARGS "shared")
qt_configure_add_summary_entry(
TYPE "firstAvailableFeature"
+ ARGS "c11 c99 c89"
+ MESSAGE "Using C standard"
+)
+qt_configure_add_summary_entry(
+ TYPE "firstAvailableFeature"
ARGS "c++2a c++17 c++14 c++11"
MESSAGE "Using C++ standard"
)
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"
diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py
index 31a0dda7dc..b8e32c9cc9 100755
--- a/util/cmake/configurejson2cmake.py
+++ b/util/cmake/configurejson2cmake.py
@@ -472,7 +472,6 @@ def parseInput(ctx, sinput, data, cm_fh):
"pps",
"slog2",
"syslog",
- "sqlite",
}
if sinput in skip_inputs:
@@ -807,7 +806,6 @@ def get_feature_mapping():
},
"simulator_and_device": {"condition": "UIKIT AND NOT QT_UIKIT_SDK"},
"pkg-config": None,
- "posix_fallocate": None, # Only needed for sqlite, which we do not want to build
"posix-libiconv": {
"condition": "NOT WIN32 AND NOT QNX AND NOT ANDROID AND NOT APPLE AND TEST_posix_iconv AND TEST_iconv_needlib",
"enable": "TEST_posix_iconv AND TEST_iconv_needlib",
@@ -828,7 +826,7 @@ def get_feature_mapping():
"sanitize_undefined": None,
"shared": {"condition": "BUILD_SHARED_LIBS"},
"silent": None,
- "sql-sqlite": {"condition": "QT_FEATURE_datestring AND SQLite3_FOUND"},
+ "sql-sqlite": {"condition": "QT_FEATURE_datestring"},
"static": None,
"static_runtime": None,
"stl": None, # Do we really need to test for this in 2018?!
@@ -838,7 +836,6 @@ def get_feature_mapping():
"enable": "TEST_sun_iconv",
"disable": "NOT TEST_sun_iconv",
},
- "system-sqlite": None,
"system-xcb": None,
"tiff": {"condition": "QT_FEATURE_imageformatplugin AND TIFF_FOUND"},
"use_gold_linker": None,
diff --git a/util/cmake/helper.py b/util/cmake/helper.py
index 00adc940f1..1879233bb6 100644
--- a/util/cmake/helper.py
+++ b/util/cmake/helper.py
@@ -472,6 +472,7 @@ _library_map = [
LibraryMapping("speechd", "SpeechDispatcher", "SpeechDispatcher::SpeechDispatcher"),
LibraryMapping("sqlite2", None, None), # No more sqlite2 support in Qt6!
LibraryMapping("sqlite3", "SQLite3", "SQLite::SQLite3"),
+ LibraryMapping("sqlite", "SQLite3", "SQLite::SQLite3"),
LibraryMapping("sun_iconv", None, None),
LibraryMapping("tslib", "Tslib", "PkgConfig::Tslib"),
LibraryMapping("udev", "Libudev", "PkgConfig::Libudev"),
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index 8f46b04c74..618e43c356 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -1550,6 +1550,7 @@ def map_condition(condition: str) -> str:
r"DEFINES___contains___QT_NO_TRANSLATION", r"(NOT QT_FEATURE_translation)", condition
)
condition = re.sub(r"styles___contains___fusion", r"QT_FEATURE_style_fusion", condition)
+ condition = re.sub(r"CONFIG___contains___largefile", r"QT_FEATURE_largefile", condition)
condition = condition.replace("cross_compile", "CMAKE_CROSSCOMPILING")
@@ -1571,6 +1572,7 @@ def map_condition(condition: str) -> str:
and not feature_name.startswith("system_tiff")
and not feature_name.startswith("system_assimp")
and not feature_name.startswith("system_doubleconversion")
+ and not feature_name.startswith("system_sqlite")
):
part = "ON"
elif feature == "dlopen":