testing and test matrix improvements

This commit is contained in:
ThePhD 2018-12-23 13:18:14 -05:00
parent a6abc0a0d9
commit 9760a400cd
No known key found for this signature in database
GPG Key ID: 1509DB1C0F702BFA
16 changed files with 305 additions and 186 deletions

View File

@ -46,7 +46,7 @@ matrix:
include: include:
# GCC 4.9.x, 5.x, 6.x, 7.x # GCC 4.9.x, 5.x, 6.x, 7.x
- env: - env:
- LUA_VERSION=5.3.4 - LUA_VERSION=5.3.5
GCC_VERSION=7 GCC_VERSION=7
PLATFORM=i686 PLATFORM=i686
CI=true CI=true
@ -64,63 +64,51 @@ matrix:
CI=true CI=true
- env: - env:
- LUA_VERSION=5.3.4 - LUA_VERSION=5.3.5
GCC_VERSION=4.9
PLATFORM=x64
CI=true
- env:
- LUA_VERSION=5.3.4
GCC_VERSION=5
CI=true
PLATFORM=x64
- env:
- LUA_VERSION=5.3.4
GCC_VERSION=6
PLATFORM=x64
CI=true
- env:
- LUA_VERSION=5.3.4
GCC_VERSION=7 GCC_VERSION=7
PLATFORM=x64 PLATFORM=x64
CI=true CI=true
# LLVM 3.6.x -> 5.0.x # LLVM 3.6.x -> 5.0.x
- env: - env:
- LUA_VERSION=5.3.4 - LUA_VERSION=5.3.5
LLVM_VERSION=3.6.2 LLVM_VERSION=3.6.2
PLATFORM=x64 PLATFORM=x64
CI=true CI=true
- env: - env:
- LUA_VERSION=5.3.4 - LUA_VERSION=5.3.5
LLVM_VERSION=3.7.1 LLVM_VERSION=3.7.1
PLATFORM=x64 PLATFORM=x64
CI=true CI=true
- env: - env:
- LUA_VERSION=5.3.4 - LUA_VERSION=5.3.5
LLVM_VERSION=3.8.1
PLATFORM=x64
CI=true
- env:
- LUA_VERSION=5.3.4
LLVM_VERSION=3.9.1 LLVM_VERSION=3.9.1
PLATFORM=x64 PLATFORM=x64
CI=true CI=true
- env: - env:
- LUA_VERSION=5.3.4 - LUA_VERSION=5.3.5
LLVM_VERSION=4.0.1 LLVM_VERSION=4.0.1
PLATFORM=x64 PLATFORM=x64
CI=true CI=true
- env: - env:
- LUA_VERSION=5.3.4 - LUA_VERSION=5.3.5
LLVM_VERSION=5.0.1 LLVM_VERSION=5.0.2
PLATFORM=x64
CI=true
- env:
- LUA_VERSION=5.3.5
LLVM_VERSION=6.0.1
PLATFORM=x64
CI=true
- env:
- LUA_VERSION=5.3.5
LLVM_VERSION=7.0.0
PLATFORM=x64 PLATFORM=x64
CI=true CI=true
@ -152,8 +140,8 @@ matrix:
- os: osx - os: osx
osx_image: xcode9.0 osx_image: xcode9.0
env: env:
- LUA_VERSION=lua-5.3.4 - LUA_VERSION=lua-5.3.5
LLVM_VERSION=5.0.1 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
@ -164,8 +152,8 @@ matrix:
- os: osx - os: osx
osx_image: xcode9.1 osx_image: xcode9.1
env: env:
- LUA_VERSION=lua-5.3.4 - LUA_VERSION=lua-5.3.5
LLVM_VERSION=5.0.1 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
@ -176,8 +164,8 @@ matrix:
- os: osx - os: osx
osx_image: xcode9.2 osx_image: xcode9.2
env: env:
- LUA_VERSION=lua-5.3.4 - LUA_VERSION=lua-5.3.5
LLVM_VERSION=5.0.1 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

@ -29,73 +29,6 @@ project(sol2 VERSION 3.0.0 LANGUAGES CXX C)
include(GNUInstallDirs) include(GNUInstallDirs)
# # # General Project Requirements
# Set general standard requirements here
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Features a C++ compiler must have to be used to compile sol2
# This list is not *complete* as CMake does not support features for
# all of the advanced features utilized.
set(CXX_FEATURES
cxx_auto_type
cxx_constexpr
cxx_decltype
cxx_decltype_auto
cxx_default_function_template_args
cxx_final
cxx_lambdas
cxx_noexcept
cxx_nullptr
cxx_override
cxx_range_for
cxx_return_type_deduction
cxx_right_angle_brackets
cxx_static_assert
cxx_strong_enums
cxx_variadic_macros
cxx_variadic_templates)
# # #
if (SOL2_PLATFORM MATCHES "i686" OR SOL2_PLATFORM STREQUAL "x86")
set(IS_X86 TRUE)
elseif (SOL2_PLATFORM MATCHES "ARM64")
set(IS_ARM64 TRUE)
set(IS_X64 TRUE)
elseif (SOL2_PLATFORM MATCHES "ARM")
set(IS_ARM TRUE)
elseif (SOL2_PLATFORM MATCHES "x86_64" OR SOL2_PLATFORM STREQUAL "x64")
set(IS_X64 TRUE)
else()
set(IS_X64 TRUE)
endif()
# # # General project flags
if (MSVC)
add_definitions(/DUNICODE /D_UNICODE /D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
# Warning level, exceptions
add_compile_options(/EHsc)
add_compile_options("$<$<CONFIG:Debug>:/MDd>"
"$<$<CONFIG:Release>:/MD>"
"$<$<CONFIG:RelWithDebInfo>:/MD>"
"$<$<CONFIG:MinSizeRel>:/MD>")
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(/MP)
endif()
else()
add_compile_options(-Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
endif()
# # # General project output locations
if (IS_X86 OR CMAKE_SIZEOF_VOID_P EQUAL 4)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/bin")
else()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/bin")
endif()
# # # Modules # # # Modules
# # Include modules useful to the project, whether locally made in our own cmake DIRECTORY # # Include modules useful to the project, whether locally made in our own cmake DIRECTORY
# # our from the standard cmake libraries # # our from the standard cmake libraries
@ -147,6 +80,33 @@ CMAKE_DEPENDENT_OPTION(BUILD_LUA_AS_DLL "Build Lua as a DLL" ON
"SOL2_BUILD_LUA" OFF) "SOL2_BUILD_LUA" OFF)
# # # Platform
# Detect x86 and x64 stuff
if (SOL2_PLATFORM MATCHES "i686" OR SOL2_PLATFORM STREQUAL "x86")
set(IS_X86 TRUE)
elseif (SOL2_PLATFORM MATCHES "ARM64")
set(IS_ARM64 TRUE)
set(IS_X64 TRUE)
elseif (SOL2_PLATFORM MATCHES "ARM")
set(IS_ARM TRUE)
elseif (SOL2_PLATFORM MATCHES "x86_64" OR SOL2_PLATFORM STREQUAL "x64")
set(IS_X64 TRUE)
else()
set(IS_X64 TRUE)
endif()
# # # General project output locations
if (IS_X86 OR CMAKE_SIZEOF_VOID_P EQUAL 4)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/bin")
else()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/bin")
endif()
# # # sol2 Source Groups # # # sol2 Source Groups
# # Sources everyone is going to need # # Sources everyone is going to need
# Header files # Header files

View File

@ -47,15 +47,15 @@ environment:
# apparently, I can't quite make LLVM work right now... # apparently, I can't quite make LLVM work right now...
#- LUA_VERSION: 5.3.4 #- LUA_VERSION: 5.3.4
# LLVM_VERSION: 4.0.0 # LLVM_VERSION: 4.0.0
- LUA_VERSION: 5.3.4 - LUA_VERSION: 5.3.5
MINGW_VERSION: 7.2.0 MINGW_VERSION: 7.2.0
- LUA_VERSION: 5.3.4 - LUA_VERSION: 5.3.5
MINGW_VERSION: 6.3.0 MINGW_VERSION: 6.3.0
- LUA_VERSION: luajit-2.0.5 - LUA_VERSION: luajit-2.0.5
MINGW_VERSION: 6.3.0 MINGW_VERSION: 6.3.0
- LUA_VERSION: luajit-2.1.0-beta3 - LUA_VERSION: luajit-2.1.0-beta3
MINGW_VERSION: 6.3.0 MINGW_VERSION: 6.3.0
- LUA_VERSION: 5.3.4 - LUA_VERSION: 5.3.5
- LUA_VERSION: 5.2.4 - LUA_VERSION: 5.2.4
- LUA_VERSION: 5.1.5 - LUA_VERSION: 5.1.5
- LUA_VERSION: luajit-2.0.5 - LUA_VERSION: luajit-2.0.5
@ -152,7 +152,7 @@ before_build:
- if DEFINED LLVM_VERSION (call %vcvars_script% && cd C:\projects\sol2) - if DEFINED LLVM_VERSION (call %vcvars_script% && cd C:\projects\sol2)
- md build-sol2 - md build-sol2
- cd build-sol2 - cd build-sol2
- cmake .. -G "%CMAKE_GENERATOR%" %build_type% %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_SINGLE_GENERATED=ON -DSOL2_TESTS_EXAMPLES=ON -DSOL2_EXAMPLES_SINGLE_GENERATED=ON -DSOL2_TESTS_SINGLE_GENERATED=ON - cmake .. -G "%CMAKE_GENERATOR%" %build_type% %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
# 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

@ -22,13 +22,13 @@
# # # sol2 Examples # # # sol2 Examples
if (SOL2_DYNAMIC_LOADING_EXAMPLES) if (SOL2_DYNAMIC_LOADING_EXAMPLES OR SOL2_DYNAMIC_LOADING_EXAMPLES_SINGLE OR SOL2_DYNAMIC_LOADING_EXAMPLES_SINGLE_GENERATED)
# # require_from_dll example # # require_from_dll example
# just add the subdirectory # just add the subdirectory
add_subdirectory(require_dll_example) add_subdirectory(require_dll_example)
endif() endif()
if (SOL2_INTEROP_EXAMPLES) if (SOL2_INTEROP_EXAMPLES OR SOL2_INTEROP_EXAMPLES_SINGLE OR SOL2_INTEROP_EXAMPLES_SINGLE_GENERATED)
# # interop examples # # interop examples
add_subdirectory(interop/kaguya) add_subdirectory(interop/kaguya)
add_subdirectory(interop/tolua) add_subdirectory(interop/tolua)
@ -61,9 +61,23 @@ function (MAKE_EXAMPLE example_source_file example_suffix target_sol example_tes
PROPERTIES PROPERTIES
OUTPUT_NAME "${example_output_name}" OUTPUT_NAME "${example_output_name}"
EXPORT_NAME sol2::${example_output_name}) EXPORT_NAME sol2::${example_output_name})
if (MSVC)
target_compile_options(${example_name}
PRIVATE /std:c++latest /EHsc "$<$<CONFIG:Debug>:/MDd>"
"$<$<CONFIG:Release>:/MD>"
"$<$<CONFIG:RelWithDebInfo>:/MD>"
"$<$<CONFIG:MinSizeRel>:/MD>")
target_compile_definitions(${example_name}
PRIVATE /DUNICODE /D_UNICODE
/D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
else()
target_compile_options(${example_name}
PRIVATE -std=c++1z -Wno-unknown-warning -Wno-unknown-warning-option
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
endif()
target_link_libraries(${example_name} ${target_sol}) target_link_libraries(${example_name} ${target_sol})
target_compile_features(${example_name}
PRIVATE ${CXX_FEATURES})
target_link_libraries(${example_name} ${LUA_LIBRARIES}) target_link_libraries(${example_name} ${LUA_LIBRARIES})
if(CMAKE_DL_LIBS) if(CMAKE_DL_LIBS)
target_link_libraries(${example_name} ${CMAKE_DL_LIBS}) target_link_libraries(${example_name} ${CMAKE_DL_LIBS})

View File

@ -24,13 +24,30 @@
find_package(LuaBridgeBuild) find_package(LuaBridgeBuild)
function (make_luabridge_interop_example target_library is_single) function (make_luabridge_interop_example target_library example_suffix)
set(example_name luabridge_interop_example) set(example_name luabridge_interop_example)
if (is_single) set(example_name "${example_name}${example_suffix}")
set(example_name "${example_name}.single")
endif(is_single)
add_executable(${example_name} source/LuaBridge.cpp) add_executable(${example_name} source/LuaBridge.cpp)
target_link_libraries(${example_name} PUBLIC ${LUA_LIBRARIES} PRIVATE ${LUABRIDGE_LIBRARIES} ${target_library}) target_link_libraries(${example_name} PUBLIC ${LUA_LIBRARIES} PRIVATE ${LUABRIDGE_LIBRARIES} ${target_library})
if (MSVC)
target_compile_options(${example_name}
PRIVATE /std:c++latest /EHsc "$<$<CONFIG:Debug>:/MDd>"
"$<$<CONFIG:Release>:/MD>"
"$<$<CONFIG:RelWithDebInfo>:/MD>"
"$<$<CONFIG:MinSizeRel>:/MD>")
target_compile_definitions(${example_name}
PRIVATE /DUNICODE /D_UNICODE
/D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
else()
target_compile_options(${example_name}
PRIVATE -std=c++1z
-Wno-noexcept-type -Wno-unknown-warning -Wno-unknown-warning-option
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
endif()
if (CMAKE_DL_LIBS) if (CMAKE_DL_LIBS)
target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS}) target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS})
endif() endif()
@ -39,12 +56,17 @@ function (make_luabridge_interop_example target_library is_single)
else() else()
target_compile_options(${example_name} PRIVATE -w) target_compile_options(${example_name} PRIVATE -w)
endif() endif()
if (TESTS_EXAMPLES) if (SOL2_TESTS_INTEROP_EXAMPLES)
add_test(NAME ${example_name} COMMAND ${example_name}) add_test(NAME ${example_name} COMMAND ${example_name})
endif() endif()
endfunction() endfunction()
make_luabridge_interop_example(sol2::sol2 FALSE) if (SOL2_INTEROP_EXAMPLES)
if (SOL2_SINGLE_FOUND AND INTEROP_EXAMPLES_SINGLE) make_luabridge_interop_example(sol2::sol2 "")
make_luabridge_interop_example(sol2::sol2_single TRUE) endif()
if (SOL2_INTEROP_EXAMPLES_SINGLE)
make_luabridge_interop_example(sol2::sol2_single ".single")
endif()
if (SOL2_INTEROP_EXAMPLES_SINGLE_GENERATED)
make_luabridge_interop_example(sol2::sol2_single_generated ".single.generated")
endif() endif()

View File

@ -24,11 +24,26 @@
find_package(KaguyaBuild) find_package(KaguyaBuild)
function (make_kaguya_interop_example target_library is_single) function (make_kaguya_interop_example target_library example_suffix)
set(example_name kaguya_interop_example) set(example_name kaguya_interop_example)
if (is_single) set(example_name "${example_name}${example_suffix}")
set(example_name "${example_name}.single")
endif(is_single) if (MSVC)
target_compile_options(${example_name}
PRIVATE /std:c++latest /EHsc "$<$<CONFIG:Debug>:/MDd>"
"$<$<CONFIG:Release>:/MD>"
"$<$<CONFIG:RelWithDebInfo>:/MD>"
"$<$<CONFIG:MinSizeRel>:/MD>")
target_compile_definitions(${example_name}
PRIVATE /DUNICODE /D_UNICODE
/D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
else()
target_compile_options(${example_name}
PRIVATE -std=c++1z
-Wno-noexcept-type -Wno-unknown-warning -Wno-unknown-warning-option
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
endif()
add_executable(${example_name} source/kaguya.cpp) add_executable(${example_name} source/kaguya.cpp)
target_link_libraries(${example_name} PUBLIC ${LUA_LIBRARIES} PRIVATE ${KAGUYA_LIBRARIES} ${target_library}) target_link_libraries(${example_name} PUBLIC ${LUA_LIBRARIES} PRIVATE ${KAGUYA_LIBRARIES} ${target_library})
if (CMAKE_DL_LIBS) if (CMAKE_DL_LIBS)
@ -39,12 +54,17 @@ function (make_kaguya_interop_example target_library is_single)
else() else()
target_compile_options(${example_name} PRIVATE -w) target_compile_options(${example_name} PRIVATE -w)
endif() endif()
if (TESTS_INTEROP_EXAMPLES) if (SOL2_TESTS_INTEROP_EXAMPLES)
add_test(NAME ${example_name} COMMAND ${example_name}) add_test(NAME ${example_name} COMMAND ${example_name})
endif() endif()
endfunction() endfunction()
make_kaguya_interop_example(sol2::sol2 FALSE) if (SOL2_INTEROP_EXAMPLES)
if (SOL2_SINGLE_FOUND AND INTEROP_EXAMPLES_SINGLE) make_kaguya_interop_example(sol2::sol2 "")
make_kaguya_interop_example(sol2::sol2_single TRUE) endif()
if (SOL2_INTEROP_EXAMPLES_SINGLE)
make_kaguya_interop_example(sol2::sol2_single ".single")
endif()
if (SOL2_INTEROP_EXAMPLES_SINGLE_GENERATED)
make_kaguya_interop_example(sol2::sol2_single_generated ".single.generated")
endif() endif()

View File

@ -24,13 +24,30 @@
find_package(LuwraBuild) find_package(LuwraBuild)
function (make_luwra_interop_example target_library is_single) function (make_luwra_interop_example target_library example_suffix)
set(example_name luwra_interop_example) set(example_name luwra_interop_example)
if (is_single) set(example_name "${example_name}${example_suffix}")
set(example_name "${example_name}.single")
endif(is_single)
add_executable(${example_name} source/luwra.cpp) add_executable(${example_name} source/luwra.cpp)
target_link_libraries(${example_name} PUBLIC ${LUA_LIBRARIES} PRIVATE ${LUWRA_LIBRARIES} ${target_library}) target_link_libraries(${example_name} PUBLIC ${LUA_LIBRARIES} PRIVATE ${LUWRA_LIBRARIES} ${target_library})
if (MSVC)
target_compile_options(${example_name}
PRIVATE /std:c++latest /EHsc "$<$<CONFIG:Debug>:/MDd>"
"$<$<CONFIG:Release>:/MD>"
"$<$<CONFIG:RelWithDebInfo>:/MD>"
"$<$<CONFIG:MinSizeRel>:/MD>")
target_compile_definitions(${example_name}
PRIVATE /DUNICODE /D_UNICODE
/D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
else()
target_compile_options(${example_name}
PRIVATE -std=c++1z
-Wno-noexcept-type -Wno-unknown-warning -Wno-unknown-warning-option
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
endif()
if (CMAKE_DL_LIBS) if (CMAKE_DL_LIBS)
target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS}) target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS})
endif() endif()
@ -39,12 +56,17 @@ function (make_luwra_interop_example target_library is_single)
else() else()
target_compile_options(${example_name} PRIVATE -w) target_compile_options(${example_name} PRIVATE -w)
endif() endif()
if (TESTS_EXAMPLES) if (SOL2_TESTS_INTEROP_EXAMPLES)
add_test(NAME ${example_name} COMMAND ${example_name}) add_test(NAME ${example_name} COMMAND ${example_name})
endif() endif()
endfunction() endfunction()
make_luwra_interop_example(sol2::sol2 FALSE) if (SOL2_INTEROP_EXAMPLES)
if (SOL2_SINGLE_FOUND AND INTEROP_EXAMPLES_SINGLE) make_luwra_interop_example(sol2::sol2 "")
make_luwra_interop_example(sol2::sol2_single TRUE)
endif() endif()
if (SOL2_INTEROP_EXAMPLES_SINGLE)
make_luwra_interop_example(sol2::sol2_single ".single")
endif()
if (SOL2_INTEROP_EXAMPLES_SINGLE_GENERATED)
make_luwra_interop_example(sol2::sol2_single_generated ".single.generated")
endif()

View File

@ -24,13 +24,28 @@
find_package(ToLuappBuild REQUIRED) find_package(ToLuappBuild REQUIRED)
function(make_tolua_interop_example target_library is_single) function(make_tolua_interop_example target_library example_suffix)
set(example_name tolua_interop_example) set(example_name tolua_interop_example)
if (is_single) set(example_name "${example_name}${example_suffix}")
set(example_name "${example_name}.single")
endif()
add_executable(${example_name} source/tolua.cpp) add_executable(${example_name} source/tolua.cpp)
target_link_libraries(${example_name} PUBLIC ${LUA_LIBRARIES} PRIVATE ${TOLUAPP_LIBRARIES} ${target_library}) target_link_libraries(${example_name} PUBLIC ${LUA_LIBRARIES} PRIVATE ${TOLUAPP_LIBRARIES} ${target_library})
if (MSVC)
target_compile_options(${example_name}
PRIVATE /std:c++latest /EHsc "$<$<CONFIG:Debug>:/MDd>"
"$<$<CONFIG:Release>:/MD>"
"$<$<CONFIG:RelWithDebInfo>:/MD>"
"$<$<CONFIG:MinSizeRel>:/MD>")
target_compile_definitions(${example_name}
PRIVATE /DUNICODE /D_UNICODE
/D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
else()
target_compile_options(${example_name}
PRIVATE -std=c++1z
-Wno-noexcept-type -Wno-unknown-warning -Wno-unknown-warning-option
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
endif()
if (CMAKE_DL_LIBS) if (CMAKE_DL_LIBS)
target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS}) target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS})
endif() endif()
@ -39,12 +54,17 @@ function(make_tolua_interop_example target_library is_single)
else() else()
target_compile_options(${example_name} PRIVATE -w) target_compile_options(${example_name} PRIVATE -w)
endif() endif()
if (SOL2_TESTS_EXAMPLES) if (SOL2_TESTS_INTEROP_EXAMPLES)
add_test(NAME ${example_name} COMMAND ${example_name}) add_test(NAME ${example_name} COMMAND ${example_name})
endif() endif()
endfunction() endfunction()
make_tolua_interop_example(sol2::sol2 FALSE) if (SOL2_INTEROP_EXAMPLES)
if (SOL2_SINGLE AND SOL2_INTEROP_EXAMPLES_SINGLE) make_tolua_interop_example(sol2::sol2 "")
make_tolua_interop_example(sol2::sol2_single TRUE) endif()
if (SOL2_INTEROP_EXAMPLES_SINGLE)
make_tolua_interop_example(sol2::sol2_single ".single")
endif()
if (SOL2_INTEROP_EXAMPLES_SINGLE_GENERATED)
make_tolua_interop_example(sol2::sol2_single_generated ".single.generated")
endif() endif()

View File

@ -24,7 +24,7 @@
# # Reusable function to call for single target # # Reusable function to call for single target
# # Also hides variables from directory/global scope # # Also hides variables from directory/global scope
function(make_require_from_dll_example target_lib is_single) function(make_require_from_dll_example target_lib example_lib_name_suffix)
# define sources # define sources
set(my_object_sources my_object.cpp my_object.hpp my_object_api.hpp) set(my_object_sources my_object.cpp my_object.hpp my_object_api.hpp)
set(require_from_dll_sources require_from_dll.cpp) set(require_from_dll_sources require_from_dll.cpp)
@ -32,11 +32,9 @@ function(make_require_from_dll_example target_lib is_single)
# define names # define names
set(example_lib_name my_object) set(example_lib_name my_object)
set(example_name require_from_dll) set(example_name require_from_dll)
if (is_single) set(example_lib_name "${example_lib_name}${example_lib_name_suffix}")
set(example_lib_name "${example_lib_name}.single") set(example_name "${example_name}${example_lib_name_suffix}")
set(example_name "${example_name}.single")
endif()
# is the lua library a shared or static library? # is the lua library a shared or static library?
list(GET LUA_LIBRARIES 0 lua_lib_target) list(GET LUA_LIBRARIES 0 lua_lib_target)
get_target_property(lua_lib_type ${lua_lib_target} TYPE) get_target_property(lua_lib_type ${lua_lib_target} TYPE)
@ -45,13 +43,32 @@ function(make_require_from_dll_example target_lib is_single)
add_library(${example_lib_name} SHARED ${my_object_sources}) add_library(${example_lib_name} SHARED ${my_object_sources})
set_target_properties(${example_lib_name} PROPERTIES set_target_properties(${example_lib_name} PROPERTIES
PREFIX "") PREFIX "")
target_include_directories(${example_lib_name} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(${example_lib_name} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_compile_features(${example_lib_name} PRIVATE ${CXX_FEATURES})
target_compile_definitions(${example_lib_name} PUBLIC MY_OBJECT_DLL PRIVATE MY_OBJECT_BUILD) target_compile_definitions(${example_lib_name} PUBLIC MY_OBJECT_DLL PRIVATE MY_OBJECT_BUILD)
target_link_libraries(${example_lib_name} PRIVATE ${target_lib})
target_include_directories(${example_lib_name} PUBLIC "${LUA_INCLUDE_DIRS}")
if (MSVC)
target_compile_options(${example_lib_name}
PRIVATE /std:c++latest /EHsc "$<$<CONFIG:Debug>:/MDd>"
"$<$<CONFIG:Release>:/MD>"
"$<$<CONFIG:RelWithDebInfo>:/MD>"
"$<$<CONFIG:MinSizeRel>:/MD>")
target_compile_definitions(${example_lib_name}
PRIVATE /DUNICODE /D_UNICODE
/D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
else()
target_compile_options(${example_lib_name}
PRIVATE
-Wno-noexcept-type -Wno-unknown-warning -Wno-unknown-warning-option
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
endif()
if(CMAKE_DL_LIBS) if(CMAKE_DL_LIBS)
target_link_libraries(${example_lib_name} PUBLIC ${CMAKE_DL_LIBS}) target_link_libraries(${example_lib_name} PUBLIC ${CMAKE_DL_LIBS})
endif() endif()
if (CI) if (SOL2_CI)
target_compile_definitions(${example_lib_name} PRIVATE SOL2_CI) target_compile_definitions(${example_lib_name} PRIVATE SOL2_CI)
endif() endif()
if (NOT MSVC) if (NOT MSVC)
@ -70,12 +87,27 @@ function(make_require_from_dll_example target_lib is_single)
if (IS_X86) if (IS_X86)
target_compile_options(${example_lib_name} BEFORE PRIVATE -m32) target_compile_options(${example_lib_name} BEFORE PRIVATE -m32)
endif() endif()
target_link_libraries(${example_lib_name} PRIVATE ${target_lib})
target_include_directories(${example_lib_name} PUBLIC "${LUA_INCLUDE_DIRS}")
# add executable target that represents require_from_dll program # add executable target that represents require_from_dll program
add_executable(${example_name} ${require_from_dll_sources}) add_executable(${example_name} ${require_from_dll_sources})
target_compile_features(${example_name} PRIVATE ${CXX_FEATURES}) target_link_libraries(${example_name} PRIVATE my_object ${target_lib})
if (MSVC)
target_compile_options(${example_name}
PRIVATE /std:c++latest /EHsc "$<$<CONFIG:Debug>:/MDd>"
"$<$<CONFIG:Release>:/MD>"
"$<$<CONFIG:RelWithDebInfo>:/MD>"
"$<$<CONFIG:MinSizeRel>:/MD>")
target_compile_definitions(${example_name}
PRIVATE /DUNICODE /D_UNICODE
/D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
else()
target_compile_options(${example_name}
PRIVATE -std=c++1z
-Wno-noexcept-type -Wno-unknown-warning -Wno-unknown-warning-option
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
endif()
if(CMAKE_DL_LIBS) if(CMAKE_DL_LIBS)
target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS}) target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS})
endif() endif()
@ -83,9 +115,9 @@ function(make_require_from_dll_example target_lib is_single)
target_compile_definitions(${example_name} PRIVATE SOL2_CI) target_compile_definitions(${example_name} PRIVATE SOL2_CI)
endif() endif()
if (NOT MSVC) if (NOT MSVC)
target_compile_options(${example_name} PRIVATE -Wno-noexcept-type) target_compile_options(${example_name} PRIVATE )
endif() endif()
target_link_libraries(${example_name} PRIVATE my_object ${target_lib})
# avoid multiply defined references due to linking in the same static library # avoid multiply defined references due to linking in the same static library
# twice over, and get "multiple definition" errors during linking # twice over, and get "multiple definition" errors during linking
if (NOT lua_lib_type MATCHES "STATIC") if (NOT lua_lib_type MATCHES "STATIC")
@ -93,15 +125,18 @@ function(make_require_from_dll_example target_lib is_single)
endif() endif()
target_include_directories(${example_name} PRIVATE ${LUA_INCLUDE_DIRS}) target_include_directories(${example_name} PRIVATE ${LUA_INCLUDE_DIRS})
if (TESTS_DYNAMIC_LOADING_EXAMPLES) if (SOL2_TESTS_DYNAMIC_LOADING_EXAMPLES)
if ((NOT is_single) OR (is_single AND DYNAMIC_LOADING_EXAMPLES_SINGLE)) get_target_property(example_working_dir ${example_name} RUNTIME_OUTPUT_DIRECTORY)
get_target_property(example_working_dir ${example_name} RUNTIME_OUTPUT_DIRECTORY) add_test(NAME ${example_name} COMMAND ${example_name} WORKING_DIRECTORY "${example_working_dir}")
add_test(NAME ${example_name} COMMAND ${example_name} WORKING_DIRECTORY "${example_working_dir}")
endif()
endif() endif()
endfunction() endfunction()
make_require_from_dll_example(sol2::sol2 FALSE) if (SOL2_DYNAMIC_LOADING_EXAMPLES)
if (SOL2_SINGLE_FOUND AND DYNAMIC_LOADING_EXAMPLES_SINGLE) make_require_from_dll_example(sol2::sol2 "")
make_require_from_dll_example(sol2::sol2_single TRUE) endif()
endif() if (SOL2_DYNAMIC_LOADING_EXAMPLES_SINGLE)
make_require_from_dll_example(sol2::sol2_single ".single")
endif()
if (SOL2_DYNAMIC_LOADING_EXAMPLES_SINGLE_GENERATED)
make_require_from_dll_example(sol2::sol2_single_generated ".single.generated")
endif()

View File

@ -675,19 +675,19 @@ namespace sol {
}; };
template <typename T> template <typename T>
constexpr bool is_adl_sol_lua_get_v = is_adl_sol_lua_get<T>::value; inline constexpr bool is_adl_sol_lua_get_v = is_adl_sol_lua_get<T>::value;
template <typename T> template <typename T>
constexpr bool is_adl_sol_lua_check_v = is_adl_sol_lua_check<T>::value; inline constexpr bool is_adl_sol_lua_check_v = is_adl_sol_lua_check<T>::value;
template <typename T> template <typename T>
constexpr bool is_adl_sol_lua_check_get_v = is_adl_sol_lua_check_get<T>::value; inline constexpr bool is_adl_sol_lua_check_get_v = is_adl_sol_lua_check_get<T>::value;
template <typename... Args> template <typename... Args>
constexpr bool is_adl_sol_lua_push_v = is_adl_sol_lua_push<Args...>::value; inline constexpr bool is_adl_sol_lua_push_v = is_adl_sol_lua_push<Args...>::value;
template <typename T, typename... Args> template <typename T, typename... Args>
constexpr bool is_adl_sol_lua_push_exact_v = is_adl_sol_lua_push_exact<T, Args...>::value; inline constexpr bool is_adl_sol_lua_push_exact_v = is_adl_sol_lua_push_exact<T, Args...>::value;
}} // namespace meta::meta_detail }} // namespace meta::meta_detail

View File

@ -123,7 +123,7 @@ namespace sol {
using is_specialization_of = meta_detail::is_specialization_of<std::remove_cv_t<T>, Templ>; using is_specialization_of = meta_detail::is_specialization_of<std::remove_cv_t<T>, Templ>;
template <typename T, template <typename...> class Templ> template <typename T, template <typename...> class Templ>
constexpr bool is_specialization_of_v = is_specialization_of<std::remove_cv_t<T>, Templ>::value; inline constexpr bool is_specialization_of_v = is_specialization_of<std::remove_cv_t<T>, Templ>::value;
template <class T, class...> template <class T, class...>
struct all_same : std::true_type {}; struct all_same : std::true_type {};

View File

@ -1266,7 +1266,7 @@ namespace sol {
using is_lua_c_function = meta::any<std::is_same<lua_CFunction, T>, std::is_same<detail::lua_CFunction_noexcept, T>, std::is_same<lua_CFunction_ref, T>>; using is_lua_c_function = meta::any<std::is_same<lua_CFunction, T>, std::is_same<detail::lua_CFunction_noexcept, T>, std::is_same<lua_CFunction_ref, T>>;
template <typename T> template <typename T>
constexpr bool is_lua_c_function_v = is_lua_c_function<T>::value; inline constexpr bool is_lua_c_function_v = is_lua_c_function<T>::value;
struct automagic_enrollments { struct automagic_enrollments {
bool default_constructor = true; bool default_constructor = true;

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 2018-12-22 20:32:42.897539 UTC // Generated 2018-12-23 18:17:39.332965 UTC
// This header was generated with sol v2.20.6 (revision 88cafb2) // This header was generated with sol v2.20.6 (revision a6abc0a)
// 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 2018-12-22 20:32:28.534178 UTC // Generated 2018-12-23 18:17:38.798117 UTC
// This header was generated with sol v2.20.6 (revision 88cafb2) // This header was generated with sol v2.20.6 (revision a6abc0a)
// https://github.com/ThePhD/sol2 // https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP #ifndef SOL_SINGLE_INCLUDE_HPP
@ -3896,7 +3896,7 @@ namespace sol {
using is_specialization_of = meta_detail::is_specialization_of<std::remove_cv_t<T>, Templ>; using is_specialization_of = meta_detail::is_specialization_of<std::remove_cv_t<T>, Templ>;
template <typename T, template <typename...> class Templ> template <typename T, template <typename...> class Templ>
constexpr bool is_specialization_of_v = is_specialization_of<std::remove_cv_t<T>, Templ>::value; inline constexpr bool is_specialization_of_v = is_specialization_of<std::remove_cv_t<T>, Templ>::value;
template <class T, class...> template <class T, class...>
struct all_same : std::true_type {}; struct all_same : std::true_type {};
@ -5940,7 +5940,7 @@ namespace sol {
using is_lua_c_function = meta::any<std::is_same<lua_CFunction, T>, std::is_same<detail::lua_CFunction_noexcept, T>, std::is_same<lua_CFunction_ref, T>>; using is_lua_c_function = meta::any<std::is_same<lua_CFunction, T>, std::is_same<detail::lua_CFunction_noexcept, T>, std::is_same<lua_CFunction_ref, T>>;
template <typename T> template <typename T>
constexpr bool is_lua_c_function_v = is_lua_c_function<T>::value; inline constexpr bool is_lua_c_function_v = is_lua_c_function<T>::value;
struct automagic_enrollments { struct automagic_enrollments {
bool default_constructor = true; bool default_constructor = true;
@ -8063,19 +8063,19 @@ namespace sol {
}; };
template <typename T> template <typename T>
constexpr bool is_adl_sol_lua_get_v = is_adl_sol_lua_get<T>::value; inline constexpr bool is_adl_sol_lua_get_v = is_adl_sol_lua_get<T>::value;
template <typename T> template <typename T>
constexpr bool is_adl_sol_lua_check_v = is_adl_sol_lua_check<T>::value; inline constexpr bool is_adl_sol_lua_check_v = is_adl_sol_lua_check<T>::value;
template <typename T> template <typename T>
constexpr bool is_adl_sol_lua_check_get_v = is_adl_sol_lua_check_get<T>::value; inline constexpr bool is_adl_sol_lua_check_get_v = is_adl_sol_lua_check_get<T>::value;
template <typename... Args> template <typename... Args>
constexpr bool is_adl_sol_lua_push_v = is_adl_sol_lua_push<Args...>::value; inline constexpr bool is_adl_sol_lua_push_v = is_adl_sol_lua_push<Args...>::value;
template <typename T, typename... Args> template <typename T, typename... Args>
constexpr bool is_adl_sol_lua_push_exact_v = is_adl_sol_lua_push_exact<T, Args...>::value; inline constexpr bool is_adl_sol_lua_push_exact_v = is_adl_sol_lua_push_exact<T, Args...>::value;
}} // namespace meta::meta_detail }} // namespace meta::meta_detail
namespace stack { namespace stack {

View File

@ -37,6 +37,21 @@ function(CREATE_TEST test_target_name test_name target_sol)
EXPORT_NAME sol2::${test_name}) EXPORT_NAME sol2::${test_name})
target_link_libraries(${test_target_name} ${target_sol}) target_link_libraries(${test_target_name} ${target_sol})
if (MSVC)
target_compile_options(${test_target_name}
PRIVATE /std:c++latest /EHsc "$<$<CONFIG:Debug>:/MDd>"
"$<$<CONFIG:Release>:/MD>"
"$<$<CONFIG:RelWithDebInfo>:/MD>"
"$<$<CONFIG:MinSizeRel>:/MD>")
target_compile_definitions(${test_target_name}
PRIVATE /DUNICODE /D_UNICODE
/D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
else()
target_compile_options(${test_target_name}
PRIVATE -std=c++1z -Wno-unknown-warning -Wno-unknown-warning-option
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
endif()
if (MSVC) if (MSVC)
if (NOT CMAKE_COMPILER_ID MATCHES "Clang") if (NOT CMAKE_COMPILER_ID MATCHES "Clang")
target_compile_options(${test_target_name} target_compile_options(${test_target_name}

View File

@ -39,6 +39,13 @@ function(CREATE_TEST test_target_name test_name target_sol)
EXPORT_NAME sol2::${test_name}) EXPORT_NAME sol2::${test_name})
target_link_libraries(${test_target_name} ${target_sol}) target_link_libraries(${test_target_name} ${target_sol})
add_definitions(/DUNICODE /D_UNICODE /D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
add_compile_options(/EHsc)
add_compile_options("$<$<CONFIG:Debug>:/MDd>"
"$<$<CONFIG:Release>:/MD>"
"$<$<CONFIG:RelWithDebInfo>:/MD>"
"$<$<CONFIG:MinSizeRel>:/MD>")
if (MSVC) if (MSVC)
if (NOT CMAKE_COMPILER_ID MATCHES "Clang") if (NOT CMAKE_COMPILER_ID MATCHES "Clang")
target_compile_options(${test_target_name} target_compile_options(${test_target_name}
@ -56,10 +63,26 @@ function(CREATE_TEST test_target_name test_name target_sol)
endif() endif()
endif() endif()
endif() endif()
if (MSVC)
target_compile_options(${test_target_name}
PRIVATE /EHsc /std:c++latest "$<$<CONFIG:Debug>:/MDd>"
"$<$<CONFIG:Release>:/MD>"
"$<$<CONFIG:RelWithDebInfo>:/MD>"
"$<$<CONFIG:MinSizeRel>:/MD>")
target_compile_definitions(${test_target_name}
PRIVATE /DUNICODE /D_UNICODE
/D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
else()
target_compile_options(${test_target_name}
PRIVATE -std=c++1z -Wno-unknown-warning -Wno-unknown-warning-option
-Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
endif()
if (SOL2_CI) if (SOL2_CI)
target_compile_definitions(${test_target_name} target_compile_definitions(${test_target_name}
PRIVATE SOL2_CI) PRIVATE SOL2_CI)
endif() endif()
if (CMAKE_DL_LIBS) if (CMAKE_DL_LIBS)
target_link_libraries(${test_target_name} target_link_libraries(${test_target_name}
${CMAKE_DL_LIBS}) ${CMAKE_DL_LIBS})