# Precompiled header macro. Parameters are source file list and filename for pch cpp file.
macro(glslang_pch SRCS PCHCPP)
- if(MSVC AND CMAKE_GENERATOR MATCHES "^Visual Studio" AND ENABLE_PCH)
+ if(MSVC AND CMAKE_GENERATOR MATCHES "^Visual Studio" AND NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND ENABLE_PCH)
set(PCH_NAME "$(IntDir)\\pch.pch")
# make source files use/depend on PCH_NAME
set_source_files_properties(${${SRCS}} PROPERTIES COMPILE_FLAGS "/Yupch.h /FIpch.h /Fp${PCH_NAME} /Zm300" OBJECT_DEPENDS "${PCH_NAME}")
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0")
add_compile_options(-Werror=deprecated-copy)
endif()
-elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
+elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
-Wunused-parameter -Wunused-value -Wunused-variable)
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
if(NOT ENABLE_RTTI)
add_compile_options(-fno-rtti)
endif()
-elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC")
+elseif(MSVC)
if(NOT ENABLE_RTTI)
add_compile_options(/GR-) # Disable RTTI
endif()
add_compile_options(/Os /GR-)
else()
add_compile_options(-Os -fno-exceptions)
- if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
+ if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
add_compile_options(-Wno-unused-parameter)
add_compile_options(-Wno-unused-variable -Wno-unused-const-variable)
endif()
return reinterpret_cast<const glslang_resource_t*>(&glslang::DefaultTBuiltInResource);
}
+#if defined(__clang__) || defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable : 4996)
+#endif
+
const char* glslang_default_resource_string()
{
std::string cpp_str = glslang::GetDefaultTBuiltInResourceString();
return c_str;
}
+#if defined(__clang__) || defined(__GNUC__)
+#pragma GCC diagnostic pop
+#elif defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
void glslang_decode_resource_limits(glslang_resource_t* resources, char* config)
{
glslang::DecodeResourceLimits(reinterpret_cast<TBuiltInResource*>(resources), config);