Let it rip!

This commit is contained in:
ThePhD 2017-12-24 12:32:23 -05:00
parent c8339468ae
commit 83013333d7
8 changed files with 58 additions and 179 deletions

View File

@ -24,13 +24,6 @@
cmake_minimum_required(VERSION 3.5.0) cmake_minimum_required(VERSION 3.5.0)
project(sol2 VERSION 2.19.0 LANGUAGES CXX C) project(sol2 VERSION 2.19.0 LANGUAGES CXX C)
if (MSVC)
add_definitions(/DUNICODE /D_UNICODE /D_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)
add_compile_options(/W4 /EHsc)
else()
add_compile_options(-Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors -Wno-noexcept-type -ftemplate-depth=1024)
endif()
# # # General Project Requirements # # # General Project Requirements
# Set general standard requirements here # Set general standard requirements here
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
@ -57,6 +50,28 @@ set(CXX_FEATURES
cxx_variadic_macros cxx_variadic_macros
cxx_variadic_templates) cxx_variadic_templates)
# # # General project flags
if (MSVC)
add_definitions(/DUNICODE /D_UNICODE /D_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)
add_compile_options(/W4 /EHsc)
else()
add_compile_options(-Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors -Wno-noexcept-type -ftemplate-depth=1024)
endif()
# # # General project output locations
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/x86")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/x86")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/x86")
else()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/x64")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/x64")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/x64")
endif()
# # # Modules
# # Include modules useful to the project, whether locally made in our own cmake DIRECTORY
# # our from the standard cmake libraries
# Add home-rolled modules path to front of module path list # Add home-rolled modules path to front of module path list
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules" "${CMAKE_MODULE_PATH}") set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules" "${CMAKE_MODULE_PATH}")
@ -132,22 +147,23 @@ set(SOL2_SINGLE_HEADER_FOUND FALSE)
if (PYTHONINTERP_FOUND) if (PYTHONINTERP_FOUND)
if (SINGLE) if (SINGLE)
set(SOL2_SINGLE_FOUND TRUE) set(SOL2_SINGLE_FOUND TRUE)
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/single/sol/sol_forward.hpp" add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/include/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/include/single/sol/sol_forward.hpp"
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/single.py" --output "${CMAKE_BINARY_DIR}/single/sol/sol.hpp" COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/single.py" --output "${CMAKE_BINARY_DIR}/include/single/sol/sol.hpp"
DEPENDS ${SOL2_HEADER_SOURCES}) DEPENDS ${SOL2_HEADER_SOURCES})
add_custom_target(sol2_single_header add_custom_target(sol2_single_header
DEPENDS "${CMAKE_BINARY_DIR}/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/single/sol/sol_forward.hpp") DEPENDS "${CMAKE_BINARY_DIR}/include/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/include/single/sol/sol_forward.hpp")
set_target_properties(sol2_single_header set_target_properties(sol2_single_header
PROPERTIES PROPERTIES
INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/single/sol") INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/include/single/sol"
install(FILES "${CMAKE_BINARY_DIR}/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/single/sol/sol_forward.hpp" INTERFACE_INCLUDE_DIRECOTIRES "${CMAKE_BINARY_DIR}/include/single/sol")
install(FILES "${CMAKE_BINARY_DIR}/include/single/sol/sol.hpp" "${CMAKE_BINARY_DIR}/include/single/sol/sol_forward.hpp"
DESTINATION include/sol) DESTINATION include/sol)
endif() endif()
if (DOCS) if (DOCS)
set(SOL2_DOCS_FOUND TRUE) set(SOL2_DOCS_FOUND TRUE)
add_custom_command(OUTPUT documentation COMMAND "make html" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs) add_custom_command(OUTPUT documentation COMMAND "make html" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs)
add_custom_target(docs DEPENDS documentation) add_custom_target(docs DEPENDS documentation)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/docs/build/html" DESTINATION bin/docs) install(DIRECTORY "${CMAKE_SOURCE_DIR}/docs/build/html" DESTINATION docs)
endif() endif()
else() else()
if (SINGLE) if (SINGLE)
@ -156,7 +172,6 @@ else()
endif() endif()
if (DOCS) if (DOCS)
set(SOL2_DOCS_FOUND FALSE) set(SOL2_DOCS_FOUND FALSE)
message(STATUS "documentation cannot be generated as python 3 has not been found.")
endif() endif()
endif() endif()

View File

@ -60,8 +60,8 @@ before_build:
- cmake .. -G "%CMAKE_GENERATOR%" -DLUA_VERSION="%LUA_VERSION%" -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON - cmake .. -G "%CMAKE_GENERATOR%" -DLUA_VERSION="%LUA_VERSION%" -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON
build_script: build_script:
- cmake --build --config Debug . - cmake --build . --config Debug
- cmake --build --config Release . - cmake --build . --config Release
test_script: test_script:
- ctest -C Debug --output-on-failure - ctest -C Debug --output-on-failure
@ -69,8 +69,12 @@ test_script:
notifications: notifications:
- provider: Webhook - provider: Webhook
url: https://webhooks.gitter.im/e/a66a71642a00d2e50d2e url: https://webhooks.gitter.im/e/1af10e654a918bef7f1e
method: POST method: POST
on_build_success: true on_build_success: false
on_build_failure: true on_build_failure: false
on_build_status_changed: true
- provider: Email
on_build_success: false
on_build_failure: false
on_build_status_changed: true on_build_status_changed: true

View File

@ -35,7 +35,7 @@ else()
set(LUA_BUILD_LIBNAME lua-${LUA_VERSION}) set(LUA_BUILD_LIBNAME lua-${LUA_VERSION})
endif() endif()
set(LUA_BUILD_TOPLEVEL "${CMAKE_BINARY_DIR}/vendor/${LUA_BUILD_LIBNAME}") set(LUA_BUILD_TOPLEVEL "${CMAKE_BINARY_DIR}/vendor/${LUA_BUILD_LIBNAME}")
set(LUA_BUILD_INSTALL_DIR "${LUA_BUILD_TOPLEVEL}/install") set(LUA_BUILD_INSTALL_DIR "${LUA_BUILD_TOPLEVEL}")
# # Misc needed variables # # Misc needed variables
set(LUA_BUILD_LIBRARY_DESCRIPTION "The base name of the library to build either the static or the dynamic library") set(LUA_BUILD_LIBRARY_DESCRIPTION "The base name of the library to build either the static or the dynamic library")
@ -50,10 +50,9 @@ endif()
# # # Options # # # Options
set(LUA_INCLUDE_PREFIX "${LUA_BUILD_INSTALL_DIR}" CACHE PATH "Directory that prefixes the Lua include directory") set(LUA_INCLUDE_DIR "${LUA_BUILD_INSTALL_DIR}/include" CACHE PATH "Directory with lua include files")
set(LUA_INCLUDE_DIR "${LUA_INCLUDE_PREFIX}/include" CACHE PATH "Directory with lua include files") set(LUA_LIB_DIR "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}" CACHE PATH "Directory with lua library files")
set(LUA_LIB_DIR "${LUA_BUILD_INSTALL_DIR}/lib" CACHE PATH "Directory with lua library files") set(LUA_BIN_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" CACHE PATH "Directory with lua executable and dynamic library files")
set(LUA_BIN_DIR "${LUA_BUILD_INSTALL_DIR}/bin" CACHE PATH "Directory with lua executable and dynamic library files")
option(BUILD_LUA_AS_DLL ${LUA_BUILD_BUILD_DLL_DEFAULT} "Build Lua or LuaJIT as a Shared/Dynamic Link Library") option(BUILD_LUA_AS_DLL ${LUA_BUILD_BUILD_DLL_DEFAULT} "Build Lua or LuaJIT as a Shared/Dynamic Link Library")
STRING(TOLOWER ${LUA_BUILD_LIBNAME} LUA_BUILD_NORMALIZED_LIBNAME) STRING(TOLOWER ${LUA_BUILD_LIBNAME} LUA_BUILD_NORMALIZED_LIBNAME)

View File

@ -183,64 +183,3 @@ else ()
# set externally-visible target indicator # set externally-visible target indicator
set(LUA_LIBRARIES lualib_${LUA_JIT_VERSION}) set(LUA_LIBRARIES lualib_${LUA_JIT_VERSION})
endif() endif()
# Cleanup variables we set
unset(LUA_JIT_NORMALIZED_LUA_VERSION)
unset(LUA_JIT_MD5)
unset(LUA_JIT_MD5_LuaJIT-2.1.0-beta3.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.1.0-beta3.zip)
unset(LUA_JIT_MD5_LuaJIT-2.1.0-beta2.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.1.0-beta2.zip)
unset(LUA_JIT_MD5_LuaJIT-2.1.0-beta1.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.1.0-beta1.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.5.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.5.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.4.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.4.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.3.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.3.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.2.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.2.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.1.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.1.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.0.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.0.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta11.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta11.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta10.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta10.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta9.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta9.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta8.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta8.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta7.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta7.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta6.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta6.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta5.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta5.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta4.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta4.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta3.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta3.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta2.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta2.zip)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta1.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-2.0.0-beta1.zip)
unset(LUA_JIT_MD5_LuaJIT-1.1.8.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-1.1.8.zip)
unset(LUA_JIT_MD5_LuaJIT-1.1.7.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-1.1.7.zip)
unset(LUA_JIT_MD5_LuaJIT-1.1.6.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-1.1.6.zip)
unset(LUA_JIT_MD5_LuaJIT-1.1.5.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-1.1.5.zip)
unset(LUA_JIT_MD5_LuaJIT-1.1.4.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-1.1.4.zip)
unset(LUA_JIT_MD5_LuaJIT-1.1.3.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-1.1.3.zip)
unset(LUA_JIT_MD5_LuaJIT-1.1.2.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-1.1.0.tar.gz)
unset(LUA_JIT_MD5_LuaJIT-1.0.3.tar.gz)
unset(LUA_JIT_EXTERNAL_2.0_LATEST)
unset(LUA_JIT_EXTERNAL_2.1_LATEST)

View File

@ -340,7 +340,7 @@ if (LUA_VANILLA_BUILD_DIRECTLY)
POSITION_INDEPENDENT_CODE TRUE POSITION_INDEPENDENT_CODE TRUE
INCLUDE_DIRECTORIES ${LUA_VANILLA_SOURCE_DIR} INCLUDE_DIRECTORIES ${LUA_VANILLA_SOURCE_DIR}
RUNTIME_OUTPUT_DIRECTORY ${LUA_BIN_DIR} RUNTIME_OUTPUT_DIRECTORY ${LUA_BIN_DIR}
LIBRARY_OUTPUT_DIRECTORY ${LUA_LIB_DIR} LIBRARY_OUTPUT_DIRECTORY ${LUA_BIN_DIR}
ARCHIVE_OUTPUT_DIRECTORY ${LUA_LIB_DIR} ARCHIVE_OUTPUT_DIRECTORY ${LUA_LIB_DIR}
OUTPUT_NAME ${LUA_BUILD_LIBNAME} OUTPUT_NAME ${LUA_BUILD_LIBNAME}
RUNTIME_OUTPUT_NAME ${LUA_BUILD_LIBNAME} RUNTIME_OUTPUT_NAME ${LUA_BUILD_LIBNAME}
@ -460,79 +460,3 @@ else ()
endif() endif()
set(LUA_FOUND TRUE) set(LUA_FOUND TRUE)
unset(LUA_VANILLA_5.1_LATEST)
unset(LUA_VANILLA_5.2_LATEST)
unset(LUA_VANILLA_5.3_LATEST)
unset(LUA_VANILLA_MD5)
unset(LUA_VANILLA_SHA1)
unset(LUA_VANILLA_MD5_5.3.4)
unset(LUA_VANILLA_SHA1_5.3.4)
unset(LUA_VANILLA_MD5_5.3.3)
unset(LUA_VANILLA_SHA1_5.3.3)
unset(LUA_VANILLA_MD5_5.3.2)
unset(LUA_VANILLA_SHA1_5.3.2)
unset(LUA_VANILLA_MD5_5.3.1)
unset(LUA_VANILLA_SHA1_5.3.1)
unset(LUA_VANILLA_MD5_5.3.0)
unset(LUA_VANILLA_SHA1_5.3.0)
unset(LUA_VANILLA_MD5_5.2.4)
unset(LUA_VANILLA_SHA1_5.2.4)
unset(LUA_VANILLA_MD5_5.2.3)
unset(LUA_VANILLA_SHA1_5.2.3)
unset(LUA_VANILLA_MD5_5.2.2)
unset(LUA_VANILLA_SHA1_5.2.2)
unset(LUA_VANILLA_MD5_5.2.1)
unset(LUA_VANILLA_SHA1_5.2.1)
unset(LUA_VANILLA_MD5_5.2.0)
unset(LUA_VANILLA_SHA1_5.2.0)
unset(LUA_VANILLA_MD5_5.1.5)
unset(LUA_VANILLA_SHA1_5.1.5)
unset(LUA_VANILLA_MD5_5.1.4)
unset(LUA_VANILLA_SHA1_5.1.4)
unset(LUA_VANILLA_MD5_5.1.3)
unset(LUA_VANILLA_SHA1_5.1.3)
unset(LUA_VANILLA_MD5_5.1.2)
unset(LUA_VANILLA_SHA1_5.1.2)
unset(LUA_VANILLA_MD5_5.1.1)
unset(LUA_VANILLA_SHA1_5.1.1)
unset(LUA_VANILLA_MD5_5.1)
unset(LUA_VANILLA_SHA1_5.1)
unset(LUA_VANILLA_MD5_5.0.3)
unset(LUA_VANILLA_SHA1_5.0.3)
unset(LUA_VANILLA_MD5_5.0.2)
unset(LUA_VANILLA_SHA1_5.0.2)
unset(LUA_VANILLA_MD5_5.0.1)
unset(LUA_VANILLA_SHA1_5.0.1)
unset(LUA_VANILLA_MD5_5.0)
unset(LUA_VANILLA_SHA1_5.0)
unset(LUA_VANILLA_MD5_4.0.1)
unset(LUA_VANILLA_SHA1_4.0.1)
unset(LUA_VANILLA_MD5_4.0)
unset(LUA_VANILLA_SHA1_4.0)
unset(LUA_VANILLA_MD5_3.2.2)
unset(LUA_VANILLA_SHA1_3.2.2)
unset(LUA_VANILLA_MD5_3.2.1)
unset(LUA_VANILLA_SHA1_3.2.1)
unset(LUA_VANILLA_MD5_3.2)
unset(LUA_VANILLA_SHA1_3.2)
unset(LUA_VANILLA_MD5_3.1)
unset(LUA_VANILLA_SHA1_3.1)
unset(LUA_VANILLA_MD5_3.0)
unset(LUA_VANILLA_SHA1_3.0)
unset(LUA_VANILLA_MD5_2.5)
unset(LUA_VANILLA_SHA1_2.5)
unset(LUA_VANILLA_MD5_2.4)
unset(LUA_VANILLA_SHA1_2.4)
unset(LUA_VANILLA_MD5_2.2)
unset(LUA_VANILLA_SHA1_2.2)
unset(LUA_VANILLA_MD5_2.1)
unset(LUA_VANILLA_SHA1_2.1)
unset(LUA_VANILLA_MD5_1.1)
unset(LUA_VANILLA_SHA1_1.1)
unset(LUA_VANILLA_MD5_1.0)
unset(LUA_VANILLA_SHA1_1.0)
unset(LUA_VANILLA_LIB_FILE)
unset(LUA_VANILLA_BUILD_COMMAND)
unset(LUA_VANILLA_TEST_COMMAND)
unset(LUA_VANILLA_INSTALL_COMMAND)

View File

@ -34,19 +34,24 @@ function (MAKE_EXAMPLE example_source_file is_single)
get_filename_component(example_name ${example_source_file} NAME_WE) get_filename_component(example_name ${example_source_file} NAME_WE)
file(RELATIVE_PATH example_source_file_relative ${CMAKE_SOURCE_DIR} ${example_source_file}) file(RELATIVE_PATH example_source_file_relative ${CMAKE_SOURCE_DIR} ${example_source_file})
get_filename_component(example_output_relative_dir ${example_source_file_relative} DIRECTORY) get_filename_component(example_output_relative_dir ${example_source_file_relative} DIRECTORY)
file(TO_CMAKE_PATH "${example_output_relative_dir}" example_output_relative_dir_name)
STRING(REGEX REPLACE "/" "." example_output_relative_dir_name "${example_output_relative_dir}")
if (is_single) if (is_single)
set(example_name "${example_name}.single") set(example_name "${example_name}.single")
endif() endif()
if (example_output_relative_dir_name STREQUAL "")
set(example_output_name "${example_name}")
else()
set(example_output_name "${example_output_relative_dir_name}.${example_name}")
endif()
add_executable(${example_name} ${example_source_file} ${header_files}) add_executable(${example_name} ${example_source_file} ${header_files})
set_target_properties(${example_name} set_target_properties(${example_name}
PROPERTIES PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${example_output_relative_dir}" OUTPUT_NAME "${example_output_name}")
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${example_output_relative_dir}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${example_output_relative_dir}")
if (is_single) if (is_single)
target_include_directories(${example_name} target_include_directories(${example_name}
PRIVATE "${CMAKE_BINARY_DIR}/single/sol" "${LUA_INCLUDE_DIR}") PRIVATE "${CMAKE_BINARY_DIR}/include/single/sol" "${LUA_INCLUDE_DIR}")
add_dependencies(${example_name} sol2_single_header) add_dependencies(${example_name} sol2_single_header)
else() else()
target_include_directories(${example_name} target_include_directories(${example_name}
@ -66,10 +71,10 @@ function (MAKE_EXAMPLE example_source_file is_single)
if (TESTS_EXAMPLES) if (TESTS_EXAMPLES)
if ((NOT is_single) OR (is_single AND TESTS_SINGLE)) if ((NOT is_single) OR (is_single AND TESTS_SINGLE))
add_test(NAME ${example_name} COMMAND ${example_name}) add_test(NAME ${example_output_name} COMMAND ${example_name})
endif() endif()
endif() endif()
install(TARGETS ${example_name} RUNTIME DESTINATION "${example_output_relative_dir}/${example_name}") install(TARGETS ${example_name} RUNTIME DESTINATION bin)
endfunction(MAKE_EXAMPLE) endfunction(MAKE_EXAMPLE)
foreach(example_source_file ${EXAMPLES_SRC}) foreach(example_source_file ${EXAMPLES_SRC})

View File

@ -16,7 +16,7 @@ public:
} }
int test(int x) { int test(int x) {
return name.length() + x; return static_cast<int>(name.length() + x);
} }
}; };

View File

@ -34,15 +34,10 @@ function(CREATE_TEST test_target_name test_name is_single)
set(header_files ${SOL2_HEADER_SOURCES}) set(header_files ${SOL2_HEADER_SOURCES})
endif() endif()
add_executable(${test_target_name} ${SOL2_TEST_SOURCES} ${header_files}) add_executable(${test_target_name} ${SOL2_TEST_SOURCES} ${header_files})
set_target_properties(${test_target_name}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/tests"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/tests"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/tests")
if (is_single) if (is_single)
add_dependencies(${test_target_name} sol2_single_header ${lualib}) add_dependencies(${test_target_name} sol2_single_header ${lualib})
target_include_directories(${test_target_name} target_include_directories(${test_target_name}
PRIVATE "${CMAKE_BINARY_DIR}/single/sol" "${LUA_INCLUDE_DIR}" "${CMAKE_BINARY_DIR}/Catch/include/") PRIVATE "${CMAKE_BINARY_DIR}/include/single/sol" "${LUA_INCLUDE_DIR}" "${CMAKE_BINARY_DIR}/Catch/include/")
else() else()
target_include_directories(${test_target_name} target_include_directories(${test_target_name}
PRIVATE "${CMAKE_SOURCE_DIR}" "${LUA_INCLUDE_DIR}" "${CMAKE_BINARY_DIR}/Catch/include/") PRIVATE "${CMAKE_SOURCE_DIR}" "${LUA_INCLUDE_DIR}" "${CMAKE_BINARY_DIR}/Catch/include/")
@ -57,10 +52,8 @@ function(CREATE_TEST test_target_name test_name is_single)
target_link_libraries(${test_target_name} target_link_libraries(${test_target_name}
Threads::Threads ${LUA_LIBRARIES} ${CMAKE_DL_LIBS}) Threads::Threads ${LUA_LIBRARIES} ${CMAKE_DL_LIBS})
add_test(NAME ${test_target_name} add_test(NAME ${test_target_name} COMMAND ${test_target_name})
COMMAND ${test_target_name}) install(TARGETS ${test_target_name} RUNTIME DESTINATION bin)
install(TARGETS ${test_target_name}
RUNTIME DESTINATION bin)
endfunction(CREATE_TEST) endfunction(CREATE_TEST)
CREATE_TEST(tests "tests" FALSE) CREATE_TEST(tests "tests" FALSE)