Removed the remaining threaded tests.
Also fixed cmake target if mingw is present.
diff --git a/cmake/utils.cmake b/cmake/utils.cmake
index eb2b40b..31fb214 100644
--- a/cmake/utils.cmake
+++ b/cmake/utils.cmake
@@ -93,7 +93,7 @@
add_executable(${TEST_NAME} src/${TARGET}_test.cc)
shaderc_default_compile_options(${TEST_NAME})
if (MINGW)
- target_compile_options(${TARGET} PRIVATE -DSHADERC_DISABLE_THREADED_TESTS)
+ target_compile_options(${TEST_NAME} PRIVATE -DSHADERC_DISABLE_THREADED_TESTS)
endif()
if (PARSED_ARGS_LINK_LIBS)
target_link_libraries(${TEST_NAME} PRIVATE
diff --git a/libshaderc/src/shaderc_cpp_test.cc b/libshaderc/src/shaderc_cpp_test.cc
index ac2b763..9e3595f 100644
--- a/libshaderc/src/shaderc_cpp_test.cc
+++ b/libshaderc/src/shaderc_cpp_test.cc
@@ -171,6 +171,7 @@
EXPECT_TRUE(compiler3.IsValid());
}
+#ifndef SHADERC_DISABLE_THREADED_TESTS
TEST_F(CppInterface, MultipleThreadsInitializing) {
std::unique_ptr<shaderc::Compiler> compiler1;
std::unique_ptr<shaderc::Compiler> compiler2;
@@ -191,6 +192,7 @@
EXPECT_TRUE(compiler2->IsValid());
EXPECT_TRUE(compiler3->IsValid());
}
+#endif
TEST_F(CppInterface, CompilerMoves) {
shaderc::Compiler compiler2(std::move(compiler_));
@@ -266,6 +268,7 @@
EXPECT_THAT(result.GetErrorMessage(), HasSubstr("wrongname"));
}
+#ifndef SHADERC_DISABLE_THREADED_TESTS
TEST_F(CppInterface, MultipleThreadsCalling) {
bool results[10];
std::vector<std::thread> threads;
@@ -279,6 +282,7 @@
}
EXPECT_THAT(results, Each(true));
}
+#endif
TEST_F(CppInterface, AccessorsOnNullResultObject) {
const SpvCompilationResult result(nullptr);
diff --git a/libshaderc/src/shaderc_test.cc b/libshaderc/src/shaderc_test.cc
index 76f51b5..ee5115a 100644
--- a/libshaderc/src/shaderc_test.cc
+++ b/libshaderc/src/shaderc_test.cc
@@ -38,6 +38,7 @@
shaderc_compiler_release(compiler3);
}
+#ifndef SHADERC_DISABLE_THREADED_TESTS
TEST(Init, MultipleThreadsCalling) {
shaderc_compiler_t compiler1, compiler2, compiler3;
std::thread t1([&compiler1]() { compiler1 = shaderc_compiler_initialize(); });
@@ -53,6 +54,7 @@
shaderc_compiler_release(compiler2);
shaderc_compiler_release(compiler3);
}
+#endif
TEST(Init, SPVVersion) {
unsigned int version = 0;
@@ -975,6 +977,7 @@
HasSubstr("wrongname"));
}
+#ifndef SHADERC_DISABLE_THREADED_TESTS
TEST_F(CompileStringTest, MultipleThreadsCalling) {
ASSERT_NE(nullptr, compiler_.get_compiler_handle());
bool results[10];
@@ -990,6 +993,7 @@
}
EXPECT_THAT(results, Each(true));
}
+#endif
TEST_F(CompileKindsTest, Vertex) {
ASSERT_NE(nullptr, compiler_.get_compiler_handle());
diff --git a/libshaderc_util/include/libshaderc_util/mutex.h b/libshaderc_util/include/libshaderc_util/mutex.h
index 34a5290..4147cac 100644
--- a/libshaderc_util/include/libshaderc_util/mutex.h
+++ b/libshaderc_util/include/libshaderc_util/mutex.h
@@ -23,7 +23,10 @@
#ifdef _WIN32
// windows.h #defines min and max if we don't define this.
// this means things like std::min and std::max break
+#ifndef NOMINMAX
#define NOMINMAX
+#endif
+
#include <windows.h>
namespace shaderc_util {