ソースを参照

Added BX_CONFIG_SUPPORTS_THREADING.

bkaradzic 11 年 前
コミット
7b609ef092
6 ファイル変更22 行追加1 行削除
  1. 4 0
      include/bx/macros.h
  2. 4 0
      include/bx/mutex.h
  3. 4 0
      include/bx/sem.h
  4. 5 1
      include/bx/spscqueue.h
  5. 4 0
      include/bx/thread.h
  6. 1 0
      premake/toolchain.lua

+ 4 - 0
include/bx/macros.h

@@ -165,4 +165,8 @@
 #	define BX_CONFIG_SEMAPHORE_PTHREAD (BX_PLATFORM_OSX|BX_PLATFORM_IOS)
 #endif // BX_CONFIG_SEMAPHORE_PTHREAD
 
+#ifndef BX_CONFIG_SUPPORTS_THREADING
+#	define BX_CONFIG_SUPPORTS_THREADING !BX_PLATFORM_EMSCRIPTEN
+#endif // BX_CONFIG_SUPPORTS_THREADING
+
 #endif // BX_MACROS_H_HEADER_GUARD

+ 4 - 0
include/bx/mutex.h

@@ -10,6 +10,8 @@
 #include "cpu.h"
 #include "sem.h"
 
+#if BX_CONFIG_SUPPORTS_THREADING
+
 #if BX_PLATFORM_NACL || BX_PLATFORM_LINUX || BX_PLATFORM_ANDROID || BX_PLATFORM_OSX
 #	include <pthread.h>
 #elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360
@@ -130,4 +132,6 @@ namespace bx
 
 } // namespace bx
 
+#endif // BX_CONFIG_SUPPORTS_THREADING
+
 #endif // BX_MUTEX_H_HEADER_GUARD

+ 4 - 0
include/bx/sem.h

@@ -9,6 +9,8 @@
 #include "bx.h"
 #include "mutex.h"
 
+#if BX_CONFIG_SUPPORTS_THREADING
+
 #if BX_PLATFORM_POSIX
 #	include <errno.h>
 #	include <semaphore.h>
@@ -222,4 +224,6 @@ namespace bx
 
 } // namespace bx
 
+#endif // BX_CONFIG_SUPPORTS_THREADING
+
 #endif // BX_SEM_H_HEADER_GUARD

+ 5 - 1
include/bx/spscqueue.h

@@ -95,6 +95,7 @@ namespace bx
 		Node* m_last;
 	};
 
+#if BX_CONFIG_SUPPORTS_THREADING
 	template<typename Ty>
 	class SpScUnboundedQueueMutex
 	{
@@ -147,13 +148,15 @@ namespace bx
 		bx::LwMutex m_mutex;
 		std::list<Ty*> m_queue;
 	};
+#endif // BX_CONFIG_SUPPORTS_THREADING
 
-#if BX_CONFIG_SPSCQUEUE_USE_MUTEX
+#if BX_CONFIG_SPSCQUEUE_USE_MUTEX && BX_CONFIG_SUPPORTS_THREADING
 #	define SpScUnboundedQueue SpScUnboundedQueueMutex
 #else
 #	define SpScUnboundedQueue SpScUnboundedQueueLf
 #endif // BX_CONFIG_SPSCQUEUE_USE_MUTEX
 
+#if BX_CONFIG_SUPPORTS_THREADING
 	template <typename Ty>
 	class SpScBlockingUnboundedQueue
 	{
@@ -196,6 +199,7 @@ namespace bx
 		Semaphore m_count;
 		SpScUnboundedQueue<void> m_queue;
 	};
+#endif // BX_CONFIG_SUPPORTS_THREADING
 
 } // namespace bx
 

+ 4 - 0
include/bx/thread.h

@@ -12,6 +12,8 @@
 
 #include "sem.h"
 
+#if BX_CONFIG_SUPPORTS_THREADING
+
 namespace bx
 {
 	typedef int32_t (*ThreadFn)(void* _userData);
@@ -222,4 +224,6 @@ namespace bx
 
 } // namespace bx
 
+#endif // BX_CONFIG_SUPPORTS_THREADING
+
 #endif // BX_THREAD_H_HEADER_GUARD

+ 1 - 0
premake/toolchain.lua

@@ -480,6 +480,7 @@ function toolchain(_buildDir, _libDir)
 			"$(EMSCRIPTEN)/system/include/libc",
 		}
 		buildoptions {
+			"-Wno-unknown-warning-option", -- Linux Emscripten doesn't know about no-warn-absolute-paths...
 			"-Wno-warn-absolute-paths",
 		}