From 599b4a83114d5f6c3e77574582261211b0427ee4 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 8 Apr 2017 22:07:12 +0200 Subject: [PATCH 1/6] BUG 2318: disable ponnuki --- scripts/eressea/e2/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/eressea/e2/init.lua b/scripts/eressea/e2/init.lua index 722078741..9407b2390 100644 --- a/scripts/eressea/e2/init.lua +++ b/scripts/eressea/e2/init.lua @@ -9,7 +9,7 @@ return { require('eressea.wedding'), require('eressea.embassy'), require('eressea.tunnels'), - require('eressea.ponnuki'), +-- require('eressea.ponnuki'), require('eressea.astral'), -- require('eressea.locales'), require('eressea.jsreport'), From aebc7d4cac56969f0d03586dfb951badd14ab6bf Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 9 Apr 2017 13:40:42 +0200 Subject: [PATCH 3/6] BUG 2138: Ponnuki is dead, long live Ponnuki https://bugs.eressea.de/view.php?id=2318 --- scripts/eressea/ponnuki.lua | 23 ++++++++++++++++------- src/kernel/config.c | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/scripts/eressea/ponnuki.lua b/scripts/eressea/ponnuki.lua index 96bb0b5f1..29f882ab5 100644 --- a/scripts/eressea/ponnuki.lua +++ b/scripts/eressea/ponnuki.lua @@ -14,8 +14,10 @@ local function ponnuki_brain(u) u:add_notice("Eine Botschaft von " .. tostring(u) .. ": " ..jokes[i]) local d = math.random(6) local r = u.region:next(d-1) - u:clear_orders() - u:add_order("NACH " .. directions[d]) + if r.terrain == 'glacier' then + u:clear_orders() + u:add_order("NACH " .. directions[d]) + end end function ponnuki.init() @@ -26,11 +28,18 @@ function ponnuki.init() local home = get_region(-67, -5) local f = get_faction(666) if home and f then - u = unit.create(f, home, 1, "illusion") - u.id = atoi36("ponn") - u.name = "Ponnuki" - u.info = "Go, Ponnuki, Go!" - u:set_racename("Ritter von Go") + if home.terrain~="glacier" then + home.terrain="glacier" + home.name = 'Magrathea' + end + u = unit.create(f, home, 1, "template") + if u then + u.id = atoi36("ponn") + u.name = "Ponnuki" + u.info = "Go, Ponnuki, Go!" + u.race_name = "Ritter von Go" + print(u:show()) + end else eressea.log.error("Ponnuki cannot find Magrathea") end diff --git a/src/kernel/config.c b/src/kernel/config.c index a18fc6494..bf61c8f02 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -123,7 +123,7 @@ const char *parameters[MAXPARAMS] = { "TEMP", "FLIEHE", "GEBAEUDE", - "GIB", /* F�r HELFE */ + "GIB", /* HELFE GIB */ "KAEMPFE", "DURCHREISE", "BEWACHE", From 7e4f55a1ac28c2e66ebed517a789e75bb94082a0 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 22 Apr 2017 13:53:06 +0200 Subject: [PATCH 4/6] enable ponnuki --- cJSON | 2 +- iniparser | 2 +- scripts/eressea/e2/init.lua | 2 +- storage | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cJSON b/cJSON index 43c04ad61..22a4fc9be 160000 --- a/cJSON +++ b/cJSON @@ -1 +1 @@ -Subproject commit 43c04ad61258ec3d54a2167eb3a43915bd003ab1 +Subproject commit 22a4fc9be31f0426e622f5bc9ebd7a1550845001 diff --git a/iniparser b/iniparser index ecf956b98..22741d9ce 160000 --- a/iniparser +++ b/iniparser @@ -1 +1 @@ -Subproject commit ecf956b9808c28c2db52e6b73930f57876dbb258 +Subproject commit 22741d9ce9d19bf7b5f5a219b6ed0925259a4d1b diff --git a/scripts/eressea/e2/init.lua b/scripts/eressea/e2/init.lua index 9407b2390..722078741 100644 --- a/scripts/eressea/e2/init.lua +++ b/scripts/eressea/e2/init.lua @@ -9,7 +9,7 @@ return { require('eressea.wedding'), require('eressea.embassy'), require('eressea.tunnels'), --- require('eressea.ponnuki'), + require('eressea.ponnuki'), require('eressea.astral'), -- require('eressea.locales'), require('eressea.jsreport'), diff --git a/storage b/storage index 2117191d4..d807ef5ce 160000 --- a/storage +++ b/storage @@ -1 +1 @@ -Subproject commit 2117191d4ad75e1eb14809878bc71d15b20a5d86 +Subproject commit d807ef5ce64b3425b31fb440e0b93a4d233f517a From 758af589e528e1617095f085744a1ff8703ab1c9 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 22 Apr 2017 18:01:49 +0200 Subject: [PATCH 5/6] remove cmake as a submodule --- .gitmodules | 3 --- cmake | 1 - 2 files changed, 4 deletions(-) delete mode 160000 cmake diff --git a/.gitmodules b/.gitmodules index 7dff5ab6a..4d903c57f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "lunit"] path = lunit url = https://github.com/ennorehling/lunit.git -[submodule "cmake"] - path = cmake - url = https://github.com/ennorehling/cmake.git [submodule "dlmalloc"] path = dlmalloc url = https://github.com/ennorehling/dlmalloc.git diff --git a/cmake b/cmake deleted file mode 160000 index f1fb3943a..000000000 --- a/cmake +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f1fb3943ace59994d90d71a891b80033dc2700a2 From e938350acd3dd561466a8185216c953124ef7243 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 22 Apr 2017 18:07:09 +0200 Subject: [PATCH 6/6] add cmake as part of main project --- CMakeLists.txt | 24 ++++- cmake/Modules/FindLua.cmake | 172 ++++++++++++++++++++++++++++++++ cmake/Modules/FindSQLite3.cmake | 63 ++++++++++++ cmake/Modules/FindToLua.cmake | 71 +++++++++++++ cmake/Modules/MSVC.cmake | 19 ++++ s/build | 2 +- s/cmake-init | 6 +- 7 files changed, 348 insertions(+), 9 deletions(-) create mode 100644 cmake/Modules/FindLua.cmake create mode 100644 cmake/Modules/FindSQLite3.cmake create mode 100644 cmake/Modules/FindToLua.cmake create mode 100644 cmake/Modules/MSVC.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 405b86a03..d9ac81e80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,29 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8) +project (eressea-server C) +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH}) + if (WIN32) FILE(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH ) FILE(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH ) endif(WIN32) -project (eressea-server C) +if (MSVC) +include(MSVC) +endif (MSVC) -enable_testing() -find_package (LibXml2) find_package (SQLite3) find_package (Curses) -find_package (Lua REQUIRED) +find_package (LibXml2) find_package (ToLua REQUIRED) +if (TOLUA_FOUND) +if (${TOLUA_VERSION_STRING} VERSION_GREATER "5.2") +find_package (Lua 5.2 REQUIRED) +elseif (${TOLUA_VERSION_STRING} VERSION_GREATER "5.1") +find_package (Lua 5.1 REQUIRED) +endif() +endif(TOLUA_FOUND) + +enable_testing() add_subdirectory (cJSON) add_subdirectory (storage) @@ -19,8 +31,10 @@ add_subdirectory (iniparser) add_subdirectory (clibs) add_subdirectory (process) add_subdirectory (src eressea) + install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.xml") install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.json") install(DIRECTORY scripts DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.lua") install(DIRECTORY lunit DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.lua") install(DIRECTORY share DESTINATION ${CMAKE_INSTALL_PREFIX}) + diff --git a/cmake/Modules/FindLua.cmake b/cmake/Modules/FindLua.cmake new file mode 100644 index 000000000..898ccbfd6 --- /dev/null +++ b/cmake/Modules/FindLua.cmake @@ -0,0 +1,172 @@ +#.rst: +# FindLua +# ------- +# +# +# +# Locate Lua library This module defines +# +# :: +# +# LUA_FOUND - if false, do not try to link to Lua +# LUA_LIBRARIES - both lua and lualib +# LUA_INCLUDE_DIR - where to find lua.h +# LUA_VERSION_STRING - the version of Lua found +# LUA_VERSION_MAJOR - the major version of Lua +# LUA_VERSION_MINOR - the minor version of Lua +# LUA_VERSION_PATCH - the patch version of Lua +# +# +# +# Note that the expected include convention is +# +# :: +# +# #include "lua.h" +# +# and not +# +# :: +# +# #include +# +# This is because, the lua location is not standardized and may exist in +# locations other than lua/ + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# Copyright 2013 Rolf Eike Beer +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +unset(_lua_include_subdirs) +unset(_lua_library_names) + +# this is a function only to have all the variables inside go away automatically +function(set_lua_version_vars) + set(LUA_VERSIONS5 5.3 5.2 5.1 5.0) + + if (Lua_FIND_VERSION_EXACT) + if (Lua_FIND_VERSION_COUNT GREATER 1) + set(lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR}) + endif () + elseif (Lua_FIND_VERSION) + # once there is a different major version supported this should become a loop + if (NOT Lua_FIND_VERSION_MAJOR GREATER 5) + if (Lua_FIND_VERSION_COUNT EQUAL 1) + set(lua_append_versions ${LUA_VERSIONS5}) + else () + foreach (subver IN LISTS LUA_VERSIONS5) + if (NOT subver VERSION_LESS ${Lua_FIND_VERSION}) + list(APPEND lua_append_versions ${subver}) + endif () + endforeach () + endif () + endif () + else () + # once there is a different major version supported this should become a loop + set(lua_append_versions ${LUA_VERSIONS5}) + endif () + + foreach (ver IN LISTS lua_append_versions) + string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}") + list(APPEND _lua_include_subdirs + include/lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} + include/lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + include/lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + ) + list(APPEND _lua_library_names + lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} + lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + lua.${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + ) + endforeach () + + set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) + set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE) +endfunction(set_lua_version_vars) + +set_lua_version_vars() + +find_path(LUA_INCLUDE_DIR lua.h + HINTS + ENV LUA_DIR + PATH_SUFFIXES ${_lua_include_subdirs} include/lua include + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) +unset(_lua_include_subdirs) + +find_library(LUA_LIBRARY + NAMES ${_lua_library_names} lua + HINTS + ENV LUA_DIR + PATH_SUFFIXES lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw + /opt/local + /opt/csw + /opt +) +unset(_lua_library_names) + +if (LUA_LIBRARY) + # include the math library for Unix + if (UNIX AND NOT APPLE AND NOT BEOS) + find_library(LUA_MATH_LIBRARY m) + set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}") + # For Windows and Mac, don't need to explicitly include the math library + else () + set(LUA_LIBRARIES "${LUA_LIBRARY}") + endif () +endif () + +if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") + # At least 5.[012] have different ways to express the version + # so all of them need to be tested. Lua 5.2 defines LUA_VERSION + # and LUA_RELEASE as joined by the C preprocessor, so avoid those. + file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_strings + REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*") + + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};") + if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};") + set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") + else () + string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") + if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") + endif () + string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}") + endif () + + unset(lua_version_strings) +endif() + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua + REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR + VERSION_VAR LUA_VERSION_STRING) + +mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARY LUA_MATH_LIBRARY) diff --git a/cmake/Modules/FindSQLite3.cmake b/cmake/Modules/FindSQLite3.cmake new file mode 100644 index 000000000..910b05cea --- /dev/null +++ b/cmake/Modules/FindSQLite3.cmake @@ -0,0 +1,63 @@ +# - Try to find the SQLite3 library +# Once done this will define +# +# SQLITE3_FOUND - System has SQLite3 +# SQLITE3_INCLUDE_DIR - The SQLite3 include directory +# SQLITE3_LIBRARIES - The libraries needed to use SQLite3 +# SQLITE3_DEFINITIONS - Compiler switches required for using SQLite3 +# SQLITE3_EXECUTABLE - The SQLite3 command line shell +# SQLITE3_VERSION_STRING - the version of SQLite3 found (since CMake 2.8.8) + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# Copyright 2006 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# use pkg-config to get the directories and then use these values +# in the find_path() and find_library() calls +find_package(PkgConfig QUIET) +PKG_CHECK_MODULES(PC_SQLITE QUIET sqlite3) +set(SQLITE3_DEFINITIONS ${PC_SQLITE_CFLAGS_OTHER}) + +find_path(SQLITE3_INCLUDE_DIR NAMES sqlite3.h + HINTS + ${PC_SQLITE_INCLUDEDIR} + ${PC_SQLITE_INCLUDE_DIRS} + ) + +find_library(SQLITE3_LIBRARIES NAMES sqlite3 + HINTS + ${PC_SQLITE_LIBDIR} + ${PC_SQLITE_LIBRARY_DIRS} + ) + +find_program(SQLITE3_EXECUTABLE sqlite3) + +if(PC_SQLITE_VERSION) + set(SQLITE3_VERSION_STRING ${PC_SQLITE_VERSION}) +elseif(SQLITE3_INCLUDE_DIR AND EXISTS "${SQLITE3_INCLUDE_DIR}/sqlite3.h") + file(STRINGS "${SQLITE3_INCLUDE_DIR}/sqlite3.h" sqlite3_version_str + REGEX "^#define[\t ]+SQLITE_VERSION[\t ]+\".*\"") + + string(REGEX REPLACE "^#define[\t ]+SQLITE_VERSION[\t ]+\"([^\"]*)\".*" "\\1" + SQLITE3_VERSION_STRING "${sqlite3_version_str}") + unset(sqlite3_version_str) +endif() + +# handle the QUIETLY and REQUIRED arguments and set SQLITE3_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SQLite3 + REQUIRED_VARS SQLITE3_LIBRARIES SQLITE3_INCLUDE_DIR + VERSION_VAR SQLITE3_VERSION_STRING) + +mark_as_advanced(SQLITE3_INCLUDE_DIR SQLITE3_LIBRARIES SQLITE3_EXECUTABLE) diff --git a/cmake/Modules/FindToLua.cmake b/cmake/Modules/FindToLua.cmake new file mode 100644 index 000000000..52c721112 --- /dev/null +++ b/cmake/Modules/FindToLua.cmake @@ -0,0 +1,71 @@ +# - Try to find the ToLua library +# Once done this will define +# +# TOLUA_FOUND - System has ToLua +# TOLUA_INCLUDE_DIR - The ToLua include directory +# TOLUA_LIBRARIES - The libraries needed to use ToLua +# TOLUA_DEFINITIONS - Compiler switches required for using ToLua +# TOLUA_EXECUTABLE - The ToLua command line shell +# TOLUA_VERSION_STRING - the version of ToLua found (since CMake 2.8.8) + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# Copyright 2006 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# use pkg-config to get the directories and then use these values +# in the find_path() and find_library() calls +find_package(PkgConfig QUIET) +PKG_CHECK_MODULES(PC_TOLUA QUIET ToLua) +set(TOLUA_DEFINITIONS ${PC_TOLUA_CFLAGS_OTHER}) + +find_path(TOLUA_INCLUDE_DIR NAMES tolua.h + HINTS + ${PC_TOLUA_DIR}/include + ${PC_TOLUA_INCLUDEDIR} + ${PC_TOLUA_INCLUDE_DIRS} + ) +find_library(TOLUA_LIBRARY NAMES tolua + HINTS + ${PC_TOLUA_DIR}/lib + ${PC_TOLUA_LIBDIR} + ${PC_TOLUA_LIBRARY_DIRS} + ) +find_program(TOLUA_EXECUTABLE tolua + HINTS + ${PC_TOLUA_DIR}/bin + ${PC_TOLUA_LIBDIR} + ${PC_TOLUA_LIBRARY_DIRS} +) + +SET( TOLUA_LIBRARIES "${TOLUA_LIBRARY}" CACHE STRING "ToLua Libraries") + +if(PC_TOLUA_VERSION) + set(TOLUA_VERSION_STRING ${PC_TOLUA_VERSION}) +elseif(TOLUA_INCLUDE_DIR AND EXISTS "${TOLUA_INCLUDE_DIR}/tolua.h") + file(STRINGS "${TOLUA_INCLUDE_DIR}/tolua.h" tolua_version_str + REGEX "^#define[\t ]+TOLUA_VERSION[\t ]+\".*\"") + + string(REGEX REPLACE "^#define[\t ]+TOLUA_VERSION[\t ]+\"tolua ([^\"]*)\".*" "\\1" + TOLUA_VERSION_STRING "${tolua_version_str}") + unset(tolua_version_str) +endif() + +# handle the QUIETLY and REQUIRED arguments and set TOLUA_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ToLua + REQUIRED_VARS TOLUA_LIBRARY TOLUA_INCLUDE_DIR TOLUA_EXECUTABLE + VERSION_VAR TOLUA_VERSION_STRING) + +mark_as_advanced(TOLUA_INCLUDE_DIR TOLUA_LIBRARIES TOLUA_EXECUTABLE) + diff --git a/cmake/Modules/MSVC.cmake b/cmake/Modules/MSVC.cmake new file mode 100644 index 000000000..d32822627 --- /dev/null +++ b/cmake/Modules/MSVC.cmake @@ -0,0 +1,19 @@ +MACRO (MSVC_CRT_SECURE_NO_WARNINGS) + IF (MSVC) + FOREACH (target ${ARGN}) + SET_TARGET_PROPERTIES (${target} PROPERTIES + COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS + ) + ENDFOREACH (target) + ENDIF (MSVC) +ENDMACRO (MSVC_CRT_SECURE_NO_WARNINGS) + +MACRO (MSVC_SET_WARNING_LEVEL level) + IF (MSVC) + IF(CMAKE_C_FLAGS MATCHES "/W[0-4]") + STRING(REGEX REPLACE "/W[0-4]" "/W${level}" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + ELSE() + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W${level}") + ENDIF() + ENDIF(MSVC) +ENDMACRO (MSVC_SET_WARNING_LEVEL) diff --git a/s/build b/s/build index 4ee259573..818cb0268 100755 --- a/s/build +++ b/s/build @@ -33,7 +33,7 @@ fi echo "build eressea" cd $ROOT/$BUILD BRANCH=$(git status -s -b | head -1 | cut -d\ -f 2 | sed 's/\..*//') -if [ "$BRANCH"=="master" ] ; then +if [ "$BRANCH" = "master" ] ; then VERSION=$(git describe --match 'v*.*.*' --tags | sed 's/^v//') cmake -DERESSEA_VERSION="$VERSION" .. else diff --git a/s/cmake-init b/s/cmake-init index 1ce7eccd3..9d529a433 100755 --- a/s/cmake-init +++ b/s/cmake-init @@ -10,6 +10,7 @@ ROOT=$(git rev-parse --show-toplevel) MACHINE=`$CC -dumpmachine` [ -z $MACHINE ] && MACHINE=`uname -m` BIN_DIR="$ROOT/build-$MACHINE-$CC-$BUILD" +rm -rf $BIN_DIR mkdir -p $BIN_DIR rm -f $BUILD ln -sf $BIN_DIR $BUILD @@ -29,12 +30,11 @@ if [ -d $HOME/usr ]; then fi DEST=$(dirname $ROOT)/server -ARGS=" -DCMAKE_MODULE_PATH=$ROOT/cmake/Modules \ - -DCMAKE_BUILD_TYPE=$BUILD \ +ARGS=" -DCMAKE_BUILD_TYPE=$BUILD \ -DCMAKE_LIBRARY_PATH=$LIBRARY_PATH \ - -DCMAKE_INCLUDE_PATH=$INCLUDE_PATH \ -DCMAKE_PREFIX_PATH=$PREFIX_PATH \ -DCMAKE_INSTALL_PREFIX=$DEST" +# -DCMAKE_INCLUDE_PATH=$INCLUDE_PATH git submodule update --init