include custom version of tolua as a submodule.

change how libm and libbsd are detected.
This commit is contained in:
Enno Rehling 2021-02-14 11:05:28 +01:00
parent 7fae809aa0
commit db402c4e2c
6 changed files with 25 additions and 87 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
tolua/
.vscode/
*.orig
eressea.ini

3
.gitmodules vendored
View File

@ -5,3 +5,6 @@
[submodule "clibs"]
path = clibs
url = https://github.com/ennorehling/clibs
[submodule "tolua"]
path = tolua
url = https://github.com/ennorehling/tolua.git

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 2.9)
if (WIN32)
FILE(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH )
FILE(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH )
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)
@ -21,17 +21,19 @@ include (MSVC)
else (MSVC)
include (CheckIncludeFile)
CHECK_INCLUDE_FILE(signal.h HAVE_SIGNAL_H)
CHECK_INCLUDE_FILE(execinfo.h HAVE_EXECINFO_H)
CHECK_INCLUDE_FILE(bsd/string.h HAVE_LIBBSD)
check_include_file(signal.h HAVE_SIGNAL_H)
check_include_file(execinfo.h HAVE_EXECINFO_H)
include (CheckLibraryExists)
check_library_exists(m sin "" HAVE_LIBM)
check_library_exists(bsd strlcat "" HAVE_LIBBSD)
include (CheckFunctionExists)
CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP)
check_function_exists(strdup HAVE_STRDUP)
check_function_exists(strlcat HAVE_STRLCAT)
if (HAVE_LIBBSD)
include (CheckLibraryExists)
CHECK_LIBRARY_EXISTS(bsd strlcat "bsd/string.h" HAVE_STRLCAT)
else (HAVE_LIBBSD)
CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT)
set (HAVE_STRLCAT 1)
endif (HAVE_LIBBSD)
endif (MSVC)
@ -43,7 +45,6 @@ find_package (SQLite3 REQUIRED)
find_package (IniParser REQUIRED)
find_package (CJSON REQUIRED)
find_package (EXPAT REQUIRED)
find_package (ToLua REQUIRED)
if (TOLUA_FOUND)
if (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.2")
find_package (Lua 5.2 REQUIRED)
@ -54,6 +55,7 @@ endif(TOLUA_FOUND)
enable_testing()
add_subdirectory (tolua)
add_subdirectory (storage)
add_subdirectory (clibs)
add_subdirectory (process)

View File

@ -1,73 +0,0 @@
# - 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 <neundorf@kde.org>
#
# 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)
else(PC_TOLUA_VERSION)
message(ERROR "TOLUA_VERSION_STRING cannot be determined")
endif(PC_TOLUA_VERSION)
# 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)

View File

@ -191,12 +191,18 @@ target_link_libraries(parser
${CRYPTO_LIBRARIES}
)
add_executable(checker ${CHECK_SRC})
target_link_libraries(checker parser)
if (HAVE_LIBBSD)
set (EXTRA_LIBS ${EXTRA_LIBS} bsd)
endif (HAVE_LIBBSD)
if (HAVE_LIBM)
set (EXTRA_LIBS ${EXTRA_LIBS} m)
endif (HAVE_LIBM)
add_library(game ${ERESSEA_SRC})
target_link_libraries(game parser version)
target_link_libraries(game ${EXTRA_LIBS} parser version)
add_executable(eressea ${SERVER_SRC})
if (IWYU_PATH)

1
tolua Submodule

@ -0,0 +1 @@
Subproject commit e7e8a7c1aa70de807cce14d0e126b4ecad9d3b9a