change database selection, fix in-memory db

This commit is contained in:
Enno Rehling 2018-09-30 13:36:34 +02:00
parent 88f0504f48
commit 4a69573786
2 changed files with 37 additions and 1 deletions

View File

@ -1,13 +1,46 @@
#!/bin/sh
ERESSEA_DB=db
ERESSEA_DB=memory
pkg-config --exists sqlite3 && ERESSEA_DB=sqlite
GETOPT=getopt
GETOPT_LONG=1
if [ "Darwin" = "$(uname)" ] ; then
if [ -x "/usr/local/opt/gnu-getopt/bin/getopt" ] ; then
GETOPT="/usr/local/opt/gnu-getopt/bin/getopt"
else
GETOPT_LONG=0
fi
fi
if [ $GETOPT_LONG -eq 1 ]; then
options=$(${GETOPT} -o d: -l db: -- "$@")
else # assume GNU getopt (long arguments)
options=$(${GETOPT} d: "$@")
fi
# Parse command line arguments
eval set -- "$options"
until [ -z "$1" ] ; do
case $1 in
-d|--db)
ERESSEA_DB=$2
shift
;;
--) shift; break;;
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
(*) break;;
esac
shift
done
while [ ! -z "$1" ] ; do
if [ "$1" = "--with-db" ] ; then
ERESSEA_DB=db
elif [ "$1" = "--with-sqlite" ] ; then
ERESSEA_DB=sqlite
elif [ "$1" = "--with-memory" ] ; then
ERESSEA_DB=memory
fi
shift 1
done

View File

@ -179,6 +179,9 @@ endif()
add_library(version STATIC ${VERSION_SRC})
add_library(game ${ERESSEA_SRC})
#add_executable(checker ${CHECK_SRC})
add_executable(eressea ${SERVER_SRC})
if (IWYU_PATH)
set_property(TARGET eressea PROPERTY C_INCLUDE_WHAT_YOU_USE ${IWYU_PATH})