fix coroutine handler, change examples compilation, try to handle m32 compilation issues

This commit is contained in:
ThePhD 2018-02-17 10:44:55 -05:00
parent e7c43ce242
commit 258acff99b
6 changed files with 27 additions and 13 deletions

View File

@ -253,6 +253,10 @@ if (DO_TESTS OR DO_EXAMPLES)
# Here, we pull in all the necessary libraries for building examples and tests
# Find threading library
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(THREADS_PREFER_PTHREAD_FLAG TRUE)
endif()

View File

@ -198,6 +198,7 @@ else ()
endif()
if (IS_X86)
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_HOST_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS} -m32")
#set(LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS} -m32")

View File

@ -81,7 +81,10 @@ function (MAKE_EXAMPLE example_source_file is_single)
target_compile_options(${example_name}
PRIVATE -Wno-noexcept-type)
endif()
if (IS_X86)
target_compile_options(${example_name} BEFORE PRIVATE -m32)
endif()
if (TESTS_EXAMPLES)
if ((NOT is_single) OR (is_single AND TESTS_SINGLE))
add_test(NAME ${example_output_name} COMMAND ${example_name})

View File

@ -74,6 +74,9 @@ function(make_require_from_dll_example target_lib is_single)
target_link_libraries(${example_lib_name} PRIVATE ${LUA_LIBRARIES})
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_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})
endif()
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 ((NOT is_single) OR (is_single AND DYNAMIC_LOADING_EXAMPLES_SINGLE))
get_target_property(example_working_dir ${example_name} RUNTIME_OUTPUT_DIRECTORY)

View File

@ -54,6 +54,15 @@ function(CREATE_TEST test_target_name test_name is_single)
else()
target_compile_options(${test_target_name}
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()
if (CI)
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}
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})
install(TARGETS ${test_target_name} RUNTIME DESTINATION bin)
endfunction(CREATE_TEST)

View File

@ -25,7 +25,7 @@
#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
function loop()