Tune sqlite build, remove the possibility of linking against system libsqlite3.

This commit is contained in:
Christian Speckner 2021-01-02 14:39:12 +01:00
parent eb33623749
commit 08cb68fea9
7 changed files with 19 additions and 45 deletions

View File

@ -175,7 +175,8 @@ MODULES += \
src/emucore \ src/emucore \
src/emucore/tia \ src/emucore/tia \
src/emucore/tia/frame-manager \ src/emucore/tia/frame-manager \
src/common/repository/sqlite src/common/repository/sqlite \
src/sqlite
###################################################################### ######################################################################
# The build rules follow - normally you should have no need to # The build rules follow - normally you should have no need to

37
configure vendored
View File

@ -22,7 +22,6 @@ _build_joystick=yes
_build_cheats=yes _build_cheats=yes
_build_png=yes _build_png=yes
_build_zip=yes _build_zip=yes
_build_sqlite=no
_build_static=no _build_static=no
_build_profile=no _build_profile=no
_build_debug=no _build_debug=no
@ -206,7 +205,6 @@ Optional Features:
--disable-png --disable-png
--enable-zip enable/disable ZIP file support [enabled] --enable-zip enable/disable ZIP file support [enabled]
--disable-zip --disable-zip
--sqlite-builtin always use builtin version of sqlite
--enable-windowed enable/disable windowed rendering modes [enabled] --enable-windowed enable/disable windowed rendering modes [enabled]
--disable-windowed --disable-windowed
--enable-shared build shared binary [enabled] --enable-shared build shared binary [enabled]
@ -221,7 +219,6 @@ Optional Libraries:
--with-sdl-prefix=DIR Prefix where the sdl2-config script is installed (optional) --with-sdl-prefix=DIR Prefix where the sdl2-config script is installed (optional)
--with-libpng-prefix=DIR Prefix where libpng is installed (optional) --with-libpng-prefix=DIR Prefix where libpng is installed (optional)
--with-zlib-prefix=DIR Prefix where zlib is installed (optional) --with-zlib-prefix=DIR Prefix where zlib is installed (optional)
--with-sqlite-prefix=DIR PREFIX where sqlite is installed (optional)
Some influential environment variables: Some influential environment variables:
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
@ -252,7 +249,6 @@ for ac_option in $@; do
--disable-png) _build_png=no ;; --disable-png) _build_png=no ;;
--enable-zip) _build_zip=yes ;; --enable-zip) _build_zip=yes ;;
--disable-zip) _build_zip=no ;; --disable-zip) _build_zip=no ;;
--sqlite-builtin) _sqlite_builtin=yes ;;
--enable-windowed) _build_windowed=yes ;; --enable-windowed) _build_windowed=yes ;;
--disable-windowed) _build_windowed=no ;; --disable-windowed) _build_windowed=no ;;
--enable-shared) _build_static=no ;; --enable-shared) _build_static=no ;;
@ -278,11 +274,6 @@ for ac_option in $@; do
ZLIB_CFLAGS="-I$_prefix/include" ZLIB_CFLAGS="-I$_prefix/include"
ZLIB_LIBS="-L$_prefix/lib" ZLIB_LIBS="-L$_prefix/lib"
;; ;;
--with-sqlite-prefix=*)
_prefix=`echo $ac_option | cut -d '=' -f 2`
SQLITE_CFLAGS="-I$_prefix/include"
SQLITE_LIBS="-L$_prefix/lib"
;;
--host=*) --host=*)
_host=`echo $ac_option | cut -d '=' -f 2` _host=`echo $ac_option | cut -d '=' -f 2`
;; ;;
@ -664,25 +655,6 @@ else
_build_png=no _build_png=no
fi fi
#
# Check for SQLite
#
echocheck "SQLite"
_sqlite=no
if test "$_sqlite_builtin" != yes ; then
cat > $TMPC << EOF
#include <stdio.h>
#include <sqlite3.h>
int main(void) { printf("%s\n", SQLITE_VERSION); }
EOF
cc_check $LDFLAGS $CXXFLAGS $SQLITE_CFLAGS $SQLITE_LIBS -lsqlite3 && _sqlite=yes
fi
if test "$_sqlite" = yes ; then
echo "$_sqlite"
else
echo "builtin"
fi
# #
# figure out installation directories # figure out installation directories
# #
@ -809,7 +781,7 @@ SQLITE_REPO="$SRC/common/repository/sqlite"
SQLITE_LIB="$SRC/sqlite" SQLITE_LIB="$SRC/sqlite"
JSON="$SRC/json" JSON="$SRC/json"
INCLUDES="-I$CORE -I$COMMON -I$TV -I$TIA -I$TIA_FRAME_MANAGER -I$JSON -I$SQLITE_REPO" INCLUDES="-I$CORE -I$COMMON -I$TV -I$TIA -I$TIA_FRAME_MANAGER -I$JSON -I$SQLITE_REPO -I$SQLITE_LIB"
INCLUDES="$INCLUDES `$_sdlconfig --cflags`" INCLUDES="$INCLUDES `$_sdlconfig --cflags`"
if test "$_build_static" = yes ; then if test "$_build_static" = yes ; then
@ -893,13 +865,6 @@ if test "$_build_png" = yes ; then
fi fi
fi fi
if test "$_sqlite" = yes; then
LIBS="$LIBS -lsqlite3"
else
MODULES="$MODULES $SQLITE_LIB"
INCLUDES="$INCLUDES -I$SQLITE_LIB"
fi
if test "$_build_zip" = yes ; then if test "$_build_zip" = yes ; then
DEFINES="$DEFINES -DZIP_SUPPORT" DEFINES="$DEFINES -DZIP_SUPPORT"
if test "$_zlib" = yes ; then if test "$_zlib" = yes ; then

View File

@ -69,7 +69,6 @@ void SqliteDatabase::initialize()
} }
exec("PRAGMA journal_mode=WAL"); exec("PRAGMA journal_mode=WAL");
exec("PRAGMA synchronous=1");
switch (sqlite3_wal_checkpoint_v2(myHandle, nullptr, SQLITE_CHECKPOINT_TRUNCATE, nullptr, nullptr)) { switch (sqlite3_wal_checkpoint_v2(myHandle, nullptr, SQLITE_CHECKPOINT_TRUNCATE, nullptr, nullptr)) {
case SQLITE_OK: case SQLITE_OK:

View File

@ -17,6 +17,10 @@
#include "SqliteStatement.hxx" #include "SqliteStatement.hxx"
#include "SqliteError.hxx" #include "SqliteError.hxx"
#ifdef __clang__
#pragma clang diagnostic ignored "-Wold-style-cast"
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SqliteStatement::SqliteStatement(sqlite3* handle, const string& sql) SqliteStatement::SqliteStatement(sqlite3* handle, const string& sql)
: myHandle{handle} : myHandle{handle}

View File

@ -15,11 +15,7 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================ //============================================================================
#ifndef SQLITE_LIB_CXX #include "sqlite_options.h"
#define SQLITE_LIB_CXX
// Linux and libretro doesn't build unless this is enabled
#define SQLITE_OMIT_LOAD_EXTENSION 1
/* /*
* We can't control the quality of code from outside projects, so for now * We can't control the quality of code from outside projects, so for now
@ -33,5 +29,3 @@
#else #else
#include "source/sqlite3.c" #include "source/sqlite3.c"
#endif #endif
#endif // SQLITE_LIB_CXX

View File

@ -18,6 +18,8 @@
#ifndef SQLITE_LIB_HXX #ifndef SQLITE_LIB_HXX
#define SQLITE_LIB_HXX #define SQLITE_LIB_HXX
#include "sqlite_options.h"
/* /*
* We can't control the quality of code from outside projects, so for now * We can't control the quality of code from outside projects, so for now
* just disable warnings for it. * just disable warnings for it.

View File

@ -0,0 +1,9 @@
// https://www.sqlite.org/compile.html
#define SQLITE_DQS 0
#define SQLITE_DEFAULT_MEMSTATUS 0
#define SQLITE_DEFAULT_WAL_SYNCHRONOUS 1
#define SQLITE_USE_ALLOCA 1
#define SQLITE_OMIT_LOAD_EXTENSION 1
#define SQLITE_OMIT_DEPRECATED 1
#define SQLITE_OMIT_DECLTYPE 1