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)
find_package (LibXml2)
if (LIBXML2_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBXML2")
endif(LIBXML2_FOUND)
find_package (SQLite3 REQUIRED)
find_package (Curses REQUIRED)
find_package (SQLite3)
find_package (Curses)
find_package (Lua REQUIRED)
find_package (ToLua REQUIRED)

View File

@ -9,10 +9,6 @@ ELSE(CMAKE_COMPILER_IS_GNUCC)
MESSAGE(STATUS "Unknown compiler ${CMAKE_C_COMPILER_ID}")
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 (${CRITBIT_INCLUDE_DIR})
include_directories (${CJSON_INCLUDE_DIR})
@ -23,7 +19,6 @@ include_directories (${CUTEST_INCLUDE_DIR})
include_directories (${LUA_INCLUDE_DIR})
include_directories (${BSON_INCLUDE_DIR})
include_directories (${INIPARSER_INCLUDE_DIR})
include_directories (${CURSES_INCLUDE_DIR})
add_subdirectory(util)
add_subdirectory(kernel)
@ -58,10 +53,7 @@ TOLUA_BINDING(eressea.pkg bind_eressea.h)
TOLUA_BINDING(settings.pkg bind_settings.h)
ENDIF()
set (SERVER_SRC
process.pkg.c
eressea.pkg.c
settings.pkg.c
set (ERESSEA_SRC
eressea.c
json.c
creation.c
@ -77,25 +69,7 @@ set (SERVER_SRC
spy.c
study.c
summary.c
# xmlreport.c
gmtool.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}
${RACES_SRC}
${ITEMS_SRC}
@ -106,21 +80,54 @@ set (SERVER_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)
target_link_libraries(eressea
${LUA_LIBRARIES}
${TOLUA_LIBRARIES}
${LUA_LIBRARIES}
${QUICKLIST_LIBRARIES}
${STORAGE_LIBRARIES}
${SQLITE3_LIBRARIES}
${CRITBIT_LIBRARIES}
${CRYPTO_LIBRARIES}
${CJSON_LIBRARIES}
${CURSES_LIBRARIES}
${INIPARSER_LIBRARIES}
)
)
set(SERVER_TEST_SRC
set(TESTS_SRC
test_eressea.c
tests.c
tests_test.c
@ -130,20 +137,18 @@ set(SERVER_TEST_SRC
laws_test.c
${UTIL_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
${LUA_LIBRARIES}
${TOLUA_LIBRARIES}
${QUICKLIST_LIBRARIES}
${STORAGE_LIBRARIES}
${SQLITE3_LIBRARIES}
${CRITBIT_LIBRARIES}
${CRYPTO_LIBRARIES}
${CJSON_LIBRARIES}
${CURSES_LIBRARIES}
${INIPARSER_LIBRARIES}
)
@ -161,9 +166,20 @@ add_test(
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)
include_directories (${LIBXML2_INCLUDE_DIR})
target_link_libraries(eressea ${LIBXML2_LIBRARIES})
target_link_libraries(test_eressea ${LIBXML2_LIBRARIES})
endif(LIBXML2_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBXML2")
endif (LIBXML2_FOUND)

View File

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

View File

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

View File

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

View File

@ -6,8 +6,8 @@
int first_turn = 0;
int first_month = 0;
int weeks_per_month = 0;
int months_per_year = 0;
int weeks_per_month = 4;
int months_per_year = 12;
char **seasonnames = NULL;
char **weeknames = 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->month = (t / weeks_per_month + first_month) % months_per_year; /* 0 - months_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;
}

View File

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

View File

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