diff --git a/CMakeLists.txt b/CMakeLists.txt index 15290221..630b63dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,20 +225,55 @@ if (DO_TESTS OR DO_EXAMPLES) find_package(LuaBuild REQUIRED) else() if (NORMALIZED_LUA_VERSION MATCHES "5.1") + set(CREATE_LUALIB_TARGET TRUE) find_package(Lua 5.1 EXACT REQUIRED) elseif(NORMALIZED_LUA_VERSION MATCHES "5.2") + set(CREATE_LUALIB_TARGET TRUE) find_package(Lua 5.2 EXACT REQUIRED) elseif(NORMALIZED_LUA_VERSION MATCHES "5.3") + set(CREATE_LUALIB_TARGET TRUE) find_package(Lua 5.3 EXACT REQUIRED) elseif(NORMALIZED_LUA_VERSION MATCHES "5.4") + set(CREATE_LUALIB_TARGET TRUE) find_package(Lua 5.4 EXACT REQUIRED) elseif(NORMALIZED_LUA_VERSION MATCHES "luajit") + set(CREATE_LUALIB_TARGET TRUE) find_package(LuaJIT REQUIRED) else() find_package(LuaBuild ${SOL2_LUA_VERSION} REQUIRED) endif() endif() + if (CREATE_LUALIB_TARGET AND LUA_FOUND) + set(lualib lua_imported_lib_${SOL2_LUA_VERSION}) + foreach(lua_search_lib ${LUA_LIBRARIES}) + get_filename_component(lsl_fname ${lua_search_lib} NAME) + if (lsl_fname MATCHES "lua" OR lsl_fname MATCHES "Lua" OR lsl_fname MATCHES "LUA") + if (lsl_fname MATCHES "\.so|\.dylib|\.dll") + set(lualibtype SHARED) + set(lualiblocation ${lua_search_lib}) + else() + set(lualibtype STATIC) + set(lualiblocation ${lua_search_lib}) + endif() + else() + set(LUA_SEARCH_DEPENDENCY_LIBS ${LUA_SEARCH_DEPENDENCY_LIBS} "${lua_search_lib}") + endif() + endforeach() + add_library(${lualib} ${lualibtype} IMPORTED) + set_target_properties(${lualib} + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${LUA_INCLUDE_DIR} + INTERFACE_LINK_LIBRARIES ${LUA_SEARCH_DEPENDENCY_LIBS} + IMPORTED_LINK_INTERFACE_LANGUAGES C + IMPORTED_LOCATION ${lualiblocation}) + if (CMAKE_DL_LIBS) + set_property(TARGET ${lualib} + APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}) + endif() + set(LUA_LIBRARIES ${lualib}) + endif() + if (NOT LUA_FOUND AND NOT LUABUILD_FOUND) message(FATAL_ERROR "sol2 Lua \"${SOL2_LUA_VERSION}\" not found and could not be targeted for building") endif() diff --git a/cmake/Modules/FindLuaBuild/LuaVanilla.cmake b/cmake/Modules/FindLuaBuild/LuaVanilla.cmake index c0a0a9a5..f48f52f6 100644 --- a/cmake/Modules/FindLuaBuild/LuaVanilla.cmake +++ b/cmake/Modules/FindLuaBuild/LuaVanilla.cmake @@ -294,7 +294,7 @@ extern \"C\" { set(LUA_VANILLA_INCLUDE_DIRS ${LUA_VANILLA_SOURCE_DIR}) endif() -message(STATUS "${LUA_VANILLA_INCLUDE_DIRS}") + # # Target names set(liblua "liblua-${LUA_VANILLA_VERSION}") set(luainterpreter "lua-${LUA_VANILLA_VERSION}") diff --git a/include/sol/optional_implementation.hpp b/include/sol/optional_implementation.hpp index 06b319bc..6ca71930 100644 --- a/include/sol/optional_implementation.hpp +++ b/include/sol/optional_implementation.hpp @@ -2270,4 +2270,4 @@ namespace std { }; } // namespace std -#endif +#endif // SOL_TL_OPTIONAL_HPP diff --git a/single/include/sol/forward.hpp b/single/include/sol/forward.hpp index b2d55ecd..a9bf8104 100644 --- a/single/include/sol/forward.hpp +++ b/single/include/sol/forward.hpp @@ -20,8 +20,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // This file was generated with a script. -// Generated 2019-01-05 10:49:38.109676 UTC -// This header was generated with sol v2.20.6 (revision 59174e7) +// Generated 2019-01-05 18:55:40.545875 UTC +// This header was generated with sol v2.20.6 (revision d9f973e) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP diff --git a/single/include/sol/sol.hpp b/single/include/sol/sol.hpp index 7123966e..25580220 100644 --- a/single/include/sol/sol.hpp +++ b/single/include/sol/sol.hpp @@ -20,8 +20,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // This file was generated with a script. -// Generated 2019-01-05 10:49:37.853965 UTC -// This header was generated with sol v2.20.6 (revision 59174e7) +// Generated 2019-01-05 18:55:40.295019 UTC +// This header was generated with sol v2.20.6 (revision d9f973e) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -5602,7 +5602,6 @@ namespace std { }; } // namespace std -#endif // end of sol/optional_implementation.hpp #endif // Boost vs. Better optional