diff options
Diffstat (limited to 'deps/sol2/cmake')
-rw-r--r-- | deps/sol2/cmake/Modules/Common/Core.cmake | 35 | ||||
-rw-r--r-- | deps/sol2/cmake/Modules/FindCatch.cmake | 84 | ||||
-rw-r--r-- | deps/sol2/cmake/Modules/FindKaguyaBuild.cmake | 76 | ||||
-rw-r--r-- | deps/sol2/cmake/Modules/FindLua/set_version_vars.cmake | 77 | ||||
-rw-r--r-- | deps/sol2/cmake/Modules/FindLua/version_check.cmake | 28 | ||||
-rw-r--r-- | deps/sol2/cmake/Modules/FindLuaBridgeBuild.cmake | 76 | ||||
-rw-r--r-- | deps/sol2/cmake/Modules/FindLuaBuild.cmake | 120 | ||||
-rw-r--r-- | deps/sol2/cmake/Modules/FindLuaBuild/LuaJIT.cmake | 420 | ||||
-rw-r--r-- | deps/sol2/cmake/Modules/FindLuaBuild/LuaVanilla.cmake | 443 | ||||
-rw-r--r-- | deps/sol2/cmake/Modules/FindLuwraBuild.cmake | 75 | ||||
-rw-r--r-- | deps/sol2/cmake/Modules/FindToLuappBuild.cmake | 95 | ||||
-rw-r--r-- | deps/sol2/cmake/sol2-config.cmake.in | 41 |
12 files changed, 1570 insertions, 0 deletions
diff --git a/deps/sol2/cmake/Modules/Common/Core.cmake b/deps/sol2/cmake/Modules/Common/Core.cmake new file mode 100644 index 0000000..d785439 --- /dev/null +++ b/deps/sol2/cmake/Modules/Common/Core.cmake @@ -0,0 +1,35 @@ +# # # # sol3
+# The MIT License (MIT)
+#
+# Copyright (c) 2013-2019 Rapptz, ThePhD, and contributors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy of
+# this software and associated documentation files (the "Software"), to deal in
+# the Software without restriction, including without limitation the rights to
+# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+# the Software, and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+if(_common_core_included)
+ return()
+endif(_common_core_included)
+set(_common_core_included true)
+
+# # Prepend function (is there an equivalent in CMake somewhere...?)
+function(prepend var prefix)
+ set(l "")
+ foreach(f ${ARGN})
+ list(APPEND l "${prefix}${f}")
+ endforeach(f)
+ SET(${var} "${l}" PARENT_SCOPE)
+ENDFUNCTION(prepend)
diff --git a/deps/sol2/cmake/Modules/FindCatch.cmake b/deps/sol2/cmake/Modules/FindCatch.cmake new file mode 100644 index 0000000..527fb6c --- /dev/null +++ b/deps/sol2/cmake/Modules/FindCatch.cmake @@ -0,0 +1,84 @@ +# # # # sol3
+# The MIT License (MIT)
+#
+# Copyright (c) 2013-2019 Rapptz, ThePhD, and contributors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy of
+# this software and associated documentation files (the "Software"), to deal in
+# the Software without restriction, including without limitation the rights to
+# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+# the Software, and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+include(ExternalProject)
+include(FindPackageHandleStandardArgs)
+include(Common/Core)
+
+# # Base variables
+if (Catch_FIND_VERSION)
+ set(catch_version ${Catch_FIND_VERSION})
+else()
+ set(catch_version 2.1.2)
+endif()
+
+set(catch_lib catch_lib_${catch_version})
+
+# # Useful locations
+set(catch_build_toplevel "${CMAKE_BINARY_DIR}/vendor/catch_${catch_version}")
+set(catch_include_dirs "${catch_build_toplevel}")
+
+# # catch library sources
+set(catch_sources catch.hpp)
+prepend(catch_sources "${catch_build_toplevel}/" ${catch_sources})
+
+# # !! CMake 3.5 does not have DOWNLOAD_NO_EXTRACT e.e
+# # Now I know why people don't like CMake that much: the earlier versions were kind of garbage
+# # External project to get sources
+#ExternalProject_Add(CATCH_BUILD_SOURCE
+# BUILD_IN_SOURCE TRUE
+# BUILD_ALWAYS FALSE
+# DOWNLOAD_NO_EXTRACT TRUE
+# URL https://github.com/catchorg/Catch2/releases/download/v${catch_version}/catch.hpp
+# TLS_VERIFY TRUE
+# PREFIX ${catch_build_toplevel}
+# SOURCE_DIR ${catch_build_toplevel}
+# DOWNLOAD_DIR ${catch_build_toplevel}
+# TMP_DIR "${catch_build_toplevel}-tmp"
+# STAMP_DIR "${catch_build_toplevel}-stamp"
+# INSTALL_DIR "${catch_build_toplevel}/local"
+# CONFIGURE_COMMAND ""
+# BUILD_COMMAND ""
+# INSTALL_COMMAND ""
+# TEST_COMMAND ""
+# BUILD_BYPRODUCTS "${catch_sources}")
+
+file(MAKE_DIRECTORY "${catch_build_toplevel}")
+file(DOWNLOAD https://github.com/catchorg/Catch2/releases/download/v${catch_version}/catch.hpp ${catch_sources})
+
+add_library(${catch_lib} INTERFACE)
+# add_dependencies(${catch_lib} CATCH_BUILD_SOURCE)
+target_include_directories(${catch_lib} INTERFACE ${catch_include_dirs})
+
+if (MSVC)
+ target_compile_definitions(${catch_lib} INTERFACE
+ _SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING)
+endif()
+
+set(CATCH_FOUND TRUE)
+set(CATCH_LIBRARIES ${catch_lib})
+set(CATCH_INCLUDE_DIRS ${catch_include_dirs})
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Catch
+ FOUND_VAR CATCH_FOUND
+ REQUIRED_VARS CATCH_LIBRARIES CATCH_INCLUDE_DIRS
+ VERSION_VAR catch_version)
diff --git a/deps/sol2/cmake/Modules/FindKaguyaBuild.cmake b/deps/sol2/cmake/Modules/FindKaguyaBuild.cmake new file mode 100644 index 0000000..dbef945 --- /dev/null +++ b/deps/sol2/cmake/Modules/FindKaguyaBuild.cmake @@ -0,0 +1,76 @@ +
+# # # # sol3
+# The MIT License (MIT)
+#
+# Copyright (c) 2013-2019 Rapptz, ThePhD, and contributors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy of
+# this software and associated documentation files (the "Software"), to deal in
+# the Software without restriction, including without limitation the rights to
+# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+# the Software, and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+include(ExternalProject)
+include(FindPackageHandleStandardArgs)
+include(Common/Core)
+
+# # Base variables
+set(kaguya_version 1.3.2)
+set(kaguya_lib kaguya_lib_${kaguya_version})
+
+# # Useful locations
+set(kaguya_build_toplevel "${CMAKE_BINARY_DIR}/vendor/kaguya_${kaguya_version}")
+set(kaguya_include_dirs "${kaguya_build_toplevel}/include")
+
+# # kaguya library sources
+set(kaguya_sources kaguya/kaguya.hpp)
+prepend(kaguya_sources "${kaguya_build_toplevel}/include/" ${kaguya_sources})
+
+# # External project to get sources
+ExternalProject_Add(KAGUYA_BUILD_SOURCE
+ BUILD_IN_SOURCE TRUE
+ BUILD_ALWAYS FALSE
+ # # Use Git to get what we need
+ GIT_SHALLOW TRUE
+ GIT_SUBMODULES ""
+ GIT_REPOSITORY https://github.com/satoren/kaguya.git
+ PREFIX ${kaguya_build_toplevel}
+ SOURCE_DIR ${kaguya_build_toplevel}
+ DOWNLOAD_DIR ${kaguya_build_toplevel}
+ TMP_DIR "${kaguya_build_toplevel}-tmp"
+ STAMP_DIR "${kaguya_build_toplevel}-stamp"
+ INSTALL_DIR "${kaguya_build_toplevel}/local"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+ BUILD_BYPRODUCTS "${kaguya_sources}")
+
+add_library(${kaguya_lib} INTERFACE)
+add_dependencies(${kaguya_lib} KAGUYA_BUILD_SOURCE)
+target_include_directories(${kaguya_lib} INTERFACE ${kaguya_include_dirs})
+target_link_libraries(${kaguya_lib} INTERFACE ${LUA_LIBRARIES})
+if (NOT MSVC)
+ target_compile_options(${kaguya_lib} INTERFACE
+ -Wno-noexcept-type -Wno-ignored-qualifiers -Wno-unused-parameter)
+endif()
+
+set(KAGUYABUILD_FOUND TRUE)
+set(KAGUYA_LIBRARIES ${kaguya_lib})
+set(KAGUYA_INCLUDE_DIRS ${kaguya_include_dirs})
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(KaguyaBuild
+ FOUND_VAR KAGUYABUILD_FOUND
+ REQUIRED_VARS KAGUYA_LIBRARIES KAGUYA_INCLUDE_DIRS
+ VERSION_VAR kaguya_version)
\ No newline at end of file diff --git a/deps/sol2/cmake/Modules/FindLua/set_version_vars.cmake b/deps/sol2/cmake/Modules/FindLua/set_version_vars.cmake new file mode 100644 index 0000000..c159221 --- /dev/null +++ b/deps/sol2/cmake/Modules/FindLua/set_version_vars.cmake @@ -0,0 +1,77 @@ +# # # # sol3 +# The MIT License (MIT) +# +# Copyright (c) 2013-2019 Rapptz, ThePhD, and contributors +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +# the Software, and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# Uses the Lua version and calculates the names of the include directories and library +# name accordingly. +# +# :: +# _prefix - Prefix added to all variables exposed, e.g. "lua" or "luajit" +# _lua_suffix - Name suffix, typically only used for specifiying luajit, which is "jit" + +function(_lua_set_version_vars _prefix _lua_suffix) + set(LUA_VERSIONS5 5.3 5.2 5.1 5.0) + + if (${_prefix}_FIND_VERSION_EXACT) + if (${_prefix}_FIND_VERSION_COUNT GREATER 1) + set(_${_prefix}_append_versions ${${_prefix}_FIND_VERSION_MAJOR}.${${_prefix}_FIND_VERSION_MINOR}) + endif () + elseif (${_prefix}_FIND_VERSION) + # once there is a different major version supported this should become a loop + if (NOT ${_prefix}_FIND_VERSION_MAJOR GREATER 5) + if (${_prefix}_FIND_VERSION_COUNT EQUAL 1) + set(_${_prefix}_append_versions ${${_prefix}_VERSIONS5}) + else () + foreach (subver IN LISTS ${_prefix}_VERSIONS5) + if (NOT subver VERSION_LESS ${${_prefix}_FIND_VERSION}) + list(APPEND _${_prefix}_append_versions ${subver}) + endif () + endforeach () + endif () + endif () + else () + # once there is a different major version supported this should become a loop + set(_${_prefix}_append_versions ${LUA_VERSIONS5}) + endif () + + list(APPEND _${_prefix}_include_subdirs "include/lua" "include") + + foreach (ver IN LISTS _${_prefix}_append_versions) + string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}") + list(APPEND _${_prefix}_include_subdirs + include/lua${_lua_suffix}${CMAKE_MATCH_1}${CMAKE_MATCH_2} + include/lua${_lua_suffix}${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + include/lua${_lua_suffix}-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + ) + + # LuaJIT hides itself as Lua lib (maintaining ABI compat) + list(APPEND _${_prefix}_library_names + lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} + lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + lua.${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + ) + endforeach () + + set(_${_prefix}_include_subdirs "${_${_prefix}_include_subdirs}" PARENT_SCOPE) + set(_${_prefix}_append_versions "${_${_prefix}_append_versions}" PARENT_SCOPE) + set(_${_prefix}_library_names "${_${_prefix}_library_names}" PARENT_SCOPE) +endfunction(_lua_set_version_vars)
\ No newline at end of file diff --git a/deps/sol2/cmake/Modules/FindLua/version_check.cmake b/deps/sol2/cmake/Modules/FindLua/version_check.cmake new file mode 100644 index 0000000..fa62f43 --- /dev/null +++ b/deps/sol2/cmake/Modules/FindLua/version_check.cmake @@ -0,0 +1,28 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# Provides a common-mechanic for extracting Lua versions from Lua/LuaJIT headers +macro(_lua_check_header_version _header_file _prefix) + # At least 5.[012] have different ways to express the version + # so all of them need to be tested. Lua 5.2 defines LUA_VERSION + # and LUA_RELEASE as joined by the C preprocessor, so avoid those. + file(STRINGS "${_header_file}" lua_version_strings + REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*") + + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" ${_prefix}_VERSION_MAJOR ";${lua_version_strings};") + if (${_prefix}_VERSION_MAJOR MATCHES "^[0-9]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" "${_prefix}_VERSION_MINOR" ";${lua_version_strings};") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" "${_prefix}_VERSION_PATCH" ";${lua_version_strings};") + set(${_prefix}_VERSION_STRING "${${_prefix}_VERSION_MAJOR}.${${_prefix}_VERSION_MINOR}.${${_prefix}_VERSION_PATCH}") + else () + string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" ${_prefix}_VERSION_STRING ";${lua_version_strings};") + if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" ${_prefix}_VERSION_STRING ";${lua_version_strings};") + endif () + string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" ${_prefix}_VERSION_MAJOR "${${_prefix}_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" ${_prefix}_VERSION_MINOR "${${_prefix}_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" ${_prefix}_VERSION_PATCH "${${_prefix}_VERSION_STRING}") + endif () + + unset(lua_version_strings) +endmacro(_lua_check_header_version)
\ No newline at end of file diff --git a/deps/sol2/cmake/Modules/FindLuaBridgeBuild.cmake b/deps/sol2/cmake/Modules/FindLuaBridgeBuild.cmake new file mode 100644 index 0000000..ffe0a7e --- /dev/null +++ b/deps/sol2/cmake/Modules/FindLuaBridgeBuild.cmake @@ -0,0 +1,76 @@ +# # # # sol3
+# The MIT License (MIT)
+#
+# Copyright (c) 2013-2019 Rapptz, ThePhD, and contributors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy of
+# this software and associated documentation files (the "Software"), to deal in
+# the Software without restriction, including without limitation the rights to
+# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+# the Software, and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+include(ExternalProject)
+include(FindPackageHandleStandardArgs)
+include(Common/Core)
+
+# # Base variables
+set(luabridge_version 1.0.2)
+set(luabridge_lib luabridge_lib_${luabridge_version})
+
+# # Useful locations
+set(luabridge_build_toplevel "${CMAKE_BINARY_DIR}/vendor/luabridge_${luabridge_version}")
+set(luabridge_include_dirs "${luabridge_build_toplevel}/Source")
+
+# # luabridge library sources
+set(luabridge_sources LuaBridge/LuaBridge.h)
+prepend(luabridge_sources "${luabridge_build_toplevel}/Source/" ${luabridge_sources})
+
+# # External project to get sources
+ExternalProject_Add(LUABRIDGE_BUILD_SOURCE
+ BUILD_IN_SOURCE TRUE
+ BUILD_ALWAYS FALSE
+ # # Use Git to get what we need
+ GIT_SHALLOW TRUE
+ GIT_SUBMODULES ""
+ GIT_REPOSITORY https://github.com/ThePhD/LuaBridge.git
+ PREFIX ${luabridge_build_toplevel}
+ SOURCE_DIR ${luabridge_build_toplevel}
+ DOWNLOAD_DIR ${luabridge_build_toplevel}
+ TMP_DIR "${luabridge_build_toplevel}-tmp"
+ STAMP_DIR "${luabridge_build_toplevel}-stamp"
+ INSTALL_DIR "${luabridge_build_toplevel}/local"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+ BUILD_BYPRODUCTS "${luabridge_sources}")
+
+add_library(${luabridge_lib} INTERFACE)
+add_dependencies(${luabridge_lib} LUABRIDGE_BUILD_SOURCE)
+target_include_directories(${luabridge_lib} INTERFACE ${luabridge_include_dirs})
+target_link_libraries(${luabridge_lib} INTERFACE ${LUA_LIBRARIES})
+if (NOT MSVC)
+ target_compile_options(${luabridge_lib} INTERFACE
+ -Wno-noexcept-type -Wno-ignored-qualifiers -Wno-unused-parameter)
+endif()
+set(LUABRIDGEBUILD_FOUND TRUE)
+set(LUABRIDGE_LIBRARIES ${luabridge_lib})
+set(LUABRIDGE_INCLUDE_DIRS ${luabridge_include_dirs})
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuabridgeBuild
+ FOUND_VAR LUABRIDGEBUILD_FOUND
+ REQUIRED_VARS LUABRIDGE_LIBRARIES LUABRIDGE_INCLUDE_DIRS
+ VERSION_VAR luabridge_version)
+
+
diff --git a/deps/sol2/cmake/Modules/FindLuaBuild.cmake b/deps/sol2/cmake/Modules/FindLuaBuild.cmake new file mode 100644 index 0000000..6ed229a --- /dev/null +++ b/deps/sol2/cmake/Modules/FindLuaBuild.cmake @@ -0,0 +1,120 @@ +# # # # sol3
+# The MIT License (MIT)
+#
+# Copyright (c) 2013-2019 Rapptz, ThePhD, and contributors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy of
+# this software and associated documentation files (the "Software"), to deal in
+# the Software without restriction, including without limitation the rights to
+# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+# the Software, and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+# # Standard CMake Libraries
+include(FindPackageHandleStandardArgs)
+
+# Contain literally everything inside of this function to prevent spillage
+function(find_lua_build LUA_VERSION)
+ # # # Variables
+ # # Core Paths
+ string(TOLOWER ${LUA_VERSION} LUA_BUILD_NORMALIZED_LUA_VERSION)
+ if (LUA_BUILD_NORMALIZED_LUA_VERSION MATCHES "luajit")
+ set(LUA_BUILD_LIBNAME ${LUA_VERSION})
+ elseif (BUILD_LUAJIT)
+ set(LUA_BUILD_LIBNAME luajit-${LUA_VERSION})
+ elseif (LUA_BUILD_NORMALIZED_LUA_VERSION MATCHES "lua")
+ set(LUA_BUILD_LIBNAME ${LUA_VERSION})
+ elseif (BUILD_LUA)
+ set(LUA_BUILD_LIBNAME lua-${LUA_VERSION})
+ else()
+ set(LUA_BUILD_LIBNAME lua-${LUA_VERSION})
+ endif()
+ set(LUA_BUILD_TOPLEVEL "${CMAKE_BINARY_DIR}/vendor/${LUA_BUILD_LIBNAME}")
+ set(LUA_BUILD_INSTALL_DIR "${LUA_BUILD_TOPLEVEL}")
+ # # Misc needed variables
+ set(LUA_BUILD_LIBRARY_DESCRIPTION "The base name of the library to build either the static or the dynamic library")
+
+ # Object file suffixes
+ if (MSVC)
+ set(LUA_BUILD_BUILD_DLL_DEFAULT ON)
+ set(LUA_BUILD_OBJECT_FILE_SUFFIX .obj)
+ else()
+ set(LUA_BUILD_BUILD_DLL_DEFAULT OFF)
+ set(LUA_BUILD_OBJECT_FILE_SUFFIX .o)
+ endif()
+
+ # # # Options
+ option(BUILD_LUA_AS_DLL ${LUA_BUILD_BUILD_DLL_DEFAULT} "Build Lua or LuaJIT as a Shared/Dynamic Link Library")
+
+ STRING(TOLOWER ${LUA_BUILD_LIBNAME} LUA_BUILD_NORMALIZED_LIBNAME)
+ if (NOT LUA_LIBRARY_NAME)
+ if (LUA_BUILD_NORMALIZED_LIBNAME MATCHES "luajit")
+ set(LUA_LIBRARY luajit)
+ else()
+ set(LUA_LIBRARY ${LUA_BUILD_LIBNAME})
+ endif()
+ else()
+ set(LUA_LIBRARY_NAME ${LUA_LIBRARY_NAME}
+ CACHE STRING
+ ${LUA_BUILD_LIBRARY_DESCRIPTION})
+ endif()
+ # # Dependent Variables
+ # If we're building a DLL, then set the library type to SHARED
+ if (BUILD_LUA_AS_DLL)
+ set(LUA_BUILD_LIBRARY_TYPE SHARED)
+ else()
+ set(LUA_BUILD_LIBRARY_TYPE STATIC)
+ endif()
+
+
+ # # # Build Lua
+ # # Select either LuaJIT or Vanilla Lua here, based on what we discover
+ if (BUILD_LUAJIT OR LUA_BUILD_NORMALIZED_LUA_VERSION MATCHES "luajit")
+ include(${CMAKE_CURRENT_LIST_DIR}/FindLuaBuild/LuaJIT.cmake)
+ set(LUA_VERSION_STRING ${LUA_JIT_VERSION})
+ else()
+ include(${CMAKE_CURRENT_LIST_DIR}/FindLuaBuild/LuaVanilla.cmake)
+ set(LUA_VERSION_STRING ${LUA_VANILLA_VERSION})
+ endif()
+
+ # # Export variables to the parent scope
+ set(LUA_LIBRARIES ${LUA_LIBRARIES} PARENT_SCOPE)
+ set(LUA_INTERPRETER ${LUA_INTERPRETER} PARENT_SCOPE)
+ set(LUA_INCLUDE_DIRS ${LUA_INCLUDE_DIRS} PARENT_SCOPE)
+ set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE)
+ set(LUABUILD_FOUND TRUE PARENT_SCOPE)
+endfunction(find_lua_build)
+
+# Call and then immediately undefine to avoid polluting the global scope
+if (LuaBuild_FIND_COMPONENTS)
+ list(GET LuaBuild_FIND_COMPONENTS 0 LUA_VERSION)
+endif()
+if (LuaBuild_FIND_VERSION)
+ if (LUA_VERSION)
+ set(LUA_VERSION "${LUA_VERSION}-${LuaBuild_FIND_VERSION}")
+ else()
+ set(LUA_VERSION "${LuaBuild_VERSION}")
+ endif()
+endif()
+if (NOT LUA_VERSION)
+ set(LUA_VERSION 5.3.5)
+endif()
+find_lua_build(${LUA_VERSION})
+unset(find_lua_build)
+
+# handle the QUIETLY and REQUIRED arguments and set LUABUILD_FOUND to TRUE if
+# all listed variables are TRUE
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaBuild
+ FOUND_VAR LUABUILD_FOUND
+ REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIRS
+ VERSION_VAR LUA_VERSION_STRING)
diff --git a/deps/sol2/cmake/Modules/FindLuaBuild/LuaJIT.cmake b/deps/sol2/cmake/Modules/FindLuaBuild/LuaJIT.cmake new file mode 100644 index 0000000..0d91aae --- /dev/null +++ b/deps/sol2/cmake/Modules/FindLuaBuild/LuaJIT.cmake @@ -0,0 +1,420 @@ +# # # # sol3 +# The MIT License (MIT) +# +# Copyright (c) 2013-2019 Rapptz, ThePhD, and contributors +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +# the Software, and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# protect from multiple inclusion +if(lua_jit_build_included) + return() +endif(lua_jit_build_included) +set(lua_jit_build_included true) + +# import necessary standard modules +include(ExternalProject) + +# Latest iterations for specific sub-versions of LuaJIT +set(LUA_JIT_2.0_LATEST_VERSION 2.0.5) +set(LUA_JIT_${LUA_JIT_2.0_LATEST_VERSION}_COMMIT c88602f080dcafea6ba222a2f7cc1ea0e41ef3cc) +set(LUA_JIT_2.1_LATEST_VERSION 2.1.0-beta3) +set(LUA_JIT_${LUA_JIT_2.1_LATEST_VERSION}_COMMIT 80aaaeee99d7f7b06c9e75ed3a457c49d86fc4db) + +# MD5 hashes taken off of LuaJIT's website +# must be updated whenever a new version appears +set(LUA_JIT_MD5_2.1.0-beta3.tar.gz eae40bc29d06ee5e3078f9444fcea39b) +set(LUA_JIT_MD5_2.1.0-beta3.zip 58d0480e1af0811e7ecee45498d62e2d) +set(LUA_JIT_MD5_2.1.0-beta2.tar.gz fa14598d0d775a7ffefb138a606e0d7b) +set(LUA_JIT_MD5_2.1.0-beta2.zip b5d943c0174ca217736e2ddc2d9721c3) +set(LUA_JIT_MD5_2.1.0-beta1.tar.gz 5a5bf71666e77cf6e7a1ae851127b834) +set(LUA_JIT_MD5_2.1.0-beta1.zip 4b5c2c9aef0e7c0b622b09e7c84d566b) +set(LUA_JIT_MD5_2.0.5.tar.gz 48353202cbcacab84ee41a5a70ea0a2c) +set(LUA_JIT_MD5_2.0.5.zip f7cf52a049d74aee4e624bdc1160b80d) +set(LUA_JIT_MD5_2.0.4.tar.gz dd9c38307f2223a504cbfb96e477eca0) +set(LUA_JIT_MD5_2.0.4.zip ed1f0caf3d390171f423f6f1b5c57aac) +set(LUA_JIT_MD5_2.0.3.tar.gz f14e9104be513913810cd59c8c658dc0) +set(LUA_JIT_MD5_2.0.3.zip 6c0f6958d5e1f67734fb1ff514ec4c84) +set(LUA_JIT_MD5_2.0.2.tar.gz 112dfb82548b03377fbefbba2e0e3a5b) +set(LUA_JIT_MD5_2.0.2.zip a57c7d1b8eaf46559303dcfd56404045) +set(LUA_JIT_MD5_2.0.1.tar.gz 85e406e8829602988eb1233a82e29f1f) +set(LUA_JIT_MD5_2.0.1.zip cf4aee0e40b220054ee3cffbe0cd6ed5) +set(LUA_JIT_MD5_2.0.0.tar.gz 97a2b87cc0490784f54b64cfb3b8f5ad) +set(LUA_JIT_MD5_2.0.0.zip 467f4f531f7e08ee252f5030ecada7ed) +set(LUA_JIT_MD5_2.0.0-beta11.tar.gz 824aa2684a11e3cc3abe87350a7b6139) +set(LUA_JIT_MD5_2.0.0-beta11.zip 8629401437048e477c94bd791b0a823a) +set(LUA_JIT_MD5_2.0.0-beta10.tar.gz ed66689b96f7ad7bfeffe0b4ff2d63d4) +set(LUA_JIT_MD5_2.0.0-beta10.zip f6bbd472726b761b29438c4a06b5ab3c) +set(LUA_JIT_MD5_2.0.0-beta9.tar.gz e7e03e67e2550817358bc28b44270c6d) +set(LUA_JIT_MD5_2.0.0-beta9.zip 3f9ca0309f26e789c6c3246c83696f84) +set(LUA_JIT_MD5_2.0.0-beta8.tar.gz f0748a73ae268d49b1d01f56c4fe3e61) +set(LUA_JIT_MD5_2.0.0-beta8.zip fb096a90c9e799c8922f32095ef3d93c) +set(LUA_JIT_MD5_2.0.0-beta7.tar.gz b845dec15dd9eba2fd17d865601a52e5) +set(LUA_JIT_MD5_2.0.0-beta7.zip e10fc2b19de52d8770cdf24f1791dd77) +set(LUA_JIT_MD5_2.0.0-beta6.tar.gz bfcbe2a11162cfa84d5a1693b442c8bf) +set(LUA_JIT_MD5_2.0.0-beta6.zip f64945c5ecaf3ea71a829fdbb5cb196c) +set(LUA_JIT_MD5_2.0.0-beta5.tar.gz 7e0dfa03a140148149a1021d4ffd5c57) +set(LUA_JIT_MD5_2.0.0-beta5.zip be8087fcb576c30ffbb6368ebc284498) +set(LUA_JIT_MD5_2.0.0-beta4.tar.gz 5c5a9305b3e06765e1dae138e1a95c3a) +set(LUA_JIT_MD5_2.0.0-beta4.zip d0b241be6207fa7d97b6afc41368e05f) +set(LUA_JIT_MD5_2.0.0-beta3.tar.gz 313b6f164e93e1bbac7bf87abb58d4a1) +set(LUA_JIT_MD5_2.0.0-beta3.zip bea9c7bcd5084f98830e31956f276ff6) +set(LUA_JIT_MD5_2.0.0-beta2.tar.gz 2ebcc38fa1d9756dc2e341f191701120) +set(LUA_JIT_MD5_2.0.0-beta2.zip 94086f99f647d46a8360adeb11851d66) +set(LUA_JIT_MD5_2.0.0-beta1.tar.gz 9ed7646d03580a1cec4abeb74ca44843) +set(LUA_JIT_MD5_2.0.0-beta1.zip 19d5bac616fa739343c7158d9d99a3f3) +set(LUA_JIT_MD5_1.1.8.tar.gz ad0e319483fa235e3979537a748631e9) +set(LUA_JIT_MD5_1.1.8.zip 92870c80f504c34c9b7547cd6c5562d0) +set(LUA_JIT_MD5_1.1.7.tar.gz 3aed0795f7c8725d3613269cd56f8e5a) +set(LUA_JIT_MD5_1.1.7.zip 40a8dbc214306bb4b9849fcf026c4ee0) +set(LUA_JIT_MD5_1.1.6.tar.gz 1a1320e09d0cd5b793014556fb7d64c9) +set(LUA_JIT_MD5_1.1.6.zip 350d7b9230637056fbd6158b95e8fa11) +set(LUA_JIT_MD5_1.1.5.tar.gz b99d244ba4fc1979946ae1025368fc5c) +set(LUA_JIT_MD5_1.1.5.zip d3ffbae3bfcd5914b02dc00b1118a59d) +set(LUA_JIT_MD5_1.1.4.tar.gz 9fe29cfb8126bc9c4302701c06965f1c) +set(LUA_JIT_MD5_1.1.4.zip 30d318e3287000ecf4c93b29e8783183) +set(LUA_JIT_MD5_1.1.3.tar.gz f5db1a147ed3d34677ad1ef310c56da7) +set(LUA_JIT_MD5_1.1.3.zip 5949e7bce9d97c37c282e1cbe85aa378) +set(LUA_JIT_MD5_1.1.2.tar.gz 4ae25ce7e3f301d1fcf0b713016edab0) +set(LUA_JIT_MD5_1.1.0.tar.gz 16d880a98a1ff6608ac1039c802233db) +set(LUA_JIT_MD5_1.0.3.tar.gz d0a63d5394cca549889bd820a05b32d2) + +# Clean up some variables +string(TOLOWER ${LUA_VERSION} LUA_JIT_NORMALIZED_LUA_VERSION) +if (LUA_JIT_NORMALIZED_LUA_VERSION MATCHES "([0-9]+\\.[0-9]+\\.[0-9]+(-[A-Za-z0-9_-]+)?)") + # 3-digit with optional beta1/beta2/beta3 (or whatever): probably okay? + set(LUA_JIT_VERSION ${CMAKE_MATCH_1}) +elseif (LUA_JIT_NORMALIZED_LUA_VERSION MATCHES "([0-9]+\\.[0-9]+)") + # extend version number with prefix + if (${CMAKE_MATCH_1} EQUAL 2) + if (${CMAKE_MATCH_2} EQUAL 0) + set(LUA_JIT_VERSION ${LUA_JIT_2.0_LATEST_VERSION}) + elseif (${CMAKE_MATCH_2} EQUAL 1) + set(LUA_JIT_VERSION ${LUA_JIT_2.1_LATEST_VERSION}) + endif() + endif() + if (NOT LUA_JIT_VERSION) + # Just pick a default version and roll with it + set(LUA_JIT_VERSION ${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.0) + endif() +elseif (LUA_JIT_NORMALIZED_LUA_VERSION MATCHES "latest") + set(LUA_JIT_VERSION ${LUA_JIT_2.1_LATEST_VERSION}) +else() + MESSAGE(FATAL "Cannot deduce LuaJIT version from ${LUA_VERSION}") +endif() + +FIND_PACKAGE_MESSAGE(LUABUILD + "Selecting LuaJIT ${LUA_JIT_VERSION} from '${LUA_VERSION}' and building a ${LUA_BUILD_LIBRARY_TYPE} library..." + "[${LUA_JIT_VERSION}][${LUA_VERSION}][${LUA_BUILD_LIBRARY_TYPE}]") + +# Get hashes for the build +# LuaJIT unfortunately does not give us SHA1 hashes as well +# set(LUA_JIT_SHA1 ${LUA_JIT_SHA1_${LUA_JIT_VERSION}}) +if (WIN32) + set(LUA_JIT_MD5 ${LUA_JIT_MD5_${LUA_JIT_VERSION}.zip}) + set(LUA_JIT_DOWNLOAD_URI http://luajit.org/download/LuaJIT-${LUA_JIT_VERSION}.zip) +else() + set(LUA_JIT_MD5 ${LUA_JIT_MD5_${LUA_JIT_VERSION}.tar.gz}) + set(LUA_JIT_DOWNLOAD_URI http://luajit.org/download/LuaJIT-${LUA_JIT_VERSION}.tar.gz) +endif() + +if (LUA_JIT_MD5) + set(LUA_JIT_DOWNLOAD_MD5_COMMAND URL_MD5 ${LUA_JIT_MD5}) +else () + set(LUA_JIT_DOWNLOAD_MD5_COMMAND "") +endif() +if (LUA_JIT_SHA1) + set(LUA_JIT_DOWNLOAD_SHA1_COMMAND URL_HASH SHA1=${LUA_JIT_SHA1}) +else () + set(LUA_JIT_DOWNLOAD_SHA1_COMMAND "") +endif() + +set(LUA_JIT_SOURCE_DIR "${LUA_BUILD_TOPLEVEL}/src") +set(LUA_JIT_INSTALL_DIR "${LUA_BUILD_TOPLEVEL}/install") +set(LUA_JIT_INCLUDE_DIRS "${LUA_JIT_SOURCE_DIR}") +file(MAKE_DIRECTORY ${LUA_JIT_SOURCE_DIR}) +file(MAKE_DIRECTORY ${LUA_JIT_INSTALL_DIR}) + +set(LUA_JIT_LIB_FILENAME "${CMAKE_STATIC_LIBRARY_PREFIX}${LUA_BUILD_LIBNAME}${CMAKE_STATIC_LIBRARY_SUFFIX}") +set(LUA_JIT_IMP_LIB_FILENAME "${CMAKE_IMPORT_LIBRARY_PREFIX}${LUA_BUILD_LIBNAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}") +set(LUA_JIT_LIB_EXP_FILENAME "${LUA_BUILD_LIBNAME}.exp") +set(LUA_JIT_DLL_FILENAME "${CMAKE_SHARED_LIBRARY_PREFIX}${LUA_BUILD_LIBNAME}${CMAKE_SHARED_LIBRARY_SUFFIX}") +set(LUA_JIT_EXE_FILENAME "${LUA_BUILD_LIBNAME}${CMAKE_EXECUTABLE_SUFFIX}") + +set(LUA_JIT_LIB_FILE "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${LUA_JIT_LIB_FILENAME}") +set(LUA_JIT_IMP_LIB_FILE "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${LUA_JIT_IMP_LIB_FILENAME}") +set(LUA_JIT_LIB_EXP_FILE "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${LUA_JIT_LIB_EXP_FILENAME}") +set(LUA_JIT_DLL_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${LUA_JIT_DLL_FILENAME}") +set(LUA_JIT_EXE_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${LUA_JIT_EXE_FILENAME}") + +# # # Do the build +if (MSVC) + # Visual C++ is predicated off running msvcbuild.bat + # which requires a Visual Studio Command Prompt + # make sure to find the right one + find_file(VCVARS_ALL_BAT NAMES vcvarsall.bat + HINTS "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build" + "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary" + "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC" + "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Auxiliary/Build" + "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Auxiliary" + "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC" + "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Auxiliary/Build" + "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Auxiliary" + "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC" + + "C:/Program Files/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build" + "C:/Program Files/Microsoft Visual Studio/2017/Community/VC/Auxiliary" + "C:/Program Files/Microsoft Visual Studio/2017/Community/VC" + "C:/Program Files/Microsoft Visual Studio/2017/Professional/VC/Auxiliary/Build" + "C:/Program Files/Microsoft Visual Studio/2017/Professional/VC/Auxiliary" + "C:/Program Files/Microsoft Visual Studio/2017/Professional/VC" + "C:/Program Files/Microsoft Visual Studio/2017/Enterprise/VC/Auxiliary/Build" + "C:/Program Files/Microsoft Visual Studio/2017/Enterprise/VC/Auxiliary" + "C:/Program Files/Microsoft Visual Studio/2017/Enterprise/VC") + if (VCVARS_ALL_BAT MATCHES "VCVARS_ALL_BAT-NOTFOUND") + MESSAGE(FATAL_ERROR "Cannot find 'vcvarsall.bat' file or similar needed to build LuaJIT ${LUA_VERSION} on Windows") + endif() + if (CMAKE_SIZEOF_VOID_P LESS_EQUAL 4) + set(LUA_JIT_MAKE_COMMAND "${VCVARS_ALL_BAT}" x86) + else() + set(LUA_JIT_MAKE_COMMAND "${VCVARS_ALL_BAT}" x64) + endif() + set(LUA_JIT_MAKE_COMMAND ${LUA_JIT_MAKE_COMMAND} && cd src && msvcbuild.bat) + if (NOT BUILD_LUA_AS_DLL) + set(LUA_JIT_MAKE_COMMAND ${LUA_JIT_MAKE_COMMAND} static) + endif() + + set(LUA_JIT_PREBUILT_LIB "lua51.lib") + set(LUA_JIT_PREBUILT_IMP_LIB "lua51.lib") + set(LUA_JIT_PREBUILT_DLL "lua51.dll") + set(LUA_JIT_PREBUILT_EXP "lua51.exp") + set(LUA_JIT_PREBUILT_EXE "luajit.exe") +else () + # get the make command we need for this system + find_program(MAKE_PROGRAM NAMES make mingw32-make mingw64-make) + if (MAKE_PROGRAM MATCHES "MAKE_PROGRAM-NOTFOUND") + MESSAGE(FATAL_ERROR "Cannot find 'make' program or similar needed to build LuaJIT ${LUA_VERSION} (perhaps place it in the PATH environment variable if it is not already?)") + endif() + + # we can simply reuse the makefile here + # so define it as an external project and then just have the proper + # build/install/test commands + # make sure to apply -pagezero_size 10000 -image_base 100000000 (done later for XCode Targets) + set(LUA_JIT_MAKE_BUILD_MODIFICATIONS "LUAJIT_T=${LUA_JIT_EXE_FILENAME}") + list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "LUAJIT_A=${LUA_JIT_LIB_FILENAME}") + set(LUA_JIT_MAKE_CFLAGS_MODIFICATIONS "") + set(LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS "") + set(LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS "-fPIC") + if (BUILD_LUA_AS_DLL) + list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "LUAJIT_SO=${LUA_JIT_DLL_FILENAME}" "TARGET_SONAME=${LUA_JIT_DLL_FILENAME}" "TARGET_DYLIBNAME=${LUA_JIT_DLL_FILENAME}" "TARGET_DLLNAME=${LUA_JIT_DLL_FILENAME}") + list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "BUILDMODE=dynamic") + else() + list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "BUILDMODE=static") + endif() + if (IS_X86) + list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "CC=${CMAKE_C_COMPILER} -m32") + list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "LDFLAGS=-m32") + #set(LUA_JIT_MAKE_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_CFLAGS_MODIFICATIONS} -m32") + #set(LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS} -m32") + #set(LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS} -m32") + endif() + + set(LUA_JIT_PREBUILT_DLL ${LUA_JIT_DLL_FILENAME}) + set(LUA_JIT_PREBUILT_LIB ${LUA_JIT_LIB_FILENAME}) + set(LUA_JIT_PREBUILT_IMP_LIB ${LUA_JIT_IMP_LIB_FILENAME}) + set(LUA_JIT_PREBUILT_EXE ${LUA_JIT_EXE_FILENAME}) + set(LUA_JIT_PREBUILT_EXP ${LUA_JIT_LIB_EXP_FILENAME}) + + if (WIN32) + list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "HOST_SYS=Windows" "TARGET_SYS=Windows" "TARGET_AR=ar rcus") + endif() + list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "CFLAGS=${LUA_JIT_MAKE_CFLAGS_MODIFICATIONS}") + list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "TARGET_CFLAGS=${LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS}") + list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "HOST_CFLAGS=${LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS}") + set(LUA_JIT_MAKE_COMMAND "${MAKE_PROGRAM}" ${LUA_JIT_MAKE_BUILD_MODIFICATIONS}) +endif() + +set(LUA_JIT_BUILD_COMMAND BUILD_COMMAND ${LUA_JIT_MAKE_COMMAND}) + +set(lualib luajit_lib_${LUA_JIT_VERSION}) +set(luainterpreter luajit_${LUA_JIT_VERSION}) + +file(TO_CMAKE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_PREBUILT_LIB}" LUA_JIT_SOURCE_LUA_LIB) +file(TO_CMAKE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_PREBUILT_IMP_LIB}" LUA_JIT_SOURCE_LUA_IMP_LIB) +file(TO_CMAKE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_PREBUILT_EXE}" LUA_JIT_SOURCE_LUA_INTERPRETER) +file(TO_CMAKE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_PREBUILT_DLL}" LUA_JIT_SOURCE_LUA_DLL) +file(TO_CMAKE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_PREBUILT_EXP}" LUA_JIT_SOURCE_LUA_LIB_EXP) + +file(TO_CMAKE_PATH "${LUA_JIT_DLL_FILE}" LUA_JIT_DESTINATION_LUA_DLL) +file(TO_CMAKE_PATH "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${LUA_JIT_LIB_EXP_FILENAME}" LUA_JIT_DESTINATION_LUA_LIB_EXP) +file(TO_CMAKE_PATH "${LUA_JIT_IMP_LIB_FILE}" LUA_JIT_DESTINATION_LUA_IMP_LIB) +file(TO_CMAKE_PATH "${LUA_JIT_LIB_FILE}" LUA_JIT_DESTINATION_LUA_LIB) +file(TO_CMAKE_PATH "${LUA_JIT_EXE_FILE}" LUA_JIT_DESTINATION_LUA_INTERPRETER) + +if (WIN32 AND NOT MSVC) + string(COMPARE EQUAL ${LUA_JIT_VERSION} ${LUA_JIT_2.0_LATEST_VERSION} lua_jit_same_version_20) + string(COMPARE EQUAL ${LUA_JIT_VERSION} ${LUA_JIT_2.1_LATEST_VERSION} lua_jit_same_version_21) + if (lua_jit_same_version_20 OR lua_jit_same_version_21) + #set (LUA_JIT_GIT_COMMIT ${LUA_JIT_${LUA_JIT_VERSION}_COMMIT}) + #set(LUA_JIT_GIT_TAG GIT_TAG ${LUA_JIT_GIT_COMMIT}) + endif() +elseif(LUA_JIT_NORMALIZED_LUA_VERSION MATCHES "latest") + set(LUA_JIT_PULL_LATEST TRUE) +endif() + +set(LUA_JIT_BYPRODUCTS "${LUA_JIT_SOURCE_LUA_DLL}" "${LUA_JIT_SOURCE_LUA_INTERPRETER}") +set(LUA_JIT_INSTALL_BYPRODUCTS "${LUA_JIT_DESTINATION_LUA_DLL}" "${LUA_JIT_DESTINATION_LUA_INTERPRETER}") + +if (BUILD_LUA_AS_DLL AND MSVC) + set(LUA_JIT_BYPRODUCTS ${LUA_JIT_BYPRODUCTS} "${LUA_JIT_SOURCE_LUA_LIB_EXP}") + set(LUA_JIT_INSTALL_BYPRODUCTS ${LUA_JIT_INSTALL_BYPRODUCTS} "${LUA_JIT_DESTINATION_LUA_LIB_EXP}") +endif() + +if (CMAKE_IMPORT_LIBRARY_SUFFIX AND BUILD_LUA_AS_DLL) + set(LUA_JIT_BYPRODUCTS ${LUA_JIT_BYPRODUCTS} "${LUA_JIT_SOURCE_LUA_IMP_LIB}") + set(LUA_JIT_INSTALL_BYPRODUCTS "${LUA_JIT_INSTALL_BYPRODUCTS}" "${LUA_JIT_DESTINATION_LUA_IMP_LIB}") +else() + set(LUA_JIT_BYPRODUCTS ${LUA_JIT_BYPRODUCTS} "${LUA_JIT_SOURCE_LUA_LIB}") + set(LUA_JIT_INSTALL_BYPRODUCTS ${LUA_JIT_INSTALL_BYPRODUCTS} "${LUA_JIT_DESTINATION_LUA_LIB}") +endif() + +# # Post-Build moving steps for necessary items +# Add post-step to move library afterwards +set(LUA_JIT_POSTBUILD_COMMENTS "Executable - Moving \"${LUA_JIT_SOURCE_LUA_INTERPRETER}\" to \"${LUA_JIT_DESTINATION_LUA_INTERPRETER}\"...") +set(LUA_JIT_POSTBUILD_COMMANDS COMMAND "${CMAKE_COMMAND}" -E copy "${LUA_JIT_SOURCE_LUA_INTERPRETER}" "${LUA_JIT_DESTINATION_LUA_INTERPRETER}") +if (BUILD_LUA_AS_DLL) + if (MSVC) + set(LUA_JIT_POSTBUILD_COMMENTS "${LUA_JIT_POSTBUILD_COMMENTS} | Import Library - Moving \"${LUA_JIT_SOURCE_LUA_IMP_LIB}\" to \"${LUA_JIT_DESTINATION_LUA_IMP_LIB}\"...") + set(LUA_JIT_POSTBUILD_COMMANDS ${LUA_JIT_POSTBUILD_COMMANDS} COMMAND "${CMAKE_COMMAND}" -E copy "${LUA_JIT_SOURCE_LUA_IMP_LIB}" "${LUA_JIT_DESTINATION_LUA_IMP_LIB}") + + set(LUA_JIT_POSTBUILD_COMMENTS "${LUA_JIT_POSTBUILD_COMMENTS} | Library - Moving \"${LUA_JIT_SOURCE_LUA_LIB_EXP}\" to \"${LUA_JIT_DESTINATION_LUA_LIB_EXP}\"...") + set(LUA_JIT_POSTBUILD_COMMANDS ${LUA_JIT_POSTBUILD_COMMANDS} && "${CMAKE_COMMAND}" -E copy "${LUA_JIT_SOURCE_LUA_LIB_EXP}" "${LUA_JIT_DESTINATION_LUA_LIB_EXP}") + endif() + set(LUA_JIT_POSTBUILD_COMMENTS "${LUA_JIT_POSTBUILD_COMMENTS} | Dynamic Library - Moving \"${LUA_JIT_SOURCE_LUA_DLL}\" to \"${LUA_JIT_DESTINATION_LUA_DLL}\"...") + set(LUA_JIT_POSTBUILD_COMMANDS ${LUA_JIT_POSTBUILD_COMMANDS} COMMAND "${CMAKE_COMMAND}" -E copy "${LUA_JIT_SOURCE_LUA_DLL}" "${LUA_JIT_DESTINATION_LUA_DLL}") +else() + set(LUA_JIT_POSTBUILD_COMMENTS "${LUA_JIT_POSTBUILD_COMMENTS} | Library - Moving \"${LUA_JIT_SOURCE_LUA_LIB}\" to \"${LUA_JIT_DESTINATION_LUA_LIB}\"...") + set(LUA_JIT_POSTBUILD_COMMANDS ${LUA_JIT_POSTBUILD_COMMANDS} COMMAND "${CMAKE_COMMAND}" -E copy "${LUA_JIT_SOURCE_LUA_LIB}" "${LUA_JIT_DESTINATION_LUA_LIB}") +endif() + +if (LUA_LOCAL_DIR) + file(COPY "${LUA_LOCAL_DIR}/" + DESTINATION "${LUA_BUILD_TOPLEVEL}" + FILES_MATCHING REGEX ".*" + ) + add_custom_command(OUTPUT ${LUA_JIT_BYPRODUCTS} + COMMAND ${LUA_JIT_MAKE_COMMAND} + WORKING_DIRECTORY "${LUA_BUILD_TOPLEVEL}" + DEPENDS "${LUA_BUILD_TOPLEVEL}/Makefile" "${LUA_BUILD_TOPLEVEL}/src/msvcbuild.bat" + COMMENT "Building LuaJIT ${LUA_JIT_VERSION}..." + ) + add_custom_target(LUA_JIT-move + ${LUA_JIT_POSTBUILD_COMMANDS} + COMMENT ${LUA_JIT_POSTBUILD_COMMENTS} + BYPRODUCTS ${LUA_JIT_INSTALL_BYPRODUCTS} + DEPENDS ${LUA_JIT_BYPRODUCTS} + ) +elseif (LUA_JIT_GIT_COMMIT OR LUA_JIT_PULL_LATEST) + if (LUA_JIT_PULL_LATEST) + MESSAGE(STATUS "Latest LuaJIT has been requested: pulling from git...") + elseif (LUA_JIT_GIT_COMMIT) + MESSAGE(STATUS "LuaJIT '${LUA_VERSION}' requested has broken static library builds: using git '${LUA_JIT_GIT_COMMIT}'...") + endif() + ExternalProject_Add(LUA_JIT + BUILD_IN_SOURCE TRUE + BUILD_ALWAYS FALSE + PREFIX "${LUA_BUILD_TOPLEVEL}" + SOURCE_DIR "${LUA_BUILD_TOPLEVEL}" + DOWNLOAD_DIR "${LUA_BUILD_TOPLEVEL}" + TMP_DIR "${LUA_BUILD_TOPLEVEL}-tmp" + STAMP_DIR "${LUA_BUILD_TOPLEVEL}-stamp" + INSTALL_DIR "${LUA_BUILD_INSTALL_DIR}" + GIT_REPOSITORY https://github.com/LuaJIT/LuaJIT.git + GIT_REMOTE_NAME origin + ${LUA_JIT_GIT_TAG} + GIT_SHALLOW TRUE + CONFIGURE_COMMAND "" + ${LUA_JIT_BUILD_COMMAND} + INSTALL_COMMAND "" + TEST_COMMAND "" + BUILD_BYPRODUCTS ${LUA_JIT_BYPRODUCTS}) +else() + ExternalProject_Add(LUA_JIT + BUILD_IN_SOURCE TRUE + BUILD_ALWAYS TRUE + # LuaJIT does not offer a TLS/SSL port + TLS_VERIFY FALSE + PREFIX "${LUA_BUILD_TOPLEVEL}" + SOURCE_DIR "${LUA_BUILD_TOPLEVEL}" + DOWNLOAD_DIR "${LUA_BUILD_TOPLEVEL}" + TMP_DIR "${LUA_BUILD_TOPLEVEL}-tmp" + STAMP_DIR "${LUA_BUILD_TOPLEVEL}-stamp" + INSTALL_DIR "${LUA_BUILD_INSTALL_DIR}" + URL "${LUA_JIT_DOWNLOAD_URI}" + ${LUA_JIT_DOWNLOAD_MD5_COMMAND} + ${LUA_JIT_DOWNLOAD_SHA1_COMMAND} + CONFIGURE_COMMAND "" + ${LUA_JIT_BUILD_COMMAND} + INSTALL_COMMAND "" + TEST_COMMAND "" + BUILD_BYPRODUCTS ${LUA_JIT_BYPRODUCTS}) +endif() + +if (NOT LUA_LOCAL_DIR) + ExternalProject_Add_Step(LUA_JIT move + ALWAYS TRUE + ${LUA_JIT_POSTBUILD_COMMANDS} + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + COMMENT ${LUA_JIT_POSTBUILD_COMMENTS} + DEPENDEES build + DEPENDS ${LUA_JIT_BYPRODUCTS} + BYPRODUCTS ${LUA_JIT_INSTALL_BYPRODUCTS}) + ExternalProject_Add_StepTargets(LUA_JIT move) +endif() + +# # Lua Library +add_library(${lualib} INTERFACE) +add_dependencies(${lualib} LUA_JIT-move) +target_include_directories(${lualib} + INTERFACE "${LUA_JIT_SOURCE_DIR}") +if (BUILD_LUA_AS_DLL) + if (MSVC) + target_link_libraries(${lualib} + INTERFACE "${LUA_JIT_DESTINATION_LUA_LIB}") + else() + target_link_libraries(${lualib} + INTERFACE "${LUA_JIT_DESTINATION_LUA_DLL}") + endif() +else() + target_link_libraries(${lualib} + INTERFACE "${LUA_JIT_DESTINATION_LUA_LIB}") +endif() + +if (CMAKE_DL_LIBS) + target_link_libraries(${lualib} + INTERFACE ${CMAKE_DL_LIBS}) +endif() +if (XCODE) + target_compile_options(${lualib} + INTERFACE -pagezero_size 10000 -image_base 100000000) +endif () + +# # set externally-visible target indicator +set(LUA_LIBRARIES ${lualib}) +set(LUA_INTERPRETER "") +set(LUA_INCLUDE_DIRS "${LUA_JIT_INCLUDE_DIRS}") diff --git a/deps/sol2/cmake/Modules/FindLuaBuild/LuaVanilla.cmake b/deps/sol2/cmake/Modules/FindLuaBuild/LuaVanilla.cmake new file mode 100644 index 0000000..0ab67a5 --- /dev/null +++ b/deps/sol2/cmake/Modules/FindLuaBuild/LuaVanilla.cmake @@ -0,0 +1,443 @@ +# # # # sol3 +# The MIT License (MIT) +# +# Copyright (c) 2013-2019 Rapptz, ThePhD, and contributors +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +# the Software, and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# Include guard +if(_lua_vanilla_build_included) + return() +endif(_lua_vanilla_build_included) +set(_lua_vanilla_build_included true) + +# import necessary standard modules +include(ExternalProject) +# import other modules +include(Common/Core) + +# Latest versions for specific sub-versions of Lua +set(LUA_VANILLA_5.1_LATEST_VERSION 5.1.5) +set(LUA_VANILLA_5.2_LATEST_VERSION 5.2.4) +set(LUA_VANILLA_5.3_LATEST_VERSION 5.3.5) +set(LUA_VANILLA_5.4_LATEST_VERSION 5.4.0-alpha) + +# exact version, coming from CI: pull directly from Lua and use external project to build +# list of known md5 / sha1: must update when there are changes +set(LUA_VANILLA_MD5_5.4.0-alpha d49d30b394794b96ffad53513ac647a5) +set(LUA_VANILLA_SHA1_5.4.0-alpha cf3559dc43cad35463740c6fbedeb1ea501e5e23) +set(LUA_VANILLA_MD5_5.4.0-work2 3cdf2a4eb84dde6b6aaf5d2d1de07be9) +set(LUA_VANILLA_SHA1_5.4.0-work2 e8484e61c5c338e3ec2f75dbe0f6703d079fecf9) +set(LUA_VANILLA_MD5_5.4.0-work1 0ff232b8658884155a43cf72212edbd9) +set(LUA_VANILLA_SHA1_5.4.0-work1 a8193b14ed3869917d1102cb0418cf9dfb0d9baf) +set(LUA_VANILLA_MD5_5.3.5 4f4b4f323fd3514a68e0ab3da8ce3455) +set(LUA_VANILLA_SHA1_5.3.5 112eb10ff04d1b4c9898e121d6bdf54a81482447) +set(LUA_VANILLA_MD5_5.3.4 53a9c68bcc0eda58bdc2095ad5cdfc63) +set(LUA_VANILLA_SHA1_5.3.4 79790cfd40e09ba796b01a571d4d63b52b1cd950) +set(LUA_VANILLA_MD5_5.3.3 703f75caa4fdf4a911c1a72e67a27498) +set(LUA_VANILLA_SHA1_5.3.3 a0341bc3d1415b814cc738b2ec01ae56045d64ef) +set(LUA_VANILLA_MD5_5.3.2 33278c2ab5ee3c1a875be8d55c1ca2a1) +set(LUA_VANILLA_SHA1_5.3.2 7a47adef554fdca7d0c5536148de34579134a973) +set(LUA_VANILLA_MD5_5.3.1 797adacada8d85761c079390ff1d9961) +set(LUA_VANILLA_SHA1_5.3.1 1676c6a041d90b6982db8cef1e5fb26000ab6dee) +set(LUA_VANILLA_MD5_5.3.0 a1b0a7e92d0c85bbff7a8d27bf29f8af) +set(LUA_VANILLA_SHA1_5.3.0 1c46d1c78c44039939e820126b86a6ae12dadfba) +set(LUA_VANILLA_MD5_5.2.4 913fdb32207046b273fdb17aad70be13) +set(LUA_VANILLA_SHA1_5.2.4 ef15259421197e3d85b7d6e4871b8c26fd82c1cf) +set(LUA_VANILLA_MD5_5.2.3 dc7f94ec6ff15c985d2d6ad0f1b35654) +set(LUA_VANILLA_SHA1_5.2.3 926b7907bc8d274e063d42804666b40a3f3c124c) +set(LUA_VANILLA_MD5_5.2.2 efbb645e897eae37cad4344ce8b0a614) +set(LUA_VANILLA_SHA1_5.2.2 0857e41e5579726a4cb96732e80d7aa47165eaf5) +set(LUA_VANILLA_MD5_5.2.1 ae08f641b45d737d12d30291a5e5f6e3) +set(LUA_VANILLA_SHA1_5.2.1 6bb1b0a39b6a5484b71a83323c690154f86b2021) +set(LUA_VANILLA_MD5_5.2.0 f1ea831f397214bae8a265995ab1a93e) +set(LUA_VANILLA_SHA1_5.2.0 08f84c355cdd646f617f09cebea48bd832415829) +set(LUA_VANILLA_MD5_5.1.5 2e115fe26e435e33b0d5c022e4490567) +set(LUA_VANILLA_SHA1_5.1.5 b3882111ad02ecc6b972f8c1241647905cb2e3fc) +set(LUA_VANILLA_MD5_5.1.4 d0870f2de55d59c1c8419f36e8fac150) +set(LUA_VANILLA_SHA1_5.1.4 2b11c8e60306efb7f0734b747588f57995493db7) +set(LUA_VANILLA_MD5_5.1.3 a70a8dfaa150e047866dc01a46272599) +set(LUA_VANILLA_SHA1_5.1.3 89bc9f5a351402565b8077e8123327e7cd15f004) +set(LUA_VANILLA_MD5_5.1.2 687ce4c2a1ddff18f1008490fdc4e5e0) +set(LUA_VANILLA_SHA1_5.1.2 8a460d2d7e70e93cb72bf3d584405464763cb5f0) +set(LUA_VANILLA_MD5_5.1.1 22f4f912f20802c11006fe9b84d5c461) +set(LUA_VANILLA_SHA1_5.1.1 be13878ceef8e1ee7a4201261f0adf09f89f1005) +set(LUA_VANILLA_MD5_5.1 3e8dfe8be00a744cec2f9e766b2f2aee) +set(LUA_VANILLA_SHA1_5.1 1ae9ec317511d525c7999c842ca0b1ddde84e374) +set(LUA_VANILLA_MD5_5.0.3 feee27132056de2949ce499b0ef4c480) +set(LUA_VANILLA_SHA1_5.0.3 e7e91f78b8a8deb09b13436829bed557a46af8ae) +set(LUA_VANILLA_MD5_5.0.2 dea74646b7e5c621fef7174df83c34b1) +set(LUA_VANILLA_SHA1_5.0.2 a200cfd20a9a4c7da1206ae45dddf26186a9e0e7) +set(LUA_VANILLA_MD5_5.0.1 e0a450d84971a3f4563b98172d1e382c) +set(LUA_VANILLA_SHA1_5.0.1 03b47b4785178aca583333f01d8726a8ab9f7ae7) +set(LUA_VANILLA_MD5_5.0 6f14803fad389fb1cb15d17edfeddd91) +set(LUA_VANILLA_SHA1_5.0 88b1bc057857c0db5ace491c4af2c917a2b803bf) +set(LUA_VANILLA_MD5_4.0.1 a31d963dbdf727f9b34eee1e0d29132c) +set(LUA_VANILLA_SHA1_4.0.1 12f1864a7ecd4b8011862a07fa3f177b2e80e7d3) +set(LUA_VANILLA_MD5_4.0 be11522d46d33a931868c03694aaeeef) +set(LUA_VANILLA_SHA1_4.0 8d432c73ef6e98b81d252114be1a83182cc9607a) +set(LUA_VANILLA_MD5_3.2.2 374ba5c4839709922de40b8d10382705) +set(LUA_VANILLA_SHA1_3.2.2 fa50ff14c00d8523c8a3d1d3f4887ecc4400d0c3) +set(LUA_VANILLA_MD5_3.2.1 47264a1978df49fc1dea6ffcddb05b21) +set(LUA_VANILLA_SHA1_3.2.1 d43af5a1c7a65c0ddb4b0ac06c29ecf4cdd22367) +set(LUA_VANILLA_MD5_3.2 a6552da3d40ae9b04489a788262279e8) +set(LUA_VANILLA_SHA1_3.2 84cf9f0e7d00eed3ea8b4ac2b84254b714510b34) +set(LUA_VANILLA_MD5_3.1 d677f3827167eefdefc7b211397cfdfb) +set(LUA_VANILLA_SHA1_3.1 509485e3baafd946f4ffe2a984f8a63746adc32a) +set(LUA_VANILLA_MD5_3.0 997558ae76c2f1cd1e10fd3835c45c6a) +set(LUA_VANILLA_SHA1_3.0 5c8c910353f717ba29b4fe7d538994454229b335) +set(LUA_VANILLA_MD5_2.5 da915d58904e75b9b0fc18147e19b0bb) +set(LUA_VANILLA_SHA1_2.5 7920e12c40242932c22fa261ff114cc485a39d99) +set(LUA_VANILLA_MD5_2.4 5d035cc244285c1dbbcaaa0908b58965) +set(LUA_VANILLA_SHA1_2.4 74036935b36e6ae4ed17bd7a9408154f9a4a6b17) +set(LUA_VANILLA_MD5_2.2 a298b58e197ff8168ec907d6145252ef) +set(LUA_VANILLA_SHA1_2.2 2d8b1df94b2fb76f0f16ca1ddc54d5186b10df4b) +set(LUA_VANILLA_MD5_2.1 053a9f6728cc56f6a23716a6a1ede595) +set(LUA_VANILLA_SHA1_2.1 b9a797547f480bcb58b5d3da846c8ac8d2201df0) +set(LUA_VANILLA_MD5_1.1 9f83141cc8ea362497e272071eda5cf6) +set(LUA_VANILLA_SHA1_1.1 67209701eec5cc633e829d023fbff62d5d6c8e5e) +set(LUA_VANILLA_MD5_1.0 96e8399fc508d128badd8ac3aa8f2119) +set(LUA_VANILLA_SHA1_1.0 6a82d2ae7ce9ad98c7b4824a325b91522c0d6ebb) + +# Clean up some variables +if (LUA_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$") + # probably okay! + set(LUA_VANILLA_VERSION ${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}) +elseif (LUA_VERSION MATCHES "([0-9]+)\\.([0-9]+)") + # extend version number with prefix + if (${CMAKE_MATCH_1} EQUAL 5) + if (${CMAKE_MATCH_2} EQUAL 1) + set(LUA_VANILLA_VERSION ${LUA_VANILLA_5.1_LATEST_VERSION}) + elseif (${CMAKE_MATCH_2} EQUAL 2) + set(LUA_VANILLA_VERSION ${LUA_VANILLA_5.2_LATEST_VERSION}) + elseif (${CMAKE_MATCH_2} EQUAL 3) + set(LUA_VANILLA_VERSION ${LUA_VANILLA_5.3_LATEST_VERSION}) + elseif (${CMAKE_MATCH_2} EQUAL 4) + set(LUA_VANILLA_VERSION ${LUA_VANILLA_5.4_LATEST_VERSION}) + else() + # default to whatever the first two + # numbers happen to be, plus build 0 + set(LUA_VANILLA_VERSION ${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.0) + endif() + endif() + if(NOT LUA_VANILLA_VERSION) + # default to whatever the first two + # numbers happen to be, plus build 0 + set(LUA_VANILLA_VERSION ${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.0) + endif() +else() + message(FATAL_ERROR "Cannot deduce the proper Lua version from ${LUA_VERSION}") +endif() + +FIND_PACKAGE_MESSAGE(LUABUILD + "Selecting PUC-RIO Lua ${LUA_VANILLA_VERSION} from '${LUA_VERSION}' and building a ${LUA_BUILD_LIBRARY_TYPE} library..." + "[${LUA_VANILLA_VERSION}][${LUA_VERSION}][${LUA_BUILD_LIBRARY_TYPE}]") + +# Get Hashes to use for download +set(LUA_VANILLA_SHA1 ${LUA_VANILLA_SHA1_${LUA_VANILLA_VERSION}}) +set(LUA_VANILLA_MD5 ${LUA_VANILLA_MD5_${LUA_VANILLA_VERSION}}) + +if (LUA_VANILLA_MD5) + set(LUA_VANILLA_DOWNLOAD_MD5_COMMAND URL_MD5 ${LUA_VANILLA_MD5}) +else () + set(LUA_VANILLA_DOWNLOAD_MD5_COMMAND "") +endif() +if (LUA_VANILLA_SHA1) + set(LUA_VANILLA_DOWNLOAD_SHA1_COMMAND URL_HASH SHA1=${LUA_VANILLA_SHA1}) +else () + set(LUA_VANILLA_DOWNLOAD_SHA1_COMMAND "") +endif() + +# # # Makefile and self-build configurations + +# # Potential compiler variables +if (MSVC) + if (BUILD_LUA_AS_DLL) + set(LUA_VANILLA_DLL_DEFINE LUA_BUILD_AS_DLL) + else() + set(LUA_VANILLA_DLL_DEFINE "") + endif() +else() + set(LUA_VANILLA_LUALIB_COMPILER_OPTIONS "") + set(LUA_VANILLA_DLL_DEFINE "") +endif() + +# # Source files for natural build, if we have to go that far +# retrieve source files +set(LUA_VANILLA_DOWNLOAD_URL https://www.lua.org/ftp/lua-${LUA_VANILLA_VERSION}.tar.gz) +if (LUA_VANILLA_VERSION MATCHES "^5\\.1") + set(LUA_VANILLA_LIB_SOURCES lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c + lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c + lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c lauxlib.c + lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c ltablib.c + lstrlib.c loadlib.c linit.c) + set(LUA_VANILLA_LUA_SOURCES lua.c ) +if (LUA_BUILD_LUA_COMPILER) + set(LUA_VANILLA_LUAC_SOURCES luac.c print.c ) +endif() + set(LUA_VANILLA_GENERATE_LUA_HPP true) +elseif (LUA_VANILLA_VERSION MATCHES "^5\\.2") + set(LUA_VANILLA_LIB_SOURCES lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c + lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c + lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c + lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c + lmathlib.c loslib.c lstrlib.c ltablib.c loadlib.c linit.c) + set(LUA_VANILLA_LUA_SOURCES lua.c ) +if (LUA_BUILD_LUA_COMPILER) + set(LUA_VANILLA_LUAC_SOURCES luac.c ) +endif() + set(LUA_VANILLA_GENERATE_LUA_HPP false) +elseif (LUA_VANILLA_VERSION MATCHES "^5\\.3") + set(LUA_VANILLA_LIB_SOURCES lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c + lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c + lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c lauxlib.c + lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c lmathlib.c + loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c) + set(LUA_VANILLA_LUA_SOURCES lua.c ) +if (LUA_BUILD_LUA_COMPILER) + set(LUA_VANILLA_LUAC_SOURCES luac.c ) +endif() + set(LUA_VANILLA_GENERATE_LUA_HPP false) +elseif (LUA_VANILLA_VERSION MATCHES "^5\\.4") + if (LUA_VANILLA_VERSION MATCHES "work" OR LUA_VANILLA_VERSION MATCHES "alpha") + set(LUA_VANILLA_DOWNLOAD_URL https://www.lua.org/work/lua-${LUA_VANILLA_VERSION}.tar.gz) + endif() + set(LUA_VANILLA_LIB_SOURCES lapi.c lauxlib.c lbaselib.c lcode.c lcorolib.c + lctype.c ldblib.c ldebug.c ldo.c ldump.c lfunc.c lgc.c linit.c liolib.c + llex.c lmathlib.c lmem.c loadlib.c lobject.c lopcodes.c loslib.c + lparser.c lstate.c lstring.c lstrlib.c ltable.c ltablib.c ltm.c lundump.c + lutf8lib.c lvm.c lzio.c) + set(LUA_VANILLA_LUA_SOURCES lua.c ) +if (LUA_BUILD_LUA_COMPILER) + set(LUA_VANILLA_LUAC_SOURCES luac.c ) +endif() + set(LUA_VANILLA_GENERATE_LUA_HPP false) +else() + MESSAGE(WARNING "Using Lua 5.4.0-work1 file list for ${LUA_VERSION} version") + set(LUA_VANILLA_LIB_SOURCES lapi.c lauxlib.c lbaselib.c lcode.c lcorolib.c + lctype.c ldblib.c ldebug.c ldo.c ldump.c lfunc.c lgc.c linit.c liolib.c + llex.c lmathlib.c lmem.c loadlib.c lobject.c lopcodes.c loslib.c + lparser.c lstate.c lstring.c lstrlib.c ltable.c ltablib.c ltm.c lundump.c + lutf8lib.c lvm.c lzio.c) + set(LUA_VANILLA_LUA_SOURCES lua.c ) +if (LUA_BUILD_LUA_COMPILER) + set(LUA_VANILLA_LUAC_SOURCES luac.c ) +endif() + set(LUA_VANILLA_GENERATE_LUA_HPP false) +endif() + +set(LUA_VANILLA_SOURCE_DIR "${LUA_BUILD_TOPLEVEL}/src") +prepend(LUA_VANILLA_LIB_SOURCES "${LUA_VANILLA_SOURCE_DIR}/" ${LUA_VANILLA_LIB_SOURCES}) +prepend(LUA_VANILLA_LUA_SOURCES "${LUA_VANILLA_SOURCE_DIR}/" ${LUA_VANILLA_LUA_SOURCES}) + +# download, just for the sake of download + extract +# or pull from local folder +if (LUA_LOCAL_DIR) + file(COPY "${LUA_LOCAL_DIR}/src" + DESTINATION "${LUA_BUILD_TOPLEVEL}") + file(COPY "${LUA_LOCAL_DIR}/include" + DESTINATION "${LUA_BUILD_TOPLEVEL}") + add_custom_target(LUA_VANILLA + DEPENDS "${LUA_VANILLA_LIB_SOURCES}" "${LUA_VANILLA_LUA_SOURCES}") + set(LUA_VANILLA_INCLUDE_DIRS ${LUA_VANILLA_INCLUDE_DIRS} "${LUA_VANILLA_SOURCE_DIR}" "${LUA_BUILD_TOPLEVEL}/include") +else() + ExternalProject_Add(LUA_VANILLA + BUILD_IN_SOURCE TRUE + BUILD_ALWAYS FALSE + TLS_VERIFY TRUE + PREFIX ${LUA_BUILD_TOPLEVEL} + SOURCE_DIR ${LUA_BUILD_TOPLEVEL} + DOWNLOAD_DIR ${LUA_BUILD_TOPLEVEL} + TMP_DIR "${LUA_BUILD_TOPLEVEL}-tmp" + STAMP_DIR "${LUA_BUILD_TOPLEVEL}-stamp" + INSTALL_DIR "${LUA_BUILD_INSTALL_DIR}" + URL ${LUA_VANILLA_DOWNLOAD_URL} + URL_MD5 ${LUA_VANILLA_MD5} + URL_HASH SHA1=${LUA_VANILLA_SHA1} + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" + BUILD_BYPRODUCTS "${LUA_VANILLA_LIB_SOURCES}" "${LUA_VANILLA_LUA_SOURCES}") + + # make a quick lua.hpp for 5.1 targets that don't have it + if (LUA_VANILLA_GENERATE_LUA_HPP) + set(LUA_VANILLA_LUA_HPP_CONTENT "// lua.hpp +// Lua header files for C++ +// <<extern \"C\">> not supplied automatically because Lua also compiles as C++ + +extern \"C\" { +#include \"lua.h\" +#include \"lualib.h\" +#include \"lauxlib.h\" +} +") + set(LUA_VANILLA_SOURCE_LUA_HPP "${LUA_BUILD_TOPLEVEL}-tmp/lua.hpp") + set(LUA_VANILLA_DESTINATION_LUA_HPP "${LUA_VANILLA_SOURCE_DIR}/lua.hpp") + file(WRITE "${LUA_VANILLA_SOURCE_LUA_HPP}" "${LUA_VANILLA_LUA_HPP_CONTENT}") + file(TO_NATIVE_PATH "${LUA_VANILLA_SOURCE_LUA_HPP}" LUA_VANILLA_SOURCE_LUA_HPP) + file(TO_NATIVE_PATH "${LUA_VANILLA_DESTINATION_LUA_HPP}" LUA_VANILLA_DESTINATION_LUA_HPP) + ExternalProject_Add_Step(LUA_VANILLA + prebuild + # after download, before build + DEPENDEES download + DEPENDERS build + BYPRODUCTS "${LUA_VANILLA_DESTINATION_LUA_HPP}" + COMMENT "Moving \"${LUA_VANILLA_SOURCE_LUA_HPP}\" to \"${LUA_VANILLA_DESTINATION_LUA_HPP}\"..." + COMMAND "${CMAKE_COMMAND}" -E copy "${LUA_VANILLA_SOURCE_LUA_HPP}" "${LUA_VANILLA_DESTINATION_LUA_HPP}") + endif() + + set(LUA_VANILLA_INCLUDE_DIRS ${LUA_VANILLA_SOURCE_DIR}) +endif() + +# # Target names +set(liblua "liblua-${LUA_VANILLA_VERSION}") +set(luainterpreter "lua-${LUA_VANILLA_VERSION}") +set(luacompiler "luac-${LUA_VANILLA_VERSION}") + +# Lua does not out-of-the-box support building +# a shared library: http://lua-users.org/lists/lua-l/2006-10/msg00098.html +# in this case, we essentially need to +# build Lua for our purposes, which is annoying +# the external project is just a dummy to get and extract the file: +# after that, we define actual targets...! + +# make an actual, buildable target +# that other parts of the code can depend on +add_library(${liblua} ${LUA_BUILD_LIBRARY_TYPE} "${LUA_VANILLA_LIB_SOURCES}") +set_target_properties(${liblua} + PROPERTIES + LANGUAGE C + LINKER_LANGUAGE C + C_STANDARD 99 + C_EXTENSIONS TRUE + POSITION_INDEPENDENT_CODE TRUE + OUTPUT_NAME ${LUA_BUILD_LIBNAME} + RUNTIME_OUTPUT_NAME ${LUA_BUILD_LIBNAME} + LIBRARY_OUTPUT_NAME ${LUA_BUILD_LIBNAME} + ARCHIVE_OUTPUT_NAME ${LUA_BUILD_LIBNAME}) +target_include_directories(${liblua} + PUBLIC "${LUA_VANILLA_INCLUDE_DIRS}") +target_compile_definitions(${liblua} + PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}) +if (MSVC) + target_compile_options(${liblua} + PRIVATE /W1) +else() + target_compile_options(${liblua} + PRIVATE -w) +endif() +if (WIN32) + #target_compile_definitions(${liblua} + # PRIVATE LUA_USE_WINDOWS) +else() + target_compile_definitions(${liblua} + PRIVATE LUA_USE_LINUX) +endif() +target_compile_options(${liblua} + PRIVATE ${LUA_VANILLA_LUALIB_COMPILER_OPTIONS}) +add_dependencies(${liblua} LUA_VANILLA) +if (CMAKE_DL_LIBS) + target_link_libraries(${liblua} PRIVATE ${CMAKE_DL_LIBS}) +endif() +if (UNIX) + target_link_libraries(${liblua} PRIVATE m) +endif() + +# we don't really need this section... +# Lua Interpreter +add_executable(${luainterpreter} ${LUA_VANILLA_LUA_SOURCES}) +set_target_properties(${luainterpreter} + PROPERTIES + LANGUAGE C + LINKER_LANGUAGE C + C_STANDARD 99 + C_EXTENSIONS TRUE + OUTPUT_NAME lua-${LUA_VANILLA_VERSION}) +target_include_directories(${luainterpreter} + PRIVATE "${LUA_VANILLA_INCLUDE_DIRS}") +target_compile_definitions(${luainterpreter} + PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE} + PRIVATE LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}) +if (MSVC) + target_compile_options(${luainterpreter} + PRIVATE /W1) +else() + target_compile_options(${luainterpreter} + PRIVATE -w) +endif() +if (WIN32) + #target_compile_definitions(${luainterpreter} + # PRIVATE LUA_USE_WINDOWS) +else() + target_compile_definitions(${luainterpreter} + PRIVATE LUA_USE_LINUX) +endif() +target_link_libraries(${luainterpreter} PRIVATE ${liblua}) +if (CMAKE_DL_LIBS) + target_link_libraries(${luainterpreter} PRIVATE ${CMAKE_DL_LIBS}) +endif() +if (UNIX) + target_link_libraries(${luainterpreter} PRIVATE m readline) +endif() + +# LuaC Compiler +if (LUA_BUILD_LUA_COMPILER) + set_target_properties(${luacompiler} + PROPERTIES + LANGUAGE C + LINKER_LANGUAGE C + C_STANDARD 99 + C_EXTENSIONS TRUE + OUTPUT_NAME luac-${LUA_VANILLA_VERSION}) + target_include_directories(${luacompiler} + PRIVATE "${LUA_VANILLA_INCLUDE_DIRS}") + target_compile_definitions(${luacompiler} + PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE} + PRIVATE LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}) + if (MSVC) + target_compile_options(${luacompiler} + PRIVATE /W1) + else() + target_compile_options(${luacompiler} + PRIVATE -w) + endif() + if (WIN32) + #target_compile_definitions(${luacompiler} + # PRIVATE LUA_USE_WINDOWS) + else() + target_compile_definitions(${luacompiler} + PRIVATE LUA_USE_LINUX) + endif() + target_link_libraries(${luacompiler} PRIVATE ${liblua}) + if (CMAKE_DL_LIBS) + target_link_libraries(${luacompiler} PRIVATE ${CMAKE_DL_LIBS}) + endif() + if (UNIX) + # TODO: make readline optional? + target_link_libraries(${luacompiler} PRIVATE m readline) + endif() +endif() + +# set externally-visible target indicator +set(LUA_LIBRARIES ${liblua}) +set(LUA_INTERPRETER ${luainterpreter}) +if (LUA_BUILD_LUA_COMPILER) + set(LUA_COMPILER ${luacompiler}) +endif() +set(LUA_INCLUDE_DIRS "${LUA_VANILLA_SOURCE_DIR}") diff --git a/deps/sol2/cmake/Modules/FindLuwraBuild.cmake b/deps/sol2/cmake/Modules/FindLuwraBuild.cmake new file mode 100644 index 0000000..243e136 --- /dev/null +++ b/deps/sol2/cmake/Modules/FindLuwraBuild.cmake @@ -0,0 +1,75 @@ +# # # # sol3
+# The MIT License (MIT)
+#
+# Copyright (c) 2013-2019 Rapptz, ThePhD, and contributors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy of
+# this software and associated documentation files (the "Software"), to deal in
+# the Software without restriction, including without limitation the rights to
+# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+# the Software, and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+include(ExternalProject)
+include(FindPackageHandleStandardArgs)
+include(Common/Core)
+
+# # Base variables
+set(luwra_version 0.5.0)
+set(luwra_lib luwra_lib_${luwra_version})
+
+# # Useful locations
+set(luwra_build_toplevel "${CMAKE_BINARY_DIR}/vendor/luwra_${luwra_version}")
+set(luwra_include_dirs "${luwra_build_toplevel}/lib")
+
+# # luwra library sources
+set(luwra_sources luwra.hpp)
+prepend(luwra_sources "${luwra_build_toplevel}/lib/" ${luwra_sources})
+
+# # External project to get sources
+ExternalProject_Add(LUWRA_BUILD_SOURCE
+ BUILD_IN_SOURCE TRUE
+ BUILD_ALWAYS FALSE
+ # # Use Git to get what we need
+ GIT_SHALLOW TRUE
+ #GIT_TAG e513907fc8c2d59ebd91cd5992eddf54f7e23e21
+ GIT_REPOSITORY https://github.com/vapourismo/luwra.git
+ PREFIX ${luwra_build_toplevel}
+ SOURCE_DIR ${luwra_build_toplevel}
+ DOWNLOAD_DIR ${luwra_build_toplevel}
+ TMP_DIR "${luwra_build_toplevel}-tmp"
+ STAMP_DIR "${luwra_build_toplevel}-stamp"
+ INSTALL_DIR "${luwra_build_toplevel}/local"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+ BUILD_BYPRODUCTS "${luwra_sources}")
+
+add_library(${luwra_lib} INTERFACE)
+add_dependencies(${luwra_lib} LUWRA_BUILD_SOURCE)
+target_include_directories(${luwra_lib} INTERFACE ${luwra_include_dirs})
+target_link_libraries(${luwra_lib} INTERFACE ${LUA_LIBRARIES})
+if (NOT MSVC)
+ target_compile_options(${luwra_lib} INTERFACE
+ -Wno-noexcept-type -Wno-ignored-qualifiers -Wno-unused-parameter)
+endif()
+
+set(LUWRABUILD_FOUND TRUE)
+set(LUWRA_LIBRARIES ${luwra_lib})
+set(LUWRA_INCLUDE_DIRS ${luwra_include_dirs})
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuwraBuild
+ FOUND_VAR LUWRABUILD_FOUND
+ REQUIRED_VARS LUWRA_LIBRARIES LUWRA_INCLUDE_DIRS
+ VERSION_VAR luwra_version)
diff --git a/deps/sol2/cmake/Modules/FindToLuappBuild.cmake b/deps/sol2/cmake/Modules/FindToLuappBuild.cmake new file mode 100644 index 0000000..c88cfa2 --- /dev/null +++ b/deps/sol2/cmake/Modules/FindToLuappBuild.cmake @@ -0,0 +1,95 @@ +# # # # sol3
+# The MIT License (MIT)
+#
+# Copyright (c) 2013-2019 Rapptz, ThePhD, and contributors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy of
+# this software and associated documentation files (the "Software"), to deal in
+# the Software without restriction, including without limitation the rights to
+# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+# the Software, and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+# # Standard CMake Libraries
+include(ExternalProject)
+include(FindPackageHandleStandardArgs)
+include(Common/Core)
+
+# # Base variables
+set(toluapp_version 1.0.93)
+
+# # Useful locations
+set(toluapp_build_toplevel "${CMAKE_BINARY_DIR}/vendor/toluapp_${toluapp_version}")
+set(toluapp_include_dirs "${toluapp_build_toplevel}/include")
+
+# # ToLua library sources
+set(toluapp_sources tolua_event.c tolua_event.h tolua_is.c tolua_map.c tolua_push.c tolua_to.c tolua_compat.h tolua_compat.c)
+prepend(toluapp_sources "${toluapp_build_toplevel}/src/lib/" ${toluapp_sources})
+list(APPEND toluapp_sources "${toluapp_build_toplevel}/include/tolua++.h")
+
+# # External project to get sources
+ExternalProject_Add(TOLUAPP_BUILD_SOURCE
+ BUILD_IN_SOURCE TRUE
+ BUILD_ALWAYS FALSE
+ # # Use Git to get what we need
+ #GIT_SUBMODULES ""
+ GIT_SHALLOW TRUE
+ GIT_REPOSITORY https://github.com/ThePhD/toluapp
+ PREFIX ${toluapp_build_toplevel}
+ SOURCE_DIR ${toluapp_build_toplevel}
+ DOWNLOAD_DIR ${toluapp_build_toplevel}
+ TMP_DIR "${toluapp_build_toplevel}-tmp"
+ STAMP_DIR "${toluapp_build_toplevel}-stamp"
+ INSTALL_DIR "${toluapp_build_toplevel}/local"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+ BUILD_BYPRODUCTS "${toluapp_sources}")
+
+set(toluapp_lib toluapp_lib_${toluapp_version})
+add_library(${toluapp_lib} SHARED ${toluapp_sources})
+add_dependencies(${toluapp_lib} TOLUAPP_BUILD_SOURCE)
+set_target_properties(${toluapp_lib} PROPERTIES
+ OUTPUT_NAME toluapp-${toluapp_version}
+ POSITION_INDEPENDENT_CODE TRUE)
+target_include_directories(${toluapp_lib}
+ PUBLIC ${toluapp_include_dirs})
+target_link_libraries(${toluapp_lib} PRIVATE ${LUA_LIBRARIES})
+if (MSVC)
+ target_compile_options(${toluapp_lib}
+ PRIVATE /W1)
+ target_compile_definitions(${toluapp_lib}
+ PRIVATE "TOLUA_API=__declspec(dllexport)")
+else()
+ target_compile_options(${toluapp_lib}
+ PRIVATE -w
+ INTERFACE -Wno-noexcept-type
+ PUBLIC -Wno-ignored-qualifiers -Wno-unused-parameter)
+endif()
+if (CMAKE_DL_LIBS)
+ target_link_libraries(${toluapp_lib} PRIVATE ${CMAKE_DL_LIBS})
+endif()
+# add compatibility define
+target_compile_definitions(${toluapp_lib}
+ PRIVATE COMPAT53_PREFIX=toluapp_compat53)
+
+# # Variables required by ToLuaBuild
+set(TOLUAPP_LIBRARIES ${toluapp_lib})
+set(TOLUAPP_INCLUDE_DIRS ${toluapp_include_dirs})
+set(TOLUAPPBUILD_FOUND TRUE)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ToLuappBuild
+ FOUND_VAR TOLUAPPBUILD_FOUND
+ REQUIRED_VARS TOLUAPP_LIBRARIES TOLUAPP_INCLUDE_DIRS
+ VERSION_VAR toluapp_version)
diff --git a/deps/sol2/cmake/sol2-config.cmake.in b/deps/sol2/cmake/sol2-config.cmake.in new file mode 100644 index 0000000..70c448d --- /dev/null +++ b/deps/sol2/cmake/sol2-config.cmake.in @@ -0,0 +1,41 @@ +# # # # sol3 +# The MIT License (MIT) +# +# Copyright (c) 2013-2019 Rapptz, ThePhD, and contributors +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +# the Software, and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/sol2-targets.cmake") + +MESSAGE(STATUS ${CMAKE_CURRENT_LIST_DIR}) + +if (TARGET sol2) + get_target_property(SOL2_INCLUDE_DIRS + sol2 INTERFACE_INCLUDE_DIRECTORIES) + set_and_check(SOL2_INCLUDE_DIRS "${SOL2_INCLUDE_DIRS}") + set(SOL2_LIBRARIES sol2) +endif() + +if(TARGET sol2_single) + get_target_property(SOL2_SINGLE_INCLUDE_DIRS + sol2_single INTERFACE_INCLUDE_DIRECTORIES) + set_and_check(SOL2_INCLUDE_DIRS "${SOL2_SINGLE_INCLUDE_DIRS}") + set(SOL2_LIBRARIES_SINGLE sol2_single) +endif() |