diff --git a/.gitmodules b/.gitmodules index 4c0b4a9ae..306652a59 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,6 +5,3 @@ [submodule "clibs"] path = clibs url = https://github.com/ennorehling/clibs -[submodule "tolua"] - path = tolua - url = https://github.com/ennorehling/tolua.git diff --git a/.travis.yml b/.travis.yml index 8d5e50027..cd71ee585 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ addons: packages: - libbsd-dev - libdb-dev - - liblua5.3-dev + - libtolua-dev - libncurses5-dev - libsqlite3-dev - libexpat1-dev diff --git a/CMakeLists.txt b/CMakeLists.txt index 24c49a514..ed4ef5d7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,7 @@ if (NOT CURSES_FOUND) find_package (Curses) endif (NOT CURSES_FOUND) +find_package (ToLua 5.2 REQUIRED) #find_package (BerkeleyDB REQUIRED) find_package (SQLite3 REQUIRED) find_package (IniParser REQUIRED) @@ -60,7 +61,6 @@ endif() enable_testing() -add_subdirectory (tolua) add_subdirectory (tools) add_subdirectory (storage) add_subdirectory (clibs) diff --git a/cmake/Modules/FindToLua.cmake b/cmake/Modules/FindToLua.cmake new file mode 100644 index 000000000..92732981b --- /dev/null +++ b/cmake/Modules/FindToLua.cmake @@ -0,0 +1,73 @@ +# - 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) +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) + diff --git a/tolua b/tolua deleted file mode 160000 index 7c73f64e0..000000000 --- a/tolua +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7c73f64e0a0001f49f04c51921e4c15167e4e67b