diff --git a/s/cmake-init b/s/cmake-init index 781db1ea7..eea222334 100755 --- a/s/cmake-init +++ b/s/cmake-init @@ -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 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5800d1814..d819675b8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -184,8 +184,10 @@ endif() add_library(version STATIC ${VERSION_SRC}) add_library(game ${ERESSEA_SRC}) + +#add_executable(checker ${CHECK_SRC}) + add_executable(eressea ${SERVER_SRC}) -add_executable(checker ${CHECK_SRC}) if (IWYU_PATH) set_property(TARGET eressea PROPERTY C_INCLUDE_WHAT_YOU_USE ${IWYU_PATH}) endif(IWYU_PATH) diff --git a/src/kernel/db/memory.c b/src/kernel/db/memory.c index 5fbaade4c..0f572a99e 100644 --- a/src/kernel/db/memory.c +++ b/src/kernel/db/memory.c @@ -1,4 +1,6 @@ +#ifdef _MSC_VER #include +#endif #include "driver.h" #include @@ -40,11 +42,10 @@ int db_driver_faction_save(int id, int no, int turn, const char *email, const ch return -1; } -static int free_data_cb(const void *match) +static void free_data_cb(void *match) { char *str = (char *)match; free(str); - return 0; } int db_driver_open(database_t db, const char *dbname)