making shit compile with cmake on unix

This commit is contained in:
Enno Rehling 2010-02-27 20:36:48 +00:00
parent c8a8c0f862
commit a17bb2b9d9
19 changed files with 42 additions and 383 deletions

33
src/CMakeLists.txt Normal file
View file

@ -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)

View file

@ -1,11 +0,0 @@
SubDir TOP ;
if $(BUILDTYPE) = UNITY {
SubInclude TOP eressea ;
}
if $(BUILDTYPE) = REGULAR {
SubInclude TOP src ;
SubInclude TOP eressea ;
SubInclude TOP tools ;
}

View file

@ -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 =
<build!external.c>
<build!gamecode.c>
<build!kernel.c>
<build!lib.c>
<build!util.c>
<src!server.c>
;
libtolua $(SERVER) ;
liblua $(SERVER) ;
# eressea-server with lua scripting
libxml2 $(SERVER) ;
libcurses $(SERVER) ;
LINKLIBS on $(SERVER) += -lm -ldl -lstdc++ ;
Main $(SERVER) : $(SERVER_SOURCES) ;

View file

@ -10,6 +10,7 @@
#include <assert.h>
#include <locale.h>
#include <wctype.h>
static const char * luafile = "init.lua";
static const char * entry_point = NULL;

View file

@ -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;

View file

@ -1,5 +1,6 @@
/* bson.c */
#include <stddef.h>
#include "bson.h"
#include <stdlib.h>
#include <string.h>

View file

@ -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 ;
}

View file

@ -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) ;
}

View file

@ -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 ;

View file

@ -1 +0,0 @@
#include "util/dl/malloc.c"

View file

@ -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) ;
}

View file

@ -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) ;
}

View file

@ -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) ;
}

View file

@ -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);

View file

@ -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;

View file

@ -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) ;
}

View file

@ -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) ;
}

View file

@ -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 += <dl>malloc.c ;
}
Library util : $(SOURCES) ;

View file

@ -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