Browse Source

CMake: Now I remeber all this hacky thing is because PCH

Signed-off-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
pull/3000/head
Caio Oliveira 3 months ago
parent
commit
36a23f155e
  1. 17
      CMakeLists.txt
  2. 19
      CMakeModules/DisableCCacheForPackage.cmake
  3. 5
      externals/CMakeLists.txt
  4. 6
      src/CMakeLists.txt
  5. 5
      src/dynarmic/CMakeLists.txt

17
CMakeLists.txt

@ -173,9 +173,6 @@ if (YUZU_STATIC_BUILD)
endif()
endif()
# Windows dont like if you compile small packages too fast, disable ccache on them
include(DisableCCacheForPackage)
# Detect current compilation architecture and create standard definitions
# =======================================================================
@ -341,7 +338,7 @@ if ((MSVC AND NOT (CMAKE_BUILD_TYPE MATCHES "Debug|RelWithDebInfo") OR ANDROID))
endif()
# ffmpeg
option(YUZU_USE_BUNDLED_FFMPEG "Download bundled FFmpeg" ${USE_BUNDLED_DEFAULT})
option(YUZU_USE_BUNDLED_FFMPEG "Download bundled FFmpeg" ${USE_CPM_DEFAULT})
cmake_dependent_option(YUZU_USE_EXTERNAL_FFMPEG "Build FFmpeg from external source" "${PLATFORM_SUN}" "NOT WIN32 AND NOT ANDROID" OFF)
# sirit
@ -375,7 +372,9 @@ option(USE_CCACHE "Use ccache for compilation" OFF)
set(CCACHE_PATH "ccache" CACHE STRING "Path to ccache binary")
if(USE_CCACHE)
find_program(CCACHE_BINARY ${CCACHE_PATH})
if(CCACHE_BINARY)
if (CMAKE_BUILD_TYPE MATCHES "Debug|RelWithDebInfo")
message(WARNING "USE_CCACHE is disabled for Debug builds!")
elseif(CCACHE_BINARY)
message(STATUS "Found ccache at: ${CCACHE_BINARY}")
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_BINARY})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_BINARY})
@ -453,13 +452,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)
@ -639,7 +631,6 @@ if (YUZU_USE_CPM)
# zlib
AddJsonPackage(zlib)
DisableCCacheForPackage(zlib)
if (ZLIB_ADDED)
add_library(ZLIB::ZLIB ALIAS zlibstatic)

19
CMakeModules/DisableCCacheForPackage.cmake

@ -1,19 +0,0 @@
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
# Disable CCache for packages that build too fast and break ccache on Windows
function(DisableCCacheForPackage)
if (WIN32)
foreach(target_package IN LISTS ARGV)
if (TARGET ${target_package})
message(STATUS "[DisableCCacheForPackage] Disabling compiler launcher for target '${target_package}'")
set_target_properties(${target_package} PROPERTIES
C_COMPILER_LAUNCHER ""
CXX_COMPILER_LAUNCHER ""
)
else()
message(WARNING "[DisableCCacheForPackage] Target '${target_package}' does not exist — skipping")
endif()
endforeach()
endif()
endfunction()

5
externals/CMakeLists.txt

@ -8,7 +8,6 @@
# otherwise we have to do weird shenanigans with library linking and stuff
include(CPMUtil)
include(DisableCCacheForPackage)
# Explicitly declare this option here to propagate to the oaknut CPM call
option(DYNARMIC_TESTS "Build tests" ${BUILD_TESTING})
@ -42,7 +41,6 @@ endif()
# enet
AddJsonPackage(enet)
DisableCCacheForPackage(enet)
if (enet_ADDED)
target_include_directories(enet INTERFACE ${enet_SOURCE_DIR}/include)
@ -54,7 +52,6 @@ endif()
# mbedtls
AddJsonPackage(mbedtls)
DisableCCacheForPackage(mbedtls mbedx509 mbedcrypto)
# VulkanUtilityHeaders - pulls in headers and utility libs
AddJsonPackage(vulkan-utility-headers)
@ -167,7 +164,6 @@ else()
target_compile_options(siritobj PRIVATE -Wno-error=unused-command-line-argument)
endif()
endif()
DisableCCacheForPackage(sirit)
# SPIRV Tools
AddJsonPackage(spirv-tools)
@ -193,7 +189,6 @@ add_subdirectory(glad)
# libusb
if (ENABLE_LIBUSB)
add_subdirectory(libusb)
DisableCCacheForPackage(usb)
endif()
# VMA

6
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()

5
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

Loading…
Cancel
Save