mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
All these platforms are so hard to deal with...
This commit is contained in:
parent
0e19156d52
commit
9524fd061e
14
.travis.yml
14
.travis.yml
|
@ -28,7 +28,7 @@ git:
|
||||||
depth: 5
|
depth: 5
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- source ./scripts/preparations.osx.sh
|
- source ./scripts/preparation.osx.sh
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- install_os_deps
|
- install_os_deps
|
||||||
|
@ -139,7 +139,7 @@ matrix:
|
||||||
- mkdir $HOME/clang-$LLVM_VERSION
|
- mkdir $HOME/clang-$LLVM_VERSION
|
||||||
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
||||||
- export PATH=$HOME/clang+llvm/bin:$PATH
|
- export PATH=$HOME/clang+llvm/bin:$PATH
|
||||||
- source ./scripts/preparations.osx.sh
|
- source ./scripts/preparation.osx.sh
|
||||||
compiler: clang
|
compiler: clang
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
|
@ -167,7 +167,7 @@ matrix:
|
||||||
- mkdir $HOME/clang-$LLVM_VERSION
|
- mkdir $HOME/clang-$LLVM_VERSION
|
||||||
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
||||||
- export PATH=$HOME/clang+llvm/bin:$PATH
|
- export PATH=$HOME/clang+llvm/bin:$PATH
|
||||||
- source ./scripts/preparations.osx.sh
|
- source ./scripts/preparation.osx.sh
|
||||||
compiler: clang
|
compiler: clang
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
|
@ -195,7 +195,7 @@ matrix:
|
||||||
- mkdir $HOME/clang-$LLVM_VERSION
|
- mkdir $HOME/clang-$LLVM_VERSION
|
||||||
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
||||||
- export PATH=$HOME/clang+llvm/bin:$PATH
|
- export PATH=$HOME/clang+llvm/bin:$PATH
|
||||||
- source ./scripts/preparations.osx.sh
|
- source ./scripts/preparation.osx.sh
|
||||||
compiler: clang
|
compiler: clang
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
|
@ -223,7 +223,7 @@ matrix:
|
||||||
- mkdir $HOME/clang-$LLVM_VERSION
|
- mkdir $HOME/clang-$LLVM_VERSION
|
||||||
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
||||||
- export PATH=$HOME/clang+llvm/bin:$PATH
|
- export PATH=$HOME/clang+llvm/bin:$PATH
|
||||||
- source ./scripts/preparations.osx.sh
|
- source ./scripts/preparation.osx.sh
|
||||||
compiler: clang
|
compiler: clang
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
|
@ -251,7 +251,7 @@ matrix:
|
||||||
- mkdir $HOME/clang-$LLVM_VERSION
|
- mkdir $HOME/clang-$LLVM_VERSION
|
||||||
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
||||||
- export PATH=$HOME/clang+llvm/bin:$PATH
|
- export PATH=$HOME/clang+llvm/bin:$PATH
|
||||||
- source ./scripts/preparations.osx.sh
|
- source ./scripts/preparation.osx.sh
|
||||||
compiler: clang
|
compiler: clang
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
|
@ -279,7 +279,7 @@ matrix:
|
||||||
- mkdir $HOME/clang-$LLVM_VERSION
|
- mkdir $HOME/clang-$LLVM_VERSION
|
||||||
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
- tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1
|
||||||
- export PATH=$HOME/clang+llvm/bin:$PATH
|
- export PATH=$HOME/clang+llvm/bin:$PATH
|
||||||
- source ./scripts/preparations.osx.sh
|
- source ./scripts/preparation.osx.sh
|
||||||
compiler: clang
|
compiler: clang
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
# # # # sol2
|
# # # # sol2
|
||||||
cmake_minimum_required(VERSION 3.5.0)
|
cmake_minimum_required(VERSION 3.5.0)
|
||||||
project(sol2 VERSION 2.19.0 LANGUAGES CXX)
|
project(sol2 VERSION 2.19.0 LANGUAGES CXX C)
|
||||||
|
|
||||||
|
|
||||||
# # # General Project Requirements
|
# # # General Project Requirements
|
||||||
|
@ -61,14 +61,17 @@ include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
# # # Configuration
|
# # # Configuration
|
||||||
# # Cached defines, strings, paths and options
|
# # Cached defines, strings, paths and options
|
||||||
set(LUA_VERSION "5.3.4" CACHE STRING "The version of Lua needed. Can be 5.1, 5.2, 5.3, LuaJIT, or a more specific 3-part version number for plain lua (e.g., 5.3.4 or luajit-2.0.5)")
|
set(LUA_VERSION "5.3.4" CACHE STRING "The version of Lua needed. Can be 5.1, 5.2, 5.3, LuaJIT, or a more specific 3-part version number for a specifc Lua (e.g., 5.3.4 or luajit-2.0.5)")
|
||||||
set(BUILD_LUA TRUE CACHE BOOL "Always build Lua, do not search for it in the system")
|
set(BUILD_LUA TRUE CACHE BOOL "Always build Lua, do not search for it in the system")
|
||||||
|
set(BUILD_LUAJIT FALSE CACHE BOOL "Always build LuaJIT, do not search for it in the system")
|
||||||
option(TESTS "Enable build of tests" OFF)
|
option(TESTS "Enable build of tests" OFF)
|
||||||
option(EXAMPLES "Enable build of examples" OFF)
|
option(EXAMPLES "Enable build of examples" OFF)
|
||||||
option(SINGLE "Enable build of single header files" ON)
|
option(SINGLE "Enable build of single header files" ON)
|
||||||
# Single tests will only be turned on if both SINGLE and TESTS are defined
|
# Single tests will only be turned on if both SINGLE and TESTS are defined
|
||||||
CMAKE_DEPENDENT_OPTION(TESTS_SINGLE "Enable build of tests using the generated single headers" ON
|
CMAKE_DEPENDENT_OPTION(TESTS_SINGLE "Enable build of tests using the generated single headers" ON
|
||||||
"SINGLE;TESTS" OFF)
|
"SINGLE;TESTS" OFF)
|
||||||
|
CMAKE_DEPENDENT_OPTION(TESTS_EXAMPLES "Enable build of examples as tests" ON
|
||||||
|
"TESTS;EXAMPLES" ON)
|
||||||
option(DOCS "Enable build of documentation" OFF)
|
option(DOCS "Enable build of documentation" OFF)
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,40 +119,19 @@ source_group(headers FILES ${SOL2_HEADER_SOURCES})
|
||||||
file(GLOB SOL2_SINGLE_HEADER_SOURCES single/sol/sol_forward.hpp single/sol/sol.hpp)
|
file(GLOB SOL2_SINGLE_HEADER_SOURCES single/sol/sol_forward.hpp single/sol/sol.hpp)
|
||||||
source_group(headers FILES ${SOL2_SINGLE_HEADER_SOURCES})
|
source_group(headers FILES ${SOL2_SINGLE_HEADER_SOURCES})
|
||||||
|
|
||||||
# # # Libraries
|
# # # Single header target
|
||||||
# Here, we pull in all the necessary libraries
|
|
||||||
# Find threading library
|
|
||||||
find_package(Threads)
|
|
||||||
# Find way to get Lua: build if requested, or attempt to build if no matching version is found
|
|
||||||
string(TOLOWER ${LUA_VERSION} LUA_VERSION)
|
|
||||||
if (BUILD_LUA)
|
|
||||||
include(LuaBuild)
|
|
||||||
elseif (LUA_VERSION MATCHES "5.1")
|
|
||||||
find_package(Lua 5.1 EXACT REQUIRED)
|
|
||||||
elseif(LUA_VERSION MATCHES "5.2")
|
|
||||||
find_package(Lua 5.2 EXACT REQUIRED)
|
|
||||||
elseif(LUA_VERSION MATCHES "5.3")
|
|
||||||
find_package(Lua 5.3 EXACT REQUIRED)
|
|
||||||
elseif(LUA_VERSION MATCHES "luajit")
|
|
||||||
find_package(LuaJIT REQUIRED)
|
|
||||||
else()
|
|
||||||
include(LuaBuild)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT LUA_FOUND)
|
|
||||||
message(FATAL_ERROR "Lua ${LUA_VERSION} not found and could not be targeted for building.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Find Python3 for single header / forward header generation
|
# Find Python3 for single header / forward header generation
|
||||||
find_package(PythonInterp 3)
|
find_package(PythonInterp 3)
|
||||||
|
set(SOL2_SINGLE_HEADER_FOUND FALSE)
|
||||||
if (PYTHONINTERP_FOUND)
|
if (PYTHONINTERP_FOUND)
|
||||||
if (SINGLE)
|
if (SINGLE)
|
||||||
|
set(SOL2_SINGLE_FOUND TRUE)
|
||||||
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/single/sol/sol_forward.hpp"
|
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/single/sol/sol_forward.hpp"
|
||||||
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/single.py" --output "${CMAKE_BINARY_DIR}/single/sol/sol.hpp"
|
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/single.py" --output "${CMAKE_BINARY_DIR}/single/sol/sol.hpp"
|
||||||
DEPENDS ${HEADER_SRCS})
|
DEPENDS ${SOL2_HEADER_SOURCES})
|
||||||
add_custom_target(single_header
|
add_custom_target(sol2_single_header
|
||||||
DEPENDS "${CMAKE_BINARY_DIR}/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/single/sol/sol_forward.hpp")
|
DEPENDS "${CMAKE_BINARY_DIR}/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/single/sol/sol_forward.hpp")
|
||||||
set_target_properties(single_header
|
set_target_properties(sol2_single_header
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/single/sol")
|
INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/single/sol")
|
||||||
install(FILES "${CMAKE_BINARY_DIR}/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/single/sol/sol_forward.hpp"
|
install(FILES "${CMAKE_BINARY_DIR}/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/single/sol/sol_forward.hpp"
|
||||||
|
@ -169,17 +151,44 @@ else()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# # # Tests
|
# # # Tests, Examples and other CI suites that come with sol2
|
||||||
# # Enable test harness for regular or single tests
|
#if (TESTS OR TESTS_SINGLE OR EXAMPLES)
|
||||||
if (TESTS OR TESTS_SINGLE)
|
# # # Libraries
|
||||||
|
# Here, we pull in all the necessary libraries for building examples and tests
|
||||||
|
# Find threading library
|
||||||
|
find_package(Threads)
|
||||||
|
# Find way to get Lua: build if requested, or attempt to build if no matching version is found
|
||||||
|
string(TOLOWER ${LUA_VERSION} NORMALIZED_LUA_VERSION)
|
||||||
|
if (BUILD_LUA OR BUILD_LUAJIT)
|
||||||
|
include(LuaBuild)
|
||||||
|
elseif (NORMALIZED_LUA_VERSION MATCHES "5.1")
|
||||||
|
find_package(Lua 5.1 EXACT REQUIRED)
|
||||||
|
elseif(NORMALIZED_LUA_VERSION MATCHES "5.2")
|
||||||
|
find_package(Lua 5.2 EXACT REQUIRED)
|
||||||
|
elseif(NORMALIZED_LUA_VERSION MATCHES "5.3")
|
||||||
|
find_package(Lua 5.3 EXACT REQUIRED)
|
||||||
|
elseif(NORMALIZED_LUA_VERSION MATCHES "luajit")
|
||||||
|
find_package(LuaJIT REQUIRED)
|
||||||
|
else()
|
||||||
|
include(LuaBuild)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT LUA_FOUND)
|
||||||
|
message(FATAL_ERROR "Lua ${LUA_VERSION} not found and could not be targeted for building.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# # # Tests
|
||||||
|
# # Enable test harness for regular or single tests
|
||||||
|
if (TESTS OR TESTS_SINGLE)
|
||||||
# enable ctest and add subdir to get going
|
# enable ctest and add subdir to get going
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(tests "${CMAKE_BINARY_DIR}/tests")
|
add_subdirectory(tests "${CMAKE_BINARY_DIR}/tests")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# # # Examples
|
# # # Examples
|
||||||
# # Enable examples to be built against the library
|
# # Enable examples to be built against the library
|
||||||
if (EXAMPLES)
|
if (EXAMPLES)
|
||||||
# NOTE: will also add to tests if TESTS is defined
|
# NOTE: will also add to tests if TESTS is defined
|
||||||
add_subdirectory(examples "${CMAKE_BINARY_DIR}/examples")
|
add_subdirectory(examples "${CMAKE_BINARY_DIR}/examples")
|
||||||
endif()
|
endif()
|
||||||
|
#endif()
|
||||||
|
|
15
appveyor.yml
15
appveyor.yml
|
@ -31,13 +31,16 @@ image:
|
||||||
|
|
||||||
configuration: Release
|
configuration: Release
|
||||||
|
|
||||||
|
environment:
|
||||||
|
- LUA_VERSION: 5.3.4
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
- x86
|
- x86
|
||||||
- x64
|
- x64
|
||||||
|
|
||||||
init:
|
init:
|
||||||
- set arch=
|
- set arch=
|
||||||
- if "%arch%"=="Win64" ( set arch= Win64)
|
- if "%PLATFORM%"=="x64" (set arch= Win64)
|
||||||
- echo %arch%
|
- echo %arch%
|
||||||
- echo %APPVEYOR_BUILD_WORKER_IMAGE%
|
- echo %APPVEYOR_BUILD_WORKER_IMAGE%
|
||||||
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( set CMAKE_GENERATOR="Visual Studio 15 2017%arch%" )
|
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( set CMAKE_GENERATOR="Visual Studio 15 2017%arch%" )
|
||||||
|
@ -46,12 +49,14 @@ init:
|
||||||
- echo %CMAKE_GENERATOR%
|
- echo %CMAKE_GENERATOR%
|
||||||
|
|
||||||
before_build:
|
before_build:
|
||||||
- cmd: >-
|
- md build-sol2
|
||||||
md build-sol2
|
- cd build-sol2
|
||||||
cd build-sol2
|
- cmake .. -G "%CMAKE_GENERATOR%" -DLUA_VERSION=%LUA_VERSION% -DLUA_BUILD=ON -DBUILD_LUA_AS_DLL=ON -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON
|
||||||
cmake .. -G "%CMAKE_GENERATOR%" -DLUA_VERSION=%LUA_VERSION% -DBUILD_LUA=ON -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_SINGLE=ON
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
project: c:\projects\sol2\build-sol2\sol2.sln
|
project: c:\projects\sol2\build-sol2\sol2.sln
|
||||||
verbosity: minimal
|
verbosity: minimal
|
||||||
parallel: true
|
parallel: true
|
||||||
|
|
||||||
|
test_script:
|
||||||
|
- cd c:\projects\sol2\build-sol2 && ctest
|
||||||
|
|
|
@ -20,239 +20,74 @@
|
||||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
# 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.
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
# import necessary standard modules
|
# # # Variables
|
||||||
include(ExternalProject)
|
# # Core Paths
|
||||||
|
string(TOLOWER ${LUA_VERSION} LUA_BUILD_NORMALIZED_LUA_VERSION)
|
||||||
# Clean up some variables
|
if (LUA_BUILD_NORMALIZED_LUA_VERSION MATCHES "luajit")
|
||||||
if (LUA_VERSION MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+$")
|
set(LUA_BUILD_LIBNAME ${LUA_VERSION})
|
||||||
# probably okay
|
elseif (LUAJIT_BUILD)
|
||||||
elseif (LUA_VERSION MATCHES "([0-9]+)\\.([0-9]+)")
|
set(LUA_BUILD_LIBNAME luajit-${LUA_VERSION})
|
||||||
# extend version number with prefix
|
elseif (LUA_BUILD_NORMALIZED_LUA_VERSION MATCHES "lua")
|
||||||
if (${CMAKE_MATCH_1} EQUAL 5)
|
set(LUA_BUILD_LIBNAME ${LUA_VERSION})
|
||||||
if (${CMAKE_MATCH_2} EQUAL 1)
|
elseif (LUA_BUILD)
|
||||||
set(LUA_VERSION "5.1.5")
|
set(LUA_BUILD_LIBNAME lua-${LUA_VERSION})
|
||||||
elseif (${CMAKE_MATCH_2} EQUAL 2)
|
|
||||||
set(LUA_VERSION "5.2.4")
|
|
||||||
elseif (${CMAKE_MATCH_2} EQUAL 3)
|
|
||||||
set(LUA_VERSION "5.3.4")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# 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_EXTERNAL_MD5_5.3.4 "53a9c68bcc0eda58bdc2095ad5cdfc63")
|
|
||||||
set(LUA_EXTERNAL_MD5_5.2.4 "913fdb32207046b273fdb17aad70be13")
|
|
||||||
set(LUA_EXTERNAL_MD5_5.1.5 "2e115fe26e435e33b0d5c022e4490567")
|
|
||||||
set(LUA_EXTERNAL_SHA1_5.3.4 "79790cfd40e09ba796b01a571d4d63b52b1cd950")
|
|
||||||
set(LUA_EXTERNAL_SHA1_5.2.4 "ef15259421197e3d85b7d6e4871b8c26fd82c1cf")
|
|
||||||
set(LUA_EXTERNAL_SHA1_5.1.5 "b3882111ad02ecc6b972f8c1241647905cb2e3fc")
|
|
||||||
|
|
||||||
if (WIN32 AND MSVC)
|
|
||||||
set(LUA_EXTERNAL_BUILD_DLL_DEFAULT ON)
|
|
||||||
else()
|
else()
|
||||||
set(LUA_EXTERNAL_BUILD_DLL_DEFAULT OFF)
|
set(LUA_BUILD_LIBNAME lua-${LUA_VERSION})
|
||||||
endif()
|
|
||||||
|
|
||||||
# get sha1/md5 hashes to verify integrity of download
|
|
||||||
set(LUA_EXTERNAL_SHA1 ${LUA_EXTERNAL_SHA1_${LUA_VERSION}})
|
|
||||||
set(LUA_EXTERNAL_MD5 ${LUA_EXTERNAL_MD5_${LUA_VERSION}})
|
|
||||||
set(LUA_EXTERNAL_TOPLEVEL "${CMAKE_BINARY_DIR}/vendor/lua-${LUA_VERSION}")
|
|
||||||
set(LUA_EXTERNAL_INSTALL_DIR "${LUA_EXTERNAL_TOPLEVEL}/install")
|
|
||||||
set(LUA_INCLUDE_PREFIX "${LUA_EXTERNAL_INSTALL_DIR}" CACHE PATH "Directory that prefixes the Lua include directory")
|
|
||||||
set(LUA_INCLUDE_DIR "${LUA_INCLUDE_PREFIX}/include" CACHE PATH "Directory with lua include files")
|
|
||||||
set(LUA_LIB_DIR "${LUA_EXTERNAL_INSTALL_DIR}/lib" CACHE PATH "Directory with lua library files")
|
|
||||||
set(LUA_BIN_DIR "${LUA_EXTERNAL_INSTALL_DIR}/bin" CACHE PATH "Directory with lua executable and dynamic library files")
|
|
||||||
option(LUA_BUILD_AS_DLL ${LUA_EXTERNAL_BUILD_DLL_DEFAULT} "Build Lua as a Shared/Dynamic Link Library")
|
|
||||||
|
|
||||||
set(LUA_LIBRARY_DESCRIPTION "Name of the either the full built static library, or of the import library used")
|
|
||||||
set(LUA_DYNAMIC_LIBRARY_DESCRIPTION "Name of the Lua dynamic library to build, if LUA_BUILD_AS_DLL is set")
|
|
||||||
|
|
||||||
set(LUA_LIBRARY ${CMAKE_STATIC_LIBRARY_PREFIX}lua${LUA_VERSION}.${CMAKE_STATIC_LIBRARY_PREFIX}
|
|
||||||
CACHE STRING
|
|
||||||
${LUA_LIBRARY_DESCRIPTION})
|
|
||||||
set(LUA_DYNAMIC_LIBRARY ${CMAKE_SHARED_LIBRARY_PREFIX}lua${LUA_VERSION}.${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
||||||
CACHE STRING
|
|
||||||
${LUA_DYNAMIC_LIBRARY_DESCRIPTION})
|
|
||||||
|
|
||||||
# Lua does not out-of-the-box support building
|
|
||||||
# a shared library: http://lua-users.org/lists/lua-l/2006-10/msg00098.html
|
|
||||||
if (LUA_BUILD_AS_DLL)
|
|
||||||
set(LUA_EXTERNAL_LIBRARY_TYPE SHARED)
|
|
||||||
else()
|
|
||||||
set(LUA_EXTERNAL_LIBRARY_TYPE STATIC)
|
|
||||||
endif()
|
endif()
|
||||||
|
set(LUA_BUILD_TOPLEVEL "${CMAKE_BINARY_DIR}/vendor/${LUA_BUILD_LIBNAME}")
|
||||||
|
set(LUA_BUILD_INSTALL_DIR "${LUA_BUILD_TOPLEVEL}/install")
|
||||||
|
# # 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)
|
if (MSVC)
|
||||||
set(LUA_EXTERNAL_OBJECT_FILE_SUFFIX .o)
|
set(LUA_BUILD_BUILD_DLL_DEFAULT ON)
|
||||||
|
set(LUA_BUILD_OBJECT_FILE_SUFFIX .obj)
|
||||||
else()
|
else()
|
||||||
set(LUA_EXTERNAL_OBJECT_FILE_SUFFIX .obj)
|
set(LUA_BUILD_BUILD_DLL_DEFAULT OFF)
|
||||||
|
set(LUA_BUILD_OBJECT_FILE_SUFFIX .o)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC OR LUA_BUILD_AS_DLL)
|
|
||||||
# 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...!
|
|
||||||
|
|
||||||
# preconfiguration
|
# # # Options
|
||||||
set(LUA_EXTERNAL_LUALIB_COMPILER_OPTIONS -O3 -Wall -Wextra -DLUA_COMPAT_5_2)
|
set(LUA_INCLUDE_PREFIX "${LUA_BUILD_INSTALL_DIR}" CACHE PATH "Directory that prefixes the Lua include directory")
|
||||||
if (LUA_BUILD_AS_DLL)
|
set(LUA_INCLUDE_DIR "${LUA_INCLUDE_PREFIX}/include" CACHE PATH "Directory with lua include files")
|
||||||
set(LUA_EXTERNAL_LIBLUA_COMPILER_OPTIONS ${LUA_EXTERNAL_LIBLUA_COMPILER_OPTIONS} -fPIC)
|
set(LUA_LIB_DIR "${LUA_BUILD_INSTALL_DIR}/lib" CACHE PATH "Directory with lua library files")
|
||||||
endif()
|
set(LUA_BIN_DIR "${LUA_BUILD_INSTALL_DIR}/bin" CACHE PATH "Directory with lua executable and dynamic library files")
|
||||||
|
option(BUILD_LUA_AS_DLL ${LUA_BUILD_BUILD_DLL_DEFAULT} "Build Lua or LuaJIT as a Shared/Dynamic Link Library")
|
||||||
|
|
||||||
# retrieve source files
|
STRING(TOLOWER ${LUA_BUILD_LIBNAME} LUA_BUILD_NORMALIZED_LIBNAME)
|
||||||
if (LUA_VERSION MATCHES "5.1")
|
if (LUA_BUILD_NORMALIZED_LIBNAME MATCHES "luajit")
|
||||||
set(LUA_EXTERNAL_LIB_SOURCES lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c
|
set(LUA_LIBRARY luajit
|
||||||
lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c
|
CACHE STRING
|
||||||
lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c lauxlib.c
|
${LUA_BUILD_LIBRARY_DESCRIPTION})
|
||||||
lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c ltablib.c
|
else()
|
||||||
lstrlib.c linit.c)
|
set(LUA_LIBRARY ${LUA_BUILD_LIBNAME}
|
||||||
set(LUA_EXTERNAL_LUA_SOURCES lua.c )
|
CACHE STRING
|
||||||
set(LUA_EXTERNAL_LUAC_SOURCES luac.c print.c )
|
${LUA_BUILD_LIBRARY_DESCRIPTION})
|
||||||
elseif (LUA_VERSION MATCHES "5.2")
|
endif()
|
||||||
set(LUA_EXTERNAL_LIB_SOURCES lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c
|
# # Dependent Variables
|
||||||
lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c lparser.c
|
# If we're building a DLL, then set the library type to SHARED
|
||||||
lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c
|
if (BUILD_LUA_AS_DLL)
|
||||||
lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c
|
set(LUA_BUILD_LIBRARY_TYPE SHARED)
|
||||||
liolib.c lmathlib.c loslib.c lstrlib.c ltablib.c linit.c)
|
else()
|
||||||
set(LUA_EXTERNAL_LUA_SOURCES lua.c )
|
set(LUA_BUILD_LIBRARY_TYPE STATIC)
|
||||||
set(LUA_EXTERNAL_LUAC_SOURCES luac.c )
|
|
||||||
else()
|
|
||||||
set(LUA_EXTERNAL_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_EXTERNAL_LUA_SOURCES lua.c )
|
|
||||||
set(LUA_EXTERNAL_LUAC_SOURCES luac.c )
|
|
||||||
endif()
|
|
||||||
STRING(REGEX REPLACE "\\.c" ${LUA_EXTERNAL_OBJECT_FILE_SUFFIX} LUA_EXTERNAL_LIB_OBJECTS ${LUA_EXTERNAL_LIB_SOURCES})
|
|
||||||
STRING(REGEX REPLACE "\\.c" ${LUA_EXTERNAL_OBJECT_FILE_SUFFIX} LUA_EXTERNAL_LUA_OBJECTS ${LUA_EXTERNAL_LUA_SOURCES})
|
|
||||||
STRING(REGEX REPLACE "\\.c" ${LUA_EXTERNAL_OBJECT_FILE_SUFFIX} LUA_EXTERNAL_LUAC_OBJECTS ${LUA_EXTERNAL_LUAC_SOURCES})
|
|
||||||
|
|
||||||
# download, just for the sake of download + extract
|
|
||||||
ExternalProject_Add(LUA_EXTERNAL
|
|
||||||
BUILD_IN_SOURCE TRUE
|
|
||||||
BUILD_ALWAYS TRUE
|
|
||||||
TLS_VERIFY TRUE
|
|
||||||
PREFIX ${LUA_EXTERNAL_TOPLEVEL}
|
|
||||||
SOURCE_DIR ${LUA_EXTERNAL_TOPLEVEL}
|
|
||||||
DOWNLOAD_DIR ${LUA_EXTERNAL_TOPLEVEL}
|
|
||||||
TMP_DIR "${LUA_EXTERNAL_TOPLEVEL}-tmp"
|
|
||||||
STAMP_DIR "${LUA_EXTERNAL_TOPLEVEL}-stamp"
|
|
||||||
INSTALL_DIR "${LUA_EXTERNAL_INSTALL_DIR}"
|
|
||||||
URL https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz
|
|
||||||
URL_MD5 ${LUA_EXTERNAL_MD5}
|
|
||||||
URL_HASH SHA1=${LUA_EXTERNAL_SHA1}
|
|
||||||
CONFIGURE_COMMAND ""
|
|
||||||
BUILD_COMMAND ""
|
|
||||||
INSTALL_COMMAND ""
|
|
||||||
TEST_COMMAND ""
|
|
||||||
BUILD_BYPRODUCTS ${LUA_EXTERNAL_LIB_SOURCES} ${LUA_EXTERNAL_LUA_SOURCES} ${LUA_EXTERNAL_LUAC_SOURCES})
|
|
||||||
|
|
||||||
# make an actual, buildable target
|
|
||||||
# that other parts of the code can depend on
|
|
||||||
add_library(lualib_${LUA_VERSION} ${LUA_EXTERNAL_LIBRARY_TYPE} ${LUA_EXTERNAL_LIB_SOURCES})
|
|
||||||
set_target_properties(lualib_${LUA_VERSION}
|
|
||||||
PROPERTIES
|
|
||||||
LANGUAGE C
|
|
||||||
LINKER_LANGUAGE C
|
|
||||||
INCLUDE_DIRECTORIES src/
|
|
||||||
LOCATION ${LUA_EXTERNAL_LIB_FILE}
|
|
||||||
SONAME ${LUA_EXTERNAL_DLL_FILE}
|
|
||||||
)
|
|
||||||
target_compile_options(lualib_${LUA_VERSION}
|
|
||||||
PRIVATE ${LUA_EXTERNAL_LUALIB_COMPILER_OPTIONS} )
|
|
||||||
add_dependencies(lualib_${LUA_VERSION} LUA_EXTERNAL)
|
|
||||||
|
|
||||||
# we don't really need this section...
|
|
||||||
#add_executable(lua_${LUA_VERSION} ${LUA_EXTERNAL_LUA_SOURCES})
|
|
||||||
#add_executable(luac_${LUA_VERSION} ${LUA_EXTERNAL_LUAC_SOURCES})
|
|
||||||
#add_dependencies(lua_${LUA_VERSION} lualib_${LUA_VERSION})
|
|
||||||
#add_dependencies(luac_${LUA_VERSION} lualib_${LUA_VERSION})
|
|
||||||
|
|
||||||
# set externally-visible target indicator
|
|
||||||
set(LUA_LIBRARIES lualib_${LUA_VERSION})
|
|
||||||
else ()
|
|
||||||
# we can simply reuse the makefile here
|
|
||||||
# so define it as an external project and then just have the proper
|
|
||||||
# build/install/test commands
|
|
||||||
# note that this only works for shared objects:
|
|
||||||
if (MINGW)
|
|
||||||
set(LUA_EXTERNAL_MAKE_TARGET mingw)
|
|
||||||
elseif(APPLE)
|
|
||||||
set(LUA_EXTERNAL_MAKE_TARGET macosx)
|
|
||||||
elseif(UNIX AND NOT APPLE)
|
|
||||||
set(LUA_EXTERNAL_MAKE_TARGET linux)
|
|
||||||
else()
|
|
||||||
set(LUA_EXTERNAL_MAKE_TARGET generic)
|
|
||||||
endif()
|
|
||||||
set(LUA_EXTERNAL_BUILD_COMMAND make ${LUA_EXTERNAL_MAKE_TARGET} LUA_A=${LUA_LIBRARY})
|
|
||||||
set(LUA_EXTERNAL_INSTALL_COMMAND make local TO_LIB=${LUA_LIBRARY})
|
|
||||||
set(LUA_EXTERNAL_TEST_COMMAND make test LUA_A=${LUA_LIBRARY})
|
|
||||||
set(LUA_EXTERNAL_LIB_FILE "${LUA_LIB_DIR}/${LUA_LIBRARY}")
|
|
||||||
set(LUA_EXTERNAL_DLL_FILE "${LUA_BIN_DIR}/${LUA_DYNAMIC_LIBRARY}")
|
|
||||||
if (LUA_BUILD_AS_DLL)
|
|
||||||
set(LUA_EXTERNAL_BYPRODUCTS ${LUA_EXTERNAL_LIB_FILE} ${LUA_EXTERNAL_DLL_FILE})
|
|
||||||
else()
|
|
||||||
set(LUA_EXTERNAL_BYPRODUCTS ${LUA_EXTERNAL_LIB_FILE})
|
|
||||||
endif()
|
|
||||||
ExternalProject_Add(LUA_EXTERNAL
|
|
||||||
BUILD_IN_SOURCE TRUE
|
|
||||||
BUILD_ALWAYS TRUE
|
|
||||||
TLS_VERIFY TRUE
|
|
||||||
PREFIX ${LUA_EXTERNAL_TOPLEVEL}
|
|
||||||
SOURCE_DIR ${LUA_EXTERNAL_TOPLEVEL}
|
|
||||||
DOWNLOAD_DIR ${LUA_EXTERNAL_TOPLEVEL}
|
|
||||||
TMP_DIR "${LUA_EXTERNAL_TOPLEVEL}-tmp"
|
|
||||||
STAMP_DIR "${LUA_EXTERNAL_TOPLEVEL}-stamp"
|
|
||||||
INSTALL_DIR "${LUA_EXTERNAL_INSTALL_DIR}"
|
|
||||||
URL https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz
|
|
||||||
URL_MD5 ${LUA_EXTERNAL_MD5}
|
|
||||||
URL_HASH SHA1=${LUA_EXTERNAL_SHA1}
|
|
||||||
CONFIGURE_COMMAND ""
|
|
||||||
BUILD_COMMAND ${LUA_EXTERNAL_BUILD_COMMAND}
|
|
||||||
INSTALL_COMMAND ${LUA_EXTERNAL_INSTALL_COMMAND}
|
|
||||||
TEST_COMMAND ${LUA_EXTERNAL_TEST_COMMAND}
|
|
||||||
BUILD_BYPRODUCTS ${LUA_EXTERNAL_BYPRODUCTS})
|
|
||||||
|
|
||||||
# TODO: SHARED not fully supported yet, stock makefiles do not build
|
|
||||||
# dynamic libs on linux out of the box...
|
|
||||||
add_library(lualib_${LUA_VERSION} ${LUA_EXTERNAL_LIBRARY_TYPE} IMPORTED)
|
|
||||||
set_target_properties(lualib_${LUA_VERSION}
|
|
||||||
PROPERTIES
|
|
||||||
LANGUAGE C
|
|
||||||
LINKER_LANGUAGE C
|
|
||||||
INCLUDE_DIRECTORIES ${LUA_INCLUDE_DIR}
|
|
||||||
IMPORTED_LOCATION ${LUA_EXTERNAL_LIB_FILE}
|
|
||||||
IMPORTED_SONAME ${LUA_EXTERNAL_DLL_FILE})
|
|
||||||
|
|
||||||
# make sure the library we export really does depend on Lua
|
|
||||||
add_dependencies(lualib_${LUA_VERSION} LUA_EXTERNAL)
|
|
||||||
|
|
||||||
# set externally-visible target indicator
|
|
||||||
set(LUA_LIBRARIES lualib_${LUA_VERSION})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(LUA_FOUND TRUE)
|
|
||||||
|
|
||||||
unset(LUA_EXTERNAL_BUILD_DLL_DEFAULT)
|
# # # Build Lua
|
||||||
unset(LUA_EXTERNAL_MD5)
|
# # Select either LuaJIT or Vanilla Lua here, based on what we discover
|
||||||
unset(LUA_EXTERNAL_SHA1)
|
if (BUILD_LUAJIT OR LUA_BUILD_NORMALIZED_LUA_VERSION MATCHES "luajit")
|
||||||
unset(LUA_EXTERNAL_MD5_5.3.4)
|
include(LuaJITBuild)
|
||||||
unset(LUA_EXTERNAL_MD5_5.2.4)
|
else()
|
||||||
unset(LUA_EXTERNAL_MD5_5.1.5)
|
include(LuaVanillaBuild)
|
||||||
unset(LUA_EXTERNAL_SHA1_5.3.4)
|
endif()
|
||||||
unset(LUA_EXTERNAL_SHA1_5.2.4)
|
|
||||||
unset(LUA_EXTERNAL_SHA1_5.1.5)
|
# # # Variable cleanup
|
||||||
unset(LUA_EXTERNAL_TOPLEVEL)
|
unset(LUA_BUILD_LIBNAME)
|
||||||
unset(LUA_EXTERNAL_INSTALL_DIR)
|
unset(LUA_BUILD_NORMALIZED_LUA_VERSION)
|
||||||
unset(LUA_EXTERNAL_LIB_FILE)
|
unset(LUA_BUILD_LIBRARY_DESCRIPTION)
|
||||||
unset(LUA_EXTERNAL_BUILD_COMMAND)
|
unset(LUA_BUILD_DYNAMIC_LIBRARY_DESCRIPTION)
|
||||||
unset(LUA_EXTERNAL_TEST_COMMAND)
|
unset(LUA_BUILD_BUILD_DLL_DEFAULT)
|
||||||
unset(LUA_EXTERNAL_INSTALL_COMMAND)
|
unset(LUA_BUILD_OBJECT_FILE_SUFFIX)
|
||||||
unset(LUA_EXTERNAL_LIBRARY_TYPE)
|
unset(LUA_BUILD_LIBRARY_TYPE)
|
||||||
unset(LUA_EXTERNAL_OBJECT_FILE_SUFFIX)
|
|
||||||
unset(LUA_LIBRARY_DESCRIPTION)
|
|
||||||
unset(LUA_DYNAMIC_LIBRARY_DESCRIPTION)
|
|
||||||
|
|
246
cmake/Modules/LuaJITBuild.cmake
Normal file
246
cmake/Modules/LuaJITBuild.cmake
Normal file
|
@ -0,0 +1,246 @@
|
||||||
|
# # # # sol2
|
||||||
|
# The MIT License (MIT)
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013-2017 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.
|
||||||
|
|
||||||
|
# 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_2.1_LATEST_VERSION 2.1.0-beta3)
|
||||||
|
|
||||||
|
# MD5 hashes taken off of LuaJIT's website
|
||||||
|
# must be updated whenever a new version appears
|
||||||
|
set(LUA_JIT_MD5_2.1.0-beta3 eae40bc29d06ee5e3078f9444fcea39b)
|
||||||
|
set(LUA_JIT_MD5_2.1.0-beta3 58d0480e1af0811e7ecee45498d62e2d)
|
||||||
|
set(LUA_JIT_MD5_2.1.0-beta2 fa14598d0d775a7ffefb138a606e0d7b)
|
||||||
|
set(LUA_JIT_MD5_2.1.0-beta2 b5d943c0174ca217736e2ddc2d9721c3)
|
||||||
|
set(LUA_JIT_MD5_2.1.0-beta1 5a5bf71666e77cf6e7a1ae851127b834)
|
||||||
|
set(LUA_JIT_MD5_2.1.0-beta1 4b5c2c9aef0e7c0b622b09e7c84d566b)
|
||||||
|
set(LUA_JIT_MD5_2.0.5 48353202cbcacab84ee41a5a70ea0a2c)
|
||||||
|
set(LUA_JIT_MD5_2.0.5 f7cf52a049d74aee4e624bdc1160b80d)
|
||||||
|
set(LUA_JIT_MD5_2.0.4 dd9c38307f2223a504cbfb96e477eca0)
|
||||||
|
set(LUA_JIT_MD5_2.0.4 ed1f0caf3d390171f423f6f1b5c57aac)
|
||||||
|
set(LUA_JIT_MD5_2.0.3 f14e9104be513913810cd59c8c658dc0)
|
||||||
|
set(LUA_JIT_MD5_2.0.3 6c0f6958d5e1f67734fb1ff514ec4c84)
|
||||||
|
set(LUA_JIT_MD5_2.0.2 112dfb82548b03377fbefbba2e0e3a5b)
|
||||||
|
set(LUA_JIT_MD5_2.0.2 a57c7d1b8eaf46559303dcfd56404045)
|
||||||
|
set(LUA_JIT_MD5_2.0.1 85e406e8829602988eb1233a82e29f1f)
|
||||||
|
set(LUA_JIT_MD5_2.0.1 cf4aee0e40b220054ee3cffbe0cd6ed5)
|
||||||
|
set(LUA_JIT_MD5_2.0.0 97a2b87cc0490784f54b64cfb3b8f5ad)
|
||||||
|
set(LUA_JIT_MD5_2.0.0 467f4f531f7e08ee252f5030ecada7ed)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta11 824aa2684a11e3cc3abe87350a7b6139)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta11 8629401437048e477c94bd791b0a823a)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta10 ed66689b96f7ad7bfeffe0b4ff2d63d4)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta10 f6bbd472726b761b29438c4a06b5ab3c)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta9 e7e03e67e2550817358bc28b44270c6d)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta9 3f9ca0309f26e789c6c3246c83696f84)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta8 f0748a73ae268d49b1d01f56c4fe3e61)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta8 fb096a90c9e799c8922f32095ef3d93c)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta7 b845dec15dd9eba2fd17d865601a52e5)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta7 e10fc2b19de52d8770cdf24f1791dd77)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta6 bfcbe2a11162cfa84d5a1693b442c8bf)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta6 f64945c5ecaf3ea71a829fdbb5cb196c)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta5 7e0dfa03a140148149a1021d4ffd5c57)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta5 be8087fcb576c30ffbb6368ebc284498)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta4 5c5a9305b3e06765e1dae138e1a95c3a)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta4 d0b241be6207fa7d97b6afc41368e05f)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta3 313b6f164e93e1bbac7bf87abb58d4a1)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta3 bea9c7bcd5084f98830e31956f276ff6)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta2 2ebcc38fa1d9756dc2e341f191701120)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta2 94086f99f647d46a8360adeb11851d66)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta1 9ed7646d03580a1cec4abeb74ca44843)
|
||||||
|
set(LUA_JIT_MD5_2.0.0-beta1 19d5bac616fa739343c7158d9d99a3f3)
|
||||||
|
set(LUA_JIT_MD5_1.1.8 ad0e319483fa235e3979537a748631e9)
|
||||||
|
set(LUA_JIT_MD5_1.1.8 92870c80f504c34c9b7547cd6c5562d0)
|
||||||
|
set(LUA_JIT_MD5_1.1.7 3aed0795f7c8725d3613269cd56f8e5a)
|
||||||
|
set(LUA_JIT_MD5_1.1.7 40a8dbc214306bb4b9849fcf026c4ee0)
|
||||||
|
set(LUA_JIT_MD5_1.1.6 1a1320e09d0cd5b793014556fb7d64c9)
|
||||||
|
set(LUA_JIT_MD5_1.1.6 350d7b9230637056fbd6158b95e8fa11)
|
||||||
|
set(LUA_JIT_MD5_1.1.5 b99d244ba4fc1979946ae1025368fc5c)
|
||||||
|
set(LUA_JIT_MD5_1.1.5 d3ffbae3bfcd5914b02dc00b1118a59d)
|
||||||
|
set(LUA_JIT_MD5_1.1.4 9fe29cfb8126bc9c4302701c06965f1c)
|
||||||
|
set(LUA_JIT_MD5_1.1.4 30d318e3287000ecf4c93b29e8783183)
|
||||||
|
set(LUA_JIT_MD5_1.1.3 f5db1a147ed3d34677ad1ef310c56da7)
|
||||||
|
set(LUA_JIT_MD5_1.1.3 5949e7bce9d97c37c282e1cbe85aa378)
|
||||||
|
set(LUA_JIT_MD5_1.1.2 4ae25ce7e3f301d1fcf0b713016edab0)
|
||||||
|
set(LUA_JIT_MD5_1.1.0 16d880a98a1ff6608ac1039c802233db)
|
||||||
|
set(LUA_JIT_MD5_1.0.3 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()
|
||||||
|
else()
|
||||||
|
message(FATAL "Cannot deduce LuaJIT version from ${LUA_VERSION}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Selecting LuaJIT ${LUA_JIT_VERSION}")
|
||||||
|
|
||||||
|
# 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}})
|
||||||
|
set(LUA_JIT_MD5 ${LUA_JIT_MD5_${LUA_JIT_VERSION}})
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
# # # Do the build
|
||||||
|
if (MSVC)
|
||||||
|
# Visual C++ is predicated off running msvcbuild.bat
|
||||||
|
# which requires a Visual Studio Command Prompt
|
||||||
|
|
||||||
|
else ()
|
||||||
|
# we can simply reuse the makefile here
|
||||||
|
# so define it as an external project and then just have the proper
|
||||||
|
# build/install/test commands
|
||||||
|
|
||||||
|
set(LUA_JIT_BUILD_COMMAND make)
|
||||||
|
set(LUA_JIT_INSTALL_COMMAND make install PREFIX=${LUA_LIB_DIR})
|
||||||
|
set(LUA_JIT_TEST_COMMAND make test)
|
||||||
|
set(LUA_JIT_LIB_FILE "${LUA_LIB_DIR}/${LUA_LIBRARY}")
|
||||||
|
set(LUA_JIT_DLL_FILE "${LUA_BIN_DIR}/${LUA_DYNAMIC_LIBRARY}")
|
||||||
|
if (BUILD_LUA_AS_DLL)
|
||||||
|
set(LUA_JIT_BYPRODUCTS ${LUA_JIT_LIB_FILE} ${LUA_JIT_DLL_FILE})
|
||||||
|
else()
|
||||||
|
set(LUA_JIT_BYPRODUCTS ${LUA_JIT_LIB_FILE})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
ExternalProject_Add(LUA_JIT
|
||||||
|
BUILD_IN_SOURCE TRUE
|
||||||
|
BUILD_ALWAYS TRUE
|
||||||
|
# LuaJIT does not offer a TLS/SSL port
|
||||||
|
# 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 http://luajit.org/download/LuaJIT-${LUA_JIT_VERSION}.tar.gz
|
||||||
|
${LUA_JIT_DOWNLOAD_MD5_COMMAND}
|
||||||
|
${LUA_JIT_DOWNLOAD_SHA1_COMMAND}
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
BUILD_COMMAND ${LUA_JIT_BUILD_COMMAND}
|
||||||
|
INSTALL_COMMAND ${LUA_JIT_INSTALL_COMMAND}
|
||||||
|
TEST_COMMAND ${LUA_JIT_TEST_COMMAND}
|
||||||
|
BUILD_BYPRODUCTS ${LUA_JIT_BYPRODUCTS})
|
||||||
|
|
||||||
|
# TODO: SHARED not fully supported yet, stock makefiles do not build
|
||||||
|
# dynamic libs on linux out of the box...
|
||||||
|
add_library(lualib_${LUA_JIT_VERSION} ${LUA_BUILD_LIBRARY_TYPE} IMPORTED)
|
||||||
|
set_target_properties(lualib_${LUA_JIT_VERSION}
|
||||||
|
PROPERTIES
|
||||||
|
LANGUAGE C
|
||||||
|
LINKER_LANGUAGE C
|
||||||
|
INCLUDE_DIRECTORIES ${LUA_INCLUDE_DIR}
|
||||||
|
IMPORTED_LOCATION ${LUA_JIT_LIB_FILE}
|
||||||
|
IMPORTED_SONAME ${LUA_JIT_DLL_FILE})
|
||||||
|
|
||||||
|
# make sure the library we export really does depend on Lua
|
||||||
|
add_dependencies(lualib_${LUA_JIT_VERSION} LUA_JIT)
|
||||||
|
|
||||||
|
# set externally-visible target indicator
|
||||||
|
set(LUA_LIBRARIES lualib_${LUA_JIT_VERSION})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Cleanup variables we set
|
||||||
|
unset(LUA_JIT_NORMALIZED_LUA_VERSION)
|
||||||
|
unset(LUA_JIT_MD5)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.1.0-beta3.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.1.0-beta3.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.1.0-beta2.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.1.0-beta2.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.1.0-beta1.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.1.0-beta1.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.5.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.5.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.4.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.4.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.3.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.3.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.2.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.2.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.1.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.1.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta11.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta11.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta10.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta10.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta9.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta9.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta8.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta8.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta7.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta7.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta6.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta6.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta5.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta5.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta4.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta4.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta3.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta3.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta2.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta2.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta1.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta1.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.1.8.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.1.8.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.1.7.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.1.7.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.1.6.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.1.6.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.1.5.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.1.5.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.1.4.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.1.4.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.1.3.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.1.3.zip)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.1.2.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.1.0.tar.gz)
|
||||||
|
unset(LUA_JIT_MD5_LuaJIT-1.0.3.tar.gz)
|
||||||
|
unset(LUA_JIT_EXTERNAL_2.0_LATEST)
|
||||||
|
unset(LUA_JIT_EXTERNAL_2.1_LATEST)
|
534
cmake/Modules/LuaVanillaBuild.cmake
Normal file
534
cmake/Modules/LuaVanillaBuild.cmake
Normal file
|
@ -0,0 +1,534 @@
|
||||||
|
# # # # sol2
|
||||||
|
# The MIT License (MIT)
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013-2017 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.
|
||||||
|
|
||||||
|
# import necessary standard modules
|
||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
|
||||||
|
# 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.4)
|
||||||
|
|
||||||
|
# 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.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)
|
||||||
|
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 "Cannot deduce the proper Lua version from ${LUA_VERSION}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Selecting PUC-RIO Lua ${LUA_VANILLA_VERSION} from '${LUA_VERSION}' and building a ${LUA_BUILD_LIBRARY_TYPE} library...")
|
||||||
|
|
||||||
|
# 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()
|
||||||
|
|
||||||
|
function(prepend var prefix)
|
||||||
|
set(l "")
|
||||||
|
foreach(f ${ARGN})
|
||||||
|
list(APPEND l "${prefix}${f}")
|
||||||
|
endforeach(f)
|
||||||
|
SET(${var} "${l}" PARENT_SCOPE)
|
||||||
|
ENDFUNCTION(prepend)
|
||||||
|
|
||||||
|
# # # Makefile and self-build configurations
|
||||||
|
|
||||||
|
# # Final outputs for lib and dll files in the case we're using the makefile directly
|
||||||
|
set(LUA_VANILLA_LIB_FILE "${LUA_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${LUA_LIBRARY}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||||
|
set(LUA_VANILLA_DLL_FILE "${LUA_BIN_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${LUA_LIBRARY}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||||
|
if (BUILD_LUA_AS_DLL)
|
||||||
|
set(LUA_VANILLA_BYPRODUCTS ${LUA_VANILLA_LIB_FILE} ${LUA_VANILLA_DLL_FILE})
|
||||||
|
else()
|
||||||
|
set(LUA_VANILLA_BYPRODUCTS ${LUA_VANILLA_LIB_FILE})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# # Potential compiler variables
|
||||||
|
if (MSVC)
|
||||||
|
set(LUA_VANILLA_LUA_LUAC_COMPILER_OPTIONS "")
|
||||||
|
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
|
||||||
|
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 linit.c)
|
||||||
|
set(LUA_VANILLA_LUA_SOURCES lua.c )
|
||||||
|
set(LUA_VANILLA_LUAC_SOURCES luac.c print.c )
|
||||||
|
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 linit.c)
|
||||||
|
set(LUA_VANILLA_LUA_SOURCES lua.c )
|
||||||
|
set(LUA_VANILLA_LUAC_SOURCES luac.c )
|
||||||
|
else()
|
||||||
|
if (NOT LUA_VANILLA_VERSION MATCHES "^5.3")
|
||||||
|
message(STATUS "Using the Lua 5.3 sources list for a version of Lua that is not 5.3: may result in an incomplete build or errors later")
|
||||||
|
endif()
|
||||||
|
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 )
|
||||||
|
set(LUA_VANILLA_LUAC_SOURCES luac.c )
|
||||||
|
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})
|
||||||
|
prepend(LUA_VANILLA_LUAC_SOURCES "${LUA_VANILLA_SOURCE_DIR}/" ${LUA_VANILLA_LUAC_SOURCES})
|
||||||
|
STRING(REGEX REPLACE "\\.c" ${LUA_BUILD_OBJECT_FILE_SUFFIX} LUA_VANILLA_LIB_OBJECTS ${LUA_VANILLA_LIB_SOURCES})
|
||||||
|
STRING(REGEX REPLACE "\\.c" ${LUA_BUILD_OBJECT_FILE_SUFFIX} LUA_VANILLA_LUA_OBJECTS ${LUA_VANILLA_LUA_SOURCES})
|
||||||
|
STRING(REGEX REPLACE "\\.c" ${LUA_BUILD_OBJECT_FILE_SUFFIX} LUA_VANILLA_LUAC_OBJECTS ${LUA_VANILLA_LUAC_SOURCES})
|
||||||
|
|
||||||
|
if (WIN32 OR MSVC OR BUILD_LUA_AS_DLL)
|
||||||
|
set(LUA_VANILLA_BUILD_DIRECTLY TRUE)
|
||||||
|
else()
|
||||||
|
set(LUA_VANILLA_BUILD_DIRECTLY FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# download, just for the sake of download + extract
|
||||||
|
# we can get additional mileage if we're just doing the static build...
|
||||||
|
if (LUA_VANILLA_BUILD_DIRECTLY)
|
||||||
|
# have to use 2 different commands just to have an empty command
|
||||||
|
# that results in nothing being run
|
||||||
|
# TODO: talk to smarter CMake people...?
|
||||||
|
|
||||||
|
ExternalProject_Add(LUA_VANILLA
|
||||||
|
BUILD_IN_SOURCE TRUE
|
||||||
|
BUILD_ALWAYS TRUE
|
||||||
|
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 https://www.lua.org/ftp/lua-${LUA_VANILLA_VERSION}.tar.gz
|
||||||
|
URL_MD5 ${LUA_VANILLA_MD5}
|
||||||
|
URL_HASH SHA1=${LUA_VANILLA_SHA1}
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
BUILD_COMMAND ""
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
TEST_COMMAND ""
|
||||||
|
BUILD_BYPRODUCTS ${LUA_VANILLA_BYPRODUCTS} "${LUA_VANILLA_LIB_SOURCES}" "${LUA_VANILLA_LUA_SOURCES}" "${LUA_VANILLA_LUAC_SOURCES}")
|
||||||
|
else()
|
||||||
|
# targets if we're building using the makefile
|
||||||
|
if (MINGW)
|
||||||
|
set(LUA_VANILLA_MAKE_TARGET generic)
|
||||||
|
elseif(APPLE)
|
||||||
|
set(LUA_VANILLA_MAKE_TARGET macosx)
|
||||||
|
elseif(UNIX AND NOT APPLE)
|
||||||
|
set(LUA_VANILLA_MAKE_TARGET linux)
|
||||||
|
else()
|
||||||
|
set(LUA_VANILLA_MAKE_TARGET generic)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(LUA_VANILLA_LIBNAME ${CMAKE_STATIC_LIBRARY_PREFIX}${LUA_LIBRARY}${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||||
|
set(LUA_VANILLA_MAKE_MODIFICATIONS TO_LIB="${LUA_VANILLA_LIBNAME}" LUA_A="${LUA_VANILLA_LIBNAME}" SYSCFLAGS=-DLUA_COMPAT_ALL)
|
||||||
|
set(LUA_VANILLA_MAKE_INSTALL_TOOL "copy /B /Y")
|
||||||
|
set(LUA_VANILLA_MAKE_INSTALL_TOP "${LUA_BUILD_INSTALL_DIR}")
|
||||||
|
set(LUA_VANILLA_MAKE_INSTALL_BIN "${LUA_BIN_DIR}")
|
||||||
|
set(LUA_VANILLA_MAKE_INSTALL_INC "${LUA_INCLUDE_DIR}")
|
||||||
|
set(LUA_VANILLA_MAKE_INSTALL_LIB "${LUA_LIB_DIR}")
|
||||||
|
set(LUA_VANILLA_MAKE_INSTALL_MAN "${LUA_BUILD_INSTALL_DIR}/man/man1")
|
||||||
|
set(LUA_VANILLA_MAKE_INSTALL_LMOD "${LUA_BUILD_INSTALL_DIR}/share/lua/$V")
|
||||||
|
set(LUA_VANILLA_MAKE_INSTALL_CMOD "${LUA_BUILD_INSTALL_DIR}/lib/lua/$V")
|
||||||
|
file(TO_NATIVE_PATH "${LUA_VANILLA_MAKE_INSTALL_TOP}" LUA_VANILLA_MAKE_INSTALL_TOP)
|
||||||
|
file(TO_NATIVE_PATH "${LUA_VANILLA_MAKE_INSTALL_BIN}" LUA_VANILLA_MAKE_INSTALL_BIN)
|
||||||
|
file(TO_NATIVE_PATH "${LUA_VANILLA_MAKE_INSTALL_INC}" LUA_VANILLA_MAKE_INSTALL_INC)
|
||||||
|
file(TO_NATIVE_PATH "${LUA_VANILLA_MAKE_INSTALL_LIB}" LUA_VANILLA_MAKE_INSTALL_LIB)
|
||||||
|
file(TO_NATIVE_PATH "${LUA_VANILLA_MAKE_INSTALL_MAN}" LUA_VANILLA_MAKE_INSTALL_MAN)
|
||||||
|
file(TO_NATIVE_PATH "${LUA_VANILLA_MAKE_INSTALL_LMOD}" LUA_VANILLA_MAKE_INSTALL_LMOD)
|
||||||
|
file(TO_NATIVE_PATH "${LUA_VANILLA_MAKE_INSTALL_CMOD}" LUA_VANILLA_MAKE_INSTALL_CMOD)
|
||||||
|
if (WIN32)
|
||||||
|
# powershell invokes too many rules and stupid errors,
|
||||||
|
# and mkdir freaks out when the directory exists because it doesn't have a -p options
|
||||||
|
# all in all, windows cmd tools SUCK
|
||||||
|
# set(LUA_VANILLA_MAKE_MKDIR_TOOL "powershell -c New-Item -ItemType directory -force -Name")
|
||||||
|
#set(LUA_VANILLA_MAKE_MKDIR_TOOL "powershell -c New-Item -ItemType directory -force -Name")
|
||||||
|
set(LUA_VANILLA_MAKE_MKDIR_TOOL "mkdir")
|
||||||
|
set(LUA_VANILLA_MAKE_MODIFICATIONS ${LUA_VANILLA_MAKE_MODIFICATIONS} RM=del MKDIR=${LUA_VANILLA_MAKE_MKDIR_TOOL})
|
||||||
|
set(LUA_VANILLA_MAKE_MODIFICATIONS ${LUA_VANILLA_MAKE_MODIFICATIONS} INSTALL="${LUA_VANILLA_MAKE_INSTALL_TOOL}" INSTALL_EXEC="${LUA_VANILLA_MAKE_INSTALL_TOOL}" INSTALL_DATA="${LUA_VANILLA_MAKE_INSTALL_TOOL}")
|
||||||
|
endif()
|
||||||
|
set(LUA_VANILLA_MAKE_MODIFICATIONS ${LUA_VANILLA_MAKE_MODIFICATIONS} INSTALL_TOP="${LUA_VANILLA_MAKE_INSTALL_TOP}" INSTALL_BIN="${LUA_VANILLA_MAKE_INSTALL_BIN}" INSTALL_INC="${LUA_VANILLA_MAKE_INSTALL_INC}" INSTALL_LIB="${LUA_VANILLA_MAKE_INSTALL_LIB}" INSTALL_MAN="${LUA_VANILLA_MAKE_INSTALL_MAN}" INSTALL_LMOD="${LUA_VANILLA_MAKE_INSTALL_LMOD}" INSTALL_CMOD="${LUA_VANILLA_MAKE_INSTALL_CMOD}")
|
||||||
|
|
||||||
|
set(LUA_VANILLA_BUILD_COMMAND make ${LUA_VANILLA_MAKE_TARGET} ${LUA_VANILLA_MAKE_MODIFICATIONS})
|
||||||
|
set(LUA_VANILLA_INSTALL_COMMAND make install ${LUA_VANILLA_MAKE_MODIFICATIONS})
|
||||||
|
set(LUA_VANILLA_TEST_COMMAND make test ${LUA_VANILLA_MAKE_MODIFICATIONS})
|
||||||
|
|
||||||
|
ExternalProject_Add(LUA_VANILLA
|
||||||
|
BUILD_IN_SOURCE TRUE
|
||||||
|
BUILD_ALWAYS TRUE
|
||||||
|
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 https://www.lua.org/ftp/lua-${LUA_VANILLA_VERSION}.tar.gz
|
||||||
|
URL_MD5 ${LUA_VANILLA_MD5}
|
||||||
|
URL_HASH SHA1=${LUA_VANILLA_SHA1}
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
BUILD_COMMAND ${LUA_VANILLA_BUILD_COMMAND}
|
||||||
|
INSTALL_COMMAND ${LUA_VANILLA_INSTALL_COMMAND}
|
||||||
|
TEST_COMMAND ${LUA_VANILLA_TEST_COMMAND}
|
||||||
|
BUILD_BYPRODUCTS ${LUA_VANILLA_BYPRODUCTS} "${LUA_VANILLA_LIB_SOURCES}" "${LUA_VANILLA_LUA_SOURCES}" "${LUA_VANILLA_LUAC_SOURCES}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# # Target names
|
||||||
|
set(lualib "lualib_${LUA_VANILLA_VERSION}")
|
||||||
|
set(luainterpreter "lua_${LUA_VANILLA_VERSION}")
|
||||||
|
set(luacompiler "luac_${LUA_VANILLA_VERSION}")
|
||||||
|
|
||||||
|
if (LUA_VANILLA_BUILD_DIRECTLY)
|
||||||
|
# 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(${lualib} ${LUA_BUILD_LIBRARY_TYPE} "${LUA_VANILLA_LIB_SOURCES}")
|
||||||
|
set_target_properties(${lualib}
|
||||||
|
PROPERTIES
|
||||||
|
LANGUAGE C
|
||||||
|
LINKER_LANGUAGE C
|
||||||
|
C_STANDARD 99
|
||||||
|
C_EXTENSIONS TRUE
|
||||||
|
POSITION_INDEPENDENT_CODE TRUE
|
||||||
|
INCLUDE_DIRECTORIES ${LUA_VANILLA_SOURCE_DIR}
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY ${LUA_BIN_DIR}
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY ${LUA_LIB_DIR}
|
||||||
|
ARCHIVE_OUTPUT_DIRECTORY ${LUA_LIB_DIR}
|
||||||
|
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(${lualib}
|
||||||
|
PRIVATE ${LUA_VANILLA_SOURCE_DIR}
|
||||||
|
PUBLIC ${LUA_VANILLA_SOURCE_DIR})
|
||||||
|
target_compile_definitions(${lualib}
|
||||||
|
PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}
|
||||||
|
PRIVATE LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE})
|
||||||
|
if (WIN32)
|
||||||
|
#target_compile_definitions(${lualib}
|
||||||
|
# PRIVATE LUA_USE_WINDOWS)
|
||||||
|
else()
|
||||||
|
target_compile_definitions(${lualib}
|
||||||
|
PRIVATE LUA_USE_LINUX)
|
||||||
|
endif()
|
||||||
|
target_compile_options(${lualib}
|
||||||
|
PRIVATE ${LUA_VANILLA_LUALIB_COMPILER_OPTIONS})
|
||||||
|
add_dependencies(${lualib} LUA_VANILLA)
|
||||||
|
if (CMAKE_DL_LIBS)
|
||||||
|
target_link_libraries(${lualib} ${CMAKE_DL_LIBS})
|
||||||
|
endif()
|
||||||
|
if (UNIX)
|
||||||
|
target_link_libraries(${lualib} 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_SOURCE_DIR})
|
||||||
|
target_compile_definitions(${luainterpreter}
|
||||||
|
PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}
|
||||||
|
PRIVATE LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE})
|
||||||
|
if (WIN32)
|
||||||
|
#target_compile_definitions(${luainterpreter}
|
||||||
|
# PRIVATE LUA_USE_WINDOWS)
|
||||||
|
else()
|
||||||
|
target_compile_definitions(${luainterpreter}
|
||||||
|
PRIVATE LUA_USE_LINUX)
|
||||||
|
endif()
|
||||||
|
target_compile_options(${luainterpreter}
|
||||||
|
PRIVATE ${LUA_VANILLA_LUA_LUAC_COMPILER_OPTIONS})
|
||||||
|
target_link_libraries(${luainterpreter} ${lualib})
|
||||||
|
if (CMAKE_DL_LIBS)
|
||||||
|
target_link_libraries(${luainterpreter} ${CMAKE_DL_LIBS})
|
||||||
|
endif()
|
||||||
|
if (UNIX)
|
||||||
|
target_link_libraries(${luainterpreter} m readline)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# LuaC Compiler
|
||||||
|
add_executable(${luacompiler} ${LUA_VANILLA_LUAC_SOURCES} ${LUA_VANILLA_LIB_SOURCES})
|
||||||
|
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_SOURCE_DIR})
|
||||||
|
target_compile_options(${luacompiler}
|
||||||
|
PRIVATE ${LUA_VANILLA_LUA_LUAC_COMPILER_OPTIONS})
|
||||||
|
target_compile_definitions(${luacompiler}
|
||||||
|
PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}
|
||||||
|
PRIVATE LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE})
|
||||||
|
if (WIN32)
|
||||||
|
#target_compile_definitions(${luacompiler}
|
||||||
|
# PRIVATE LUA_USE_WINDOWS)
|
||||||
|
else()
|
||||||
|
target_compile_definitions(${luacompiler}
|
||||||
|
PRIVATE LUA_USE_LINUX)
|
||||||
|
endif()
|
||||||
|
#target_link_libraries(${luacompiler} ${lualib})
|
||||||
|
if (CMAKE_DL_LIBS)
|
||||||
|
target_link_libraries(${luacompiler} ${CMAKE_DL_LIBS})
|
||||||
|
endif()
|
||||||
|
if (UNIX)
|
||||||
|
target_link_libraries(${luacompiler} m readline)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# set externally-visible target indicator
|
||||||
|
set(LUA_LIBRARIES ${lualib})
|
||||||
|
else ()
|
||||||
|
# the proper build/install/test commands have generated the library for us
|
||||||
|
# note that this only works for static libs (see above comment under other branch)
|
||||||
|
add_library(${lualib} ${LUA_BUILD_LIBRARY_TYPE} IMPORTED)
|
||||||
|
set_target_properties(lualib_${LUA_VANILLA_VERSION}
|
||||||
|
PROPERTIES
|
||||||
|
LANGUAGE C
|
||||||
|
LINKER_LANGUAGE C
|
||||||
|
INCLUDE_DIRECTORIES ${LUA_INCLUDE_DIR}
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY ${LUA_BIN_DIR}
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY ${LUA_LIB_DIR}
|
||||||
|
ARCHIVE_OUTPUT_DIRECTORY ${LUA_LIB_DIR}
|
||||||
|
RUNTIME_OUTPUT_NAME ${LUA_BUILD_LIBNAME}
|
||||||
|
LIBRARY_OUTPUT_NAME ${LUA_BUILD_LIBNAME}
|
||||||
|
ARCHIVE_OUTPUT_NAME ${LUA_BUILD_LIBNAME}
|
||||||
|
IMPORTED_LOCATION ${LUA_VANILLA_LIB_FILE}
|
||||||
|
IMPORTED_SONAME ${LUA_VANILLA_DLL_FILE})
|
||||||
|
|
||||||
|
# make sure the library we export really does depend on Lua
|
||||||
|
add_dependencies(${lualib} LUA_VANILLA)
|
||||||
|
|
||||||
|
# set externally-visible target indicator
|
||||||
|
set(LUA_LIBRARIES ${lualib})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(LUA_FOUND TRUE)
|
||||||
|
|
||||||
|
unset(LUA_VANILLA_5.1_LATEST)
|
||||||
|
unset(LUA_VANILLA_5.2_LATEST)
|
||||||
|
unset(LUA_VANILLA_5.3_LATEST)
|
||||||
|
unset(LUA_VANILLA_MD5)
|
||||||
|
unset(LUA_VANILLA_SHA1)
|
||||||
|
unset(LUA_VANILLA_MD5_5.3.4)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.3.4)
|
||||||
|
unset(LUA_VANILLA_MD5_5.3.3)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.3.3)
|
||||||
|
unset(LUA_VANILLA_MD5_5.3.2)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.3.2)
|
||||||
|
unset(LUA_VANILLA_MD5_5.3.1)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.3.1)
|
||||||
|
unset(LUA_VANILLA_MD5_5.3.0)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.3.0)
|
||||||
|
unset(LUA_VANILLA_MD5_5.2.4)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.2.4)
|
||||||
|
unset(LUA_VANILLA_MD5_5.2.3)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.2.3)
|
||||||
|
unset(LUA_VANILLA_MD5_5.2.2)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.2.2)
|
||||||
|
unset(LUA_VANILLA_MD5_5.2.1)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.2.1)
|
||||||
|
unset(LUA_VANILLA_MD5_5.2.0)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.2.0)
|
||||||
|
unset(LUA_VANILLA_MD5_5.1.5)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.1.5)
|
||||||
|
unset(LUA_VANILLA_MD5_5.1.4)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.1.4)
|
||||||
|
unset(LUA_VANILLA_MD5_5.1.3)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.1.3)
|
||||||
|
unset(LUA_VANILLA_MD5_5.1.2)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.1.2)
|
||||||
|
unset(LUA_VANILLA_MD5_5.1.1)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.1.1)
|
||||||
|
unset(LUA_VANILLA_MD5_5.1)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.1)
|
||||||
|
unset(LUA_VANILLA_MD5_5.0.3)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.0.3)
|
||||||
|
unset(LUA_VANILLA_MD5_5.0.2)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.0.2)
|
||||||
|
unset(LUA_VANILLA_MD5_5.0.1)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.0.1)
|
||||||
|
unset(LUA_VANILLA_MD5_5.0)
|
||||||
|
unset(LUA_VANILLA_SHA1_5.0)
|
||||||
|
unset(LUA_VANILLA_MD5_4.0.1)
|
||||||
|
unset(LUA_VANILLA_SHA1_4.0.1)
|
||||||
|
unset(LUA_VANILLA_MD5_4.0)
|
||||||
|
unset(LUA_VANILLA_SHA1_4.0)
|
||||||
|
unset(LUA_VANILLA_MD5_3.2.2)
|
||||||
|
unset(LUA_VANILLA_SHA1_3.2.2)
|
||||||
|
unset(LUA_VANILLA_MD5_3.2.1)
|
||||||
|
unset(LUA_VANILLA_SHA1_3.2.1)
|
||||||
|
unset(LUA_VANILLA_MD5_3.2)
|
||||||
|
unset(LUA_VANILLA_SHA1_3.2)
|
||||||
|
unset(LUA_VANILLA_MD5_3.1)
|
||||||
|
unset(LUA_VANILLA_SHA1_3.1)
|
||||||
|
unset(LUA_VANILLA_MD5_3.0)
|
||||||
|
unset(LUA_VANILLA_SHA1_3.0)
|
||||||
|
unset(LUA_VANILLA_MD5_2.5)
|
||||||
|
unset(LUA_VANILLA_SHA1_2.5)
|
||||||
|
unset(LUA_VANILLA_MD5_2.4)
|
||||||
|
unset(LUA_VANILLA_SHA1_2.4)
|
||||||
|
unset(LUA_VANILLA_MD5_2.2)
|
||||||
|
unset(LUA_VANILLA_SHA1_2.2)
|
||||||
|
unset(LUA_VANILLA_MD5_2.1)
|
||||||
|
unset(LUA_VANILLA_SHA1_2.1)
|
||||||
|
unset(LUA_VANILLA_MD5_1.1)
|
||||||
|
unset(LUA_VANILLA_SHA1_1.1)
|
||||||
|
unset(LUA_VANILLA_MD5_1.0)
|
||||||
|
unset(LUA_VANILLA_SHA1_1.0)
|
||||||
|
unset(LUA_VANILLA_LIB_FILE)
|
||||||
|
unset(LUA_VANILLA_BUILD_COMMAND)
|
||||||
|
unset(LUA_VANILLA_TEST_COMMAND)
|
||||||
|
unset(LUA_VANILLA_INSTALL_COMMAND)
|
|
@ -31,27 +31,57 @@ else()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors -Wno-noexcept-type -ftemplate-depth=1024")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors -Wno-noexcept-type -ftemplate-depth=1024")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(example_source_file ${EXAMPLES_SRC})
|
function (MAKE_EXAMPLE example_source_file is_single)
|
||||||
|
if (is_single)
|
||||||
|
set(header_files ${SOL2_SINGLE_HEADER_SOURCES})
|
||||||
|
else()
|
||||||
|
set(header_files ${SOL2_HEADER_SOURCES})
|
||||||
|
endif()
|
||||||
get_filename_component(example_name ${example_source_file} NAME_WE)
|
get_filename_component(example_name ${example_source_file} NAME_WE)
|
||||||
file(RELATIVE_PATH example_source_file_relative ${CMAKE_SOURCE_DIR} ${example_source_file})
|
file(RELATIVE_PATH example_source_file_relative ${CMAKE_SOURCE_DIR} ${example_source_file})
|
||||||
get_filename_component(example_output_relative_dir ${example_source_file_relative} DIRECTORY)
|
get_filename_component(example_output_relative_dir ${example_source_file_relative} DIRECTORY)
|
||||||
set(example_name "${example_name}")
|
if (is_single)
|
||||||
|
set(example_name "${example_name}.single")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(${example_name} ${example_source_file} ${HEADER_SRCS})
|
add_executable(${example_name} ${example_source_file} ${header_files})
|
||||||
set_target_properties(${example_name}
|
set_target_properties(${example_name}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${example_output_relative_dir}"
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${example_output_relative_dir}"
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${example_output_relative_dir}"
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${example_output_relative_dir}"
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${example_output_relative_dir}")
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${example_output_relative_dir}")
|
||||||
target_include_directories(${example_name} PRIVATE "${CMAKE_SOURCE_DIR}" "${LUA_INCLUDE_DIR}" "${CMAKE_BINARY_DIR}/Catch/include/")
|
if (is_single)
|
||||||
|
target_include_directories(${example_name}
|
||||||
|
PRIVATE "${CMAKE_BINARY_DIR}/single/sol" "${LUA_INCLUDE_DIR}")
|
||||||
|
add_dependencies(${example_name} sol2_single_header)
|
||||||
|
else()
|
||||||
|
target_include_directories(${example_name}
|
||||||
|
PRIVATE "${CMAKE_SOURCE_DIR}" "${LUA_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
target_compile_features(${example_name} PUBLIC ${CXX_FEATURES})
|
target_compile_features(${example_name} PUBLIC ${CXX_FEATURES})
|
||||||
target_link_libraries(${example_name} ${LUA_LIBRARIES} ${CMAKE_DL_LIBS})
|
target_link_libraries(${example_name} ${LUA_LIBRARIES})
|
||||||
#if(CMAKE_DL_LIBS)
|
if(CMAKE_DL_LIBS)
|
||||||
# target_link_libraries(${example_name} )
|
target_link_libraries(${example_name} ${CMAKE_DL_LIBS})
|
||||||
#endif()
|
endif()
|
||||||
|
# examples must be built in debug mode to allow assertions to fire
|
||||||
|
target_compile_definitions(${example_name} PRIVATE _DEBUG)
|
||||||
|
if (MSVC)
|
||||||
|
target_compile_options(${example_name} PRIVATE /DDEBUG /UNDEBUG)
|
||||||
|
else()
|
||||||
|
target_compile_options(${example_name} PRIVATE -Og -g -UNDEBUG)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (TESTS)
|
if (TESTS_EXAMPLES)
|
||||||
|
if ((NOT is_single) OR (is_single AND TESTS_SINGLE))
|
||||||
add_test(NAME ${example_name} COMMAND ${example_name})
|
add_test(NAME ${example_name} COMMAND ${example_name})
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS ${example_name} RUNTIME DESTINATION ${example_name})
|
endif()
|
||||||
|
install(TARGETS ${example_name} RUNTIME DESTINATION "${example_output_relative_dir}/${example_name}")
|
||||||
|
endfunction(MAKE_EXAMPLE)
|
||||||
|
|
||||||
|
foreach(example_source_file ${EXAMPLES_SRC})
|
||||||
|
MAKE_EXAMPLE(${example_source_file} FALSE)
|
||||||
|
if (TESTS_SINGLE)
|
||||||
|
MAKE_EXAMPLE(${example_source_file} TRUE)
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
|
@ -24,24 +24,27 @@
|
||||||
|
|
||||||
# # Initial and necessary installations
|
# # Initial and necessary installations
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install build-essential ninja-build libreadline6 libreadline6-dev python3 zsh wget curl openssl cmake
|
sudo apt dist-upgrade
|
||||||
|
sudo apt install build-essential ninja-build libreadline6 libreadline6-dev python3 zsh wget curl libcurl3 openssl libexpat1 libexpat1-dev cmake
|
||||||
|
|
||||||
# # CMake Installation
|
# # CMake Installation (from script)
|
||||||
# This is only necessary if we need cmake of a better version than what's available on the system
|
# This is only necessary if we need cmake of a better version than what's available on the system
|
||||||
#CMAKE_VERSION_MAJOR_MINOR=3.10
|
#CMAKE_VERSION_MAJOR_MINOR=3.10
|
||||||
#CMAKE_VERSION_BUILD=1
|
#CMAKE_VERSION_BUILD=1
|
||||||
#CMAKE_VERSION=$CMAKE_VERSION_MAJOR_MINOR.$CMAKE_VERSION_BUILD
|
#CMAKE_VERSION=$CMAKE_VERSION_MAJOR_MINOR.$CMAKE_VERSION_BUILD
|
||||||
#wget https://cmake.org/files/v$CMAKE_VERSION_MAJOR_MINOR/cmake-$CMAKE_VERSION-Linux-x86_64.sh
|
#wget https://cmake.org/files/v$CMAKE_VERSION_MAJOR_MINOR/cmake-$CMAKE_VERSION-Linux-x86_64.sh
|
||||||
#sudo bash cmake-$CMAKE_VERSION-Linux-x86_64.sh --prefix=/usr/local --exclude-subdir --skip-license
|
#sudo bash cmake-$CMAKE_VERSION-Linux-x86_64.sh --prefix=/usr/local --exclude-subdir --skip-license
|
||||||
#mkdir -p ~/temp
|
|
||||||
#cd ~/temp
|
# # CMake Installation (from source)
|
||||||
|
#mkdir -p cmake-tmp
|
||||||
|
#cd cmake-tmp
|
||||||
#wget https://cmake.org/files/v$CMAKE_VERSION_MAJOR_MINOR/cmake-$CMAKE_VERSION.tar.gz
|
#wget https://cmake.org/files/v$CMAKE_VERSION_MAJOR_MINOR/cmake-$CMAKE_VERSION.tar.gz
|
||||||
#tar -xzvf cmake-$CMAKE_VERSION.tar.gz
|
#tar -xzvf cmake-$CMAKE_VERSION.tar.gz
|
||||||
#cd cmake-$CMAKE_VERSION/
|
#cd cmake-$CMAKE_VERSION/
|
||||||
#./bootstrap
|
#./bootstrap --system-libs
|
||||||
#make -j4
|
#make
|
||||||
#sudo make install
|
#sudo make install
|
||||||
cd ~
|
# cd ..
|
||||||
# refresh the shell, then print the CMake version to make
|
# refresh the shell, then print the CMake version to make
|
||||||
# sure we've got what we need (need to be 3.6 or better: Ubuntu 16.04 rolls 3.5.1 or somethnig)
|
# sure we've got what we need (need to be 3.6 or better: Ubuntu 16.04 rolls 3.5.1 or somethnig)
|
||||||
#exec bash
|
#exec bash
|
||||||
|
|
|
@ -33,36 +33,43 @@ endif()
|
||||||
|
|
||||||
file(DOWNLOAD https://github.com/catchorg/Catch2/releases/download/v2.0.1/catch.hpp ${CMAKE_BINARY_DIR}/Catch/include/catch.hpp)
|
file(DOWNLOAD https://github.com/catchorg/Catch2/releases/download/v2.0.1/catch.hpp ${CMAKE_BINARY_DIR}/Catch/include/catch.hpp)
|
||||||
|
|
||||||
function(CREATE_TEST test_target_name test_name test_includes is_single)
|
function(CREATE_TEST test_target_name test_name is_single)
|
||||||
if (is_single)
|
if (is_single)
|
||||||
set(header_files ${SOL2_SINGLE_HEADER_SOURCES})
|
set(header_files ${SOL2_SINGLE_HEADER_SOURCES})
|
||||||
else()
|
else()
|
||||||
set(header_files ${SOL2_HEADER_SOURCES})
|
set(header_files ${SOL2_HEADER_SOURCES})
|
||||||
endif()
|
endif()
|
||||||
add_executable(${test_target_name} ${SOL2_TEST_SOURCES}
|
add_executable(${test_target_name} ${SOL2_TEST_SOURCES} ${header_files})
|
||||||
${header_files})
|
|
||||||
set_target_properties(${test_target_name}
|
set_target_properties(${test_target_name}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/tests"
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/tests"
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/tests"
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/tests"
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/tests")
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/tests")
|
||||||
|
if (is_single)
|
||||||
|
add_dependencies(${test_target_name} sol2_single_header ${lualib})
|
||||||
target_include_directories(${test_target_name}
|
target_include_directories(${test_target_name}
|
||||||
PRIVATE ${test_includes} "${LUA_INCLUDE_DIR}" "${CMAKE_BINARY_DIR}/Catch/include/")
|
PRIVATE "${CMAKE_BINARY_DIR}/single/sol" "${LUA_INCLUDE_DIR}" "${CMAKE_BINARY_DIR}/Catch/include/")
|
||||||
|
else()
|
||||||
|
target_include_directories(${test_target_name}
|
||||||
|
PRIVATE "${CMAKE_SOURCE_DIR}" "${LUA_INCLUDE_DIR}" "${CMAKE_BINARY_DIR}/Catch/include/")
|
||||||
|
endif()
|
||||||
|
if (MSVC)
|
||||||
|
target_compile_options(${test_target_name}
|
||||||
|
PRIVATE /bigobj)
|
||||||
|
endif()
|
||||||
target_compile_features(${test_target_name}
|
target_compile_features(${test_target_name}
|
||||||
PRIVATE ${CXX_FEATURES})
|
PRIVATE ${CXX_FEATURES})
|
||||||
# if CMAKE_DL_LIBS is empty, then that just resolves to nothingness
|
# if CMAKE_DL_LIBS is empty, then that just resolves to nothingness
|
||||||
target_link_libraries(${test_target_name}
|
target_link_libraries(${test_target_name}
|
||||||
Threads::Threads ${LUA_LIBRARIES} ${CMAKE_DL_LIBS})
|
Threads::Threads ${LUA_LIBRARIES} ${CMAKE_DL_LIBS})
|
||||||
if (is_single)
|
|
||||||
add_dependencies(${test_target_name} single_header)
|
|
||||||
endif()
|
|
||||||
add_test(NAME ${test_target_name}
|
add_test(NAME ${test_target_name}
|
||||||
COMMAND ${test_target_name})
|
COMMAND ${test_target_name})
|
||||||
install(TARGETS ${test_target_name}
|
install(TARGETS ${test_target_name}
|
||||||
RUNTIME DESTINATION bin)
|
RUNTIME DESTINATION bin)
|
||||||
endfunction(CREATE_TEST)
|
endfunction(CREATE_TEST)
|
||||||
|
|
||||||
CREATE_TEST(tests "tests" "${CMAKE_SOURCE_DIR}" FALSE)
|
CREATE_TEST(tests "tests" FALSE)
|
||||||
if (TESTS_SINGLE)
|
if (TESTS_SINGLE)
|
||||||
CREATE_TEST(tests_single "tests.single" "${CMAKE_BINARY_DIR}/single/sol" TRUE)
|
CREATE_TEST(tests_single "tests.single" TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user