瀏覽代碼

examples: CMake: don't build core_loading_thread if no pthreads

The example requires pthreads and now C11 <stdatomic.h>, thus skip it
if either isn't available.

This also fixes the current Travis CI build failure for the
Windows configuration.
pull/832/head
Ahmad Fatoum 5 年之前
父節點
當前提交
2cda760312
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: C3EAC3DE9321D59B
共有 1 個文件被更改,包括 18 次插入0 次删除
  1. +18
    -0
      examples/CMakeLists.txt

+ 18
- 0
examples/CMakeLists.txt 查看文件

@ -28,6 +28,24 @@ include(CheckIncludeFiles)
set(OUTPUT_EXT)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
include(CheckIncludeFile)
CHECK_INCLUDE_FILE("stdatomic.h" HAVE_STDATOMIC_H)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads)
if (CMAKE_USE_PTHREADS_INIT AND HAVE_STDATOMIC_H)
add_if_flag_compiles("-std=c11" CMAKE_C_FLAGS)
if(THREADS_HAVE_PTHREAD_ARG)
add_if_flag_compiles("-pthread" CMAKE_C_FLAGS)
endif()
if(CMAKE_THREAD_LIBS_INIT)
link_libraries("${CMAKE_THREAD_LIBS_INIT}")
endif()
else()
# Items requiring pthreads
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_loading_thread.c)
endif()
if(${PLATFORM} MATCHES "Android")
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c)

Loading…
取消
儲存