mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Beef up testing suite significantly and make sure that the interop examples compile, at least on Linux
These damn libraries definitely don't compile clean on Windows... but then again, most people don't give a damn about Windows :<
This commit is contained in:
parent
8d2a25988c
commit
eca9ec46fd
10
.travis.yml
10
.travis.yml
|
@ -45,16 +45,22 @@ matrix:
|
|||
- ALLOW_FAILURE=true
|
||||
include:
|
||||
# GCC 4.9.x, 5.x, 6.x, 7.x
|
||||
- env:
|
||||
- LUA_VERSION=5.3.4
|
||||
GCC_VERSION=7
|
||||
PLATFORM=i686
|
||||
CI=true
|
||||
|
||||
- env:
|
||||
- LUA_VERSION=luajit-2.0.5
|
||||
GCC_VERSION=7
|
||||
PLATFORM=x86
|
||||
PLATFORM=i686
|
||||
CI=true
|
||||
|
||||
- env:
|
||||
- LUA_VERSION=luajit-2.1.0-beta3
|
||||
GCC_VERSION=7
|
||||
PLATFORM=x86
|
||||
PLATFORM=i686
|
||||
CI=true
|
||||
|
||||
- env:
|
||||
|
|
|
@ -56,8 +56,13 @@ set(CXX_FEATURES
|
|||
# # #
|
||||
if (PLATFORM MATCHES "i686" OR PLATFORM STREQUAL "x86")
|
||||
set(IS_X86 TRUE)
|
||||
elseif (PLATFORM MATCHES "ARM64")
|
||||
set(IS_ARM64 TRUE)
|
||||
set(IS_X64 TRUE)
|
||||
elseif (PLATFORM MATCHES "ARM")
|
||||
set(IS_ARM TRUE)
|
||||
elseif (PLATFORM MATCHES "x86_64" OR PLATFORM STREQUAL "x64")
|
||||
set(IS_X64 TRUE)
|
||||
else()
|
||||
set(IS_X64 TRUE)
|
||||
endif()
|
||||
|
@ -78,17 +83,8 @@ else()
|
|||
add_compile_options(-Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
|
||||
endif()
|
||||
|
||||
if (CI)
|
||||
#if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++")
|
||||
# add_compile_options("$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:-stdlib=libc++>")
|
||||
# LIST(APPEND CMAKE_LIBRARY_PATH_FLAG "$$ENV{CLANG_PREFIX}/lib")
|
||||
# include_directories("$ENV{CLANG_PREFIX}/include/c++/v1")
|
||||
#endif()
|
||||
endif()
|
||||
|
||||
# # # General project output locations
|
||||
if (PLATFORM MATCHES "x86" OR CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
if (IS_X86 OR CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/x86/lib")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/x86/bin")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/x86/bin")
|
||||
|
@ -118,6 +114,7 @@ option(CI "Enable build of tests" 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" ON)
|
||||
option(DOCS "Enable build of documentation" OFF)
|
||||
# Single tests and examples tests will only be turned on if both SINGLE and TESTS are defined
|
||||
|
@ -125,12 +122,16 @@ CMAKE_DEPENDENT_OPTION(TESTS_SINGLE "Enable build of tests using the generated s
|
|||
"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 examples using the generated single headers" 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
|
||||
"EXAMPLES;INTEROP_EXAMPLES" OFF)
|
||||
"INTEROP_EXAMPLES" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(TESTS_DYNAMIC_LOADING_EXAMPLES "Enable build of dynamic loading examples as tests" ON
|
||||
"DYNAMIC_LOADING_EXAMPLES" OFF)
|
||||
|
||||
|
||||
# # # sol2 Library
|
||||
|
@ -215,8 +216,26 @@ if (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)
|
||||
set(DO_EXAMPLES TRUE)
|
||||
else()
|
||||
set(DO_EXAMPLES FALSE)
|
||||
endif()
|
||||
|
||||
if (TESTS OR 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)
|
||||
set(ENABLE_TESTING TRUE)
|
||||
else()
|
||||
set(ENABLE_TESTING FALSE)
|
||||
endif()
|
||||
|
||||
# # # Tests, Examples and other CI suites that come with sol2
|
||||
if (TESTS OR TESTS_SINGLE OR TESTS_EXAMPLES OR TESTS_INTEROP_EXAMPLES OR EXAMPLES OR EXAMPLES_SINGLE OR INTEROP_EXAMPLES)
|
||||
if (DO_TESTS OR DO_EXAMPLES)
|
||||
# # # Libraries
|
||||
# Here, we pull in all the necessary libraries for building examples and tests
|
||||
# Find threading library
|
||||
|
@ -251,7 +270,7 @@ if (TESTS OR TESTS_SINGLE OR TESTS_EXAMPLES OR TESTS_INTEROP_EXAMPLES OR EXAMPLE
|
|||
endif()
|
||||
|
||||
# # Enable test harness for regular, example or single tests
|
||||
if (TESTS OR TESTS_SINGLE OR TESTS_EXAMPLES OR TESTS_INTEROP_EXAMPLES)
|
||||
if (ENABLE_TESTING)
|
||||
# enable ctest
|
||||
message(STATUS "sol2 testing enabled")
|
||||
enable_testing()
|
||||
|
@ -259,7 +278,7 @@ if (TESTS OR TESTS_SINGLE OR TESTS_EXAMPLES OR TESTS_INTEROP_EXAMPLES OR EXAMPLE
|
|||
|
||||
# # # Examples
|
||||
# # Enable examples to be built against the library
|
||||
if (EXAMPLES OR TESTS_EXAMPLES OR EXAMPLES_SINGLE OR INTEROP_EXAMPLES OR INTEROP_EXAMPLES_SINGLE OR TEST_INTEROP_EXAMPLES)
|
||||
if (DO_EXAMPLES)
|
||||
# NOTE: will also add to tests if TESTS is defined
|
||||
message(STATUS "sol2 adding examples...")
|
||||
add_subdirectory(examples "${CMAKE_BINARY_DIR}/examples")
|
||||
|
@ -267,10 +286,9 @@ if (TESTS OR TESTS_SINGLE OR TESTS_EXAMPLES OR TESTS_INTEROP_EXAMPLES OR EXAMPLE
|
|||
|
||||
# # # Tests
|
||||
# # Add tests here
|
||||
if (TESTS OR TESTS_SINGLE)
|
||||
if (DO_TESTS)
|
||||
# add subdir to get going
|
||||
message(STATUS "sol2 adding tests...")
|
||||
add_subdirectory(tests "${CMAKE_BINARY_DIR}/tests")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
|
|
@ -196,6 +196,12 @@ else ()
|
|||
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "BUILDMODE=static")
|
||||
set(LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS} -fPIC")
|
||||
endif()
|
||||
if (IS_X86)
|
||||
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "CC=${CMAKE_C_COMPILER} -m32")
|
||||
#set(LUA_JIT_MAKE_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_CFLAGS_MODIFICATIONS} -m32")
|
||||
#set(LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS} -m32")
|
||||
#set(LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS} -m32")
|
||||
endif()
|
||||
|
||||
set(LUA_JIT_PREBUILT_DLL ${LUA_JIT_DLL_FILENAME})
|
||||
set(LUA_JIT_PREBUILT_LIB ${LUA_JIT_LIB_FILENAME})
|
||||
|
@ -206,7 +212,7 @@ else ()
|
|||
endif()
|
||||
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "CFLAGS=${LUA_JIT_MAKE_CFLAGS_MODIFICATIONS}")
|
||||
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "TARGET_CFLAGS=${LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS}")
|
||||
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "HOST_CFLAGS=${LUA_JIT_MAKE_CFLAGS_MODIFICATIONS}")
|
||||
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "HOST_CFLAGS=${LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS}")
|
||||
|
||||
set(LUA_JIT_BUILD_COMMAND BUILD_COMMAND "${MAKE_PROGRAM}" ${LUA_JIT_MAKE_BUILD_MODIFICATIONS})
|
||||
endif()
|
||||
|
|
|
@ -22,11 +22,13 @@
|
|||
|
||||
# # # sol2 Examples
|
||||
|
||||
if (INTEROP_EXAMPLES)
|
||||
if (DYNAMIC_LOADING_EXAMPLES)
|
||||
# # require_from_dll example
|
||||
# just add the subdirectory
|
||||
add_subdirectory(require_dll_example)
|
||||
|
||||
endif(DYNAMIC_LOADING_EXAMPLES)
|
||||
|
||||
if (INTEROP_EXAMPLES)
|
||||
# # interop examples
|
||||
add_subdirectory(interop/kaguya)
|
||||
add_subdirectory(interop/tolua)
|
||||
|
|
|
@ -34,8 +34,10 @@ function (make_luabridge_interop_example target_library is_single)
|
|||
if (CMAKE_DL_LIBS)
|
||||
target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
if (NOT MSVC)
|
||||
target_compile_options(${example_name} PRIVATE -Wno-noexcept-type -Wignored-qualifiers -Wunused-parameter)
|
||||
if (MSVC)
|
||||
target_compile_options(${example_name} PRIVATE /W1)
|
||||
else()
|
||||
target_compile_options(${example_name} PRIVATE -w)
|
||||
endif()
|
||||
if (TESTS_EXAMPLES)
|
||||
add_test(NAME ${example_name} COMMAND ${example_name})
|
||||
|
|
|
@ -34,8 +34,10 @@ function (make_kaguya_interop_example target_library is_single)
|
|||
if (CMAKE_DL_LIBS)
|
||||
target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
if (NOT MSVC)
|
||||
target_compile_options(${example_name} PRIVATE -Wno-noexcept-type)
|
||||
if (MSVC)
|
||||
target_compile_options(${example_name} PRIVATE /W1)
|
||||
else()
|
||||
target_compile_options(${example_name} PRIVATE -w)
|
||||
endif()
|
||||
if (TESTS_INTEROP_EXAMPLES)
|
||||
add_test(NAME ${example_name} COMMAND ${example_name})
|
||||
|
|
|
@ -34,8 +34,10 @@ function (make_luwra_interop_example target_library is_single)
|
|||
if (CMAKE_DL_LIBS)
|
||||
target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
if (NOT MSVC)
|
||||
target_compile_options(${example_name} PRIVATE -Wno-noexcept-type)
|
||||
if (MSVC)
|
||||
target_compile_options(${example_name} PRIVATE /W1)
|
||||
else()
|
||||
target_compile_options(${example_name} PRIVATE -w)
|
||||
endif()
|
||||
if (TESTS_EXAMPLES)
|
||||
add_test(NAME ${example_name} COMMAND ${example_name})
|
||||
|
|
|
@ -34,8 +34,10 @@ function(make_tolua_interop_example target_library is_single)
|
|||
if (CMAKE_DL_LIBS)
|
||||
target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
if (NOT MSVC)
|
||||
target_compile_options(${example_name} PRIVATE -Wno-noexcept-type -Wno-unused-function -Wno-pedantic)
|
||||
if (MSVC)
|
||||
target_compile_options(${example_name} PRIVATE /W1)
|
||||
else()
|
||||
target_compile_options(${example_name} PRIVATE -w)
|
||||
endif()
|
||||
if (TESTS_EXAMPLES)
|
||||
add_test(NAME ${example_name} COMMAND ${example_name})
|
||||
|
|
|
@ -89,8 +89,8 @@ function(make_require_from_dll_example target_lib is_single)
|
|||
endif()
|
||||
target_include_directories(${example_name} PRIVATE ${LUA_INCLUDE_DIRS})
|
||||
|
||||
if (TESTS_EXAMPLES)
|
||||
if ((NOT is_single) OR (is_single AND TESTS_SINGLE))
|
||||
if (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)
|
||||
add_test(NAME ${example_name} COMMAND ${example_name} WORKING_DIRECTORY "${example_working_dir}")
|
||||
endif()
|
||||
|
@ -98,6 +98,6 @@ function(make_require_from_dll_example target_lib is_single)
|
|||
endfunction()
|
||||
|
||||
make_require_from_dll_example(sol2 FALSE)
|
||||
if (EXAMPLES_SINGLE OR TESTS_SINGLE)
|
||||
if (SOL2_SINGLE_FOUND AND DYNAMIC_LOADING_EXAMPLES_SINGLE)
|
||||
make_require_from_dll_example(sol2_single TRUE)
|
||||
endif()
|
|
@ -52,7 +52,7 @@ echo -en "travis_fold:start:build_preparation.1\r"
|
|||
|
||||
if [[ ${LUA_VERSION} =~ "5.3" ]]
|
||||
then
|
||||
export INTEROP_DEFINES="-DINTEROP_EXAMPLES=ON -DTESTS_INTEROP_EXAMPLES=ON -DINTEROP_EXAMPLES_SINGLE=ON"
|
||||
export INTEROP_DEFINES="-DINTEROP_EXAMPLES=ON -DTESTS_INTEROP_EXAMPLES=ON -DINTEROP_EXAMPLES_SINGLE=ON -DDYNAMIC_LOADING_EXAMPLES=ON -DDYNAMIC_LOADING_EXAMPLES_SINGLE=ON -DTESTS_DYNAMIC_LOADING_EXAMPLES=ON"
|
||||
else
|
||||
export INTEROP_DEFINES=
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue
Block a user