Sqlite3 is not conditional anymore, support amalgamation on UNIX.

This commit is contained in:
Christian Speckner 2020-12-14 00:10:11 +01:00
parent 0999396853
commit 771b5b44e3
7 changed files with 244058 additions and 244027 deletions

View File

@ -21,7 +21,7 @@
srcdir ?= .
DEFINES := -DSDL_SUPPORT -D_GLIBCXX_USE_CXX11_ABI=1
DEFINES := -DSDL_SUPPORT -D_GLIBCXX_USE_CXX11_ABI=1 -DSQLITE_SUPPORT
LDFLAGS := -pthread
INCLUDES :=
LIBS :=
@ -40,48 +40,61 @@ include config.mak
# CXXFLAGS+= -Werror
ifdef CXXFLAGS
CFLAGS:= $(CXXFLAGS)
CXXFLAGS:= $(CXXFLAGS) -x c++
else
CXXFLAGS:= -O2 -x c++
CFLAGS:= -O2
endif
CXXFLAGS+= -Wall -Wextra -Wno-unused-parameter
CXLAGS+= -Wall -Wextra -Wno-unused-parameter
ifdef HAVE_GCC
CXXFLAGS+= -Wno-multichar -Wunused -Woverloaded-virtual -Wnon-virtual-dtor -std=c++17
CFLAGS+= -Wno-multichar -Wunused
endif
ifdef HAVE_CLANG
CXXFLAGS+= -Wno-multichar -Wunused -Woverloaded-virtual -Wnon-virtual-dtor -std=c++17
CFLAGS+= -Wno-multichar -Wunused
endif
ifdef CLANG_WARNINGS
CXXFLAGS+= -Weverything -Wno-c++17-extensions -Wno-c++98-compat-pedantic \
EXTRA_WARN=-Weverything -Wno-c++17-extensions -Wno-c++98-compat-pedantic \
-Wno-switch-enum -Wno-conversion -Wno-covered-switch-default \
-Wno-inconsistent-missing-destructor-override -Wno-float-equal \
-Wno-exit-time-destructors -Wno-global-constructors -Wno-weak-vtables \
-Wno-four-char-constants -Wno-padded
CXXFLAGS+= $(EXTRA_WARN)
CFLAGS+= $(EXTRA_WARN)
endif
ifdef PROFILE
PROF:= -pg -fprofile-arcs -ftest-coverage
CXXFLAGS+= $(PROF)
CFLAGS+= $(PROF)
endif
ifdef DEBUG
CXXFLAGS += -g
CFLAGS += -g
else
ifdef HAVE_GCC
CXXFLAGS+= -fomit-frame-pointer
CFLAGS+= -fomit-frame-pointer
endif
ifdef HAVE_CLANG
CXXFLAGS+= -fomit-frame-pointer
CFLAGS+= -fomit-frame-pointer
endif
endif
ifdef RELEASE
CXXFLAGS += -flto -fno-rtti
CFLAGS += -flto
LDFLAGS += -flto -fno-rtti
endif
@ -107,6 +120,8 @@ PROFILE_STAMP = profile.stamp
CXXFLAGS_PROFILE_GENERATE = $(CXXFLAGS)
CXXFLAGS_PROFILE_USE = $(CXXFLAGS)
CFLAGS_PROFILE_GENERATE = $(CFLAGS)
CFLAGS_PROFILE_USE = $(CFLAGS)
LDFLAGS_PROFILE_GENERATE = $(LDFLAGS)
STELLA_PROFILE_GENERATE = $(BINARY_LOADER) ./$(EXECUTABLE_PROFILE_GENERATE) -profile \
$(PROFILE_DIR)/128.bin:10 \
@ -115,6 +130,8 @@ STELLA_PROFILE_GENERATE = $(BINARY_LOADER) ./$(EXECUTABLE_PROFILE_GENERATE) -pro
ifdef HAVE_CLANG
CXXFLAGS_PROFILE_GENERATE += -fprofile-generate=$(PROFILE_OUT)
CXXFLAGS_PROFILE_USE += -fprofile-use=$(PROFILE_OUT)
CFLAGS_PROFILE_GENERATE += -fprofile-generate=$(PROFILE_OUT)
CFLAGS_PROFILE_USE += -fprofile-use=$(PROFILE_OUT)
LDFLAGS_PROFILE_GENERATE += -fprofile-generate
STELLA_PROFILE_GENERATE := \
LLVM_PROFILE_FILE="$(PROFILE_OUT)/default.profraw" $(STELLA_PROFILE_GENERATE) && \
@ -124,6 +141,8 @@ endif
ifdef HAVE_GCC
CXXFLAGS_PROFILE_GENERATE += -fprofile-generate -fprofile-dir=$(PROFILE_OUT)
CXXFLAGS_PROFILE_USE += -fprofile-use -fprofile-dir=$(PROFILE_OUT)
CFLAGS_PROFILE_GENERATE += -fprofile-generate -fprofile-dir=$(PROFILE_OUT)
CFLAGS_PROFILE_USE += -fprofile-use -fprofile-dir=$(PROFILE_OUT)
LDFLAGS_PROFILE_GENERATE += -fprofile-generate
STELLA_PROFILE_GENERATE := $(STELLA_PROFILE_GENERATE) && \
rm -fr $(PROFILE_OUT)/$(OBJECT_ROOT_PROFILE_USE) && \
@ -155,7 +174,8 @@ MODULES += \
src/common/tv_filters \
src/emucore \
src/emucore/tia \
src/emucore/tia/frame-manager
src/emucore/tia/frame-manager \
src/common/repository/sqlite
######################################################################
# The build rules follow - normally you should have no need to
@ -223,7 +243,7 @@ $(OBJECT_ROOT)/%.o: %.cxx
$(OBJECT_ROOT)/%.o: %.c
$(create_dir)
$(CC) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $@
$(CC) $(CXX_UPDATE_DEP_FLAG) $(CFLAGS) $(CPPFLAGS) -c $(<) -o $@
$(merge_dep)
$(OBJECT_ROOT_PROFILE_GENERERATE)/%.pgen.o: %.cxx
@ -231,9 +251,9 @@ $(OBJECT_ROOT_PROFILE_GENERERATE)/%.pgen.o: %.cxx
$(CXX) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS_PROFILE_GENERATE) $(CPPFLAGS) -c $(<) -o $@
$(merge_dep)
$(OBJECT_ROOT_PROFILE_GENERERATE)/%.pgen.o: %.cxx
$(OBJECT_ROOT_PROFILE_GENERERATE)/%.pgen.o: %.c
$(create_dir)
$(CC) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS_PROFILE_GENERATE) $(CPPFLAGS) -c $(<) -o $@
$(CC) $(CXX_UPDATE_DEP_FLAG) $(CFLAGS_PROFILE_GENERATE) $(CPPFLAGS) -c $(<) -o $@
$(merge_dep)
$(OBJECT_ROOT_PROFILE_USE)/%.pgo.o: %.cxx $(PROFILE_STAMP)
@ -241,9 +261,9 @@ $(OBJECT_ROOT_PROFILE_USE)/%.pgo.o: %.cxx $(PROFILE_STAMP)
$(CXX) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS_PROFILE_USE) $(CPPFLAGS) -c $(<) -o $@
$(merge_dep)
$(OBJECT_ROOT_PROFILE_USE)/%.pgo.o: %.cxx $(PROFILE_STAMP)
$(OBJECT_ROOT_PROFILE_USE)/%.pgo.o: %.c $(PROFILE_STAMP)
$(create_dir)
$(CC) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS_PROFILE_USE) $(CPPFLAGS) -c $(<) -o $@
$(CC) $(CXX_UPDATE_DEP_FLAG) $(CFLAGS_PROFILE_USE) $(CPPFLAGS) -c $(<) -o $@
$(merge_dep)
else
@ -257,7 +277,7 @@ $(OBJECT_ROOT)/%.o: %.cxx
$(OBJECT_ROOT)/%.o: %.c
$(create_dir)
$(CC) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $@
$(CC) $(CXX_UPDATE_DEP_FLAG) $(CFLAGS) $(CPPFLAGS) -c $(<) -o $@
$(OBJECT_ROOT_PROFILE_GENERERATE)/%.o: %.cxx
$(create_dir)
@ -265,7 +285,7 @@ $(OBJECT_ROOT_PROFILE_GENERERATE)/%.o: %.cxx
$(OBJECT_ROOT_PROFILE_GENERERATE)/%.o: %.c
$(create_dir)
$(CC) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS_PROFILE_GENERATE) $(CPPFLAGS) -c $(<) -o $@
$(CC) $(CXX_UPDATE_DEP_FLAG) $(CFLAGS_PROFILE_GENERATE) $(CPPFLAGS) -c $(<) -o $@
$(OBJECT_ROOT_PROFILE_USE)/%.o: %.cxx $(PROFILE_STAMP)
$(create_dir)
@ -273,7 +293,7 @@ $(OBJECT_ROOT_PROFILE_USE)/%.o: %.cxx $(PROFILE_STAMP)
$(OBJECT_ROOT_PROFILE_USE)/%.o: %.c $(PROFILE_STAMP)
$(create_dir)
$(CC) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS_PROFILE_USE) $(CPPFLAGS) -c $(<) -o $@
$(CC) $(CXX_UPDATE_DEP_FLAG) $(CFLAGS_PROFILE_USE) $(CPPFLAGS) -c $(<) -o $@
endif

47
configure vendored
View File

@ -206,8 +206,7 @@ Optional Features:
--disable-png
--enable-zip enable/disable ZIP file support [enabled]
--disable-zip
--enable-sqlite enable SQLite for storing settings and preferences [disabled]
--disable-sqlite
--sqlite-builtin always use builtin version of sqlite
--enable-windowed enable/disable windowed rendering modes [enabled]
--disable-windowed
--enable-shared build shared binary [enabled]
@ -253,8 +252,7 @@ for ac_option in $@; do
--disable-png) _build_png=no ;;
--enable-zip) _build_zip=yes ;;
--disable-zip) _build_zip=no ;;
--enable-sqlite) _build_sqlite=yes ;;
--disable-sqlite) _build_sqlite=no ;;
--sqlite-builtin) _sqlite_builtin=yes ;;
--enable-windowed) _build_windowed=yes ;;
--disable-windowed) _build_windowed=no ;;
--enable-shared) _build_static=no ;;
@ -670,24 +668,19 @@ fi
# Check for SQLite
#
echocheck "SQLite"
if test "$_build_sqlite" = yes ; then
_sqlite=no
_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
if test "$_sqlite" = yes ; then
echo "$_sqlite"
else
echo "disabled"
_build_sqlite=no
fi
fi
if test "$_sqlite" = yes ; then
echo "$_sqlite"
else
echo "disabled"
_build_sqlite=no
echo "builtin"
fi
#
@ -759,14 +752,6 @@ else
echo
fi
if test "$_build_sqlite" = yes ; then
echo_n " SQLite enabled"
echo
else
echo_n " SQLite disabled"
echo
fi
if test "$_build_windowed" = "yes" ; then
echo_n " Windowed rendering modes enabled"
echo
@ -820,10 +805,11 @@ YACC="$SRC/yacc"
CHEAT="$SRC/cheat"
LIBPNG="$SRC/libpng"
ZLIB="$SRC/zlib"
SQLITE="$SRC/common/repository/sqlite"
SQLITE_REPO="$SRC/common/repository/sqlite"
SQLITE_LIB="$SRC/sqlite"
JSON="$SRC/json"
INCLUDES="-I$CORE -I$COMMON -I$TV -I$TIA -I$TIA_FRAME_MANAGER -I$JSON"
INCLUDES="-I$CORE -I$COMMON -I$TV -I$TIA -I$TIA_FRAME_MANAGER -I$JSON -I$SQLITE_REPO"
INCLUDES="$INCLUDES `$_sdlconfig --cflags`"
if test "$_build_static" = yes ; then
@ -846,6 +832,9 @@ case $_host_os in
DEFINES="$DEFINES -DBSPF_UNIX -DMACOS_KEYS"
MODULES="$MODULES $SRC/unix"
INCLUDES="$INCLUDES -I$SRC/unix"
if test "$have_clang" == yes; then
CXXFLAGS="$CXXFLAGS -Wno-poison-system-directories"
fi
;;
retron77)
DEFINES="$DEFINES -DBSPF_UNIX -DRETRON77"
@ -904,11 +893,11 @@ if test "$_build_png" = yes ; then
fi
fi
if test "$_build_sqlite" = yes; then
DEFINES="$DEFINES -DSQLITE_SUPPORT"
MODULES="$MODULES $SQLITE"
INCLUDES="$INCLUDES -I$SQLITE"
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

10
src/sqlite/module.mk Normal file
View File

@ -0,0 +1,10 @@
MODULE := src/sqlite
MODULE_OBJS := \
src/sqlite/sqlite3.o
MODULE_DIRS += \
src/sqlite
# Include common rules
include $(srcdir)/common.rules

231754
src/sqlite/source/sqlite3.c Normal file

File diff suppressed because it is too large Load Diff

12237
src/sqlite/source/sqlite3.h Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff