appveyor.yml updates to try and more properly capture constraints

travis.yml updates to try and more properly capture constraints
I truly dislike MSVC's inability to handle lots of using statements.
This commit is contained in:
ThePhD 2019-03-23 12:09:51 -04:00
parent e8467334f6
commit a925963708
No known key found for this signature in database
GPG Key ID: 1509DB1C0F702BFA
15 changed files with 199 additions and 165 deletions

View File

@ -37,15 +37,6 @@ script:
- sudo docker image pull thephd/sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION} - sudo docker image pull thephd/sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION}
- sudo docker run --rm --interactive --tty --name "sol2.test" -v "${SOL2_DIR}:/root/sol2" --env "SOL2_CI=${SOL2_CI}" --env "SOL2_PLATFORM=${SOL2_PLATFORM}" --env "SOL2_LUA_VERSION=${SOL2_LUA_VERSION}" --env "SOL2_TEST_SINGLE=${SOL2_TEST_SINGLE}" --env "SOL2_TEST_INTEROP=${SOL2_TEST_INTEROP}" --env "GCC_VERSION=${GCC_VERSION}" --env "LLVM_VERSION=${LLVM_VERSION}" thephd/sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION} - sudo docker run --rm --interactive --tty --name "sol2.test" -v "${SOL2_DIR}:/root/sol2" --env "SOL2_CI=${SOL2_CI}" --env "SOL2_PLATFORM=${SOL2_PLATFORM}" --env "SOL2_LUA_VERSION=${SOL2_LUA_VERSION}" --env "SOL2_TEST_SINGLE=${SOL2_TEST_SINGLE}" --env "SOL2_TEST_INTEROP=${SOL2_TEST_INTEROP}" --env "GCC_VERSION=${GCC_VERSION}" --env "LLVM_VERSION=${LLVM_VERSION}" thephd/sol2:gcc-${GCC_VERSION}_llvm-${LLVM_VERSION}
after_success:
- wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
- chmod +x send.sh
- ./send.sh success ${DISORD_WEBHOOK_URL}
after_failure:
- wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
- chmod +x send.sh
- ./send.sh failure ${DISORD_WEBHOOK_URL}
matrix: matrix:
fast_finish: true fast_finish: true
allow_failures: allow_failures:
@ -66,24 +57,18 @@ matrix:
SOL2_CI=true SOL2_CI=true
- env: - env:
- LLVM_VERSION=7.0.1 - SOL2_LUA_VERSION=5.3.5
SOL2_LUA_VERSION=5.3.5 LLVM_VERSION=7.0.1
SOL2_PLATFORM=x64 SOL2_PLATFORM=x64
SOL2_CI=true SOL2_CI=true
- env: - env:
- LLVM_VERSION=8.0.0 - SOL2_LUA_VERSION=5.3.5
SOL2_LUA_VERSION=5.3.5 LLVM_VERSION=8.0.0
SOL2_PLATFORM=x64 SOL2_PLATFORM=x64
SOL2_CI=true SOL2_CI=true
# GCC 7.x, 8.x # GCC 7.x, 8.x
- env:
- SOL2_LUA_VERSION=5.3.5
GCC_VERSION=8
SOL2_PLATFORM=i686
SOL2_CI=true
- env: - env:
- SOL2_LUA_VERSION=5.3.5 - SOL2_LUA_VERSION=5.3.5
GCC_VERSION=7 GCC_VERSION=7
@ -121,6 +106,19 @@ matrix:
SOL2_PLATFORM=x64 SOL2_PLATFORM=x64
SOL2_CI=true SOL2_CI=true
# x86 builds
- env:
- SOL2_LUA_VERSION=5.3.5
GCC_VERSION=8
SOL2_PLATFORM=i686
SOL2_CI=true
- env:
- SOL2_LUA_VERSION=5.3.5
LLVM_VERSION=8.0.0
SOL2_PLATFORM=i686
SOL2_CI=true
- env: - env:
- SOL2_LUA_VERSION=luajit-2.0.5 - SOL2_LUA_VERSION=luajit-2.0.5
GCC_VERSION=8 GCC_VERSION=8
@ -135,26 +133,25 @@ matrix:
# Test Single, Interop, Etc. # Test Single, Interop, Etc.
- env: - env:
- LLVM_VERSION=7.0.0 - SOL2_LUA_VERSION=5.3.5
SOL2_LUA_VERSION=5.3.5
SOL2_PLATFORM=x64
SOL2_CI=true
SOL2_TEST_SINGLE=true SOL2_TEST_SINGLE=true
SOL2_TEST_INTEROP=true SOL2_TEST_INTEROP=true
LLVM_VERSION=8.0.0
SOL2_PLATFORM=x64
SOL2_CI=true
- env: - env:
- SOL2_LUA_VERSION=5.3.5 - SOL2_LUA_VERSION=5.3.5
SOL2_TEST_SINGLE=true
SOL2_TEST_INTEROP=true
GCC_VERSION=8 GCC_VERSION=8
SOL2_PLATFORM=x64 SOL2_PLATFORM=x64
SOL2_CI=true SOL2_CI=true
SOL2_TEST_SINGLE=true
SOL2_TEST_INTEROP=true
- os: osx - os: osx
osx_image: xcode9.0 osx_image: xcode10.1
env: env:
- SOL2_LUA_VERSION=lua-5.3.5 - SOL2_LUA_VERSION=lua-5.3.5
LLVM_VERSION=5.0.2
before_install: before_install:
- chmod +x ./scripts/run.osx.sh - chmod +x ./scripts/run.osx.sh
- chmod +x ./scripts/preparation.osx.sh - chmod +x ./scripts/preparation.osx.sh
@ -163,10 +160,20 @@ matrix:
- ./scripts/run.osx.sh - ./scripts/run.osx.sh
- os: osx - os: osx
osx_image: xcode9.1 osx_image: xcode9.4
env:
- SOL2_LUA_VERSION=lua-5.3.5
before_install:
- chmod +x ./scripts/run.osx.sh
- chmod +x ./scripts/preparation.osx.sh
- ./scripts/preparation.osx.sh
script:
- ./scripts/run.osx.sh
- os: osx
osx_image: xcode9.3
env: env:
- SOL2_LUA_VERSION=lua-5.3.5 - SOL2_LUA_VERSION=lua-5.3.5
LLVM_VERSION=5.0.2
before_install: before_install:
- chmod +x ./scripts/run.osx.sh - chmod +x ./scripts/run.osx.sh
- chmod +x ./scripts/preparation.osx.sh - chmod +x ./scripts/preparation.osx.sh
@ -178,7 +185,6 @@ matrix:
osx_image: xcode9.2 osx_image: xcode9.2
env: env:
- SOL2_LUA_VERSION=lua-5.3.5 - SOL2_LUA_VERSION=lua-5.3.5
LLVM_VERSION=5.0.2
before_install: before_install:
- chmod +x ./scripts/run.osx.sh - chmod +x ./scripts/run.osx.sh
- chmod +x ./scripts/preparation.osx.sh - chmod +x ./scripts/preparation.osx.sh

View File

@ -45,19 +45,24 @@ platform:
environment: environment:
matrix: matrix:
# apparently, I can't quite make LLVM work right now... # apparently, I can't quite make LLVM work right now...
- LUA_VERSION: 5.3.5 - SOL2_LUA_VERSION: 5.3.5
MINGW_VERSION: 7.3.0 MINGW_VERSION: 7.3.0
- LUA_VERSION: 5.3.5 - SOL2_LUA_VERSION: 5.3.5
MINGW_VERSION: 8.1.0 MINGW_VERSION: 8.1.0
- LUA_VERSION: luajit-2.0.5 - SOL2_LUA_VERSION: luajit-2.0.5
MINGW_VERSION: 8.1.0 MINGW_VERSION: 8.1.0
- LUA_VERSION: luajit-2.1.0-beta3 - SOL2_LUA_VERSION: luajit-2.1.0-beta3
MINGW_VERSION: 8.1.0 MINGW_VERSION: 8.1.0
- LUA_VERSION: 5.3.5 - SOL2_LUA_VERSION: 5.3.5
- LUA_VERSION: 5.2.4 SOL2_NO_2015: true
- LUA_VERSION: 5.1.5 - SOL2_LUA_VERSION: 5.2.4
- LUA_VERSION: luajit-2.0.5 SOL2_NO_2015: true
- LUA_VERSION: luajit-2.1.0-beta3 - SOL2_LUA_VERSION: 5.1.5
SOL2_NO_2015: true
- SOL2_LUA_VERSION: luajit-2.0.5
SOL2_NO_2015: true
- SOL2_LUA_VERSION: luajit-2.1.0-beta3
SOL2_NO_2015: true
matrix: matrix:
allow_failures: allow_failures:
@ -74,11 +79,20 @@ matrix:
platform: x86 platform: x86
- MINGW_VERSION: 8.1.0 - MINGW_VERSION: 8.1.0
platform: x86 platform: x86
# Get rid of Visual Studio 2015 builds (unsupported)
- image: Visual Studio 2015
SOL_NO_2015: true
- platform: x86
SOL2_LUA_VERSION: 5.2.4
- platform: x86
SOL2_LUA_VERSION: 5.1.5
# Get rid of x86 builds for non-latest (no reason to redo that work) # Get rid of x86 builds for non-latest (no reason to redo that work)
- platform: x86 - platform: x86
LUA_VERSION: 5.2.4 SOL2_LUA_VERSION: 5.3.5
- platform: x86 - platform: x86
LUA_VERSION: 5.1.5 SOL2_LUA_VERSION: 5.2.4
- platform: x86
SOL2_LUA_VERSION: 5.1.5
init: init:
# # Ninja # # Ninja
@ -131,9 +145,9 @@ before_build:
- md buid-sol2\Debug - md buid-sol2\Debug
- md buid-sol2\Release - md buid-sol2\Release
- cd build-sol2 - cd build-sol2
- if not defined %MINGW_VERSION% (cmake .. -G "%CMAKE_GENERATOR%" %build_compiler% -DSOL2_LUA_VERSION="%LUA_VERSION%" -DSOL2_CI=ON -DSOL2_BUILD_LUA=ON -DBUILD_LUA_AS_DLL=%lua_build_type% -DSOL2_TESTS=ON -DSOL2_EXAMPLES=ON -DSOL2_GENERATE_SINGLE=ON -DSOL2_TESTS_EXAMPLES=ON -DSOL2_EXAMPLES_SINGLE_GENERATED=ON -DSOL2_TESTS_SINGLE_GENERATED=ON) - if not defined %MINGW_VERSION% (cmake .. -G "%CMAKE_GENERATOR%" %build_compiler% -DSOL2_LUA_VERSION="%SOL2_LUA_VERSION%" -DSOL2_CI=ON -DSOL2_BUILD_LUA=ON -DBUILD_LUA_AS_DLL=%lua_build_type% -DSOL2_TESTS=ON -DSOL2_EXAMPLES=ON -DSOL2_GENERATE_SINGLE=ON -DSOL2_TESTS_EXAMPLES=ON -DSOL2_EXAMPLES_SINGLE_GENERATED=ON -DSOL2_TESTS_SINGLE_GENERATED=ON)
- if defined %MINGW_VERSION% (cmake ..\.. -G "%CMAKE_GENERATOR%" %build_compiler% -DSOL2_LUA_VERSION="%LUA_VERSION%" -DSOL2_CI=ON -DSOL2_BUILD_LUA=ON -DBUILD_LUA_AS_DLL=%lua_build_type% -DSOL2_TESTS=ON -DSOL2_EXAMPLES=ON -DSOL2_GENERATE_SINGLE=ON -DSOL2_TESTS_EXAMPLES=ON -DSOL2_EXAMPLES_SINGLE_GENERATED=ON -DSOL2_TESTS_SINGLE_GENERATED=ON) - if defined %MINGW_VERSION% (cmake ..\.. -G "%CMAKE_GENERATOR%" %build_compiler% -DSOL2_LUA_VERSION="%SOL2_LUA_VERSION%" -DSOL2_CI=ON -DSOL2_BUILD_LUA=ON -DBUILD_LUA_AS_DLL=%lua_build_type% -DSOL2_TESTS=ON -DSOL2_EXAMPLES=ON -DSOL2_GENERATE_SINGLE=ON -DSOL2_TESTS_EXAMPLES=ON -DSOL2_EXAMPLES_SINGLE_GENERATED=ON -DSOL2_TESTS_SINGLE_GENERATED=ON)
- if defined %MINGW_VERSION% (cmake ..\.. -G "%CMAKE_GENERATOR%" %build_compiler% -DSOL2_LUA_VERSION="%LUA_VERSION%" -DSOL2_CI=ON -DSOL2_BUILD_LUA=ON -DBUILD_LUA_AS_DLL=%lua_build_type% -DSOL2_TESTS=ON -DSOL2_EXAMPLES=ON -DSOL2_GENERATE_SINGLE=ON -DSOL2_TESTS_EXAMPLES=ON -DSOL2_EXAMPLES_SINGLE_GENERATED=ON -DSOL2_TESTS_SINGLE_GENERATED=ON) - if defined %MINGW_VERSION% (cmake ..\.. -G "%CMAKE_GENERATOR%" %build_compiler% -DSOL2_LUA_VERSION="%SOL2_LUA_VERSION%" -DSOL2_CI=ON -DSOL2_BUILD_LUA=ON -DBUILD_LUA_AS_DLL=%lua_build_type% -DSOL2_TESTS=ON -DSOL2_EXAMPLES=ON -DSOL2_GENERATE_SINGLE=ON -DSOL2_TESTS_EXAMPLES=ON -DSOL2_EXAMPLES_SINGLE_GENERATED=ON -DSOL2_TESTS_SINGLE_GENERATED=ON)
# We do not build the debug versions because the compiler # We do not build the debug versions because the compiler
# generates too much debug info for MinGW to handle # generates too much debug info for MinGW to handle

View File

@ -116,5 +116,5 @@ unset(find_lua_build)
# all listed variables are TRUE # all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaBuild FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaBuild
FOUND_VAR LUABUILD_FOUND FOUND_VAR LUABUILD_FOUND
REQUIRED_VARS LUA_LIBRARIES LUA_INTERPRETER LUA_INCLUDE_DIRS REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIRS
VERSION_VAR LUA_VERSION_STRING) VERSION_VAR LUA_VERSION_STRING)

View File

@ -145,6 +145,7 @@ endif()
set(LUA_JIT_SOURCE_DIR "${LUA_BUILD_TOPLEVEL}/src") set(LUA_JIT_SOURCE_DIR "${LUA_BUILD_TOPLEVEL}/src")
set(LUA_JIT_INSTALL_DIR "${LUA_BUILD_TOPLEVEL}/install") set(LUA_JIT_INSTALL_DIR "${LUA_BUILD_TOPLEVEL}/install")
set(LUA_JIT_INCLUDE_DIRS "${LUA_JIT_SOURCE_DIR}")
file(MAKE_DIRECTORY ${LUA_JIT_SOURCE_DIR}) file(MAKE_DIRECTORY ${LUA_JIT_SOURCE_DIR})
file(MAKE_DIRECTORY ${LUA_JIT_INSTALL_DIR}) file(MAKE_DIRECTORY ${LUA_JIT_INSTALL_DIR})
@ -165,9 +166,9 @@ if (MSVC)
# Visual C++ is predicated off running msvcbuild.bat # Visual C++ is predicated off running msvcbuild.bat
# which requires a Visual Studio Command Prompt # which requires a Visual Studio Command Prompt
if (BUILD_LUA_AS_DLL) if (BUILD_LUA_AS_DLL)
set(LUA_JIT_BUILD_COMMAND BUILD_COMMAND cd src && msvcbuild.bat) set(LUA_JIT_MAKE_COMMAND cd src && msvcbuild.bat)
else() else()
set(LUA_JIT_BUILD_COMMAND BUILD_COMMAND cd src && msvcbuild.bat static) set(LUA_JIT_MAKE_COMMAND cd src && msvcbuild.bat static)
endif() endif()
set(LUA_JIT_PREBUILT_LIB "lua51.lib") set(LUA_JIT_PREBUILT_LIB "lua51.lib")
set(LUA_JIT_PREBUILT_IMP_LIB "lua51.lib") set(LUA_JIT_PREBUILT_IMP_LIB "lua51.lib")
@ -189,13 +190,12 @@ else ()
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "LUAJIT_A=${LUA_JIT_LIB_FILENAME}") list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "LUAJIT_A=${LUA_JIT_LIB_FILENAME}")
set(LUA_JIT_MAKE_CFLAGS_MODIFICATIONS "") set(LUA_JIT_MAKE_CFLAGS_MODIFICATIONS "")
set(LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS "") set(LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS "")
set(LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS "") set(LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS "-fPIC")
if (BUILD_LUA_AS_DLL) if (BUILD_LUA_AS_DLL)
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "LUAJIT_SO=${LUA_JIT_DLL_FILENAME}" "TARGET_SONAME=${LUA_JIT_DLL_FILENAME}" "TARGET_DYLIBNAME=${LUA_JIT_DLL_FILENAME}" "TARGET_DLLNAME=${LUA_JIT_DLL_FILENAME}") list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "LUAJIT_SO=${LUA_JIT_DLL_FILENAME}" "TARGET_SONAME=${LUA_JIT_DLL_FILENAME}" "TARGET_DYLIBNAME=${LUA_JIT_DLL_FILENAME}" "TARGET_DLLNAME=${LUA_JIT_DLL_FILENAME}")
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "BUILDMODE=dynamic") list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "BUILDMODE=dynamic")
else() else()
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "BUILDMODE=static") list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "BUILDMODE=static")
set(LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS} -fPIC")
endif() endif()
if (IS_X86) if (IS_X86)
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "CC=${CMAKE_C_COMPILER} -m32") list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "CC=${CMAKE_C_COMPILER} -m32")
@ -217,10 +217,11 @@ else ()
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "CFLAGS=${LUA_JIT_MAKE_CFLAGS_MODIFICATIONS}") list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "CFLAGS=${LUA_JIT_MAKE_CFLAGS_MODIFICATIONS}")
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "TARGET_CFLAGS=${LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS}") list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "TARGET_CFLAGS=${LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS}")
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "HOST_CFLAGS=${LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS}") list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "HOST_CFLAGS=${LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS}")
set(LUA_JIT_MAKE_COMMAND "${MAKE_PROGRAM}" ${LUA_JIT_MAKE_BUILD_MODIFICATIONS})
set(LUA_JIT_BUILD_COMMAND BUILD_COMMAND "${MAKE_PROGRAM}" ${LUA_JIT_MAKE_BUILD_MODIFICATIONS})
endif() endif()
set(LUA_JIT_BUILD_COMMAND BUILD_COMMAND ${LUA_JIT_MAKE_COMMAND})
set(lualib luajit_lib_${LUA_JIT_VERSION}) set(lualib luajit_lib_${LUA_JIT_VERSION})
set(luainterpreter luajit_${LUA_JIT_VERSION}) set(luainterpreter luajit_${LUA_JIT_VERSION})
@ -247,15 +248,20 @@ elseif(LUA_JIT_NORMALIZED_LUA_VERSION MATCHES "latest")
set(LUA_JIT_PULL_LATEST TRUE) set(LUA_JIT_PULL_LATEST TRUE)
endif() endif()
set(LUA_JIT_BYPRODUCTS "${LUA_JIT_SOURCE_LUA_LIB}" "${LUA_JIT_SOURCE_LUA_LIB_EXP}" set(LUA_JIT_BYPRODUCTS "${LUA_JIT_SOURCE_LUA_DLL}" "${LUA_JIT_SOURCE_LUA_INTERPRETER}")
"${LUA_JIT_SOURCE_LUA_DLL}" "${LUA_JIT_SOURCE_LUA_INTERPRETER}") set(LUA_JIT_INSTALL_BYPRODUCTS "${LUA_JIT_DESTINATION_LUA_DLL}" "${LUA_JIT_DESTINATION_LUA_INTERPRETER}")
set(LUA_JIT_INSTALL_BYPRODUCTS "${LUA_JIT_DESTINATION_LUA_LIB}" "${LUA_JIT_DESTINATION_LUA_LIB_EXP}" if (BUILD_LUA_AS_DLL AND MSVC)
"${LUA_JIT_DESTINATION_LUA_DLL}" "${LUA_JIT_DESTINATION_LUA_INTERPRETER}") set(LUA_JIT_BYPRODUCTS ${LUA_JIT_BYPRODUCTS} "${LUA_JIT_SOURCE_LUA_LIB_EXP}")
set(LUA_JIT_INSTALL_BYPRODUCTS ${LUA_JIT_INSTALL_BYPRODUCTS} "${LUA_JIT_DESTINATION_LUA_LIB_EXP}")
endif()
if (CMAKE_IMPORT_LIBRARY_SUFFIX) if (CMAKE_IMPORT_LIBRARY_SUFFIX AND BUILD_LUA_AS_DLL)
set(LUA_JIT_BYPRODUCTS "${LUA_JIT_BYPRODUCTS}" "${LUA_JIT_SOURCE_LUA_IMP_LIB}") set(LUA_JIT_BYPRODUCTS ${LUA_JIT_BYPRODUCTS} "${LUA_JIT_SOURCE_LUA_IMP_LIB}")
set(LUA_JIT_INSTALL_BYPRODUCTS "${LUA_JIT_INSTALL_BYPRODUCTS}" "${LUA_JIT_DESTINATION_LUA_IMP_LIB}") set(LUA_JIT_INSTALL_BYPRODUCTS "${LUA_JIT_INSTALL_BYPRODUCTS}" "${LUA_JIT_DESTINATION_LUA_IMP_LIB}")
else()
set(LUA_JIT_BYPRODUCTS ${LUA_JIT_BYPRODUCTS} "${LUA_JIT_SOURCE_LUA_LIB}")
set(LUA_JIT_INSTALL_BYPRODUCTS ${LUA_JIT_INSTALL_BYPRODUCTS} "${LUA_JIT_DESTINATION_LUA_LIB}")
endif() endif()
# # Post-Build moving steps for necessary items # # Post-Build moving steps for necessary items
@ -277,7 +283,24 @@ else()
set(LUA_JIT_POSTBUILD_COMMANDS ${LUA_JIT_POSTBUILD_COMMANDS} COMMAND "${CMAKE_COMMAND}" -E copy "${LUA_JIT_SOURCE_LUA_LIB}" "${LUA_JIT_DESTINATION_LUA_LIB}") set(LUA_JIT_POSTBUILD_COMMANDS ${LUA_JIT_POSTBUILD_COMMANDS} COMMAND "${CMAKE_COMMAND}" -E copy "${LUA_JIT_SOURCE_LUA_LIB}" "${LUA_JIT_DESTINATION_LUA_LIB}")
endif() endif()
if (LUA_JIT_GIT_COMMIT OR LUA_JIT_PULL_LATEST) if (LUA_LOCAL_DIR)
file(COPY "${LUA_LOCAL_DIR}/"
DESTINATION "${LUA_BUILD_TOPLEVEL}"
FILES_MATCHING REGEX ".*"
)
add_custom_command(OUTPUT ${LUA_JIT_BYPRODUCTS}
COMMAND ${LUA_JIT_MAKE_COMMAND}
WORKING_DIRECTORY "${LUA_BUILD_TOPLEVEL}"
DEPENDS "${LUA_BUILD_TOPLEVEL}/Makefile" "${LUA_BUILD_TOPLEVEL}/src/msvcbuild.bat"
COMMENT "Building LuaJIT ${LUA_JIT_VERSION}..."
)
add_custom_target(LUA_JIT-move
${LUA_JIT_POSTBUILD_COMMANDS}
COMMENT ${LUA_JIT_POSTBUILD_COMMENTS}
BYPRODUCTS ${LUA_JIT_INSTALL_BYPRODUCTS}
DEPENDS ${LUA_JIT_BYPRODUCTS}
)
elseif (LUA_JIT_GIT_COMMIT OR LUA_JIT_PULL_LATEST)
if (LUA_JIT_PULL_LATEST) if (LUA_JIT_PULL_LATEST)
MESSAGE(STATUS "Latest LuaJIT has been requested: pulling from git...") MESSAGE(STATUS "Latest LuaJIT has been requested: pulling from git...")
elseif (LUA_JIT_GIT_COMMIT) elseif (LUA_JIT_GIT_COMMIT)
@ -300,11 +323,11 @@ if (LUA_JIT_GIT_COMMIT OR LUA_JIT_PULL_LATEST)
${LUA_JIT_BUILD_COMMAND} ${LUA_JIT_BUILD_COMMAND}
INSTALL_COMMAND "" INSTALL_COMMAND ""
TEST_COMMAND "" TEST_COMMAND ""
BUILD_BYPRODUCTS "${LUA_JIT_BYPRODUCTS}" "${LUA_JIT_BYPRODUCTS}") BUILD_BYPRODUCTS ${LUA_JIT_BYPRODUCTS})
else() else()
ExternalProject_Add(LUA_JIT ExternalProject_Add(LUA_JIT
BUILD_IN_SOURCE TRUE BUILD_IN_SOURCE TRUE
BUILD_ALWAYS FALSE BUILD_ALWAYS TRUE
# LuaJIT does not offer a TLS/SSL port # LuaJIT does not offer a TLS/SSL port
TLS_VERIFY FALSE TLS_VERIFY FALSE
PREFIX "${LUA_BUILD_TOPLEVEL}" PREFIX "${LUA_BUILD_TOPLEVEL}"
@ -319,63 +342,50 @@ else()
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
${LUA_JIT_BUILD_COMMAND} ${LUA_JIT_BUILD_COMMAND}
INSTALL_COMMAND "" INSTALL_COMMAND ""
TEST_COMMAND "") TEST_COMMAND ""
BUILD_BYPRODUCTS ${LUA_JIT_BYPRODUCTS})
endif() endif()
# # MAYBE?: if (NOT LUA_LOCAL_DIR)
# Add additional post-build step to move all necessary headers/lua files ExternalProject_Add_Step(LUA_JIT move
# for now, we just point directly to the `src` directory... ALWAYS TRUE
${LUA_JIT_POSTBUILD_COMMANDS}
ExternalProject_Add_Step(LUA_JIT move WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
${LUA_JIT_POSTBUILD_COMMANDS} COMMENT ${LUA_JIT_POSTBUILD_COMMENTS}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" DEPENDEES build
COMMENT ${LUA_JIT_POSTBUILD_COMMENTS} DEPENDS ${LUA_JIT_BYPRODUCTS}
DEPENDS build BYPRODUCTS ${LUA_JIT_INSTALL_BYPRODUCTS})
ALWAYS TRUE) ExternalProject_Add_StepTargets(LUA_JIT move)
ExternalProject_Add_StepTargets(LUA_JIT move) endif()
# # Lua Library # # Lua Library
add_library(${lualib} ${LUA_BUILD_LIBRARY_TYPE} IMPORTED) add_library(${lualib} INTERFACE)
# make sure the library we export really does depend on Lua JIT's external project
add_dependencies(${lualib} LUA_JIT-move) add_dependencies(${lualib} LUA_JIT-move)
# Configure properties target_include_directories(${lualib}
INTERFACE "${LUA_JIT_SOURCE_DIR}")
if (BUILD_LUA_AS_DLL) if (BUILD_LUA_AS_DLL)
if (MSVC) if (MSVC)
set_target_properties(${lualib} target_link_libraries(${lualib}
PROPERTIES INTERFACE "${LUA_JIT_DESTINATION_LUA_LIB}")
IMPORTED_IMPLIB "${LUA_JIT_DESTINATION_LUA_IMP_LIB}") else()
target_link_libraries(${lualib}
INTERFACE "${LUA_JIT_DESTINATION_LUA_DLL}")
endif() endif()
set_target_properties(${lualib} else()
PROPERTIES target_link_libraries(${lualib}
IMPORTED_LOCATION "${LUA_JIT_DESTINATION_LUA_DLL}") INTERFACE "${LUA_JIT_DESTINATION_LUA_LIB}")
else ()
set_target_properties(${lualib}
PROPERTIES
IMPORTED_LOCATION "${LUA_JIT_DESTINATION_LUA_LIB}")
endif() endif()
set_target_properties(${lualib}
PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES C
INTERFACE_INCLUDE_DIRECTORIES "${LUA_JIT_SOURCE_DIR}")
if (CMAKE_DL_LIBS) if (CMAKE_DL_LIBS)
set_target_properties(${lualib} target_link_libraries(${lualib}
PROPERTIES INTERFACE ${CMAKE_DL_LIBS})
INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS})
endif() endif()
if (XCODE) if (XCODE)
target_compile_options(${lualib} target_compile_options(${lualib}
PUBLIC -pagezero_size 10000 -image_base 100000000) INTERFACE -pagezero_size 10000 -image_base 100000000)
endif () endif ()
# # Lua Executable
add_executable(${luainterpreter} IMPORTED)
# Add location pointing to executable
set_target_properties(${luainterpreter}
PROPERTIES
IMPORTED_LOCATION "${LUA_JIT_DESTINATION_LUA_INTERPRETER}")
add_dependencies(${luainterpreter} LUA_JIT-move)
# # set externally-visible target indicator # # set externally-visible target indicator
set(LUA_LIBRARIES ${lualib}) set(LUA_LIBRARIES ${lualib})
set(LUA_INTERPRETER ${luainterpreter}) set(LUA_INTERPRETER "")
set(LUA_INCLUDE_DIRS "${LUA_JIT_SOURCE_DIR}") set(LUA_INCLUDE_DIRS "${LUA_JIT_INCLUDE_DIRS}")

View File

@ -132,6 +132,7 @@ namespace sol {
~push_popper() { ~push_popper() {
} }
}; };
template <typename T> template <typename T>
struct push_popper<false, T, std::enable_if_t<std::is_base_of<stack_reference, meta::unqualified_t<T>>::value>> { struct push_popper<false, T, std::enable_if_t<std::is_base_of<stack_reference, meta::unqualified_t<T>>::value>> {
using Tu = meta::unqualified_t<T>; using Tu = meta::unqualified_t<T>;

View File

@ -41,11 +41,7 @@
// we'll just let this alone for now // we'll just let this alone for now
#elif defined _MSC_VER #elif defined _MSC_VER
#pragma warning(push) #pragma warning(push)
//#pragma warning(disable : 4324) // structure was padded due to alignment specifier #pragma warning(disable : 4505) // unreferenced local function has been removed GEE THANKS
//#pragma warning(disable : 4503) // decorated name horse shit
//#pragma warning(disable : 4702) // unreachable code
//#pragma warning(disable : 4127) // 'conditional expression is constant' yeah that's the point your old compilers don't have `if constexpr` you jerk
//#pragma warning(disable : 4505) // some other nonsense warning
#endif // clang++ vs. g++ vs. VC++ #endif // clang++ vs. g++ vs. VC++
#include "forward.hpp" #include "forward.hpp"

View File

@ -59,12 +59,6 @@ namespace sol {
return luaL_error(L, "sol: cannot modify the elements of an enumeration table"); return luaL_error(L, "sol: cannot modify the elements of an enumeration table");
} }
template <bool top_level, typename... Args>
using is_global = meta::all<meta::boolean<top_level>, meta::is_c_str<Args>...>;
template <bool top_level, typename... Args>
constexpr inline bool is_global_v = is_global<top_level, Args...>::value;
} // namespace detail } // namespace detail
template <bool top_level, typename ref_t> template <bool top_level, typename ref_t>
@ -104,7 +98,7 @@ namespace sol {
template <bool raw, typename Ret, typename... Keys> template <bool raw, typename Ret, typename... Keys>
decltype(auto) traverse_get_single(int table_index, Keys&&... keys) const { decltype(auto) traverse_get_single(int table_index, Keys&&... keys) const {
constexpr static bool global = detail::is_global_v<top_level, Keys...>; constexpr static bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<meta::unqualified_t<Keys>>...>::value;
if constexpr (meta::is_optional_v<meta::unqualified_t<Ret>>) { if constexpr (meta::is_optional_v<meta::unqualified_t<Ret>>) {
int popcount = 0; int popcount = 0;
detail::ref_clean c(base_t::lua_state(), popcount); detail::ref_clean c(base_t::lua_state(), popcount);
@ -118,7 +112,7 @@ namespace sol {
template <bool raw, typename Pairs, std::size_t... I> template <bool raw, typename Pairs, std::size_t... I>
void tuple_set(std::index_sequence<I...>, Pairs&& pairs) { void tuple_set(std::index_sequence<I...>, Pairs&& pairs) {
constexpr bool global = detail::is_global<top_level, decltype(std::get<I * 2>(std::forward<Pairs>(pairs)))...>::value; constexpr bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<decltype(std::get<I * 2>(std::forward<Pairs>(pairs)))>...>::value;
auto pp = stack::push_pop<global>(*this); auto pp = stack::push_pop<global>(*this);
int table_index = pp.index_of(*this); int table_index = pp.index_of(*this);
lua_State* L = base_t::lua_state(); lua_State* L = base_t::lua_state();
@ -309,7 +303,7 @@ namespace sol {
template <typename... Ret, typename... Keys> template <typename... Ret, typename... Keys>
decltype(auto) get(Keys&&... keys) const { decltype(auto) get(Keys&&... keys) const {
static_assert(sizeof...(Keys) == sizeof...(Ret), "number of keys and number of return types do not match"); static_assert(sizeof...(Keys) == sizeof...(Ret), "number of keys and number of return types do not match");
constexpr static bool global = detail::is_global_v<top_level, Keys...>; constexpr static bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<meta::unqualified_t<Keys>>...>::value;
auto pp = stack::push_pop<global>(*this); auto pp = stack::push_pop<global>(*this);
int table_index = pp.index_of(*this); int table_index = pp.index_of(*this);
return tuple_get<false, Ret...>(table_index, std::forward<Keys>(keys)...); return tuple_get<false, Ret...>(table_index, std::forward<Keys>(keys)...);
@ -336,7 +330,7 @@ namespace sol {
template <typename T, typename... Keys> template <typename T, typename... Keys>
decltype(auto) traverse_get(Keys&&... keys) const { decltype(auto) traverse_get(Keys&&... keys) const {
constexpr static bool global = detail::is_global_v<top_level, Keys...>; constexpr static bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<meta::unqualified_t<Keys>>...>::value;
auto pp = stack::push_pop<global>(*this); auto pp = stack::push_pop<global>(*this);
int table_index = pp.index_of(*this); int table_index = pp.index_of(*this);
return traverse_get_single<false, T>(table_index, std::forward<Keys>(keys)...); return traverse_get_single<false, T>(table_index, std::forward<Keys>(keys)...);
@ -344,7 +338,7 @@ namespace sol {
template <typename... Keys> template <typename... Keys>
basic_table_core& traverse_set(Keys&&... keys) { basic_table_core& traverse_set(Keys&&... keys) {
constexpr static bool global = detail::is_global_v<top_level, Keys...>; constexpr static bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<meta::unqualified_t<Keys>>...>::value;
auto pp = stack::push_pop<global>(*this); auto pp = stack::push_pop<global>(*this);
int table_index = pp.index_of(*this); int table_index = pp.index_of(*this);
lua_State* L = base_t::lua_state(); lua_State* L = base_t::lua_state();
@ -367,7 +361,7 @@ namespace sol {
template <typename... Ret, typename... Keys> template <typename... Ret, typename... Keys>
decltype(auto) raw_get(Keys&&... keys) const { decltype(auto) raw_get(Keys&&... keys) const {
static_assert(sizeof...(Keys) == sizeof...(Ret), "number of keys and number of return types do not match"); static_assert(sizeof...(Keys) == sizeof...(Ret), "number of keys and number of return types do not match");
constexpr static bool global = detail::is_global_v<top_level, Keys...>; constexpr static bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<meta::unqualified_t<Keys>>...>::value;
auto pp = stack::push_pop<global>(*this); auto pp = stack::push_pop<global>(*this);
int table_index = pp.index_of(*this); int table_index = pp.index_of(*this);
return tuple_get<true, Ret...>(table_index, std::forward<Keys>(keys)...); return tuple_get<true, Ret...>(table_index, std::forward<Keys>(keys)...);
@ -394,7 +388,7 @@ namespace sol {
template <typename T, typename... Keys> template <typename T, typename... Keys>
decltype(auto) traverse_raw_get(Keys&&... keys) const { decltype(auto) traverse_raw_get(Keys&&... keys) const {
constexpr static bool global = detail::is_global_v<top_level, Keys...>; constexpr static bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<meta::unqualified_t<Keys>>...>::value;
auto pp = stack::push_pop<global>(*this); auto pp = stack::push_pop<global>(*this);
int table_index = pp.index_of(*this); int table_index = pp.index_of(*this);
return traverse_get_single<true, T>(table_index, std::forward<Keys>(keys)...); return traverse_get_single<true, T>(table_index, std::forward<Keys>(keys)...);
@ -402,7 +396,7 @@ namespace sol {
template <typename... Keys> template <typename... Keys>
basic_table_core& traverse_raw_set(Keys&&... keys) { basic_table_core& traverse_raw_set(Keys&&... keys) {
constexpr static bool global = detail::is_global_v<top_level, Keys...>; constexpr static bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<meta::unqualified_t<Keys>>...>::value;
auto pp = stack::push_pop<global>(*this); auto pp = stack::push_pop<global>(*this);
lua_State* L = base_t::lua_state(); lua_State* L = base_t::lua_state();
auto pn = stack::pop_n(L, static_cast<int>(sizeof...(Keys) - 2)); auto pn = stack::pop_n(L, static_cast<int>(sizeof...(Keys) - 2));

View File

@ -106,13 +106,13 @@ namespace sol {
struct all : boolean<true> {}; struct all : boolean<true> {};
template <typename T, typename... Args> template <typename T, typename... Args>
struct all<T, Args...> : conditional_t<T::value, all<Args...>, boolean<false>> {}; struct all<T, Args...> : std::conditional_t<T::value, all<Args...>, boolean<false>> {};
template <typename... Args> template <typename... Args>
struct any : boolean<false> {}; struct any : boolean<false> {};
template <typename T, typename... Args> template <typename T, typename... Args>
struct any<T, Args...> : conditional_t<T::value, boolean<true>, any<Args...>> {}; struct any<T, Args...> : std::conditional_t<T::value, boolean<true>, any<Args...>> {};
template <typename T, typename... Args> template <typename T, typename... Args>
constexpr inline bool all_v = all<T, Args...>::value; constexpr inline bool all_v = all<T, Args...>::value;

View File

@ -26,13 +26,15 @@
CI=true CI=true
declare -a gcc_versions declare -a gcc_versions
gcc_versions=( gcc_versions=(
7 # 7
8 # 8
) )
declare -r gcc_versions declare -r gcc_versions
declare -a llvm_versions declare -a llvm_versions
llvm_versions=( llvm_versions=(
3.9.1
4.0.0
# 5.0.2 # 5.0.2
# 6.0.1 # 6.0.1
# 7.0.1 # 7.0.1

View File

@ -73,7 +73,7 @@ echo -e "travis_fold:start:build_preparation.1\r"
SOL2_CMAKE_DEFINES+=("-DSOL2_PLATFORM=${SOL2_PLATFORM}") SOL2_CMAKE_DEFINES+=("-DSOL2_PLATFORM=${SOL2_PLATFORM}")
SOL2_CMAKE_DEFINES+=('-DSOL2_CI=ON') SOL2_CMAKE_DEFINES+=('-DSOL2_CI=ON')
SOL2_CMAKE_DEFINES+=('-DSOL2_BUILD_LUA=ON') SOL2_CMAKE_DEFINES+=('-DSOL2_BUILD_LUA=ON')
SOL2_CMAKE_DEFINES+=('-DBUILD_LUA_AS_DLL=OFF') SOL2_CMAKE_DEFINES+=('-DBUILD_LUA_AS_DLL=ON')
SOL2_CMAKE_DEFINES+=('-DSOL2_TESTS=ON') SOL2_CMAKE_DEFINES+=('-DSOL2_TESTS=ON')
SOL2_CMAKE_DEFINES+=('-DSOL2_EXAMPLES=ON') SOL2_CMAKE_DEFINES+=('-DSOL2_EXAMPLES=ON')
SOL2_CMAKE_DEFINES+=('-DSOL2_TESTS_EXAMPLES=ON') SOL2_CMAKE_DEFINES+=('-DSOL2_TESTS_EXAMPLES=ON')

View File

@ -32,13 +32,13 @@ ninja --version
cmake --version cmake --version
cd Debug cd Debug
cmake ${SOL2_DIR} -G Xcode -DCMAKE_BUILD_TYPE=Debug -DSOL2_LUA_VERSION="${SOL2_LUA_VERSION}" -DSOL2_CI=ON -DSOL2_PLATFORM=${SOL2_PLATFORM} -DSOL2_BUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DSOL2_TESTS=ON -DSOL2_EXAMPLES=ON -DSOL2_GENERATE_SINGLE=ON -DSOL2_TESTS_EXAMPLES=ON -DSOL2_EXAMPLES_SINGLE_GENERATED=ON -DSOL2_TESTS_SINGLE_GENERATED=ON cmake "${SOL2_DIR}" -G Xcode -DCMAKE_BUILD_TYPE=Debug -DSOL2_LUA_VERSION="${SOL2_LUA_VERSION}" -DSOL2_CI=ON -DSOL2_PLATFORM=${SOL2_PLATFORM} -DSOL2_BUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DSOL2_TESTS=ON -DSOL2_EXAMPLES=ON -DSOL2_GENERATE_SINGLE=ON -DSOL2_TESTS_EXAMPLES=ON -DSOL2_EXAMPLES_SINGLE_GENERATED=ON -DSOL2_TESTS_SINGLE_GENERATED=ON
cmake --build . --config Debug cmake --build . --config Debug
ctest --build-config Debug --output-on-failure ctest --build-config Debug --output-on-failure
cd .. cd ..
cd Release cd Release
cmake ${SOL2_DIR} -G Xcode -DCMAKE_BUILD_TYPE=Release -DSOL2_LUA_VERSION="${SOL2_LUA_VERSION}" -DSOL2_CI=ON -DSOL2_PLATFORM=${SOL2_PLATFORM} -DSOL2_BUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DSOL2_TESTS=ON -DSOL2_EXAMPLES=ON -DSOL2_GENERATE_SINGLE=ON -DSOL2_TESTS_EXAMPLES=ON -DSOL2_EXAMPLES_SINGLE=ON -DSOL2_TESTS_SINGLE_GENERATED=ON cmake "${SOL2_DIR}" -G Xcode -DCMAKE_BUILD_TYPE=Release -DSOL2_LUA_VERSION="${SOL2_LUA_VERSION}" -DSOL2_CI=ON -DSOL2_PLATFORM=${SOL2_PLATFORM} -DSOL2_BUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DSOL2_TESTS=ON -DSOL2_EXAMPLES=ON -DSOL2_GENERATE_SINGLE=ON -DSOL2_TESTS_EXAMPLES=ON -DSOL2_EXAMPLES_SINGLE=ON -DSOL2_TESTS_SINGLE_GENERATED=ON
cmake --build . --config Release cmake --build . --config Release
ctest --build-config Release --output-on-failure ctest --build-config Release --output-on-failure
cd .. cd ..

View File

@ -20,8 +20,8 @@
// 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.
// This file was generated with a script. // This file was generated with a script.
// Generated 2019-03-21 16:10:16.440886 UTC // Generated 2019-03-23 16:07:48.139041 UTC
// This header was generated with sol v3.0.0-beta (revision 04b36f1) // This header was generated with sol v3.0.0-beta (revision e846733)
// https://github.com/ThePhD/sol2 // https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP #ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script. // This file was generated with a script.
// Generated 2019-03-21 16:10:16.112045 UTC // Generated 2019-03-23 16:07:47.653951 UTC
// This header was generated with sol v3.0.0-beta (revision 04b36f1) // This header was generated with sol v3.0.0-beta (revision e846733)
// https://github.com/ThePhD/sol2 // https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP #ifndef SOL_SINGLE_INCLUDE_HPP
@ -50,6 +50,7 @@
#elif defined(__clang__) #elif defined(__clang__)
#elif defined _MSC_VER #elif defined _MSC_VER
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4505) // unreferenced local function has been removed GEE THANKS
#endif // clang++ vs. g++ vs. VC++ #endif // clang++ vs. g++ vs. VC++
// beginning of sol/forward.hpp // beginning of sol/forward.hpp
@ -1395,13 +1396,13 @@ namespace sol {
struct all : boolean<true> {}; struct all : boolean<true> {};
template <typename T, typename... Args> template <typename T, typename... Args>
struct all<T, Args...> : conditional_t<T::value, all<Args...>, boolean<false>> {}; struct all<T, Args...> : std::conditional_t<T::value, all<Args...>, boolean<false>> {};
template <typename... Args> template <typename... Args>
struct any : boolean<false> {}; struct any : boolean<false> {};
template <typename T, typename... Args> template <typename T, typename... Args>
struct any<T, Args...> : conditional_t<T::value, boolean<true>, any<Args...>> {}; struct any<T, Args...> : std::conditional_t<T::value, boolean<true>, any<Args...>> {};
template <typename T, typename... Args> template <typename T, typename... Args>
constexpr inline bool all_v = all<T, Args...>::value; constexpr inline bool all_v = all<T, Args...>::value;
@ -1919,8 +1920,7 @@ namespace sol {
struct is_pair<std::pair<T1, T2>> : std::true_type {}; struct is_pair<std::pair<T1, T2>> : std::true_type {};
template <typename T> template <typename T>
using is_c_str = any<std::is_same<std::decay_t<unqualified_t<T>>, const char*>, std::is_same<std::decay_t<unqualified_t<T>>, char*>, using is_c_str = any<std::is_same<T, const char*>, std::is_same<T, char const* const>, std::is_same<T, char*>, is_string_of<T, char>, is_string_literal_array_of<T, char>>;
std::is_same<unqualified_t<T>, std::string>>;
template <typename T> template <typename T>
constexpr inline bool is_c_str_v = is_c_str<T>::value; constexpr inline bool is_c_str_v = is_c_str<T>::value;
@ -8471,6 +8471,7 @@ namespace sol {
~push_popper() { ~push_popper() {
} }
}; };
template <typename T> template <typename T>
struct push_popper<false, T, std::enable_if_t<std::is_base_of<stack_reference, meta::unqualified_t<T>>::value>> { struct push_popper<false, T, std::enable_if_t<std::is_base_of<stack_reference, meta::unqualified_t<T>>::value>> {
using Tu = meta::unqualified_t<T>; using Tu = meta::unqualified_t<T>;
@ -10013,7 +10014,7 @@ namespace sol {
} }
template <typename T, typename Handler> template <typename T, typename Handler>
bool check_usertype(lua_State* L, int index, type index_type, Handler&& handler, record& tracking) { bool check_usertype(lua_State* L, int index, type, Handler&& handler, record& tracking) {
using Tu = meta::unqualified_t<T>; using Tu = meta::unqualified_t<T>;
using detail_t = meta::conditional_t<std::is_pointer_v<T>, detail::as_pointer_tag<Tu>, detail::as_value_tag<Tu>>; using detail_t = meta::conditional_t<std::is_pointer_v<T>, detail::as_pointer_tag<Tu>, detail::as_value_tag<Tu>>;
return check<detail_t>(L, index, std::forward<Handler>(handler), tracking); return check<detail_t>(L, index, std::forward<Handler>(handler), tracking);
@ -13933,7 +13934,7 @@ namespace stack {
template <typename T, bool global, bool raw, typename> template <typename T, bool global, bool raw, typename>
struct field_setter { struct field_setter {
static constexpr int default_table_index = meta::conditional_t < meta::is_c_str_v<T> || (std::is_integral_v<T> && !std::is_same_v<T, bool>) static constexpr int default_table_index = meta::conditional_t<(meta::is_c_str_v<T> || meta::is_string_of_v<T, char>) || (std::is_integral_v<T> && !std::is_same_v<T, bool>)
|| (std::is_integral_v<T> && !std::is_same_v<T, bool>) || (raw && std::is_void_v<std::remove_pointer_t<T>>), || (std::is_integral_v<T> && !std::is_same_v<T, bool>) || (raw && std::is_void_v<std::remove_pointer_t<T>>),
std::integral_constant<int, -2>, std::integral_constant<int, -3>> ::value; std::integral_constant<int, -2>, std::integral_constant<int, -3>> ::value;
@ -13968,7 +13969,7 @@ namespace stack {
} }
} }
else { else {
if constexpr (meta::is_c_str_v<T>) { if constexpr (meta::is_c_str_v<T> || meta::is_string_of_v<T, char>) {
if constexpr (global) { if constexpr (global) {
push(L, std::forward<Value>(value)); push(L, std::forward<Value>(value));
lua_setglobal(L, &key[0]); lua_setglobal(L, &key[0]);
@ -20899,6 +20900,12 @@ namespace sol { namespace u_detail {
stack::clear(gc_names_table); stack::clear(gc_names_table);
} }
if (named_metatable.valid()) { if (named_metatable.valid()) {
lua_State* L = named_metatable.lua_state();
auto pp = stack::push_pop(named_metatable);
int named_metatable_index = pp.index_of(named_metatable);
if (lua_getmetatable(L, named_metatable_index) == 1) {
stack::clear(L, absolute_index(L, -1));
}
stack::clear(named_metatable); stack::clear(named_metatable);
} }
@ -20911,7 +20918,7 @@ namespace sol { namespace u_detail {
type_table = lua_nil; type_table = lua_nil;
gc_names_table = lua_nil; gc_names_table = lua_nil;
named_metatable = lua_nil; named_metatable = lua_nil;
storage.clear(); storage.clear();
string_keys.clear(); string_keys.clear();
auxiliary_keys.clear(); auxiliary_keys.clear();
@ -20981,7 +20988,7 @@ namespace sol { namespace u_detail {
int base_result; int base_result;
(void)keep_going; (void)keep_going;
(void)base_result; (void)base_result;
detail::swallow{ 1, (base_walk_index<is_new_index, Bases>(L, self, keep_going, base_result), 1)... }; (void)detail::swallow{ 1, (base_walk_index<is_new_index, Bases>(L, self, keep_going, base_result), 1)... };
if constexpr (sizeof...(Bases) > 0) { if constexpr (sizeof...(Bases) > 0) {
if (!keep_going) { if (!keep_going) {
return base_result; return base_result;
@ -21954,12 +21961,6 @@ namespace sol {
return luaL_error(L, "sol: cannot modify the elements of an enumeration table"); return luaL_error(L, "sol: cannot modify the elements of an enumeration table");
} }
template <bool top_level, typename... Args>
using is_global = meta::all<meta::boolean<top_level>, meta::is_c_str<Args>...>;
template <bool top_level, typename... Args>
constexpr inline bool is_global_v = is_global<top_level, Args...>::value;
} // namespace detail } // namespace detail
template <bool top_level, typename ref_t> template <bool top_level, typename ref_t>
@ -21999,7 +22000,7 @@ namespace sol {
template <bool raw, typename Ret, typename... Keys> template <bool raw, typename Ret, typename... Keys>
decltype(auto) traverse_get_single(int table_index, Keys&&... keys) const { decltype(auto) traverse_get_single(int table_index, Keys&&... keys) const {
constexpr static bool global = detail::is_global_v<top_level, Keys...>; constexpr static bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<meta::unqualified_t<Keys>>...>::value;
if constexpr (meta::is_optional_v<meta::unqualified_t<Ret>>) { if constexpr (meta::is_optional_v<meta::unqualified_t<Ret>>) {
int popcount = 0; int popcount = 0;
detail::ref_clean c(base_t::lua_state(), popcount); detail::ref_clean c(base_t::lua_state(), popcount);
@ -22013,7 +22014,7 @@ namespace sol {
template <bool raw, typename Pairs, std::size_t... I> template <bool raw, typename Pairs, std::size_t... I>
void tuple_set(std::index_sequence<I...>, Pairs&& pairs) { void tuple_set(std::index_sequence<I...>, Pairs&& pairs) {
constexpr bool global = detail::is_global<top_level, decltype(std::get<I * 2>(std::forward<Pairs>(pairs)))...>::value; constexpr bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<decltype(std::get<I * 2>(std::forward<Pairs>(pairs)))>...>::value;
auto pp = stack::push_pop<global>(*this); auto pp = stack::push_pop<global>(*this);
int table_index = pp.index_of(*this); int table_index = pp.index_of(*this);
lua_State* L = base_t::lua_state(); lua_State* L = base_t::lua_state();
@ -22204,7 +22205,7 @@ namespace sol {
template <typename... Ret, typename... Keys> template <typename... Ret, typename... Keys>
decltype(auto) get(Keys&&... keys) const { decltype(auto) get(Keys&&... keys) const {
static_assert(sizeof...(Keys) == sizeof...(Ret), "number of keys and number of return types do not match"); static_assert(sizeof...(Keys) == sizeof...(Ret), "number of keys and number of return types do not match");
constexpr static bool global = detail::is_global_v<top_level, Keys...>; constexpr static bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<meta::unqualified_t<Keys>>...>::value;
auto pp = stack::push_pop<global>(*this); auto pp = stack::push_pop<global>(*this);
int table_index = pp.index_of(*this); int table_index = pp.index_of(*this);
return tuple_get<false, Ret...>(table_index, std::forward<Keys>(keys)...); return tuple_get<false, Ret...>(table_index, std::forward<Keys>(keys)...);
@ -22231,7 +22232,7 @@ namespace sol {
template <typename T, typename... Keys> template <typename T, typename... Keys>
decltype(auto) traverse_get(Keys&&... keys) const { decltype(auto) traverse_get(Keys&&... keys) const {
constexpr static bool global = detail::is_global_v<top_level, Keys...>; constexpr static bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<meta::unqualified_t<Keys>>...>::value;
auto pp = stack::push_pop<global>(*this); auto pp = stack::push_pop<global>(*this);
int table_index = pp.index_of(*this); int table_index = pp.index_of(*this);
return traverse_get_single<false, T>(table_index, std::forward<Keys>(keys)...); return traverse_get_single<false, T>(table_index, std::forward<Keys>(keys)...);
@ -22239,7 +22240,7 @@ namespace sol {
template <typename... Keys> template <typename... Keys>
basic_table_core& traverse_set(Keys&&... keys) { basic_table_core& traverse_set(Keys&&... keys) {
constexpr static bool global = detail::is_global_v<top_level, Keys...>; constexpr static bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<meta::unqualified_t<Keys>>...>::value;
auto pp = stack::push_pop<global>(*this); auto pp = stack::push_pop<global>(*this);
int table_index = pp.index_of(*this); int table_index = pp.index_of(*this);
lua_State* L = base_t::lua_state(); lua_State* L = base_t::lua_state();
@ -22262,7 +22263,7 @@ namespace sol {
template <typename... Ret, typename... Keys> template <typename... Ret, typename... Keys>
decltype(auto) raw_get(Keys&&... keys) const { decltype(auto) raw_get(Keys&&... keys) const {
static_assert(sizeof...(Keys) == sizeof...(Ret), "number of keys and number of return types do not match"); static_assert(sizeof...(Keys) == sizeof...(Ret), "number of keys and number of return types do not match");
constexpr static bool global = detail::is_global_v<top_level, Keys...>; constexpr static bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<meta::unqualified_t<Keys>>...>::value;
auto pp = stack::push_pop<global>(*this); auto pp = stack::push_pop<global>(*this);
int table_index = pp.index_of(*this); int table_index = pp.index_of(*this);
return tuple_get<true, Ret...>(table_index, std::forward<Keys>(keys)...); return tuple_get<true, Ret...>(table_index, std::forward<Keys>(keys)...);
@ -22289,7 +22290,7 @@ namespace sol {
template <typename T, typename... Keys> template <typename T, typename... Keys>
decltype(auto) traverse_raw_get(Keys&&... keys) const { decltype(auto) traverse_raw_get(Keys&&... keys) const {
constexpr static bool global = detail::is_global_v<top_level, Keys...>; constexpr static bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<meta::unqualified_t<Keys>>...>::value;
auto pp = stack::push_pop<global>(*this); auto pp = stack::push_pop<global>(*this);
int table_index = pp.index_of(*this); int table_index = pp.index_of(*this);
return traverse_get_single<true, T>(table_index, std::forward<Keys>(keys)...); return traverse_get_single<true, T>(table_index, std::forward<Keys>(keys)...);
@ -22297,7 +22298,7 @@ namespace sol {
template <typename... Keys> template <typename... Keys>
basic_table_core& traverse_raw_set(Keys&&... keys) { basic_table_core& traverse_raw_set(Keys&&... keys) {
constexpr static bool global = detail::is_global_v<top_level, Keys...>; constexpr static bool global = meta::all<meta::boolean<top_level>, meta::is_c_str<meta::unqualified_t<Keys>>...>::value;
auto pp = stack::push_pop<global>(*this); auto pp = stack::push_pop<global>(*this);
lua_State* L = base_t::lua_state(); lua_State* L = base_t::lua_state();
auto pn = stack::pop_n(L, static_cast<int>(sizeof...(Keys) - 2)); auto pn = stack::pop_n(L, static_cast<int>(sizeof...(Keys) - 2));
@ -22589,9 +22590,9 @@ namespace sol {
lua_State* L = this->lua_state(); lua_State* L = this->lua_state();
auto pp = stack::push_pop(*this);
int top = lua_gettop(L); int top = lua_gettop(L);
auto pp = stack::push_pop(*this);
stack_reference mt(L, -1); stack_reference mt(L, -1);
stack::get_field(L, meta_function::gc_names, mt.stack_index()); stack::get_field(L, meta_function::gc_names, mt.stack_index());
if (type_of(L, -1) != type::table) { if (type_of(L, -1) != type::table) {
@ -22604,7 +22605,7 @@ namespace sol {
} }
ustorage_base& base_storage = *static_cast<ustorage_base*>(stack::get<void*>(L, -1)); ustorage_base& base_storage = *static_cast<ustorage_base*>(stack::get<void*>(L, -1));
std::array<string_view, 6> registry_traits; std::array<string_view, 6> registry_traits;
for (int i = 0; i < registry_traits.size(); ++i) { for (std::size_t i = 0; i < registry_traits.size(); ++i) {
u_detail::submetatable_type smt = static_cast<u_detail::submetatable_type>(i); u_detail::submetatable_type smt = static_cast<u_detail::submetatable_type>(i);
stack::get_field<false, true>(L, smt, gc_names_table.stack_index()); stack::get_field<false, true>(L, smt, gc_names_table.stack_index());
registry_traits[i] = stack::get<string_view>(L, -1); registry_traits[i] = stack::get<string_view>(L, -1);
@ -22617,11 +22618,13 @@ namespace sol {
// in the registry (luaL_newmetatable does // in the registry (luaL_newmetatable does
// [name] = new table // [name] = new table
// in registry upon creation) // in registry upon creation)
for (int i = 0; i < registry_traits.size(); ++i) { for (std::size_t i = 0; i < registry_traits.size(); ++i) {
u_detail::submetatable_type smt = static_cast<u_detail::submetatable_type>(i); u_detail::submetatable_type smt = static_cast<u_detail::submetatable_type>(i);
const string_view& gcmetakey = registry_traits[i]; const string_view& gcmetakey = registry_traits[i];
if (smt == u_detail::submetatable_type::named) { if (smt == u_detail::submetatable_type::named) {
stack::set_field<true>(L, gcmetakey, lua_nil); // use .data() to make it treat it like a c string,
// which it is...
stack::set_field<true>(L, gcmetakey.data(), lua_nil);
} }
else { else {
// do not change the values in the registry: they need to be present // do not change the values in the registry: they need to be present
@ -22667,7 +22670,7 @@ namespace sol {
if constexpr (sizeof...(I) > 0) { if constexpr (sizeof...(I) > 0) {
if (maybe_uts) { if (maybe_uts) {
u_detail::usertype_storage<T>& uts = *maybe_uts; u_detail::usertype_storage<T>& uts = *maybe_uts;
detail::swallow{ 0, (void)detail::swallow{ 0,
(uts.set(this->lua_state(), std::get<I * 2>(std::forward<args_tuple>(args)), std::get<I * 2 + 1>(std::forward<args_tuple>(args))), (uts.set(this->lua_state(), std::get<I * 2>(std::forward<args_tuple>(args)), std::get<I * 2 + 1>(std::forward<args_tuple>(args))),
0)... }; 0)... };
} }

View File

@ -674,7 +674,7 @@ TEST_CASE("object/is", "test whether or not the is abstraction works properly fo
TEST_CASE("object/base_of_things", "make sure that object is the base of things and can be sliced / returned safely") { TEST_CASE("object/base_of_things", "make sure that object is the base of things and can be sliced / returned safely") {
SECTION("reference") { SECTION("reference") {
sol::state lua; sol::state lua;
lua.open_libraries(sol::lib::coroutine); lua.open_libraries(sol::lib::base, sol::lib::coroutine);
lua["ud"] = base1{}; lua["ud"] = base1{};
@ -699,7 +699,7 @@ TEST_CASE("object/base_of_things", "make sure that object is the base of things
} }
SECTION("stack_reference") { SECTION("stack_reference") {
sol::state lua; sol::state lua;
lua.open_libraries(sol::lib::coroutine); lua.open_libraries(sol::lib::base, sol::lib::coroutine);
lua["ud"] = base1{}; lua["ud"] = base1{};

View File

@ -435,7 +435,7 @@ TEST_CASE("functions/function_result and protected_function_result", "Function r
} }
} }
#if !defined(SOL2_CI) && ((!defined(_M_IX86) || defined(_M_IA64)) || (defined(_WIN64)) || (defined(__LLP64__) || defined(__LP64__)) ) #if !defined(SOL2_CI) && !(SOL2_CI) && ((!defined(_M_IX86) || defined(_M_IA64)) || (defined(_WIN64)) || (defined(__LLP64__) || defined(__LP64__)) )
TEST_CASE("functions/safe protected_function_result handlers", "These tests will (hopefully) not destroy the stack since they are supposed to be mildly safe. Still, run with caution.") { TEST_CASE("functions/safe protected_function_result handlers", "These tests will (hopefully) not destroy the stack since they are supposed to be mildly safe. Still, run with caution.") {
sol::state lua; sol::state lua;
lua.open_libraries(sol::lib::base, sol::lib::debug); lua.open_libraries(sol::lib::base, sol::lib::debug);
@ -512,7 +512,15 @@ TEST_CASE("functions/unsafe protected_function_result handlers",
present = (bool)opvalue; present = (bool)opvalue;
REQUIRE_FALSE(present); REQUIRE_FALSE(present);
sol::error err = result; sol::error err = result;
#ifdef SOL_LUAJIT
#if !((!defined(SOL_EXCEPTIONS_SAFE_PROPAGATION) || !(SOL_EXCEPTIONS_SAFE_PROPAGATION)))
REQUIRE(err.what() == std::string("C++ exception"));
#else
REQUIRE(err.what() == handlederrormessage_s); REQUIRE(err.what() == handlederrormessage_s);
#endif
#else
REQUIRE(err.what() == handlederrormessage_s);
#endif
} }
} }
#endif // These tests will thrash the stack and allocations on weaker compilers #endif // These tests will thrash the stack and allocations on weaker compilers