]> O.S.I.I.S - jp/vkhelpers.git/commitdiff
Added tinycthread change for checking if C11 supports for Threads.h exists
authorLinuxLegend <Tyler@linuxdev.app>
Wed, 30 Mar 2022 16:56:38 +0000 (10:56 -0600)
committerLinuxLegend <Tyler@linuxdev.app>
Wed, 30 Mar 2022 16:56:38 +0000 (10:56 -0600)
meson.build
src/deps/tinycthread.c
src/deps/tinycthread.h

index 4ce3a84bfabddef4e1d06ed1b23defea4d657d3f..9bae7ec049e753c15707e5e818a607c73cef4f5a 100644 (file)
@@ -156,7 +156,6 @@ vkh_dependencies = [vulkan_dep, threads_dep]
 
 pkg_conf = import('pkgconfig')
 
-
 vkh_src = [
     'src/vkh_app.c',
     'src/vkh_buffer.c',
@@ -169,7 +168,7 @@ vkh_src = [
     'src/VmaUsage.cpp'
 ]
 
-if (host_machine.system() == 'windows')
+if (has_c11_threads_support == false)
     vkh_src += 'src/deps/tinycthread.c'
 endif
 
@@ -180,8 +179,8 @@ vkh_include = [
 ]
 
 vkh_shared_library = shared_library('vkh', 
-    c_args: [vkh_compile_options, '-DVKH_SHARED_BUILD'],
-    cpp_args: [vkh_compile_options, '-DVKH_SHARED_BUILD'],
+    c_args: [vkh_compile_options, has_c11_threads_support_defines, '-DVKH_SHARED_BUILD'],
+    cpp_args: [vkh_compile_options, has_c11_threads_support_defines, '-DVKH_SHARED_BUILD'],
     build_by_default: true,
     install: true,
     soversion: lib_so_version,
@@ -191,8 +190,8 @@ vkh_shared_library = shared_library('vkh',
 )
 
 vkh_static_library = static_library('vkh', 
-    c_args: [vkh_compile_options, '-DVKH_STATIC_BUILD'],
-    cpp_args: [vkh_compile_options, '-DVKH_STATIC_BUILD'],
+    c_args: [vkh_compile_options, has_c11_threads_support_defines, '-DVKH_STATIC_BUILD'],
+    cpp_args: [vkh_compile_options, has_c11_threads_support_defines, '-DVKH_STATIC_BUILD'],
     build_by_default: true,
     install: true,
     sources: vkh_src,
index f9cea2ed8c8587b442bffb1167c672af62826dc4..6a457848729d225a279d4679382f986ebde5f272 100644 (file)
@@ -21,6 +21,7 @@ freely, subject to the following restrictions:
     distribution.
 */
 
+#if defined(STDC_VERSION) && (STDC_VERSION >= 201102L) && !defined(STDC_NO_THREADS)
 /* 2013-01-06 Camilla Löwy <elmindreda@glfw.org>
  *
  * Added casts from time_t to DWORD to avoid warnings on VC++.
@@ -591,4 +592,4 @@ int _tthread_clock_gettime(clockid_t clk_id, struct timespec *ts)
   return 0;
 }
 #endif // _TTHREAD_EMULATE_CLOCK_GETTIME_
-
+#endif // END OF STDC_NO_THREADS
\ No newline at end of file
index 42958c393e86ec8bc55ee10e150a02f243f71041..71b3e725c289fe2784ab569b78ec1a7addaea6d1 100644 (file)
@@ -23,7 +23,7 @@ freely, subject to the following restrictions:
 
 #ifndef _TINYCTHREAD_H_
 #define _TINYCTHREAD_H_
-
+#if defined(STDC_VERSION) && (STDC_VERSION >= 201102L) && !defined(STDC_NO_THREADS)
 /**
 * @file
 * @mainpage TinyCThread API Reference
@@ -438,6 +438,7 @@ void *tss_get(tss_t key);
 */
 int tss_set(tss_t key, void *val);
 
-
-#endif /* _TINYTHREAD_H_ */
-
+#else
+#include <threads.h>
+#endif
+#endif /* _TINYTHREAD_H_ */
\ No newline at end of file