2010-08-20 11:27:17 +00:00
|
|
|
# - Locate Luabind library
|
|
|
|
# This module defines
|
2010-09-11 22:40:26 +00:00
|
|
|
# LUABIND_LIBRARIES, the libraries to link against
|
2010-08-20 11:27:17 +00:00
|
|
|
# LUABIND_FOUND, if false, do not try to link to LUABIND
|
|
|
|
# LUABIND_INCLUDE_DIR, where to find headers.
|
|
|
|
|
2013-09-22 08:47:12 +00:00
|
|
|
MACRO(FIND_CORRECT_LUA_VERSION)
|
|
|
|
# Check Lua version linked to Luabind under Linux
|
|
|
|
IF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
|
|
|
|
INCLUDE(CheckDepends)
|
|
|
|
|
|
|
|
SET(LUA52_LIBRARY "liblua5.2")
|
|
|
|
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
|
|
|
|
|
|
|
|
IF(LUALIB_FOUND)
|
|
|
|
MESSAGE(STATUS "Luabind is using Lua 5.2")
|
|
|
|
FIND_PACKAGE(Lua52 REQUIRED)
|
|
|
|
ELSE(LUALIB_FOUND)
|
|
|
|
SET(LUA51_LIBRARY "liblua5.1")
|
|
|
|
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA51_LIBRARY LUALIB_FOUND)
|
|
|
|
|
|
|
|
IF(LUALIB_FOUND)
|
|
|
|
MESSAGE(STATUS "Luabind is using Lua 5.1")
|
|
|
|
FIND_PACKAGE(Lua51 REQUIRED)
|
|
|
|
ELSE(LUALIB_FOUND)
|
|
|
|
SET(LUA50_LIBRARY "liblua5.0")
|
|
|
|
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA50_LIBRARY LUALIB_FOUND)
|
|
|
|
|
|
|
|
IF(LUALIB_FOUND)
|
|
|
|
MESSAGE(STATUS "Luabind is using Lua 5.0")
|
|
|
|
FIND_PACKAGE(Lua50 REQUIRED)
|
|
|
|
ELSE(LUALIB_FOUND)
|
|
|
|
MESSAGE(FATAL_ERROR "Can't determine Lua version used by Luabind")
|
|
|
|
ENDIF(LUALIB_FOUND)
|
|
|
|
ENDIF(LUALIB_FOUND)
|
|
|
|
ENDIF(LUALIB_FOUND)
|
|
|
|
ELSE(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
|
|
|
|
# TODO: find a way to detect Lua version
|
|
|
|
IF(WITH_LUA52)
|
|
|
|
FIND_PACKAGE(Lua52 REQUIRED)
|
|
|
|
ELSEIF(WITH_LUA51)
|
|
|
|
FIND_PACKAGE(Lua51 REQUIRED)
|
|
|
|
ELSE(WITH_LUA52)
|
|
|
|
FIND_PACKAGE(Lua50 REQUIRED)
|
|
|
|
ENDIF(WITH_LUA52)
|
|
|
|
ENDIF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
|
|
|
|
ENDMACRO(FIND_CORRECT_LUA_VERSION)
|
|
|
|
|
2010-09-11 22:40:26 +00:00
|
|
|
IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
|
2010-08-20 11:27:17 +00:00
|
|
|
# in cache already
|
2011-05-23 10:52:35 +00:00
|
|
|
SET(Luabind_FIND_QUIETLY TRUE)
|
2010-09-11 22:40:26 +00:00
|
|
|
ENDIF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
|
2010-08-20 11:27:17 +00:00
|
|
|
|
|
|
|
FIND_PATH(LUABIND_INCLUDE_DIR
|
2010-09-25 13:41:37 +00:00
|
|
|
luabind/luabind.hpp
|
2010-08-20 11:27:17 +00:00
|
|
|
PATHS
|
|
|
|
$ENV{LUABIND_DIR}/include
|
|
|
|
/usr/local/include
|
|
|
|
/usr/include
|
|
|
|
/sw/include
|
|
|
|
/opt/local/include
|
|
|
|
/opt/csw/include
|
|
|
|
/opt/include
|
|
|
|
)
|
|
|
|
|
2010-10-02 09:40:27 +00:00
|
|
|
SET(LIBRARY_NAME_RELEASE luabind libluabind)
|
2011-05-24 18:25:03 +00:00
|
|
|
SET(LIBRARY_NAME_DEBUG luabind_d luabindd libluabind_d libluabindd)
|
2010-10-02 09:40:27 +00:00
|
|
|
|
2010-09-25 13:41:37 +00:00
|
|
|
IF(WITH_STLPORT)
|
2010-10-02 09:40:27 +00:00
|
|
|
SET(LIBRARY_NAME_RELEASE luabind_stlport ${LIBRARY_NAME_RELEASE})
|
|
|
|
SET(LIBRARY_NAME_DEBUG luabind_stlportd ${LIBRARY_NAME_DEBUG})
|
|
|
|
ENDIF(WITH_STLPORT)
|
2010-08-20 11:27:17 +00:00
|
|
|
|
2010-10-02 09:40:27 +00:00
|
|
|
FIND_LIBRARY(LUABIND_LIBRARY_RELEASE
|
|
|
|
NAMES ${LIBRARY_NAME_RELEASE}
|
|
|
|
PATHS
|
|
|
|
$ENV{LUABIND_DIR}/lib
|
|
|
|
/usr/local/lib
|
|
|
|
/usr/lib
|
|
|
|
/usr/local/X11R6/lib
|
|
|
|
/usr/X11R6/lib
|
|
|
|
/sw/lib
|
|
|
|
/opt/local/lib
|
|
|
|
/opt/csw/lib
|
|
|
|
/opt/lib
|
|
|
|
/usr/freeware/lib64
|
|
|
|
)
|
2010-08-20 11:27:17 +00:00
|
|
|
|
2010-10-02 09:40:27 +00:00
|
|
|
FIND_LIBRARY(LUABIND_LIBRARY_DEBUG
|
|
|
|
NAMES ${LIBRARY_NAME_DEBUG}
|
|
|
|
PATHS
|
|
|
|
$ENV{LUABIND_DIR}/lib
|
|
|
|
/usr/local/lib
|
|
|
|
/usr/lib
|
|
|
|
/usr/local/X11R6/lib
|
|
|
|
/usr/X11R6/lib
|
|
|
|
/sw/lib
|
|
|
|
/opt/local/lib
|
|
|
|
/opt/csw/lib
|
|
|
|
/opt/lib
|
|
|
|
/usr/freeware/lib64
|
|
|
|
)
|
2010-08-20 11:27:17 +00:00
|
|
|
|
2010-10-02 09:40:27 +00:00
|
|
|
FIND_PACKAGE(Boost REQUIRED)
|
|
|
|
|
|
|
|
IF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
|
2011-05-23 10:52:35 +00:00
|
|
|
IF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
|
|
|
|
# Case where both Release and Debug versions are provided
|
2010-09-25 13:41:37 +00:00
|
|
|
SET(LUABIND_FOUND TRUE)
|
2011-05-23 10:52:35 +00:00
|
|
|
SET(LUABIND_LIBRARIES optimized ${LUABIND_LIBRARY_RELEASE} debug ${LUABIND_LIBRARY_DEBUG})
|
|
|
|
ELSEIF(LUABIND_LIBRARY_RELEASE)
|
|
|
|
# Normal case
|
|
|
|
SET(LUABIND_FOUND TRUE)
|
|
|
|
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_RELEASE})
|
|
|
|
ELSEIF(LUABIND_LIBRARY_DEBUG)
|
|
|
|
# Case where Luabind is compiled from sources (debug version is compiled by default)
|
|
|
|
SET(LUABIND_FOUND TRUE)
|
|
|
|
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_DEBUG})
|
|
|
|
ENDIF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
|
2010-10-02 09:40:27 +00:00
|
|
|
ENDIF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
|
2010-09-11 22:40:26 +00:00
|
|
|
|
|
|
|
IF(LUABIND_FOUND)
|
2011-05-23 10:52:35 +00:00
|
|
|
SET(LUABIND_INCLUDE_DIR ${LUABIND_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
|
2010-12-30 11:20:42 +00:00
|
|
|
# Check if luabind/version.hpp exists
|
|
|
|
FIND_FILE(LUABIND_VERSION_FILE luabind/version.hpp PATHS ${LUABIND_INCLUDE_DIR})
|
|
|
|
IF(LUABIND_VERSION_FILE)
|
2010-12-30 11:22:39 +00:00
|
|
|
SET(LUABIND_DEFINITIONS "-DHAVE_LUABIND_VERSION")
|
2010-12-30 11:20:42 +00:00
|
|
|
ENDIF(LUABIND_VERSION_FILE)
|
2013-09-22 08:47:12 +00:00
|
|
|
|
|
|
|
FIND_CORRECT_LUA_VERSION()
|
|
|
|
|
2011-05-23 10:52:35 +00:00
|
|
|
IF(NOT Luabind_FIND_QUIETLY)
|
2010-09-11 22:40:26 +00:00
|
|
|
MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}")
|
2011-05-23 10:52:35 +00:00
|
|
|
ENDIF(NOT Luabind_FIND_QUIETLY)
|
2010-09-11 22:40:26 +00:00
|
|
|
ELSE(LUABIND_FOUND)
|
2011-05-23 10:52:35 +00:00
|
|
|
IF(NOT Luabind_FIND_QUIETLY)
|
2010-08-20 11:27:17 +00:00
|
|
|
MESSAGE(STATUS "Warning: Unable to find Luabind!")
|
2011-05-23 10:52:35 +00:00
|
|
|
ENDIF(NOT Luabind_FIND_QUIETLY)
|
2010-09-11 22:40:26 +00:00
|
|
|
ENDIF(LUABIND_FOUND)
|
|
|
|
|
2010-10-02 09:40:27 +00:00
|
|
|
MARK_AS_ADVANCED(LUABIND_LIBRARY_RELEASE LUABIND_LIBRARY_DEBUG Boost_LIB_DIAGNOSTIC_DEFINITIONS)
|