diff --git a/include/bx/macros.h b/include/bx/macros.h index de2bcb4..0b6e168 100644 --- a/include/bx/macros.h +++ b/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 diff --git a/include/bx/mutex.h b/include/bx/mutex.h index fa26965..8b59511 100644 --- a/include/bx/mutex.h +++ b/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 #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 diff --git a/include/bx/sem.h b/include/bx/sem.h index cfc1cfa..d857d57 100644 --- a/include/bx/sem.h +++ b/include/bx/sem.h @@ -9,6 +9,8 @@ #include "bx.h" #include "mutex.h" +#if BX_CONFIG_SUPPORTS_THREADING + #if BX_PLATFORM_POSIX # include # include @@ -222,4 +224,6 @@ namespace bx } // namespace bx +#endif // BX_CONFIG_SUPPORTS_THREADING + #endif // BX_SEM_H_HEADER_GUARD diff --git a/include/bx/spscqueue.h b/include/bx/spscqueue.h index 5f57fa8..fd02963 100644 --- a/include/bx/spscqueue.h +++ b/include/bx/spscqueue.h @@ -95,6 +95,7 @@ namespace bx Node* m_last; }; +#if BX_CONFIG_SUPPORTS_THREADING template class SpScUnboundedQueueMutex { @@ -147,13 +148,15 @@ namespace bx bx::LwMutex m_mutex; std::list 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 class SpScBlockingUnboundedQueue { @@ -196,6 +199,7 @@ namespace bx Semaphore m_count; SpScUnboundedQueue m_queue; }; +#endif // BX_CONFIG_SUPPORTS_THREADING } // namespace bx diff --git a/include/bx/thread.h b/include/bx/thread.h index e43c6cb..0a17446 100644 --- a/include/bx/thread.h +++ b/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 diff --git a/premake/toolchain.lua b/premake/toolchain.lua index 97cfa9e..1616f87 100755 --- a/premake/toolchain.lua +++ b/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", }