diff --git a/cmake/3rdparty/glsl-optimizer.cmake b/cmake/3rdparty/glsl-optimizer.cmake index 7692d98..2cfc8fe 100755 --- a/cmake/3rdparty/glsl-optimizer.cmake +++ b/cmake/3rdparty/glsl-optimizer.cmake @@ -24,6 +24,9 @@ set( GLSL-OPTIMIZER_INCLUDES file( GLOB GLCPP_SOURCES ${BGFX_DIR}/3rdparty/glsl-optimizer/src/glsl/glcpp/*.c ${BGFX_DIR}/3rdparty/glsl-optimizer/src/util/*.c ) add_library( glcpp ${GLCPP_SOURCES} ) target_include_directories( glcpp PUBLIC ${GLSL-OPTIMIZER_INCLUDES} ) +if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") +target_compile_options( glcpp PRIVATE "-fno-strict-aliasing") +endif() if( MSVC ) set_target_properties( glcpp PROPERTIES COMPILE_FLAGS "/W0" ) endif() @@ -33,6 +36,9 @@ set_target_properties( glcpp PROPERTIES FOLDER "bgfx/3rdparty" ) file( GLOB MESA_SOURCES ${BGFX_DIR}/3rdparty/glsl-optimizer/src/mesa/program/*.c ${BGFX_DIR}/3rdparty/glsl-optimizer/src/mesa/main/*.c ) add_library( mesa ${MESA_SOURCES} ) target_include_directories( mesa PUBLIC ${GLSL-OPTIMIZER_INCLUDES} ) +if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") +target_compile_options( mesa PRIVATE "-fno-strict-aliasing") +endif() if( MSVC ) set_target_properties( mesa PROPERTIES COMPILE_FLAGS "/W0" ) endif() @@ -44,6 +50,9 @@ file( GLOB GLSL-OPTIMIZER_SOURCES_REMOVE ${BGFX_DIR}/3rdparty/glsl-optimizer/src list( REMOVE_ITEM GLSL-OPTIMIZER_SOURCES ${GLSL-OPTIMIZER_SOURCES_REMOVE} ) add_library( glsl-optimizer ${GLSL-OPTIMIZER_SOURCES} ) target_link_libraries( glsl-optimizer glcpp mesa ) +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") +target_compile_options( glsl-optimizer PRIVATE "-fno-strict-aliasing") +endif() if( MSVC ) set_target_properties( glsl-optimizer PROPERTIES COMPILE_FLAGS "/W0" ) endif()