aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaio Oliveira <caiooliveirafarias0@gmail.com>2025-11-13 03:20:38 +0100
committercrueter <crueter@eden-emu.dev>2025-11-13 03:20:38 +0100
commit028765867feae4a1cae77bfc3370c73381cfeb2d (patch)
tree86f43f996864f1a86b430bae378fbb44c43bd9e0
parentd89df63a287b75ed4402cfac43c23261d778a9bb (diff)
externals: Fix Debug builds and remove PCH leftover (#3000)
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3000 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Co-committed-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
-rw-r--r--CMakeLists.txt34
-rw-r--r--CMakeModules/MinGWClangCross.cmake58
-rw-r--r--CMakeModules/MinGWCross.cmake57
-rw-r--r--externals/CMakeLists.txt7
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/dynarmic/CMakeLists.txt5
6 files changed, 20 insertions, 147 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ff0667d8e8..6f099834c3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -307,11 +307,9 @@ endif()
# On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion
cmake_dependent_option(ENABLE_SDL2 "Enable the SDL2 frontend" ON "NOT ANDROID" OFF)
-if (ENABLE_SDL2)
- # TODO(crueter): Cleanup, each dep that has a bundled option should allow to choose between bundled, external, system
- cmake_dependent_option(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" OFF "NOT MSVC" OFF)
- option(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 build" "${MSVC}")
-endif()
+# TODO(crueter): Cleanup, each dep that has a bundled option should allow to choose between bundled, external, system
+cmake_dependent_option(YUZU_USE_EXTERNAL_SDL2 "Build SDL2 from external source" OFF "ENABLE_SDL2;NOT MSVC" OFF)
+cmake_dependent_option(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 build" "${MSVC}" "ENABLE_SDL2" OFF)
# qt stuff
option(ENABLE_QT "Enable the Qt frontend" ON)
@@ -332,10 +330,14 @@ option(YUZU_USE_CPM "Use CPM to fetch system dependencies (fmt, boost, etc) if n
# ffmpeg
option(YUZU_USE_BUNDLED_FFMPEG "Download bundled FFmpeg" ${EXT_DEFAULT})
-cmake_dependent_option(YUZU_USE_EXTERNAL_FFMPEG "Build FFmpeg from source" "${PLATFORM_SUN}" "NOT WIN32 AND NOT ANDROID" OFF)
+cmake_dependent_option(YUZU_USE_EXTERNAL_FFMPEG "Build FFmpeg from external source" "${PLATFORM_SUN}" "NOT WIN32 AND NOT ANDROID" OFF)
# sirit
-option(YUZU_USE_BUNDLED_SIRIT "Download bundled sirit" ${EXT_DEFAULT})
+set(BUNDLED_SIRIT_DEFAULT OFF)
+if ((MSVC AND NOT (CMAKE_BUILD_TYPE MATCHES "Debug|RelWithDebInfo") OR ANDROID))
+ set(BUNDLED_SIRIT_DEFAULT ON)
+endif()
+option(YUZU_USE_BUNDLED_SIRIT "Download bundled sirit" ${BUNDLED_SIRIT_DEFAULT})
# Re-allow on FreeBSD once its on mainline ports
cmake_dependent_option(ENABLE_LIBUSB "Enable the use of LibUSB" ON "WIN32 OR PLATFORM_LINUX OR APPLE" OFF)
@@ -372,6 +374,17 @@ if(USE_CCACHE)
else()
message(FATAL_ERROR "USE_CCACHE enabled, but no executable found at: ${CCACHE_PATH}")
endif()
+ # Follow SCCache recommendations:
+ # <https://github.com/mozilla/sccache/blob/main/README.md?plain=1#L144>
+ if(WIN32)
+ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
+ string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
+ elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
+ string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
+ string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
+ endif()
+ endif()
endif()
# TODO(crueter): CI this?
@@ -443,13 +456,6 @@ if (ANDROID)
set(CMAKE_POLICY_VERSION_MINIMUM 3.5) # Workaround for Oboe
endif()
-# We need to downgrade debug info (/Zi -> /Z7) to use an older but more cacheable format
-# See https://github.com/nanoant/CMakePCHCompiler/issues/21
-if(WIN32 AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
- string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
- string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
-endif()
-
# Default to a Release build
get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE)
diff --git a/CMakeModules/MinGWClangCross.cmake b/CMakeModules/MinGWClangCross.cmake
deleted file mode 100644
index 286a59a7ad..0000000000
--- a/CMakeModules/MinGWClangCross.cmake
+++ /dev/null
@@ -1,58 +0,0 @@
-# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-set(MINGW_PREFIX /usr/x86_64-w64-mingw32/)
-set(CMAKE_SYSTEM_NAME Windows)
-set(CMAKE_SYSTEM_PROCESSOR x86_64)
-
-set(CMAKE_FIND_ROOT_PATH ${MINGW_PREFIX})
-set(SDL2_PATH ${MINGW_PREFIX})
-set(MINGW_TOOL_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32-)
-
-# Specify the cross compiler
-set(CMAKE_C_COMPILER ${MINGW_TOOL_PREFIX}clang)
-set(CMAKE_CXX_COMPILER ${MINGW_TOOL_PREFIX}clang++)
-set(CMAKE_RC_COMPILER ${MINGW_TOOL_PREFIX}windres)
-set(CMAKE_C_COMPILER_AR ${MINGW_TOOL_PREFIX}ar)
-set(CMAKE_CXX_COMPILER_AR ${MINGW_TOOL_PREFIX}ar)
-set(CMAKE_C_COMPILER_RANLIB ${MINGW_TOOL_PREFIX}ranlib)
-set(CMAKE_CXX_COMPILER_RANLIB ${MINGW_TOOL_PREFIX}ranlib)
-
-# Mingw tools
-set(STRIP ${MINGW_TOOL_PREFIX}strip)
-set(WINDRES ${MINGW_TOOL_PREFIX}windres)
-set(ENV{PKG_CONFIG} ${MINGW_TOOL_PREFIX}pkg-config)
-
-# ccache wrapper
-option(USE_CCACHE "Use ccache for compilation" OFF)
-if(USE_CCACHE)
- find_program(CCACHE ccache)
- if(CCACHE)
- message(STATUS "Using ccache found in PATH")
- set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
- set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
- else(CCACHE)
- message(WARNING "USE_CCACHE enabled, but no ccache found")
- endif(CCACHE)
-endif(USE_CCACHE)
-
-# Search for programs in the build host directories
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-
-
-# Echo modified cmake vars to screen for debugging purposes
-if(NOT DEFINED ENV{MINGW_DEBUG_INFO})
- message("")
- message("Custom cmake vars: (blank = system default)")
- message("-----------------------------------------")
- message("* CMAKE_C_COMPILER : ${CMAKE_C_COMPILER}")
- message("* CMAKE_CXX_COMPILER : ${CMAKE_CXX_COMPILER}")
- message("* CMAKE_RC_COMPILER : ${CMAKE_RC_COMPILER}")
- message("* WINDRES : ${WINDRES}")
- message("* ENV{PKG_CONFIG} : $ENV{PKG_CONFIG}")
- message("* STRIP : ${STRIP}")
- message("* USE_CCACHE : ${USE_CCACHE}")
- message("")
- # So that the debug info only appears once
- set(ENV{MINGW_DEBUG_INFO} SHOWN)
-endif()
diff --git a/CMakeModules/MinGWCross.cmake b/CMakeModules/MinGWCross.cmake
deleted file mode 100644
index 61464f7dae..0000000000
--- a/CMakeModules/MinGWCross.cmake
+++ /dev/null
@@ -1,57 +0,0 @@
-# SPDX-FileCopyrightText: 2018 tech4me <guiwanglong@gmail.com>
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-set(MINGW_PREFIX /usr/x86_64-w64-mingw32/)
-set(CMAKE_SYSTEM_NAME Windows)
-set(CMAKE_SYSTEM_PROCESSOR x86_64)
-# Actually a hack, w/o this will cause some strange errors
-set(CMAKE_HOST_WIN32 TRUE)
-
-
-set(CMAKE_FIND_ROOT_PATH ${MINGW_PREFIX})
-set(SDL2_PATH ${MINGW_PREFIX})
-set(MINGW_TOOL_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32-)
-
-# Specify the cross compiler
-set(CMAKE_C_COMPILER ${MINGW_TOOL_PREFIX}gcc)
-set(CMAKE_CXX_COMPILER ${MINGW_TOOL_PREFIX}g++)
-set(CMAKE_RC_COMPILER ${MINGW_TOOL_PREFIX}windres)
-
-# Mingw tools
-set(STRIP ${MINGW_TOOL_PREFIX}strip)
-set(WINDRES ${MINGW_TOOL_PREFIX}windres)
-set(ENV{PKG_CONFIG} ${MINGW_TOOL_PREFIX}pkg-config)
-
-# ccache wrapper
-option(USE_CCACHE "Use ccache for compilation" OFF)
-if(USE_CCACHE)
- find_program(CCACHE ccache)
- if(CCACHE)
- message(STATUS "Using ccache found in PATH")
- set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
- set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
- else(CCACHE)
- message(WARNING "USE_CCACHE enabled, but no ccache found")
- endif(CCACHE)
-endif(USE_CCACHE)
-
-# Search for programs in the build host directories
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-
-
-# Echo modified cmake vars to screen for debugging purposes
-if(NOT DEFINED ENV{MINGW_DEBUG_INFO})
- message("")
- message("Custom cmake vars: (blank = system default)")
- message("-----------------------------------------")
- message("* CMAKE_C_COMPILER : ${CMAKE_C_COMPILER}")
- message("* CMAKE_CXX_COMPILER : ${CMAKE_CXX_COMPILER}")
- message("* CMAKE_RC_COMPILER : ${CMAKE_RC_COMPILER}")
- message("* WINDRES : ${WINDRES}")
- message("* ENV{PKG_CONFIG} : $ENV{PKG_CONFIG}")
- message("* STRIP : ${STRIP}")
- message("* USE_CCACHE : ${USE_CCACHE}")
- message("")
- # So that the debug info only appears once
- set(ENV{MINGW_DEBUG_INFO} SHOWN)
-endif()
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt
index 096760925f..51980dfffe 100644
--- a/externals/CMakeLists.txt
+++ b/externals/CMakeLists.txt
@@ -160,13 +160,6 @@ if (YUZU_USE_BUNDLED_SIRIT)
AddJsonPackage(sirit-ci)
else()
AddJsonPackage(sirit)
- # Change to old-but-more-cacheable debug info on Windows
- if (WIN32 AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
- get_target_property(sirit_opts sirit COMPILE_OPTIONS)
- list(FILTER sirit_opts EXCLUDE REGEX "/Zi")
- list(APPEND sirit_opts "/Z7")
- set_target_properties(sirit PROPERTIES COMPILE_OPTIONS "${sirit_opts}")
- endif()
if(MSVC AND CXX_CLANG)
target_compile_options(siritobj PRIVATE -Wno-error=unused-command-line-argument)
endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5f2d076899..2510458812 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -35,7 +35,6 @@ if (MSVC AND NOT CXX_CLANG)
# /W4 - Level 4 warnings
# /MP - Multi-threaded compilation
- # /Zi - Output debugging information
# /Zm - Specifies the precompiled header memory allocation limit
# /Zo - Enhanced debug info for optimized builds
# /permissive- - Enables stricter C++ standards conformance checks
@@ -98,11 +97,6 @@ if (MSVC AND NOT CXX_CLANG)
)
endif()
- if (WIN32 AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
- string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
- string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
- endif()
-
if (ARCHITECTURE_x86_64)
add_compile_options(/QIntel-jcc-erratum)
endif()
diff --git a/src/dynarmic/CMakeLists.txt b/src/dynarmic/CMakeLists.txt
index 03532c3344..5f9506273f 100644
--- a/src/dynarmic/CMakeLists.txt
+++ b/src/dynarmic/CMakeLists.txt
@@ -81,11 +81,6 @@ if (MSVC)
/bigobj # Increase number of sections in .obj files
/DNOMINMAX)
- if (WIN32 AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
- string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
- string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
- endif()
-
if (CXX_CLANG)
list(APPEND DYNARMIC_CXX_FLAGS
-Qunused-arguments