mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
fix VC++ build of examples and try to get appveyor to compile and run...
This commit is contained in:
parent
ed3de48cce
commit
453a0daaaf
|
@ -24,6 +24,12 @@
|
|||
cmake_minimum_required(VERSION 3.5.0)
|
||||
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 /std:c++latest)
|
||||
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
|
||||
# Set general standard requirements here
|
||||
|
|
|
@ -57,7 +57,7 @@ before_build:
|
|||
- set PATH=%PYTHON_PATH%;%PATH%
|
||||
- md build-sol2
|
||||
- cd build-sol2
|
||||
- cmake .. -G "%CMAKE_GENERATOR%" -DLUA_VERSION="%LUA_VERSION%" -DLUA_BUILD=ON -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON
|
||||
- cmake .. -G "%CMAKE_GENERATOR%" -DLUA_VERSION="%LUA_VERSION%" -DBUILD_LUA=ON -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON
|
||||
|
||||
build_script:
|
||||
- cmake --build .
|
||||
|
|
|
@ -25,12 +25,6 @@
|
|||
file(GLOB EXAMPLES_SRC *.cpp tutorials/quick_n_dirty/*.cpp)
|
||||
source_group(examples FILES ${EXAMPLES_SRC})
|
||||
|
||||
if (MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /EHsc /std:c++latest /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING=1 /D_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING=1")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors -Wno-noexcept-type -ftemplate-depth=1024")
|
||||
endif()
|
||||
|
||||
function (MAKE_EXAMPLE example_source_file is_single)
|
||||
if (is_single)
|
||||
set(header_files ${SOL2_SINGLE_HEADER_SOURCES})
|
||||
|
@ -64,11 +58,10 @@ function (MAKE_EXAMPLE example_source_file is_single)
|
|||
target_link_libraries(${example_name} ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
# examples must be built in debug mode to allow assertions to fire
|
||||
target_compile_definitions(${example_name} PRIVATE _DEBUG)
|
||||
if (MSVC)
|
||||
target_compile_options(${example_name} PRIVATE /DDEBUG /UNDEBUG)
|
||||
target_compile_options(${example_name} PRIVATE /UNDEBUG)
|
||||
else()
|
||||
target_compile_options(${example_name} PRIVATE -Og -g -UNDEBUG)
|
||||
target_compile_options(${example_name} PRIVATE -UNDEBUG)
|
||||
endif()
|
||||
|
||||
if (TESTS_EXAMPLES)
|
||||
|
|
|
@ -14,7 +14,7 @@ sol::object fancy_func(sol::object a, sol::object b, sol::this_state s) {
|
|||
}
|
||||
else if (a.is<bool>()) {
|
||||
bool do_triple = a.as<bool>();
|
||||
return sol::object(lua, sol::in_place<double>, b.as<double>() * (do_triple ? 3 : 1));
|
||||
return sol::object(lua, sol::in_place_type<double>, b.as<double>() * (do_triple ? 3 : 1));
|
||||
}
|
||||
// Can also use make_object
|
||||
return sol::make_object(lua, sol::nil);
|
||||
|
|
|
@ -25,12 +25,6 @@
|
|||
file(GLOB SOL2_TEST_SOURCES test*.cpp)
|
||||
source_group(test_sources FILES ${SOL2_TEST_SOURCES})
|
||||
|
||||
if (MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /EHsc /std:c++latest /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING=1 /D_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING=1")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors -Wno-noexcept-type -ftemplate-depth=1024")
|
||||
endif()
|
||||
|
||||
file(DOWNLOAD https://github.com/catchorg/Catch2/releases/download/v2.0.1/catch.hpp ${CMAKE_BINARY_DIR}/Catch/include/catch.hpp)
|
||||
|
||||
function(CREATE_TEST test_target_name test_name is_single)
|
||||
|
|
Loading…
Reference in New Issue
Block a user