From 13dd3fd27773a252b9faa219f52791911a5101d0 Mon Sep 17 00:00:00 2001 From: LinuxLegend Date: Mon, 28 Mar 2022 04:26:30 -0600 Subject: [PATCH] Implmented switch between Tinycthread and Threads.h --- CMakeLists.txt | 6 +++++- include/vkh.h | 6 +++++- meson.build | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 831dbee..845d621 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,11 @@ FIND_PACKAGE(Vulkan REQUIRED) INCLUDE(GNUInstallDirs) -FILE(GLOB VKH_SRC src/*.c src/deps/*.c) +FILE(GLOB VKH_SRC src/*.c) + +IF (WIN32) +LIST(APPEND VKH_SRC src/deps/*.c) +ENDIF() CONFIGURE_FILE(vkh.pc.in vkh.pc @ONLY) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/vkh.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) diff --git a/include/vkh.h b/include/vkh.h index 93db165..78c0657 100644 --- a/include/vkh.h +++ b/include/vkh.h @@ -30,8 +30,12 @@ extern "C" { #include +#if defined(_WIN32) || defined(WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WIN64) || defined(__WIN64__) #include "deps/tinycthread.h" - +#else +// For platforms outside of Windows, Threads.h is provided for by compiler that supports C11 standard. +#include +#endif typedef enum VmaMemoryUsage VmaMemoryUsage; #include diff --git a/meson.build b/meson.build index 12d74db..4ce3a84 100644 --- a/meson.build +++ b/meson.build @@ -166,10 +166,13 @@ vkh_src = [ 'src/vkh_presenter.c', 'src/vkh_queue.c', 'src/vkhelpers.c', - 'src/deps/tinycthread.c', 'src/VmaUsage.cpp' ] +if (host_machine.system() == 'windows') + vkh_src += 'src/deps/tinycthread.c' +endif + vkh_include = [ 'include', 'src', -- 2.47.3