From 5d7e0ddf8be717699421f3c7beec3cc2166ff886 Mon Sep 17 00:00:00 2001 From: Aleksey Komarov Date: Sat, 26 May 2018 01:42:05 +0300 Subject: [PATCH] Use luabind.cmake instead of luabind/CMakeLists.txt. luabind now depends on Externals/luajit --- Externals/CMakeLists.txt | 3 ++- Externals/luabind.cmake | 46 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 Externals/luabind.cmake diff --git a/Externals/CMakeLists.txt b/Externals/CMakeLists.txt index 617b7f2864a..2ad939097e8 100644 --- a/Externals/CMakeLists.txt +++ b/Externals/CMakeLists.txt @@ -1,5 +1,6 @@ add_subdirectory(luajit) -add_subdirectory(luabind) +include(luabind.cmake) +#add_subdirectory(luabind) add_subdirectory(lzo) add_subdirectory(cximage) add_subdirectory(NVTT) diff --git a/Externals/luabind.cmake b/Externals/luabind.cmake new file mode 100644 index 00000000000..0ac43b12b1a --- /dev/null +++ b/Externals/luabind.cmake @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 2.8) +project(luabind) + +option(LUABIND_BUILD_TESTING "Build luabind testing" OFF) +option(LUABIND_BUILD_SHARED "Build luabind as a shared library?" ON) + +set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake") + +if(BUILD_DEPENDS) + add_subdirectory(luajit ${CMAKE_BINARY_DIR}/Externals/luajit) +else() + link_directories(${CMAKE_BINARY_DIR}/Externals/luajit) +endif() +#if(BUILD_DEPENDS) +# add_subdirectory(platform/cmake/LuaJIT ${CMAKE_BINARY_DIR}/LuaJIT) +#else() +# link_directories(dependencies/LuaJIT/build/) +#endif() + +if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fpermissive") +endif() + +if(LUABIND_BUILD_SHARED) + add_definitions(-DLUABIND_DYNAMIC_LINK) +endif() + +add_definitions(-DNDEBUG) #TODO: Add toggle for debug mode + +include_directories(${CMAKE_CURRENT_SOURCE_DIR} + ${LUA_INCLUDE_DIR} + luabind +) + +add_subdirectory(luabind/src) + +if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + if(LUABIND_BUILD_TESTING) + add_subdirectory(luabind/test) + endif() + add_subdirectory(luabind/doc) +endif()