From 22acf85d054f7df8f4dc1eecd92c4d784112763c Mon Sep 17 00:00:00 2001 From: darktux Date: Fri, 5 Apr 2024 01:58:30 +0200 Subject: [PATCH] Fix GCC builds with Debug build type When compiling with -DCMAKE_BUILD_TYPE=Debug, GCC would (correctly) fail to compile intrinsics in stb and host1x due to lack of optimizations. Sadly, the compilation error given is bogus and Clang completing the builds without issues does raise some eyebrows. Therefore, force optimizations for the offending files under GCC when creating Debug builds. Signed-off-by: voidanix --- src/common/CMakeLists.txt | 9 +++++++++ src/video_core/CMakeLists.txt | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 52931afc31..796ffc26b1 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -239,6 +239,15 @@ if (MSVC) ) else() set_source_files_properties(stb.cpp PROPERTIES COMPILE_OPTIONS "-Wno-implicit-fallthrough;-Wno-missing-declarations;-Wno-missing-field-initializers") + + # Get around GCC failing with intrinsics in Debug + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_BUILD_TYPE MATCHES "Debug") + set_property( + SOURCE stb.cpp + APPEND + PROPERTY COMPILE_OPTIONS ";-O2" + ) + endif() endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index ed8bf6c008..6c0dda296e 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -364,6 +364,11 @@ else() # VMA set_source_files_properties(vulkan_common/vma.cpp PROPERTIES COMPILE_OPTIONS "-Wno-conversion;-Wno-unused-variable;-Wno-unused-parameter;-Wno-missing-field-initializers") + + # Get around GCC failing with intrinsics in Debug + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_BUILD_TYPE MATCHES "Debug") + set_source_files_properties(host1x/vic.cpp PROPERTIES COMPILE_OPTIONS "-O2") + endif() endif() if (ARCHITECTURE_x86_64)