From a17bb2b9d966ea1f7534fdc2d8da8f5a93665ece Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 27 Feb 2010 20:36:48 +0000 Subject: [PATCH] making shit compile with cmake on unix --- src/CMakeLists.txt | 33 ++++++++++++++++++ src/Jamfile | 11 ------ src/eressea/Jamfile | 38 -------------------- src/eressea/src/main.c | 1 + src/eressea/src/spells/spells.c | 2 +- src/external/bson/bson.c | 1 + src/src/Jamfile | 16 --------- src/src/attributes/Jamfile | 38 -------------------- src/src/build/Jamfile | 62 --------------------------------- src/src/build/malloc.c | 1 - src/src/gamecode/Jamfile | 32 ----------------- src/src/items/Jamfile | 23 ------------ src/src/kernel/Jamfile | 54 ---------------------------- src/src/kernel/config.h | 6 ++-- src/src/kernel/move.c | 3 -- src/src/modules/Jamfile | 28 --------------- src/src/triggers/Jamfile | 29 --------------- src/src/util/Jamfile | 44 ----------------------- src/src/util/console.h | 3 ++ 19 files changed, 42 insertions(+), 383 deletions(-) create mode 100644 src/CMakeLists.txt delete mode 100644 src/Jamfile delete mode 100644 src/eressea/Jamfile delete mode 100644 src/src/Jamfile delete mode 100644 src/src/attributes/Jamfile delete mode 100644 src/src/build/Jamfile delete mode 100644 src/src/build/malloc.c delete mode 100644 src/src/gamecode/Jamfile delete mode 100644 src/src/items/Jamfile delete mode 100644 src/src/kernel/Jamfile delete mode 100644 src/src/modules/Jamfile delete mode 100644 src/src/triggers/Jamfile delete mode 100644 src/src/util/Jamfile diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..f5a854749 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 2.4) +project (eressea) + +if (WIN32) + add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE) +else (WIN32) + include_directories (src /usr/include/lua5.1/ /usr/include/libxml2) + set(CMAKE_C_FLAGS "-g -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts") +endif (WIN32) +include_directories (external) + +set (LIB_SRCS + external/sqlite3.c + external/md5.c + external/bson/bson.c + external/bson/numbers.c + external/dlmalloc/malloc.c + src/build/gamecode.c + src/build/kernel.c + src/build/lib.c + src/build/util.c +) + +set (ERESSEA_SRCS + eressea/src/server.c +) + +add_executable (eressea ${LIB_SRCS} ${ERESSEA_SRCS}) +target_link_libraries (eressea tolua xml2 ncurses lua5.1 pthread) +if (WIN32) +else (WIN32) + target_link_libraries (eressea tolua xml2 ncurses lua5.1 pthread) +endif (WIN32) diff --git a/src/Jamfile b/src/Jamfile deleted file mode 100644 index ab3e0e5ca..000000000 --- a/src/Jamfile +++ /dev/null @@ -1,11 +0,0 @@ -SubDir TOP ; - -if $(BUILDTYPE) = UNITY { -SubInclude TOP eressea ; -} - -if $(BUILDTYPE) = REGULAR { -SubInclude TOP src ; -SubInclude TOP eressea ; -SubInclude TOP tools ; -} \ No newline at end of file diff --git a/src/eressea/Jamfile b/src/eressea/Jamfile deleted file mode 100644 index a7416f710..000000000 --- a/src/eressea/Jamfile +++ /dev/null @@ -1,38 +0,0 @@ -SubDir TOP eressea ; - -TargetDirectory ; -SubDirHdrs $(SUBDIR)/../src/build ; -SubDirHdrs $(SUBDIR)/../src/kernel ; -SubDirHdrs $(SUBDIR)/../src/util ; -SubDirHdrs $(SUBDIR)/../src ; -SubDirHdrs $(SUBDIR)/../external ; -SubDirHdrs $(SUBDIR)/.. ; - -UsingLua ; - -SEARCH_SOURCE += [ FDirName $(TOP) src build ] ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) src ] ; -SubDirC++Flags -DHAVE_LUA ; - -SubDirHdrs $(XMLHDRS) ; - -SERVER = eressea ; - -SERVER_SOURCES = - - - - - - - ; - -libtolua $(SERVER) ; -liblua $(SERVER) ; - -# eressea-server with lua scripting -libxml2 $(SERVER) ; -libcurses $(SERVER) ; - -LINKLIBS on $(SERVER) += -lm -ldl -lstdc++ ; -Main $(SERVER) : $(SERVER_SOURCES) ; diff --git a/src/eressea/src/main.c b/src/eressea/src/main.c index eff4f2321..ebf949f04 100644 --- a/src/eressea/src/main.c +++ b/src/eressea/src/main.c @@ -10,6 +10,7 @@ #include #include +#include static const char * luafile = "init.lua"; static const char * entry_point = NULL; diff --git a/src/eressea/src/spells/spells.c b/src/eressea/src/spells/spells.c index b768e431b..2ecf59358 100644 --- a/src/eressea/src/spells/spells.c +++ b/src/eressea/src/spells/spells.c @@ -2846,7 +2846,7 @@ mk_deathcloud(unit * mage, region * r, double force, int duration) #define COMPAT_DEATHCLOUD #ifdef COMPAT_DEATHCLOUD static int -dc_read_compat(struct attrib * a, const void * target, storage * store) +dc_read_compat(struct attrib * a, void * target, storage * store) /* return AT_READ_OK on success, AT_READ_FAIL if attrib needs removal */ { region * r = NULL; diff --git a/src/external/bson/bson.c b/src/external/bson/bson.c index 834f57261..cd2b71075 100644 --- a/src/external/bson/bson.c +++ b/src/external/bson/bson.c @@ -1,5 +1,6 @@ /* bson.c */ +#include #include "bson.h" #include #include diff --git a/src/src/Jamfile b/src/src/Jamfile deleted file mode 100644 index 566c39d4e..000000000 --- a/src/src/Jamfile +++ /dev/null @@ -1,16 +0,0 @@ -SubDir TOP src ; - -if $(BUILDTYPE) = REGULAR { -SubInclude TOP src kernel ; -SubInclude TOP src gamecode ; -SubInclude TOP src spells ; -SubInclude TOP src races ; -SubInclude TOP src triggers ; -SubInclude TOP src util ; -SubInclude TOP src attributes ; -SubInclude TOP src modules ; -SubInclude TOP src items ; -} else { -# UNITY build -SubInclude TOP src build ; -} diff --git a/src/src/attributes/Jamfile b/src/src/attributes/Jamfile deleted file mode 100644 index 4d191013b..000000000 --- a/src/src/attributes/Jamfile +++ /dev/null @@ -1,38 +0,0 @@ -SubDir TOP src attributes ; - -TargetDirectory ; -SubDirHdrs $(SUBDIR)/../gamecode ; -SubDirHdrs $(SUBDIR)/../kernel ; -SubDirHdrs $(SUBDIR)/../util ; -SubDirHdrs $(SUBDIR)/.. ; -SubDirHdrs $(SUBDIR)/../.. ; - -SOURCES = - alliance.c - attributes.c - fleechance.c - follow.c - giveitem.c - gm.c - hate.c - iceberg.c - key.c - matmod.c - movement.c - moved.c - object.c - option.c - orcification.c - otherfaction.c - overrideroads.c - racename.c - raceprefix.c - reduceproduction.c - targetregion.c - viewrange.c - variable.c - ; - -if $(BUILDTYPE) = REGULAR { -Library attributes : $(SOURCES) ; -} diff --git a/src/src/build/Jamfile b/src/src/build/Jamfile deleted file mode 100644 index 0afff22c8..000000000 --- a/src/src/build/Jamfile +++ /dev/null @@ -1,62 +0,0 @@ -SubDir TOP src build ; - -TargetDirectory ; -SubDirHdrs $(SUBDIR)/../../eressea ; -SubDirHdrs $(SUBDIR)/../../src/gamecode ; -SubDirHdrs $(SUBDIR)/../../src/kernel ; -SubDirHdrs $(SUBDIR)/../../src/util ; -SubDirHdrs $(SUBDIR)/../../src ; -SubDirHdrs $(SUBDIR)/../../tools ; -SubDirHdrs $(SUBDIR)/../../external ; -SubDirHdrs $(SUBDIR)/.. ; - -UsingLua ; - -SEARCH_SOURCE += [ FDirName $(TOP) src iniparser ] ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) curses ] ; -if $(BINDINGS) = LUABIND { - SEARCH_SOURCE += [ FDirName $(SUBDIR) lua ] ; -} -if $(BINDINGS) = TOLUA { - SEARCH_SOURCE += [ FDirName $(SUBDIR) tolua ] ; -} -SubDirC++Flags -DHAVE_LUA ; - -SubDirHdrs $(XMLHDRS) ; - -SERVER = eressea ; - -SERVER_SOURCES = - curses.c - gamecode.c - kernel.c - stdafx.c - util.c - external.c -; - -CCFLAGS += -DSQLITE_THREADSAFE=0 ; - -if $(MSPACES) { - SERVER_SOURCES += malloc.c ; -} - - -if $(BINDINGS) = LUABIND { - SERVER_SOURCES += bindings.cpp ; - libluabind $(SERVER) ; -} -if $(BINDINGS) = TOLUA { - libtolua $(SERVER) ; -} -liblua $(SERVER) ; - -# eressea-server with lua scripting -libxml2 $(SERVER) ; -libcurses $(SERVER) ; -libmcheck $(SERVER) ; - -LINKLIBS on $(SERVER) += -lm -ldl -lstdc++ ; -Main $(SERVER) : $(SERVER_SOURCES) ; - -Main atoi36 : atoi36.c ; diff --git a/src/src/build/malloc.c b/src/src/build/malloc.c deleted file mode 100644 index 36141b5fa..000000000 --- a/src/src/build/malloc.c +++ /dev/null @@ -1 +0,0 @@ -#include "util/dl/malloc.c" diff --git a/src/src/gamecode/Jamfile b/src/src/gamecode/Jamfile deleted file mode 100644 index 8b96dd4e7..000000000 --- a/src/src/gamecode/Jamfile +++ /dev/null @@ -1,32 +0,0 @@ -SubDir TOP src gamecode ; - -TargetDirectory ; -SubDirHdrs $(SUBDIR)/../kernel ; -SubDirHdrs $(SUBDIR)/../util ; -SubDirHdrs $(SUBDIR)/.. ; -SubDirHdrs $(SUBDIR)/../.. ; -SubDirHdrs $(XMLHDRS) ; - -SOURCES = - archetype.c - creation.c - creport.c - economy.c - give.c - items.c - laws.c - luck.c - market.c - monster.c - randenc.c - report.c - spells.c - spy.c - study.c - summary.c - xmlreport.c - ; - -if $(BUILDTYPE) = REGULAR { -Library gamecode : $(SOURCES) ; -} diff --git a/src/src/items/Jamfile b/src/src/items/Jamfile deleted file mode 100644 index 854501024..000000000 --- a/src/src/items/Jamfile +++ /dev/null @@ -1,23 +0,0 @@ -SubDir TOP src items ; - -TargetDirectory ; -SubDirHdrs $(SUBDIR)/../gamecode ; -SubDirHdrs $(SUBDIR)/../kernel ; -SubDirHdrs $(SUBDIR)/../util ; -SubDirHdrs $(SUBDIR)/.. ; -SubDirHdrs $(SUBDIR)/../.. ; -SubDirHdrs $(XMLHDRS) ; - -SOURCES = - artrewards.c - demonseye.c - itemtypes.c - phoenixcompass.c - seed.c - weapons.c - xerewards.c - ; - -if $(BUILDTYPE) = REGULAR { -Library items : $(SOURCES) ; -} diff --git a/src/src/kernel/Jamfile b/src/src/kernel/Jamfile deleted file mode 100644 index e03b858ef..000000000 --- a/src/src/kernel/Jamfile +++ /dev/null @@ -1,54 +0,0 @@ -SubDir TOP src kernel ; - -TargetDirectory ; -SubDirHdrs $(SUBDIR)/../util ; -SubDirHdrs $(SUBDIR)/.. ; -SubDirHdrs $(SUBDIR)/../.. ; -SubDirHdrs $(SUBDIR)/../../external ; -SubDirHdrs $(XMLHDRS) ; - -SOURCES = - alchemy.c - alliance.c - battle.c - build.c - building.c - calendar.c - command.c - connection.c - curse.c - eressea.c - equipment.c - faction.c - group.c - item.c - karma.c - magic.c - message.c - move.c - names.c - order.c - pathfinder.c - plane.c - player.c - pool.c - race.c - region.c - reports.c - resources.c - save.c - ship.c - skill.c - spell.c - sqlite.c - teleport.c - terrain.c - unit.c - xmlreader.c - textstore.c - binarystore.c - ; - -if $(BUILDTYPE) = REGULAR { -Library kernel : $(SOURCES) ; -} diff --git a/src/src/kernel/config.h b/src/src/kernel/config.h index b4fb4adb5..918e56908 100644 --- a/src/src/kernel/config.h +++ b/src/src/kernel/config.h @@ -28,7 +28,7 @@ extern "C" { /* this should always be the first thing included after platform.h */ #include "types.h" -typedef struct _dictionary_ dictionary; +struct _dictionary_; /* experimental gameplay features (that don't affect the savefile) */ /* TODO: move these settings to settings.h or into configuration files */ @@ -366,7 +366,7 @@ extern void set_datapath(const char * path); extern const char * basepath(void); extern void set_basepath(const char *); -void load_inifile(dictionary * d); +void load_inifile(struct _dictionary_ * d); extern const char * reportpath(void); extern void set_reportpath(const char *); @@ -392,7 +392,7 @@ typedef struct settings { void * vm_state; float producexpchance; int cookie; - dictionary * inifile; + struct _dictionary_ * inifile; struct global_functions { int (*wage)(const struct region *r, const struct faction * f, const struct race * rc, int in_turn); diff --git a/src/src/kernel/move.c b/src/src/kernel/move.c index 7d6320481..4a12e6af1 100644 --- a/src/src/kernel/move.c +++ b/src/src/kernel/move.c @@ -677,9 +677,6 @@ ship_allowed(const struct ship * sh, const region * r) static boolean flying_ship(const ship * sh) { - static int init = 0; - static const curse_type * ct_flyingship; - if (sh->type->flags & SFL_FLY) return true; if (sh->flags & SF_FLYING) return true; return false; diff --git a/src/src/modules/Jamfile b/src/src/modules/Jamfile deleted file mode 100644 index a346a77a1..000000000 --- a/src/src/modules/Jamfile +++ /dev/null @@ -1,28 +0,0 @@ -SubDir TOP src modules ; - -TargetDirectory ; -SubDirHdrs $(SUBDIR)/../gamecode ; -SubDirHdrs $(SUBDIR)/../kernel ; -SubDirHdrs $(SUBDIR)/../util ; -SubDirHdrs $(SUBDIR)/.. ; -SubDirHdrs $(SUBDIR)/../.. ; -SubDirHdrs $(XMLHDRS) ; - -SOURCES = - arena.c - autoseed.c - dungeon.c - gmcmd.c - infocmd.c - museum.c - score.c - weather.c - wormhole.c - xecmd.c - xmas.c - ; - - -if $(BUILDTYPE) = REGULAR { -Library modules : $(SOURCES) ; -} diff --git a/src/src/triggers/Jamfile b/src/src/triggers/Jamfile deleted file mode 100644 index cacf7a025..000000000 --- a/src/src/triggers/Jamfile +++ /dev/null @@ -1,29 +0,0 @@ -SubDir TOP src triggers ; - -TargetDirectory ; -SubDirHdrs $(SUBDIR)/../gamecode ; -SubDirHdrs $(SUBDIR)/../kernel ; -SubDirHdrs $(SUBDIR)/../util ; -SubDirHdrs $(SUBDIR)/.. ; -SubDirHdrs $(SUBDIR)/../.. ; - -SOURCES = - changefaction.c - changerace.c - clonedied.c - createcurse.c - createunit.c - gate.c - giveitem.c - killunit.c - removecurse.c - shock.c - timeout.c - triggers.c - unguard.c - unitmessage.c - ; - -if $(BUILDTYPE) = REGULAR { -Library triggers : $(SOURCES) ; -} diff --git a/src/src/util/Jamfile b/src/src/util/Jamfile deleted file mode 100644 index 997d4f958..000000000 --- a/src/src/util/Jamfile +++ /dev/null @@ -1,44 +0,0 @@ -SubDir TOP src util ; - -TargetDirectory ; -SubDirHdrs $(SUBDIR)/.. ; -SubDirHdrs $(SUBDIR)/../.. ; -SubDirHdrs $(XMLHDRS) ; - -SEARCH_SOURCE += - [ FDirName $(SUBDIR) dl ] ; - -SOURCES = - attrib.c - base36.c - bsdstring.c - crmessage.c - cvector.c - dice.c - event.c - filereader.c - functions.c - goodies.c - language.c - lists.c - log.c - message.c - nrmessage.c - parser.c - rand.c - resolve.c - sql.c - strncpy.c - translation.c - umlaut.c - unicode.c - xml.c - ; - -SOURCES += mt19937ar.c ; - -if $(MSPACES) { - SOURCES +=
malloc.c ; -} - -Library util : $(SOURCES) ; diff --git a/src/src/util/console.h b/src/src/util/console.h index 4c41e5a58..bd0c6a409 100644 --- a/src/src/util/console.h +++ b/src/src/util/console.h @@ -7,6 +7,8 @@ * prior permission by the authors of Eressea. **/ +#ifndef H_LUA_CONSOLE +#define H_LUA_CONSOLE #ifdef __cplusplus extern "C" { #endif @@ -23,3 +25,4 @@ extern "C" { } #endif +#endif