2012-06-04 08:39:32 +02:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
2012-06-04 03:55:52 +02:00
|
|
|
project (server C)
|
|
|
|
|
2014-02-18 05:45:00 +01:00
|
|
|
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
|
2012-06-04 03:55:52 +02:00
|
|
|
include_directories (${CRITBIT_INCLUDE_DIR})
|
2014-03-06 16:15:43 +01:00
|
|
|
include_directories (${CJSON_INCLUDE_DIR})
|
2013-12-31 10:06:28 +01:00
|
|
|
include_directories (${STORAGE_INCLUDE_DIR})
|
2012-06-04 03:55:52 +02:00
|
|
|
include_directories (${CRYPTO_INCLUDE_DIR})
|
|
|
|
include_directories (${QUICKLIST_INCLUDE_DIR})
|
|
|
|
include_directories (${CUTEST_INCLUDE_DIR})
|
|
|
|
include_directories (${LUA_INCLUDE_DIR})
|
2015-07-12 03:08:29 +02:00
|
|
|
include_directories (${TOLUA_INCLUDE_DIR})
|
2012-06-04 03:55:52 +02:00
|
|
|
include_directories (${BSON_INCLUDE_DIR})
|
|
|
|
include_directories (${INIPARSER_INCLUDE_DIR})
|
|
|
|
|
2015-06-01 08:04:46 +02:00
|
|
|
IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
|
2015-05-17 17:52:41 +02:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wno-sign-conversion")
|
2015-05-20 07:30:59 +02:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wsign-compare -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
|
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unused-but-set-variable")
|
2014-08-29 07:47:47 +02:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL")
|
2015-06-01 08:04:46 +02:00
|
|
|
ELSEIF(MSVC)
|
2015-05-12 23:28:25 +02:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall /WX /MP")
|
2014-08-29 07:47:47 +02:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_DEBUG
|
|
|
|
"${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrt.lib")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE
|
|
|
|
"${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib")
|
2015-06-01 08:04:46 +02:00
|
|
|
ELSE()
|
|
|
|
MESSAGE(STATUS "unknown compiler ${CMAKE_C_COMPILER_ID}")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
IF(CMAKE_COMPILER_IS_CLANG)
|
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wtautological-compare -Weverything")
|
|
|
|
MESSAGE(STATUS "compiler is clang: ${CMAKE_C_COMPILER_ID}")
|
|
|
|
ELSEIF(CMAKE_COMPILER_IS_GCC)
|
|
|
|
EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
|
|
|
OUTPUT_VARIABLE GCC_VERSION)
|
|
|
|
IF (GCC_VERSION VERSION_GREATER 4.9)
|
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-conversion")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF(CMAKE_COMPILER_IS_CLANG)
|
2014-08-29 07:47:47 +02:00
|
|
|
|
2014-02-18 05:45:00 +01:00
|
|
|
add_subdirectory(util)
|
|
|
|
add_subdirectory(kernel)
|
|
|
|
add_subdirectory(items)
|
|
|
|
add_subdirectory(attributes)
|
|
|
|
add_subdirectory(spells)
|
|
|
|
add_subdirectory(triggers)
|
|
|
|
add_subdirectory(modules)
|
|
|
|
add_subdirectory(races)
|
|
|
|
|
2014-02-22 09:30:20 +01:00
|
|
|
MACRO(ADD_LUA_MODULE MODULE_NAME FILES)
|
|
|
|
ADD_LIBRARY (${MODULE_NAME} SHARED ${FILES})
|
|
|
|
SET_TARGET_PROPERTIES(${MODULE_NAME}
|
|
|
|
PROPERTIES
|
|
|
|
PREFIX ""
|
|
|
|
)
|
|
|
|
ENDMACRO(ADD_LUA_MODULE)
|
|
|
|
|
|
|
|
MACRO(TOLUA_BINDING PKGFILE FILES)
|
|
|
|
ADD_CUSTOM_COMMAND(
|
2014-03-08 10:28:15 +01:00
|
|
|
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${PKGFILE}.c
|
2014-02-22 09:30:20 +01:00
|
|
|
DEPENDS ${FILES} ${PKGFILE}
|
|
|
|
COMMAND ${TOLUA_EXECUTABLE}
|
2014-03-08 10:28:15 +01:00
|
|
|
ARGS -o ${CMAKE_CURRENT_SOURCE_DIR}/${PKGFILE}.c ${PKGFILE}
|
2014-02-22 09:30:20 +01:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
)
|
|
|
|
ENDMACRO(TOLUA_BINDING)
|
|
|
|
|
2014-03-08 13:28:04 +01:00
|
|
|
IF(NOT MSVC)
|
2014-06-13 22:02:03 +02:00
|
|
|
TOLUA_BINDING(log.pkg util/log.h)
|
2014-06-14 16:52:32 +02:00
|
|
|
TOLUA_BINDING(locale.pkg bind_locale.h)
|
2014-06-13 02:34:57 +02:00
|
|
|
TOLUA_BINDING(config.pkg bind_config.h)
|
2014-02-22 09:30:20 +01:00
|
|
|
TOLUA_BINDING(process.pkg bind_process.h)
|
2014-06-21 16:34:36 +02:00
|
|
|
TOLUA_BINDING(game.pkg bind_eressea.h config.h)
|
2014-02-22 09:30:20 +01:00
|
|
|
TOLUA_BINDING(eressea.pkg bind_eressea.h)
|
|
|
|
TOLUA_BINDING(settings.pkg bind_settings.h)
|
2014-03-08 13:28:04 +01:00
|
|
|
ENDIF()
|
2014-02-22 09:30:20 +01:00
|
|
|
|
2014-06-12 05:30:34 +02:00
|
|
|
set (ERESSEA_SRC
|
2014-08-27 06:40:18 +02:00
|
|
|
move.c
|
2014-08-27 21:09:39 +02:00
|
|
|
spells.c
|
2014-08-27 06:40:18 +02:00
|
|
|
battle.c
|
|
|
|
alchemy.c
|
2014-08-31 08:58:55 +02:00
|
|
|
upkeep.c
|
2014-08-27 21:09:39 +02:00
|
|
|
vortex.c
|
2014-08-27 06:40:18 +02:00
|
|
|
names.c
|
2014-12-17 17:22:26 +01:00
|
|
|
lighthouse.c
|
2014-08-27 06:40:18 +02:00
|
|
|
reports.c
|
2015-09-08 09:56:56 +02:00
|
|
|
seen.c
|
2014-02-18 05:45:00 +01:00
|
|
|
eressea.c
|
2014-07-03 14:10:53 +02:00
|
|
|
callback.c
|
2014-06-16 03:34:39 +02:00
|
|
|
direction.c
|
|
|
|
keyword.c
|
2014-06-21 08:59:04 +02:00
|
|
|
skill.c
|
2014-03-15 06:30:07 +01:00
|
|
|
json.c
|
2014-02-18 05:45:00 +01:00
|
|
|
creport.c
|
2015-03-29 14:03:56 +02:00
|
|
|
jsreport.c
|
2014-02-18 05:45:00 +01:00
|
|
|
economy.c
|
|
|
|
give.c
|
|
|
|
items.c
|
|
|
|
laws.c
|
2014-11-01 12:57:01 +01:00
|
|
|
magic.c
|
2014-02-18 05:45:00 +01:00
|
|
|
market.c
|
2014-12-10 19:04:02 +01:00
|
|
|
morale.c
|
2014-02-18 05:45:00 +01:00
|
|
|
monster.c
|
|
|
|
randenc.c
|
2014-12-13 11:30:34 +01:00
|
|
|
chaos.c
|
2014-02-18 05:45:00 +01:00
|
|
|
report.c
|
|
|
|
spy.c
|
|
|
|
study.c
|
|
|
|
summary.c
|
2015-08-18 18:57:04 +02:00
|
|
|
travelthru.c
|
2012-06-05 06:45:25 +02:00
|
|
|
monsters.c
|
2014-09-29 23:19:59 +02:00
|
|
|
wormhole.c
|
2014-02-18 05:45:00 +01:00
|
|
|
${SPELLS_SRC}
|
|
|
|
${RACES_SRC}
|
|
|
|
${ITEMS_SRC}
|
|
|
|
${MODULES_SRC}
|
|
|
|
${TRIGGERS_SRC}
|
|
|
|
${ATTRIBUTES_SRC}
|
|
|
|
${KERNEL_SRC}
|
|
|
|
${UTIL_SRC}
|
2012-06-05 06:45:25 +02:00
|
|
|
)
|
|
|
|
|
2014-06-12 05:30:34 +02:00
|
|
|
set(SERVER_SRC
|
2014-06-12 06:25:24 +02:00
|
|
|
main.c
|
2014-07-26 22:52:25 +02:00
|
|
|
building_action.c
|
2014-06-12 06:25:24 +02:00
|
|
|
console.c
|
2014-06-12 05:30:34 +02:00
|
|
|
helpers.c
|
2014-08-14 19:39:17 +02:00
|
|
|
bind_tolua.c
|
2014-06-12 05:30:34 +02:00
|
|
|
bind_building.c
|
2014-06-13 02:34:57 +02:00
|
|
|
bind_config.c
|
2014-06-14 16:52:32 +02:00
|
|
|
bind_locale.c
|
2014-06-12 05:30:34 +02:00
|
|
|
bind_eressea.c
|
|
|
|
bind_faction.c
|
2015-01-17 13:22:26 +01:00
|
|
|
bind_dict.c
|
2014-06-12 05:30:34 +02:00
|
|
|
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
|
2015-01-10 17:27:18 +01:00
|
|
|
)
|
2014-06-12 05:30:34 +02:00
|
|
|
|
|
|
|
if (SQLITE3_FOUND)
|
2015-01-10 17:27:18 +01:00
|
|
|
set (SERVER_SRC ${SERVER_SRC}
|
2014-06-12 05:30:34 +02:00
|
|
|
sqlite.c
|
|
|
|
bind_sqlite.c
|
2015-01-10 17:27:18 +01:00
|
|
|
)
|
2014-06-12 05:30:34 +02:00
|
|
|
endif (SQLITE3_FOUND)
|
|
|
|
|
|
|
|
if (CURSES_FOUND)
|
2015-01-10 17:27:18 +01:00
|
|
|
set (SERVER_SRC ${SERVER_SRC}
|
2014-06-12 05:30:34 +02:00
|
|
|
gmtool.c
|
|
|
|
listbox.c
|
|
|
|
bind_gmtool.c
|
2015-01-10 17:27:18 +01:00
|
|
|
)
|
2014-06-12 05:30:34 +02:00
|
|
|
endif(CURSES_FOUND)
|
|
|
|
|
2015-01-10 17:27:18 +01:00
|
|
|
add_library(game ${ERESSEA_SRC})
|
2014-06-12 06:25:24 +02:00
|
|
|
add_executable(eressea ${SERVER_SRC})
|
2014-02-18 05:45:00 +01:00
|
|
|
target_link_libraries(eressea
|
2015-01-10 17:27:18 +01:00
|
|
|
game
|
2014-02-18 05:45:00 +01:00
|
|
|
${TOLUA_LIBRARIES}
|
2014-06-12 05:30:34 +02:00
|
|
|
${LUA_LIBRARIES}
|
2014-02-18 05:45:00 +01:00
|
|
|
${QUICKLIST_LIBRARIES}
|
|
|
|
${STORAGE_LIBRARIES}
|
|
|
|
${CRITBIT_LIBRARIES}
|
|
|
|
${CRYPTO_LIBRARIES}
|
2014-03-06 16:15:43 +01:00
|
|
|
${CJSON_LIBRARIES}
|
2014-02-18 05:45:00 +01:00
|
|
|
${INIPARSER_LIBRARIES}
|
2014-06-12 05:30:34 +02:00
|
|
|
)
|
2014-02-18 05:45:00 +01:00
|
|
|
|
2014-06-12 05:30:34 +02:00
|
|
|
set(TESTS_SRC
|
2014-09-29 23:19:59 +02:00
|
|
|
wormhole.test.c
|
2015-08-27 13:19:58 +02:00
|
|
|
alchemy.test.c
|
2014-02-18 05:45:00 +01:00
|
|
|
test_eressea.c
|
|
|
|
tests.c
|
2014-08-27 06:40:18 +02:00
|
|
|
battle.test.c
|
2014-08-29 07:47:47 +02:00
|
|
|
vortex.test.c
|
2014-06-16 17:01:59 +02:00
|
|
|
tests.test.c
|
2014-08-27 06:40:18 +02:00
|
|
|
reports.test.c
|
2015-09-08 10:00:51 +02:00
|
|
|
seen.test.c
|
2015-08-19 14:37:51 +02:00
|
|
|
travelthru.test.c
|
2014-07-03 14:10:53 +02:00
|
|
|
callback.test.c
|
2014-06-16 17:01:59 +02:00
|
|
|
direction.test.c
|
|
|
|
economy.test.c
|
2014-08-31 08:58:55 +02:00
|
|
|
json.test.c
|
|
|
|
keyword.test.c
|
2014-11-03 08:40:58 +01:00
|
|
|
give.test.c
|
2014-06-16 17:01:59 +02:00
|
|
|
laws.test.c
|
2014-11-01 12:57:01 +01:00
|
|
|
magic.test.c
|
2014-08-31 08:58:55 +02:00
|
|
|
market.test.c
|
|
|
|
move.test.c
|
|
|
|
skill.test.c
|
2015-05-06 17:36:20 +02:00
|
|
|
spells.test.c
|
2015-01-18 17:40:54 +01:00
|
|
|
spy.test.c
|
2015-07-09 13:24:21 +02:00
|
|
|
study.test.c
|
2015-05-06 17:36:20 +02:00
|
|
|
upkeep.test.c
|
2015-07-07 20:23:24 +02:00
|
|
|
spells/magicresistance.test.c
|
2014-11-01 12:09:56 +01:00
|
|
|
${ATTRIBUTES_TESTS}
|
2014-02-18 05:45:00 +01:00
|
|
|
${UTIL_TESTS}
|
|
|
|
${KERNEL_TESTS}
|
2015-05-24 07:17:23 +02:00
|
|
|
${ITEMS_TESTS}
|
2014-02-18 05:45:00 +01:00
|
|
|
)
|
|
|
|
|
2014-06-12 05:30:34 +02:00
|
|
|
add_executable(test_eressea ${TESTS_SRC})
|
2014-02-18 05:45:00 +01:00
|
|
|
target_link_libraries(test_eressea
|
2015-01-10 17:27:18 +01:00
|
|
|
game
|
|
|
|
${CUTEST_LIBRARIES}
|
2014-02-18 05:45:00 +01:00
|
|
|
${LUA_LIBRARIES}
|
|
|
|
${QUICKLIST_LIBRARIES}
|
|
|
|
${STORAGE_LIBRARIES}
|
|
|
|
${CRITBIT_LIBRARIES}
|
|
|
|
${CRYPTO_LIBRARIES}
|
2014-03-06 16:15:43 +01:00
|
|
|
${CJSON_LIBRARIES}
|
2014-02-18 05:45:00 +01:00
|
|
|
${INIPARSER_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_test(server test_eressea)
|
2014-08-07 13:23:11 +02:00
|
|
|
#add_test(NAME E3
|
|
|
|
# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/game-e3
|
|
|
|
# COMMAND $<TARGET_FILE:eressea> runtests.lua )
|
|
|
|
#add_test(NAME E2
|
|
|
|
# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/game-e2
|
|
|
|
# COMMAND $<TARGET_FILE:eressea> runtests.lua )
|
2014-03-02 21:20:49 +01:00
|
|
|
|
2014-07-17 15:55:50 +02:00
|
|
|
install(TARGETS eressea DESTINATION "bin")
|
2014-06-10 04:04:11 +02:00
|
|
|
|
2014-06-12 05:30:34 +02:00
|
|
|
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)
|
|
|
|
|
2014-06-10 04:04:11 +02:00
|
|
|
if (LIBXML2_FOUND)
|
|
|
|
include_directories (${LIBXML2_INCLUDE_DIR})
|
|
|
|
target_link_libraries(eressea ${LIBXML2_LIBRARIES})
|
|
|
|
target_link_libraries(test_eressea ${LIBXML2_LIBRARIES})
|
2014-06-12 05:30:34 +02:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBXML2")
|
|
|
|
endif (LIBXML2_FOUND)
|