Sqlite: Use config.h instead of setting everything in the build files

Change-Id: Ia70a5e78475a8b8078276df03330060c8785bf90
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2021-04-09 18:53:48 +02:00
parent f8647ec428
commit 1618937637
13 changed files with 146 additions and 36 deletions

View File

@@ -1,16 +1,7 @@
add_qtc_library(Sqlite
PUBLIC_DEFINES
BUILD_SQLITE_LIBRARY
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 SQLITE_OMIT_AUTOINIT
SQLITE_CORE
DEPENDS Qt5::Core Threads::Threads ${CMAKE_DL_LIBS}
PUBLIC_INCLUDES
"${CMAKE_CURRENT_LIST_DIR}"
@@ -19,6 +10,8 @@ add_qtc_library(Sqlite
../3rdparty/sqlite/sqlite3.c
../3rdparty/sqlite/sqlite3.h
../3rdparty/sqlite/carray.c
../3rdparty/sqlite/config.h
../3rdparty/sqlite/sqlite.h
constraints.h
createtablesqlstatementbuilder.cpp createtablesqlstatementbuilder.h
lastchangedrowid.h
@@ -48,3 +41,11 @@ add_qtc_library(Sqlite
sqlitetimestamp.h
sqlitelibraryinitializer.cpp sqlitelibraryinitializer.h
)
extend_qtc_library(Sqlite DEFINES _HAVE_SQLITE_CONFIG_H)
if (APPLE)
extend_qtc_library(Sqlite DEFINES _BSD_SOURCE)
elseif (UNIX)
extend_qtc_library(Sqlite DEFINES _POSIX_C_SOURCE=200809L _GNU_SOURCE _DEFAULT_SOURCE)
endif()

View File

@@ -52,16 +52,7 @@ HEADERS += \
$$PWD/sqliteindex.h \
$$PWD/sqlitebasestatement.h
DEFINES += 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 SQLITE_OMIT_AUTOINIT
DEFINES += _HAVE_SQLITE_CONFIG_H SQLITE_CORE
CONFIG(debug, debug|release): DEFINES += SQLITE_ENABLE_API_ARMOR

View File

@@ -29,7 +29,7 @@
#include "sqlitedatabasebackend.h"
#include "sqliteexception.h"
#include "sqlite3.h"
#include "sqlite.h"
#include <condition_variable>
#include <mutex>

View File

@@ -35,7 +35,7 @@
#include <QThread>
#include <QDebug>
#include "sqlite3.h"
#include "sqlite.h"
#include <chrono>
#include <thread>

View File

@@ -29,7 +29,7 @@
#include <utils/smallstringio.h>
#include <sqlite3ext.h>
#include <sqlite.h>
namespace Sqlite {

View File

@@ -28,7 +28,7 @@
#include "sqlitesessionchangeset.h"
#include "sqlitetable.h"
#include <sqlite3ext.h>
#include <sqlite.h>
#include <memory>