update cmake to compile without sqlite3, curses or libxml2 installed.

This is not actually recommended, but your system may not have
this,and you should still be able to contribute. also, libxml2 is on
the way out, I am beginning to really hate it.

Moving a couple of files around.
This commit is contained in:
Enno Rehling 2014-06-11 20:30:34 -07:00
parent 2578a15318
commit 28726e2bea
11 changed files with 71 additions and 60 deletions

View File

@ -67,12 +67,8 @@ ELSE(CMAKE_COMPILER_IS_GNUCC)
ENDIF(CMAKE_COMPILER_IS_GNUCC) ENDIF(CMAKE_COMPILER_IS_GNUCC)
find_package (LibXml2) find_package (LibXml2)
if (LIBXML2_FOUND) find_package (SQLite3)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBXML2") find_package (Curses)
endif(LIBXML2_FOUND)
find_package (SQLite3 REQUIRED)
find_package (Curses REQUIRED)
find_package (Lua REQUIRED) find_package (Lua REQUIRED)
find_package (ToLua REQUIRED) find_package (ToLua REQUIRED)

View File

@ -9,10 +9,6 @@ ELSE(CMAKE_COMPILER_IS_GNUCC)
MESSAGE(STATUS "Unknown compiler ${CMAKE_C_COMPILER_ID}") MESSAGE(STATUS "Unknown compiler ${CMAKE_C_COMPILER_ID}")
ENDIF(CMAKE_COMPILER_IS_GNUCC) ENDIF(CMAKE_COMPILER_IS_GNUCC)
find_package (Lua 5 REQUIRED)
find_package (ToLua)
find_package (SQLite3 REQUIRED)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}) include_directories (${CMAKE_CURRENT_SOURCE_DIR})
include_directories (${CRITBIT_INCLUDE_DIR}) include_directories (${CRITBIT_INCLUDE_DIR})
include_directories (${CJSON_INCLUDE_DIR}) include_directories (${CJSON_INCLUDE_DIR})
@ -23,7 +19,6 @@ include_directories (${CUTEST_INCLUDE_DIR})
include_directories (${LUA_INCLUDE_DIR}) include_directories (${LUA_INCLUDE_DIR})
include_directories (${BSON_INCLUDE_DIR}) include_directories (${BSON_INCLUDE_DIR})
include_directories (${INIPARSER_INCLUDE_DIR}) include_directories (${INIPARSER_INCLUDE_DIR})
include_directories (${CURSES_INCLUDE_DIR})
add_subdirectory(util) add_subdirectory(util)
add_subdirectory(kernel) add_subdirectory(kernel)
@ -58,10 +53,7 @@ TOLUA_BINDING(eressea.pkg bind_eressea.h)
TOLUA_BINDING(settings.pkg bind_settings.h) TOLUA_BINDING(settings.pkg bind_settings.h)
ENDIF() ENDIF()
set (SERVER_SRC set (ERESSEA_SRC
process.pkg.c
eressea.pkg.c
settings.pkg.c
eressea.c eressea.c
json.c json.c
creation.c creation.c
@ -77,25 +69,7 @@ set (SERVER_SRC
spy.c spy.c
study.c study.c
summary.c summary.c
# xmlreport.c
gmtool.c
monsters.c monsters.c
bind_building.c
bind_eressea.c
bind_faction.c
bind_gmtool.c
bind_hashtable.c
bindings.c
helpers.c
bind_message.c
bind_monsters.c
bind_process.c
bind_region.c
bind_settings.c
bind_ship.c
bind_sqlite.c
bind_storage.c
bind_unit.c
${SPELLS_SRC} ${SPELLS_SRC}
${RACES_SRC} ${RACES_SRC}
${ITEMS_SRC} ${ITEMS_SRC}
@ -106,21 +80,54 @@ set (SERVER_SRC
${UTIL_SRC} ${UTIL_SRC}
) )
set(SERVER_SRC
helpers.c
process.pkg.c
eressea.pkg.c
settings.pkg.c
bind_building.c
bind_eressea.c
bind_faction.c
bind_hashtable.c
bindings.c
bind_message.c
bind_monsters.c
bind_process.c
bind_region.c
bind_settings.c
bind_ship.c
bind_storage.c
bind_unit.c
${ERESSEA_SRC})
if (SQLITE3_FOUND)
set (SERVER_SRC
sqlite.c
bind_sqlite.c
${SERVER_SRC})
endif (SQLITE3_FOUND)
if (CURSES_FOUND)
set (SERVER_SRC
gmtool.c
listbox.c
bind_gmtool.c
${SERVER_SRC})
endif(CURSES_FOUND)
add_executable(eressea ${SERVER_SRC} main.c) add_executable(eressea ${SERVER_SRC} main.c)
target_link_libraries(eressea target_link_libraries(eressea
${LUA_LIBRARIES}
${TOLUA_LIBRARIES} ${TOLUA_LIBRARIES}
${LUA_LIBRARIES}
${QUICKLIST_LIBRARIES} ${QUICKLIST_LIBRARIES}
${STORAGE_LIBRARIES} ${STORAGE_LIBRARIES}
${SQLITE3_LIBRARIES}
${CRITBIT_LIBRARIES} ${CRITBIT_LIBRARIES}
${CRYPTO_LIBRARIES} ${CRYPTO_LIBRARIES}
${CJSON_LIBRARIES} ${CJSON_LIBRARIES}
${CURSES_LIBRARIES}
${INIPARSER_LIBRARIES} ${INIPARSER_LIBRARIES}
) )
set(SERVER_TEST_SRC set(TESTS_SRC
test_eressea.c test_eressea.c
tests.c tests.c
tests_test.c tests_test.c
@ -130,20 +137,18 @@ set(SERVER_TEST_SRC
laws_test.c laws_test.c
${UTIL_TESTS} ${UTIL_TESTS}
${KERNEL_TESTS} ${KERNEL_TESTS}
${ERESSEA_SRC}
) )
add_executable(test_eressea ${SERVER_SRC} ${SERVER_TEST_SRC}) add_executable(test_eressea ${TESTS_SRC})
target_link_libraries(test_eressea ${CUTEST_LIBRARIES}) target_link_libraries(test_eressea ${CUTEST_LIBRARIES})
target_link_libraries(test_eressea target_link_libraries(test_eressea
${LUA_LIBRARIES} ${LUA_LIBRARIES}
${TOLUA_LIBRARIES}
${QUICKLIST_LIBRARIES} ${QUICKLIST_LIBRARIES}
${STORAGE_LIBRARIES} ${STORAGE_LIBRARIES}
${SQLITE3_LIBRARIES}
${CRITBIT_LIBRARIES} ${CRITBIT_LIBRARIES}
${CRYPTO_LIBRARIES} ${CRYPTO_LIBRARIES}
${CJSON_LIBRARIES} ${CJSON_LIBRARIES}
${CURSES_LIBRARIES}
${INIPARSER_LIBRARIES} ${INIPARSER_LIBRARIES}
) )
@ -161,9 +166,20 @@ add_test(
install(TARGETS eressea DESTINATION bin) install(TARGETS eressea DESTINATION bin)
if (SQLITE3_FOUND)
target_link_libraries(eressea ${SQLITE3_LIBRARIES})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_SQLITE")
endif(SQLITE3_FOUND)
if (CURSES_FOUND)
include_directories (${CURSES_INCLUDE_DIR})
target_link_libraries(eressea ${CURSES_LIBRARIES})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_CURSES")
endif(CURSES_FOUND)
if (LIBXML2_FOUND) if (LIBXML2_FOUND)
include_directories (${LIBXML2_INCLUDE_DIR}) include_directories (${LIBXML2_INCLUDE_DIR})
target_link_libraries(eressea ${LIBXML2_LIBRARIES}) target_link_libraries(eressea ${LIBXML2_LIBRARIES})
target_link_libraries(test_eressea ${LIBXML2_LIBRARIES}) target_link_libraries(test_eressea ${LIBXML2_LIBRARIES})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBXML2")
endif (LIBXML2_FOUND) endif (LIBXML2_FOUND)

View File

@ -1179,25 +1179,24 @@ lua_State *lua_init(void) {
lua_State *L = luaL_newstate(); lua_State *L = luaL_newstate();
openlibs(L); openlibs(L);
#ifdef BINDINGS_TOLUA
register_tolua_helpers(); register_tolua_helpers();
tolua_bindings_open(L); tolua_bindings_open(L);
tolua_eressea_open(L); tolua_eressea_open(L);
#ifdef USE_SQLITE
tolua_sqlite_open(L); tolua_sqlite_open(L);
#endif
tolua_unit_open(L); tolua_unit_open(L);
tolua_building_open(L); tolua_building_open(L);
tolua_ship_open(L); tolua_ship_open(L);
tolua_region_open(L); tolua_region_open(L);
tolua_faction_open(L); tolua_faction_open(L);
#ifdef BSON_ATTRIB
tolua_attrib_open(L);
#endif
tolua_unit_open(L); tolua_unit_open(L);
tolua_message_open(L); tolua_message_open(L);
tolua_hashtable_open(L); tolua_hashtable_open(L);
#ifdef USE_CURSES
tolua_gmtool_open(L); tolua_gmtool_open(L);
tolua_storage_open(L);
#endif #endif
tolua_storage_open(L);
return L; return L;
} }

View File

@ -1,3 +1,3 @@
#define VERSION_MAJOR 3 #define VERSION_MAJOR 3
#define VERSION_MINOR 0 #define VERSION_MINOR 0
#define VERSION_BUILD 675 #define VERSION_BUILD 676

View File

@ -52,7 +52,6 @@ ship.c
skill.c skill.c
spellbook.c spellbook.c
spell.c spell.c
sqlite.c
teleport.c teleport.c
terrain.c terrain.c
unit.c unit.c

View File

@ -6,8 +6,8 @@
int first_turn = 0; int first_turn = 0;
int first_month = 0; int first_month = 0;
int weeks_per_month = 0; int weeks_per_month = 4;
int months_per_year = 0; int months_per_year = 12;
char **seasonnames = NULL; char **seasonnames = NULL;
char **weeknames = NULL; char **weeknames = NULL;
char **weeknames2 = NULL; char **weeknames2 = NULL;
@ -28,7 +28,7 @@ const gamedate *get_gamedate(int turn, gamedate * gd)
gd->week = t % weeks_per_month; /* 0 - weeks_per_month-1 */ gd->week = t % weeks_per_month; /* 0 - weeks_per_month-1 */
gd->month = (t / weeks_per_month + first_month) % months_per_year; /* 0 - months_per_year-1 */ gd->month = (t / weeks_per_month + first_month) % months_per_year; /* 0 - months_per_year-1 */
gd->year = t / (weeks_per_year) + 1; gd->year = t / (weeks_per_year) + 1;
gd->season = month_season[gd->month]; gd->season = month_season ? month_season[gd->month] : 0;
return gd; return gd;
} }

View File

@ -25,7 +25,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <kernel/save.h> #include <kernel/save.h>
#include <kernel/version.h> #include <kernel/version.h>
#include "eressea.h" #include "eressea.h"
#ifdef USE_CURSES
#include "gmtool.h" #include "gmtool.h"
#endif
#include "build.h" #include "build.h"
#include "bindings.h" #include "bindings.h"
@ -52,10 +54,10 @@ static void parse_config(const char *filename)
log_debug("reading from configuration file %s\n", filename); log_debug("reading from configuration file %s\n", filename);
memdebug = iniparser_getint(d, "eressea:memcheck", memdebug); memdebug = iniparser_getint(d, "eressea:memcheck", memdebug);
#ifdef USE_CURSES
/* only one value in the [editor] section */ /* only one value in the [editor] section */
force_color = iniparser_getint(d, "editor:color", force_color); force_color = iniparser_getint(d, "editor:color", force_color);
#endif
/* excerpt from [config] (the rest is used in bindings.c) */ /* excerpt from [config] (the rest is used in bindings.c) */
game_name = iniparser_getstring(d, "config:game", game_name); game_name = iniparser_getstring(d, "config:game", game_name);
} else { } else {
@ -105,9 +107,11 @@ static int parse_args(int argc, char **argv, int *exitcode)
"Copyright (C) 1996-2005 C. Schlittchen, K. Zedel, E. Rehling, H. Peters.\n\n" "Copyright (C) 1996-2005 C. Schlittchen, K. Zedel, E. Rehling, H. Peters.\n\n"
"Compilation: " __DATE__ " at " __TIME__ "\nVersion: %d.%d.%d\n\n", "Compilation: " __DATE__ " at " __TIME__ "\nVersion: %d.%d.%d\n\n",
global.gamename, VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD); global.gamename, VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD);
#ifdef USE_CURSES
} else if (strcmp(argv[i] + 2, "color") == 0) { } else if (strcmp(argv[i] + 2, "color") == 0) {
/* force the editor to have colors */ /* force the editor to have colors */
force_color = 1; force_color = 1;
#endif
} else if (strcmp(argv[i] + 2, "help") == 0) { } else if (strcmp(argv[i] + 2, "help") == 0) {
return usage(argv[0], NULL); return usage(argv[0], NULL);
} else { } else {
@ -239,7 +243,6 @@ int main(int argc, char **argv)
{ {
int err, result = 0; int err, result = 0;
lua_State *L; lua_State *L;
setup_signal_handler(); setup_signal_handler();
parse_config(inifile); parse_config(inifile);
log_open(logfile); log_open(logfile);
@ -261,7 +264,6 @@ int main(int argc, char **argv)
register_borders(); register_borders();
register_spells(); register_spells();
bind_monsters(L); bind_monsters(L);
err = eressea_run(L, luafile); err = eressea_run(L, luafile);
if (err) { if (err) {
log_error("server execution failed with code %d\n", err); log_error("server execution failed with code %d\n", err);

View File

@ -19,7 +19,6 @@ filereader.c
functions.c functions.c
goodies.c goodies.c
language.c language.c
listbox.c
lists.c lists.c
log.c log.c
message.c message.c