CMake: Add support for bundled SQLite library

Change-Id: I4d3f6e3bf04eb2fcf337e2c5dbc04b6e6f8ebe0b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Leander Beernaert 2020-03-24 16:29:54 +01:00
parent d0b30de542
commit 8dcf7d2674
7 changed files with 98 additions and 11 deletions

View File

@ -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
@ -769,6 +773,11 @@ qt_configure_add_summary_entry(
CONDITION NOT QT_FEATURE_debug OR QT_FEATURE_debug_and_release
)
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"

View File

@ -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")

View File

@ -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
)

View File

@ -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"

View File

@ -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,

View File

@ -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"),

View File

@ -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":