mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Fix Linux build as best as possible while size issues still remain with MinGW.
This commit is contained in:
parent
9b292770df
commit
bbd5bd7fa1
@ -25,7 +25,7 @@ BasedOnStyle: WebKit
|
||||
IndentWidth: 5
|
||||
TabWidth: 5
|
||||
ContinuationIndentWidth: 5
|
||||
UseTab: Always
|
||||
UseTab: ForIndentation
|
||||
|
||||
# Namespaces
|
||||
NamespaceIndentation: All
|
||||
@ -33,7 +33,7 @@ CompactNamespaces: true
|
||||
FixNamespaceComments: true
|
||||
|
||||
# Overall Alignment
|
||||
ColumnLimit: 0
|
||||
ColumnLimit: 160
|
||||
AlignAfterOpenBracket: DontAlign # uses ContinuationIndentWidth for this instead
|
||||
AccessModifierOffset: -5 # do not push public: or private: around
|
||||
#AlignConsecutiveAssignments: true # affects more than what's expected: do not use
|
||||
@ -59,7 +59,7 @@ AlwaysBreakAfterReturnType: None
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
ConstructorInitializerIndentWidth: 0
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
BinPackArguments: true
|
||||
BinPackArguments: false
|
||||
BinPackParameters: true
|
||||
|
||||
# Classes
|
||||
|
16
.gitignore
vendored
16
.gitignore
vendored
@ -72,15 +72,6 @@ main.pdb
|
||||
*.files
|
||||
*.includes
|
||||
|
||||
# Scratchpad Files
|
||||
m.lua
|
||||
main.lua
|
||||
catch_mock.hpp
|
||||
main_aux.cpp
|
||||
main.hpp
|
||||
main2.cpp
|
||||
main.cpp
|
||||
|
||||
# Local Lua Testbeds
|
||||
lua-5.4.0-cxx/
|
||||
lua-5.4.0/
|
||||
@ -122,3 +113,10 @@ cmake-build-relwithdebinfo/
|
||||
cmake-build-release/
|
||||
/subprojects/*
|
||||
!/subprojects/*.wrap
|
||||
lua-5.3/
|
||||
lua-5.3-cxx/
|
||||
lua-5.4/
|
||||
LuaJIT-2.0/
|
||||
LuaJIT-2.1/
|
||||
lua-5.1/
|
||||
lua-5.2/
|
||||
|
163
CMakeLists.txt
163
CMakeLists.txt
@ -25,7 +25,7 @@
|
||||
cmake_minimum_required(VERSION 3.5.0)
|
||||
|
||||
# # # project declaration
|
||||
project(sol2 VERSION 2.20.0 LANGUAGES CXX C)
|
||||
project(sol2 VERSION 3.0.0 LANGUAGES CXX C)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
@ -56,14 +56,14 @@ set(CXX_FEATURES
|
||||
cxx_variadic_templates)
|
||||
|
||||
# # #
|
||||
if (PLATFORM MATCHES "i686" OR PLATFORM STREQUAL "x86")
|
||||
if (SOL2_PLATFORM MATCHES "i686" OR SOL2_PLATFORM STREQUAL "x86")
|
||||
set(IS_X86 TRUE)
|
||||
elseif (PLATFORM MATCHES "ARM64")
|
||||
elseif (SOL2_PLATFORM MATCHES "ARM64")
|
||||
set(IS_ARM64 TRUE)
|
||||
set(IS_X64 TRUE)
|
||||
elseif (PLATFORM MATCHES "ARM")
|
||||
elseif (SOL2_PLATFORM MATCHES "ARM")
|
||||
set(IS_ARM TRUE)
|
||||
elseif (PLATFORM MATCHES "x86_64" OR PLATFORM STREQUAL "x64")
|
||||
elseif (SOL2_PLATFORM MATCHES "x86_64" OR SOL2_PLATFORM STREQUAL "x64")
|
||||
set(IS_X64 TRUE)
|
||||
else()
|
||||
set(IS_X64 TRUE)
|
||||
@ -73,8 +73,7 @@ endif()
|
||||
if (MSVC)
|
||||
add_definitions(/DUNICODE /D_UNICODE /D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
|
||||
# Warning level, exceptions
|
||||
add_compile_options(/W4 /EHsc)
|
||||
add_compile_options("/std:c++latest")
|
||||
add_compile_options(/EHsc)
|
||||
add_compile_options("$<$<CONFIG:Debug>:/MDd>"
|
||||
"$<$<CONFIG:Release>:/MD>"
|
||||
"$<$<CONFIG:RelWithDebInfo>:/MD>"
|
||||
@ -110,44 +109,62 @@ include(CMakePackageConfigHelpers)
|
||||
|
||||
# # # Configuration
|
||||
# # 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 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(PLATFORM "x64" CACHE STRING "Target platform to compile for when building binaries (x86, x64)")
|
||||
option(CI "Whether or not we are in continguous integration mode" OFF)
|
||||
option(TESTS "Enable build of tests" OFF)
|
||||
option(EXAMPLES "Enable build of examples" OFF)
|
||||
option(INTEROP_EXAMPLES "Enable build of interop examples" OFF)
|
||||
option(DYNAMIC_LOADING_EXAMPLES "Enable build of interop examples" OFF)
|
||||
option(SINGLE "Enable build of single header files" OFF)
|
||||
option(DOCS "Enable build of documentation" OFF)
|
||||
set(SOL2_LUA_VERSION "5.3.5" CACHE STRING "The version of Lua needed. Can be 5.1, 5.2, 5.3, 5.4, LuaJIT, or a more specific 3-part version number for a specifc Lua (e.g., 5.3.4 or luajit-2.0.5)")
|
||||
set(SOL2_BUILD_LUA TRUE CACHE BOOL "Always build Lua, do not search for it in the system")
|
||||
set(SOL2_PLATFORM "x64" CACHE STRING "Target platform to compile for when building binaries (x86, x64)")
|
||||
option(SOL2_CI "Whether or not we are in continguous integration mode" OFF)
|
||||
option(SOL2_TESTS "Enable build of tests" OFF)
|
||||
option(SOL2_EXAMPLES "Enable build of examples" OFF)
|
||||
option(SOL2_INTEROP_EXAMPLES "Enable build of interop examples" OFF)
|
||||
option(SOL2_DYNAMIC_LOADING_EXAMPLES "Enable build of interop examples" OFF)
|
||||
option(SOL2_GENERATE_SINGLE "Enable generation and build of single header files" OFF)
|
||||
option(SOL2_SINGLE "Enable use of prepackaged single header files" OFF)
|
||||
option(SOL2_DOCS "Enable build of documentation" OFF)
|
||||
# Single tests and examples 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
|
||||
"SINGLE;TESTS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(EXAMPLES_SINGLE "Enable build of examples using the generated single headers" OFF
|
||||
"SINGLE;EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(INTEROP_EXAMPLES_SINGLE "Enable build of interop examples using the generated single headers" OFF
|
||||
"SINGLE;INTEROP_EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DYNAMIC_LOADING_EXAMPLES_SINGLE "Enable build of dynamic loading examples using the generated single headers" OFF
|
||||
"SINGLE;DYNAMIC_LOADING_EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(TESTS_EXAMPLES "Enable build of examples as tests" ON
|
||||
"EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(TESTS_INTEROP_EXAMPLES "Enable build of interop examples as tests" ON
|
||||
"INTEROP_EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(TESTS_DYNAMIC_LOADING_EXAMPLES "Enable build of dynamic loading examples as tests" ON
|
||||
"DYNAMIC_LOADING_EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(SOL2_TESTS_SINGLE "Enable build of tests using the premade single headers" ON
|
||||
"SOL2_SINGLE;SOL2_TESTS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(SOL2_TESTS_SINGLE_GENERATED "Enable build of tests using the generated single headers" ON
|
||||
"SOL2_GENERATE_SINGLE;SOL2_TESTS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(SOL2_EXAMPLES_SINGLE "Enable build of examples using the generated single headers" OFF
|
||||
"SOL2_SINGLE;SOL2_EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(SOL2_EXAMPLES_SINGLE_GENERATED "Enable build of examples using the premade single headers" OFF
|
||||
"SOL2_GENERATE_SINGLE;SOL2_EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(SOL2_INTEROP_EXAMPLES_SINGLE "Enable build of interop examples using the generated single headers" OFF
|
||||
"SOL2_SINGLE;SOL2_INTEROP_EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(SOL2_INTEROP_EXAMPLES_SINGLE_GENERATED "Enable build of interop examples using the generated single headers" OFF
|
||||
"SOL2_GENERATE_SINGLE;SOL2_INTEROP_EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(SOL2_DYNAMIC_LOADING_EXAMPLES_SINGLE "Enable build of dynamic loading examples using the generated single headers" OFF
|
||||
"SOL2_SINGLE;SOL2_DYNAMIC_LOADING_EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(SOL2_DYNAMIC_LOADING_EXAMPLES_SINGLE_GENERATED "Enable build of dynamic loading examples using the generated single headers" OFF
|
||||
"SOL2_GENERATE_SINGLE;SOL2_DYNAMIC_LOADING_EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(SOL2_TESTS_EXAMPLES "Enable build of examples as tests" ON
|
||||
"SOL2_EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(SOL2_TESTS_INTEROP_EXAMPLES "Enable build of interop examples as tests" ON
|
||||
"SOL2_INTEROP_EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(SOL2_TESTS_DYNAMIC_LOADING_EXAMPLES "Enable build of dynamic loading examples as tests" ON
|
||||
"SOL2_DYNAMIC_LOADING_EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_LUA_AS_DLL "Build Lua as a DLL" ON
|
||||
"SOL2_BUILD_LUA" OFF)
|
||||
|
||||
|
||||
# # # sol2 Source Groups
|
||||
# # Sources everyone is going to need
|
||||
# Header files
|
||||
file(GLOB SOL2_HEADER_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/include/sol*.hpp)
|
||||
source_group(sol2 FILES ${SOL2_HEADER_SOURCES})
|
||||
|
||||
# # # sol2 Library
|
||||
# # Add a target for sol2's library to be included by external users
|
||||
add_library(sol2 INTERFACE)
|
||||
add_library(sol2::sol2 ALIAS sol2)
|
||||
target_sources(sol2 INTERFACE ${SOL2_SINGLE_HEADER_SOURCES})
|
||||
set_target_properties(sol2
|
||||
PROPERTIES
|
||||
EXPORT_NAME sol2::sol2)
|
||||
|
||||
target_include_directories(sol2 INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
$<INSTALL_INTERFACE:sol/include>)
|
||||
|
||||
# # Version configurations
|
||||
configure_package_config_file(
|
||||
@ -169,62 +186,26 @@ install(EXPORT sol2
|
||||
FILE sol2-targets.cmake
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/sol2")
|
||||
|
||||
install(DIRECTORY sol
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
|
||||
install(FILES sol.hpp
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
install(DIRECTORY include/
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sol/include")
|
||||
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake/sol2-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake/sol2-config-version.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/sol2")
|
||||
|
||||
# # # Source Groups
|
||||
# # Sources everyone is going to need
|
||||
# Header files
|
||||
file(GLOB SOL2_HEADER_SOURCES sol*.hpp)
|
||||
source_group(headers FILES ${SOL2_HEADER_SOURCES})
|
||||
# single header files
|
||||
file(GLOB SOL2_SINGLE_HEADER_SOURCES single/sol/sol_forward.hpp single/sol/sol.hpp)
|
||||
source_group(headers FILES ${SOL2_SINGLE_HEADER_SOURCES})
|
||||
|
||||
# # # Single header target
|
||||
# Find Python3 for single header / forward header generation
|
||||
find_package(PythonInterp 3)
|
||||
set(SOL2_SINGLE_HEADER_FOUND FALSE)
|
||||
set(SOL2_SINGLE_FOUND FALSE)
|
||||
set(SOL2_DOCS_FOUND FALSE)
|
||||
if (PYTHONINTERP_FOUND)
|
||||
if (SINGLE)
|
||||
set(SOL2_SINGLE_FOUND TRUE)
|
||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/single/sol/sol.hpp" "${CMAKE_CURRENT_BINARY_DIR}/single/sol/sol_forward.hpp"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/sol/single"
|
||||
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/single.py" --output "${CMAKE_CURRENT_BINARY_DIR}/single/sol/sol.hpp")
|
||||
add_custom_target(sol2_single_header ALL
|
||||
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/single/sol/sol.hpp" "${CMAKE_CURRENT_BINARY_DIR}/single/sol/sol_forward.hpp")
|
||||
add_library(sol2_single INTERFACE)
|
||||
add_library(sol2::sol2_single ALIAS sol2_single)
|
||||
set_target_properties(sol2_single
|
||||
PROPERTIES
|
||||
EXPORT_NAME sol2::sol2_single
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/single/")
|
||||
add_dependencies(sol2_single sol2_single_header)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/single/sol/sol.hpp" "${CMAKE_CURRENT_BINARY_DIR}/single/sol/sol_forward.hpp"
|
||||
DESTINATION include/sol/single/sol)
|
||||
endif()
|
||||
if (DOCS)
|
||||
set(SOL2_DOCS_FOUND TRUE)
|
||||
add_custom_command(OUTPUT docs
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/docs" docs
|
||||
COMMAND make -C docs html)
|
||||
add_custom_target(documentation ALL DEPENDS docs)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/docs/build/html" DESTINATION "${CMAKE_INSTALL_DOCDIR}")
|
||||
endif()
|
||||
else()
|
||||
if (SINGLE)
|
||||
message(STATUS "sol2 single_header cannot be generated as python 3 has not been found.")
|
||||
endif()
|
||||
if (SOL2_GENERATE_SINGLE OR SOL2_SINGLE)
|
||||
message(STATUS "sol2 adding single...")
|
||||
add_subdirectory(single)
|
||||
endif()
|
||||
|
||||
# # # documentation
|
||||
# Generates the docs
|
||||
if (SOL2_DOCS)
|
||||
message(STATUS "sol2 adding docs...")
|
||||
add_subdirectory(docs)
|
||||
endif()
|
||||
|
||||
# pkg-config support, except on Windows
|
||||
@ -237,23 +218,23 @@ if(NOT WIN32 OR NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sol2.pc" DESTINATION "${PKGCONFIG_INSTALL_DIR}")
|
||||
endif()
|
||||
|
||||
if (CI)
|
||||
if (SOL2_CI)
|
||||
message(STATUS "sol2 Contiguous Integration is on")
|
||||
endif()
|
||||
|
||||
if (EXAMPLES OR TESTS_EXAMPLES OR EXAMPLES_SINGLE OR INTEROP_EXAMPLES OR TESTS_INTEROP_EXAMPLES OR INTEROP_EXAMPLES_SINGLE OR DYNAMIC_LOADING_EXAMPLES OR TESTS_DYNAMIC_LOADING_EXAMPLES OR DYNAMIC_LOADING_EXAMPLES_SINGLE)
|
||||
if (SOL2_EXAMPLES OR SOL2_TESTS_EXAMPLES OR SOL2_EXAMPLES_SINGLE OR SOL2_INTEROP_EXAMPLES OR SOL2_TESTS_INTEROP_EXAMPLES OR SOL2_INTEROP_EXAMPLES_SINGLE OR SOL2_DYNAMIC_LOADING_EXAMPLES OR SOL2_TESTS_DYNAMIC_LOADING_EXAMPLES OR SOL2_DYNAMIC_LOADING_EXAMPLES_SINGLE)
|
||||
set(DO_EXAMPLES TRUE)
|
||||
else()
|
||||
set(DO_EXAMPLES FALSE)
|
||||
endif()
|
||||
|
||||
if (TESTS OR TESTS_SINGLE)
|
||||
if (SOL2_TESTS OR SOL2_TESTS_SINGLE)
|
||||
set(DO_TESTS TRUE)
|
||||
else()
|
||||
set(DO_TESTS FALSE)
|
||||
endif()
|
||||
|
||||
if (DO_TESTS OR TESTS_EXAMPLES OR TESTS_INTEROP_EXAMPLES OR TESTS_DYNAMIC_LOADING_EXAMPLES)
|
||||
if (DO_TESTS OR SOL2_TESTS_EXAMPLES OR SOL2_TESTS_INTEROP_EXAMPLES OR SOL2_TESTS_DYNAMIC_LOADING_EXAMPLES)
|
||||
set(ENABLE_TESTING TRUE)
|
||||
else()
|
||||
set(ENABLE_TESTING FALSE)
|
||||
@ -276,11 +257,11 @@ if (DO_TESTS OR DO_EXAMPLES)
|
||||
endif()
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
string(TOLOWER ${LUA_VERSION} NORMALIZED_LUA_VERSION)
|
||||
string(TOLOWER ${SOL2_LUA_VERSION} NORMALIZED_LUA_VERSION)
|
||||
# Find way to get Lua: build if requested, or attempt to build if no matching version is found
|
||||
if (BUILD_LUA)
|
||||
find_package(LuaBuild REQUIRED COMPONENTS ${LUA_VERSION})
|
||||
elseif (NOT LUA_VERSION)
|
||||
if (SOL2_BUILD_LUA)
|
||||
find_package(LuaBuild REQUIRED COMPONENTS ${SOL2_LUA_VERSION})
|
||||
elseif (NOT SOL2_LUA_VERSION)
|
||||
find_package(LuaBuild REQUIRED)
|
||||
else()
|
||||
if (NORMALIZED_LUA_VERSION MATCHES "5.1")
|
||||
@ -289,15 +270,17 @@ if (DO_TESTS OR DO_EXAMPLES)
|
||||
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 "5.4")
|
||||
find_package(Lua 5.4 EXACT REQUIRED)
|
||||
elseif(NORMALIZED_LUA_VERSION MATCHES "luajit")
|
||||
find_package(LuaJIT REQUIRED)
|
||||
else()
|
||||
find_package(LuaBuild ${LUA_VERSION} REQUIRED)
|
||||
find_package(LuaBuild ${SOL2_LUA_VERSION} REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT LUA_FOUND AND NOT LUABUILD_FOUND)
|
||||
message(FATAL_ERROR "sol2 Lua \"${LUA_VERSION}\" not found and could not be targeted for building")
|
||||
message(FATAL_ERROR "sol2 Lua \"${SOL2_LUA_VERSION}\" not found and could not be targeted for building")
|
||||
endif()
|
||||
|
||||
# # Enable test harness for regular, example or single tests
|
||||
|
@ -107,7 +107,7 @@ if (LuaBuild_FIND_VERSION)
|
||||
endif()
|
||||
endif()
|
||||
if (NOT LUA_VERSION)
|
||||
set(LUA_VERSION 5.3.4)
|
||||
set(LUA_VERSION 5.3.5)
|
||||
endif()
|
||||
find_lua_build(${LUA_VERSION})
|
||||
unset(find_lua_build)
|
||||
|
@ -34,10 +34,17 @@ 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.4)
|
||||
set(LUA_VANILLA_5.3_LATEST_VERSION 5.3.5)
|
||||
set(LUA_VANILLA_5.4_LATEST_VERSION 5.4.0-work1)
|
||||
|
||||
# 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-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)
|
||||
@ -118,6 +125,8 @@ elseif (LUA_VERSION MATCHES "([0-9]+)\\.([0-9]+)")
|
||||
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
|
||||
@ -169,6 +178,7 @@ 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
|
||||
@ -187,10 +197,7 @@ elseif (LUA_VANILLA_VERSION MATCHES "^5\\.2")
|
||||
set(LUA_VANILLA_LUA_SOURCES lua.c )
|
||||
set(LUA_VANILLA_LUAC_SOURCES luac.c )
|
||||
set(LUA_VANILLA_GENERATE_LUA_HPP false)
|
||||
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()
|
||||
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
|
||||
@ -199,6 +206,28 @@ else()
|
||||
set(LUA_VANILLA_LUA_SOURCES lua.c )
|
||||
set(LUA_VANILLA_LUAC_SOURCES luac.c )
|
||||
set(LUA_VANILLA_GENERATE_LUA_HPP false)
|
||||
elseif (LUA_VANILLA_VERSION MATCHES "^5\\.4")
|
||||
if (LUA_VANILLA_VERSION MATCHES "work")
|
||||
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 )
|
||||
set(LUA_VANILLA_LUAC_SOURCES luac.c )
|
||||
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 )
|
||||
set(LUA_VANILLA_LUAC_SOURCES luac.c )
|
||||
set(LUA_VANILLA_GENERATE_LUA_HPP false)
|
||||
endif()
|
||||
|
||||
set(LUA_VANILLA_SOURCE_DIR "${LUA_BUILD_TOPLEVEL}/src")
|
||||
@ -221,7 +250,7 @@ ExternalProject_Add(LUA_VANILLA
|
||||
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 ${LUA_VANILLA_DOWNLOAD_URL}
|
||||
URL_MD5 ${LUA_VANILLA_MD5}
|
||||
URL_HASH SHA1=${LUA_VANILLA_SHA1}
|
||||
CONFIGURE_COMMAND ""
|
||||
|
43
docs/CMakeLists.txt
Normal file
43
docs/CMakeLists.txt
Normal file
@ -0,0 +1,43 @@
|
||||
# # # # sol3
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2013-2018 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.
|
||||
|
||||
# # # # sol3, documentation generation
|
||||
# # # Required minimum version statement
|
||||
cmake_minimum_required(VERSION 3.5.0)
|
||||
|
||||
find_package(PythonInterp 3)
|
||||
|
||||
if (NOT PYTHONINTERP_FOUND)
|
||||
message(FATAL_ERROR "sol2 documentation cannot be generated as python 3 has not been found: install or set the python 3 interpreter for the docs to find it")
|
||||
endif()
|
||||
|
||||
find_program(sol2_make_executable make make.exe mingw32-make mingw32-make.exe)
|
||||
if(NOT sol2_make_executable)
|
||||
message(FATAL_ERROR "could not find a suitable make executable to build Sphinx documentation")
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT make_docs
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/docs" ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND "${sol2_make_executable}" -C "${CMAKE_CURRENT_BINARY_DIR}" html)
|
||||
add_custom_target(docs ALL DEPENDS make_docs)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/docs/html" DESTINATION "${CMAKE_INSTALL_DOCDIR}")
|
||||
endif()
|
@ -55,9 +55,9 @@ author = 'ThePhD'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '2.20'
|
||||
version = '3.0'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '2.20.5'
|
||||
release = '3.0.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
@ -22,82 +22,82 @@
|
||||
|
||||
# # # sol2 Examples
|
||||
|
||||
if (DYNAMIC_LOADING_EXAMPLES)
|
||||
if (SOL2_DYNAMIC_LOADING_EXAMPLES)
|
||||
# # require_from_dll example
|
||||
# just add the subdirectory
|
||||
add_subdirectory(require_dll_example)
|
||||
endif(DYNAMIC_LOADING_EXAMPLES)
|
||||
endif()
|
||||
|
||||
if (INTEROP_EXAMPLES)
|
||||
if (SOL2_INTEROP_EXAMPLES)
|
||||
# # interop examples
|
||||
add_subdirectory(interop/kaguya)
|
||||
add_subdirectory(interop/tolua)
|
||||
add_subdirectory(interop/LuaBridge)
|
||||
add_subdirectory(interop/luwra)
|
||||
endif(INTEROP_EXAMPLES)
|
||||
endif()
|
||||
|
||||
# # single-source compilable examples
|
||||
|
||||
file(GLOB EXAMPLES_SRC *.cpp tutorials/quick_n_dirty/*.cpp docs/*.cpp)
|
||||
file(GLOB EXAMPLES_SRC source/*.cpp source/tutorials/quick_n_dirty/*.cpp source/docs/*.cpp)
|
||||
source_group(examples FILES ${EXAMPLES_SRC})
|
||||
|
||||
function (MAKE_EXAMPLE example_source_file is_single)
|
||||
function (MAKE_EXAMPLE example_source_file example_suffix target_sol example_test_var)
|
||||
|
||||
get_filename_component(example_name ${example_source_file} NAME_WE)
|
||||
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)
|
||||
file(TO_CMAKE_PATH "${example_output_relative_dir}" example_output_relative_dir_name)
|
||||
STRING(REGEX REPLACE "/" "." example_output_relative_dir_name "${example_output_relative_dir}")
|
||||
if (is_single)
|
||||
set(example_name "${example_name}.single")
|
||||
endif()
|
||||
set(example_name "${example_name}${example_suffix}")
|
||||
|
||||
if (example_output_relative_dir_name STREQUAL "")
|
||||
set(example_output_name "${example_name}")
|
||||
else()
|
||||
set(example_output_name "${example_output_relative_dir_name}.${example_name}")
|
||||
endif()
|
||||
|
||||
add_executable(${example_name} ${example_source_file} assert.hpp)
|
||||
add_executable(${example_name} ${example_source_file} source/assert.hpp)
|
||||
set_target_properties(${example_name}
|
||||
PROPERTIES
|
||||
OUTPUT_NAME "${example_output_name}")
|
||||
if (is_single)
|
||||
target_link_libraries(${example_name} sol2::sol2_single)
|
||||
else()
|
||||
target_link_libraries(${example_name} sol2::sol2)
|
||||
endif()
|
||||
target_link_libraries(${example_name} ${target_sol})
|
||||
target_compile_features(${example_name}
|
||||
PRIVATE ${CXX_FEATURES})
|
||||
target_link_libraries(${example_name} ${LUA_LIBRARIES})
|
||||
if(CMAKE_DL_LIBS)
|
||||
target_link_libraries(${example_name} ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
if (CI)
|
||||
if (SOL2_CI)
|
||||
target_compile_definitions(${example_name}
|
||||
PRIVATE SOL2_CI)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
|
||||
else()
|
||||
target_compile_options(${example_name}
|
||||
PRIVATE -Wno-noexcept-type)
|
||||
endif()
|
||||
|
||||
if (TESTS_EXAMPLES)
|
||||
if ((NOT is_single) OR (is_single AND TESTS_SINGLE))
|
||||
add_test(NAME ${example_output_name} COMMAND ${example_name})
|
||||
endif()
|
||||
if (${example_test_var})
|
||||
add_test(NAME ${example_output_name} COMMAND ${example_name})
|
||||
endif()
|
||||
install(TARGETS ${example_name} RUNTIME DESTINATION bin)
|
||||
endfunction(MAKE_EXAMPLE)
|
||||
|
||||
if (EXAMPLES)
|
||||
if (SOL2_EXAMPLES)
|
||||
foreach(example_source_file ${EXAMPLES_SRC})
|
||||
MAKE_EXAMPLE(${example_source_file} FALSE)
|
||||
MAKE_EXAMPLE(${example_source_file} "" sol2::sol2 SOL2_TESTS_EXAMPLES)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if (SOL2_SINGLE AND SOL2_EXAMPLES_SINGLE)
|
||||
foreach(example_source_file ${EXAMPLES_SRC})
|
||||
MAKE_EXAMPLE(${example_source_file} ".single" sol2::sol2_single SOL2_TESTS_EXAMPLES)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if (SOL2_GENERATE_SINGLE AND SOL2_EXAMPLES_SINGLE_GENERATED)
|
||||
foreach(example_source_file ${EXAMPLES_SRC})
|
||||
MAKE_EXAMPLE(${example_source_file} ".single.generated" sol2::sol2_single_generated SOL2_TESTS_EXAMPLES)
|
||||
endforeach()
|
||||
|
||||
if (SOL2_SINGLE_FOUND AND EXAMPLES_SINGLE)
|
||||
foreach(example_source_file ${EXAMPLES_SRC})
|
||||
MAKE_EXAMPLE(${example_source_file} TRUE)
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -29,7 +29,7 @@ function (make_luabridge_interop_example target_library is_single)
|
||||
if (is_single)
|
||||
set(example_name "${example_name}.single")
|
||||
endif(is_single)
|
||||
add_executable(${example_name} LuaBridge.cpp)
|
||||
add_executable(${example_name} source/LuaBridge.cpp)
|
||||
target_link_libraries(${example_name} PUBLIC ${LUA_LIBRARIES} PRIVATE ${LUABRIDGE_LIBRARIES} ${target_library})
|
||||
if (CMAKE_DL_LIBS)
|
||||
target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS})
|
||||
|
@ -29,7 +29,7 @@ function (make_kaguya_interop_example target_library is_single)
|
||||
if (is_single)
|
||||
set(example_name "${example_name}.single")
|
||||
endif(is_single)
|
||||
add_executable(${example_name} kaguya.cpp)
|
||||
add_executable(${example_name} source/kaguya.cpp)
|
||||
target_link_libraries(${example_name} PUBLIC ${LUA_LIBRARIES} PRIVATE ${KAGUYA_LIBRARIES} ${target_library})
|
||||
if (CMAKE_DL_LIBS)
|
||||
target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS})
|
||||
|
@ -29,7 +29,7 @@ function (make_luwra_interop_example target_library is_single)
|
||||
if (is_single)
|
||||
set(example_name "${example_name}.single")
|
||||
endif(is_single)
|
||||
add_executable(${example_name} luwra.cpp)
|
||||
add_executable(${example_name} source/luwra.cpp)
|
||||
target_link_libraries(${example_name} PUBLIC ${LUA_LIBRARIES} PRIVATE ${LUWRA_LIBRARIES} ${target_library})
|
||||
if (CMAKE_DL_LIBS)
|
||||
target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS})
|
||||
|
@ -29,7 +29,7 @@ function(make_tolua_interop_example target_library is_single)
|
||||
if (is_single)
|
||||
set(example_name "${example_name}.single")
|
||||
endif()
|
||||
add_executable(${example_name} tolua.cpp)
|
||||
add_executable(${example_name} source/tolua.cpp)
|
||||
target_link_libraries(${example_name} PUBLIC ${LUA_LIBRARIES} PRIVATE ${TOLUAPP_LIBRARIES} ${target_library})
|
||||
if (CMAKE_DL_LIBS)
|
||||
target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS})
|
||||
@ -39,12 +39,12 @@ function(make_tolua_interop_example target_library is_single)
|
||||
else()
|
||||
target_compile_options(${example_name} PRIVATE -w)
|
||||
endif()
|
||||
if (TESTS_EXAMPLES)
|
||||
if (SOL2_TESTS_EXAMPLES)
|
||||
add_test(NAME ${example_name} COMMAND ${example_name})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
make_tolua_interop_example(sol2::sol2 FALSE)
|
||||
if (SOL2_SINGLE_FOUND AND INTEROP_EXAMPLES_SINGLE)
|
||||
if (SOL2_SINGLE AND SOL2_INTEROP_EXAMPLES_SINGLE)
|
||||
make_tolua_interop_example(sol2::sol2_single TRUE)
|
||||
endif()
|
@ -33,7 +33,7 @@ namespace sol {
|
||||
};
|
||||
|
||||
template <>
|
||||
struct getter<GlobalResource*> {
|
||||
struct unqualified_getter<GlobalResource*> {
|
||||
static GlobalResource* get(lua_State* L, int /*index*/, record& tracking) {
|
||||
// retrieve the (light) userdata for this type
|
||||
tracking.use(0); // not actually pulling anything off the stack
|
@ -42,7 +42,7 @@ namespace sol {
|
||||
};
|
||||
|
||||
template <>
|
||||
struct getter<two_things> {
|
||||
struct unqualified_getter<two_things> {
|
||||
static two_things get(lua_State* L, int index, record& tracking) {
|
||||
int absolute_index = lua_absindex(L, index);
|
||||
// Get the first element
|
@ -30,7 +30,7 @@ namespace sol {
|
||||
};
|
||||
|
||||
template <>
|
||||
struct getter<number_shim> {
|
||||
struct unqualified_getter<number_shim> {
|
||||
static number_shim get(lua_State* L, int index, record& tracking) {
|
||||
if (check_usertype<number_shim>(L, index)) {
|
||||
number_shim& ns = get_usertype<number_shim>(L, index, tracking);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user