mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
fix coroutine handler, change examples compilation, try to handle m32 compilation issues
This commit is contained in:
parent
e7c43ce242
commit
258acff99b
|
@ -253,6 +253,10 @@ if (DO_TESTS OR DO_EXAMPLES)
|
||||||
# Here, we pull in all the necessary libraries for building examples and tests
|
# Here, we pull in all the necessary libraries for building examples and tests
|
||||||
# Find threading library
|
# Find threading library
|
||||||
if (NOT MSVC)
|
if (NOT MSVC)
|
||||||
|
if (IS_X86)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
|
||||||
|
endif()
|
||||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -198,6 +198,7 @@ else ()
|
||||||
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")
|
||||||
|
list(APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "LDFLAGS=-m32")
|
||||||
#set(LUA_JIT_MAKE_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_CFLAGS_MODIFICATIONS} -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_HOST_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS} -m32")
|
||||||
#set(LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS} -m32")
|
#set(LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS} -m32")
|
||||||
|
|
|
@ -81,7 +81,10 @@ function (MAKE_EXAMPLE example_source_file is_single)
|
||||||
target_compile_options(${example_name}
|
target_compile_options(${example_name}
|
||||||
PRIVATE -Wno-noexcept-type)
|
PRIVATE -Wno-noexcept-type)
|
||||||
endif()
|
endif()
|
||||||
|
if (IS_X86)
|
||||||
|
target_compile_options(${example_name} BEFORE PRIVATE -m32)
|
||||||
|
endif()
|
||||||
|
|
||||||
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_output_name} COMMAND ${example_name})
|
add_test(NAME ${example_output_name} COMMAND ${example_name})
|
||||||
|
|
|
@ -74,6 +74,9 @@ function(make_require_from_dll_example target_lib is_single)
|
||||||
target_link_libraries(${example_lib_name} PRIVATE ${LUA_LIBRARIES})
|
target_link_libraries(${example_lib_name} PRIVATE ${LUA_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
if (IS_X86)
|
||||||
|
target_compile_options(${example_lib_name} BEFORE PRIVATE -m32)
|
||||||
|
endif()
|
||||||
target_link_libraries(${example_lib_name} PRIVATE ${target_lib})
|
target_link_libraries(${example_lib_name} PRIVATE ${target_lib})
|
||||||
target_include_directories(${example_lib_name} PUBLIC "${LUA_INCLUDE_DIRS}")
|
target_include_directories(${example_lib_name} PUBLIC "${LUA_INCLUDE_DIRS}")
|
||||||
|
|
||||||
|
@ -96,7 +99,11 @@ function(make_require_from_dll_example target_lib is_single)
|
||||||
target_link_libraries(${example_name} PRIVATE ${LUA_LIBRARIES})
|
target_link_libraries(${example_name} PRIVATE ${LUA_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
target_include_directories(${example_name} PRIVATE ${LUA_INCLUDE_DIRS})
|
target_include_directories(${example_name} PRIVATE ${LUA_INCLUDE_DIRS})
|
||||||
|
if (IS_X86)
|
||||||
|
target_compile_options(${example_name} BEFORE PRIVATE -m32)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if (TESTS_DYNAMIC_LOADING_EXAMPLES)
|
if (TESTS_DYNAMIC_LOADING_EXAMPLES)
|
||||||
if ((NOT is_single) OR (is_single AND DYNAMIC_LOADING_EXAMPLES_SINGLE))
|
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)
|
||||||
|
|
|
@ -54,6 +54,15 @@ function(CREATE_TEST test_target_name test_name is_single)
|
||||||
else()
|
else()
|
||||||
target_compile_options(${test_target_name}
|
target_compile_options(${test_target_name}
|
||||||
PRIVATE -Wno-noexcept-type -ftemplate-depth=1024 -pthread)
|
PRIVATE -Wno-noexcept-type -ftemplate-depth=1024 -pthread)
|
||||||
|
|
||||||
|
if (IS_X86)
|
||||||
|
target_compile_options(${test_target_name} BEFORE PRIVATE -m32)
|
||||||
|
if(MINGW)
|
||||||
|
#set_target_properties(${test_target_name}
|
||||||
|
# PROPERTIES
|
||||||
|
# LINK_FLAGS -static-libstdc++)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if (CI)
|
if (CI)
|
||||||
target_compile_definitions(${test_target_name}
|
target_compile_definitions(${test_target_name}
|
||||||
|
@ -68,16 +77,6 @@ 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} ${CATCH_LIBRARIES})
|
Threads::Threads ${LUA_LIBRARIES} ${CATCH_LIBRARIES})
|
||||||
|
|
||||||
if (IS_X86)
|
|
||||||
target_compile_options(${test_target_name} BEFORE PRIVATE -m32)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MINGW AND IS_X86)
|
|
||||||
#set_target_properties(${test_target_name}
|
|
||||||
# PROPERTIES
|
|
||||||
# LINK_FLAGS -static-libstdc++)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_test(NAME ${test_name} COMMAND ${test_target_name})
|
add_test(NAME ${test_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)
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <catch.hpp>
|
#include <catch.hpp>
|
||||||
|
|
||||||
TEST_CASE("coroutines/yielding", "ensure calling a coroutine works") {
|
TEST_CASE("coroutines/coroutine.yield", "ensure calling a coroutine works") {
|
||||||
const auto& script = R"(counter = 20
|
const auto& script = R"(counter = 20
|
||||||
|
|
||||||
function loop()
|
function loop()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user