Update single, fix more CMakeLists stuff to work with Local and Not-From-Source builds of Lua

This commit is contained in:
ThePhD 2019-01-05 13:56:21 -05:00
parent d9f973e5cd
commit 91faa7a014
No known key found for this signature in database
GPG Key ID: 1509DB1C0F702BFA
5 changed files with 41 additions and 7 deletions

View File

@ -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()

View File

@ -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}")

View File

@ -2270,4 +2270,4 @@ namespace std {
};
} // namespace std
#endif
#endif // SOL_TL_OPTIONAL_HPP

View File

@ -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

View File

@ -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