0
0
mirror of https://notabug.org/litucks/torzu.git synced 2025-04-24 09:05:13 +00:00

Allow Yuzu to be built using Clang-CL for better compiler optimizations for Windows

Also updates Boost to 1.88.0
This commit is contained in:
spectranator 2025-04-12 18:44:18 +02:00
parent 709f70a3b2
commit a640bbee41
49 changed files with 349 additions and 199 deletions

View File

@ -10,13 +10,14 @@ apt -y install libfmt-dev libenet-dev liblz4-dev nlohmann-json3-dev zlib1g-dev l
# Install correct version of boost
cd /tmp
wget https://web.archive.org/web/20241120101759id_/https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.tar.bz2
tar xf boost_1_84_0.tar.bz2
cd boost_1_84_0
wget https://archives.boost.io/release/1.88.0/source/boost_1_88_0.tar.bz2
echo "Extracting Boost sources..."
tar xf boost_1_88_0.tar.bz2
cd boost_1_88_0
./bootstrap.sh
./b2 install --with-{headers,context} link=static
cd ..
rm -rf boost_1_84_0
rm -rf boost_1_88_0
# Build Torzu
cd /tmp

View File

@ -85,10 +85,78 @@ option(YUZU_ENABLE_PORTABLE "Allow yuzu to enable portable mode if a user folder
option(YUZU_USE_LLVM_DEMANGLE "Use LLVM Demangle" ON)
option(YUZU_NO_PRECOMPILED_HEADERS "Do not precompile headers" OFF)
CMAKE_DEPENDENT_OPTION(YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "NOT WIN32" OFF)
CMAKE_DEPENDENT_OPTION(USE_SYSTEM_MOLTENVK "Use the system MoltenVK lib (instead of the bundled one)" OFF "APPLE" OFF)
if (YUZU_NO_PRECOMPILED_HEADERS)
function (target_precompile_headers)
# Do nothing instead
endfunction()
endif()
# Detect current compilation architecture and create standard definitions
# =======================================================================
include(CheckSymbolExists)
function(detect_architecture symbol arch)
if (NOT DEFINED ARCHITECTURE)
set(CMAKE_REQUIRED_QUIET 1)
check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch})
unset(CMAKE_REQUIRED_QUIET)
# The output variable needs to be unique across invocations otherwise
# CMake's crazy scope rules will keep it defined
if (ARCHITECTURE_${arch})
set(ARCHITECTURE "${arch}" PARENT_SCOPE)
set(ARCHITECTURE_${arch} 1 PARENT_SCOPE)
add_definitions(-DARCHITECTURE_${arch}=1)
endif()
endif()
endfunction()
if (NOT ENABLE_GENERIC)
if (MSVC)
detect_architecture("_M_AMD64" x86_64)
detect_architecture("_M_IX86" x86)
detect_architecture("_M_ARM" arm)
detect_architecture("_M_ARM64" arm64)
else()
detect_architecture("__x86_64__" x86_64)
detect_architecture("__i386__" x86)
detect_architecture("__arm__" arm)
detect_architecture("__aarch64__" arm64)
endif()
endif()
if (NOT DEFINED ARCHITECTURE)
set(ARCHITECTURE "GENERIC")
set(ARCHITECTURE_GENERIC 1)
add_definitions(-DARCHITECTURE_GENERIC=1)
endif()
message(STATUS "Target architecture: ${ARCHITECTURE} (${YUZU_MARCH})")
if (MSVC AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(YUZU_MARCH "SSE4.2" CACHE STRING "Compile for specified x86 arch (AVX, AVX2, etc.)")
add_compile_options(/arch:${YUZU_MARCH})
else()
if (ARCHITECTURE STREQUAL "x86_64")
set(YUZU_MARCH "x86-64-v2" CACHE STRING "Compile for specified x86 microarchitecture level (x86-64-v3, native, etc.)")
add_compile_options(-march=${YUZU_MARCH})
elseif (ARCHITECTURE STREQUAL "arm64")
set(YUZU_MARCH "armv8-a" CACHE STRING "Compile for specified ARM architecture (armv8.1-a, native, etc.)")
add_compile_options(-march=${YUZU_MARCH})
else()
message(WARNING "Architecture ${ARCHITECTURE} unknown, EXPECT THINGS TO GO WRONG.")
endif()
endif()
if (MSVC)
add_definitions(-DWIN32)
endif()
set(DEFAULT_ENABLE_OPENSSL ON)
if (ANDROID OR WIN32 OR APPLE)
# - Windows defaults to the Schannel backend.
@ -244,46 +312,6 @@ if (NOT EXISTS ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.
file(WRITE ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json "")
endif()
# Detect current compilation architecture and create standard definitions
# =======================================================================
include(CheckSymbolExists)
function(detect_architecture symbol arch)
if (NOT DEFINED ARCHITECTURE)
set(CMAKE_REQUIRED_QUIET 1)
check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch})
unset(CMAKE_REQUIRED_QUIET)
# The output variable needs to be unique across invocations otherwise
# CMake's crazy scope rules will keep it defined
if (ARCHITECTURE_${arch})
set(ARCHITECTURE "${arch}" PARENT_SCOPE)
set(ARCHITECTURE_${arch} 1 PARENT_SCOPE)
add_definitions(-DARCHITECTURE_${arch}=1)
endif()
endif()
endfunction()
if (NOT ENABLE_GENERIC)
if (MSVC)
detect_architecture("_M_AMD64" x86_64)
detect_architecture("_M_IX86" x86)
detect_architecture("_M_ARM" arm)
detect_architecture("_M_ARM64" arm64)
else()
detect_architecture("__x86_64__" x86_64)
detect_architecture("__i386__" x86)
detect_architecture("__arm__" arm)
detect_architecture("__aarch64__" arm64)
endif()
endif()
if (NOT DEFINED ARCHITECTURE)
set(ARCHITECTURE "GENERIC")
set(ARCHITECTURE_GENERIC 1)
add_definitions(-DARCHITECTURE_GENERIC=1)
endif()
message(STATUS "Target architecture: ${ARCHITECTURE}")
if (UNIX)
add_definitions(-DYUZU_UNIX=1)
@ -317,7 +345,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
# Enforce the search mode of non-required packages for better and shorter failure messages
if (NOT YUZU_USE_CPM)
find_package(Boost 1.79.0 REQUIRED context)
find_package(Boost 1.86.0 REQUIRED context)
find_package(enet 1.3 MODULE)
find_package(fmt REQUIRED)
if (YUZU_USE_LLVM_DEMANGLE)
@ -335,10 +363,20 @@ if (NOT YUZU_USE_CPM)
else()
include(CMakeModules/CPM.cmake)
# Disable tests in all externals supporting the standard option name
set(BUILD_TESTING OFF)
# Build only static externals
set(BUILD_SHARED_LIBS OFF)
# Do not attempt to use Brotli in httplib since we're not downloading it
set(HTTPLIB_USE_BROTLI_IF_AVAILABLE OFF)
message(STATUS "Downloading and extracting boost library sources. This will take some time...")
CPMAddPackage(
NAME boost
URL "https://github.com/boostorg/boost/releases/download/boost-1.88.0/boost-1.88.0-cmake.7z"
PATCHES boost-1.88.0-fix.patch
VERSION 1.88.0
)
CPMAddPackage("gh:lsalzman/enet@1.3.18")
@ -363,12 +401,20 @@ else()
)
add_subdirectory(${zstd_SOURCE_DIR}/build/cmake zstd)
CPMAddPackage("gh:KhronosGroup/SPIRV-Headers#vulkan-sdk-1.3.280.0")
CPMAddPackage("gh:yhirose/cpp-httplib@0.20.0")
# Set up required aliases
add_library(enet::enet ALIAS enet)
add_library(Opus::opus ALIAS opus)
add_library(lz4::lz4 ALIAS lz4)
add_library(zstd::zstd ALIAS libzstd)
add_library(zstd::libzstd ALIAS libzstd)
add_library(nlohmann::json ALIAS nlohmann_json)
# Enet specific setup to add missing include dir
add_library(enet_fixed INTERFACE)
target_link_libraries(enet_fixed INTERFACE enet)
target_include_directories(enet_fixed INTERFACE ${enet_SOURCE_DIR}/include)
add_library(enet::enet ALIAS enet_fixed)
endif()
if (NOT YUZU_USE_EXTERNAL_VULKAN_HEADERS)
@ -422,7 +468,6 @@ endif()
if (ENABLE_WEB_SERVICE)
find_package(cpp-jwt 1.4 CONFIG)
find_package(httplib 0.12 MODULE COMPONENTS OpenSSL)
endif()
if (YUZU_TESTS)
@ -596,6 +641,10 @@ if(ENABLE_QT)
if (DEFINED QT_BUILD)
download_bundled_external("qt/" ${QT_BUILD} QT_PREFIX)
execute_process(COMMAND chmod +x ${QT_PREFIX}/bin/moc.exe ERROR_QUIET)
execute_process(COMMAND chmod +x ${QT_PREFIX}/bin/uic.exe ERROR_QUIET)
execute_process(COMMAND chmod +x ${QT_PREFIX}/bin/rcc.exe ERROR_QUIET)
execute_process(COMMAND chmod +x ${QT_PREFIX}/bin/lrelease.exe ERROR_QUIET)
endif()
set(QT_PREFIX_HINT HINTS "${QT_PREFIX}")
@ -775,6 +824,59 @@ if (MSVC AND CMAKE_GENERATOR STREQUAL "Ninja")
)
endif()
# Adjustments for Clang-cl
if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND ARCHITECTURE STREQUAL "x86_64")
set(LLVM_MINGW_VERSION 20250402)
# Set download URL and library path within the ZIP
set(ZIP_URL "https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_MINGW_VERSION}/llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-x86_64.zip")
set(LIB_PATH "llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-x86_64/lib/clang/20/lib/windows/libclang_rt.builtins-x86_64.a")
# Set paths for download and extraction
set(DOWNLOAD_DIR "${CMAKE_BINARY_DIR}/llvm-mingw-download")
set(ZIP_FILE "${DOWNLOAD_DIR}/llvm-mingw.zip")
set(EXTRACTED_LIB "${DOWNLOAD_DIR}/${LIB_PATH}")
# Create download directory if it doesn't exist
file(MAKE_DIRECTORY "${DOWNLOAD_DIR}")
# Download and extract if the library doesn't exist
if(NOT EXISTS "${EXTRACTED_LIB}")
message(STATUS "Downloading llvm-mingw runtime libraries...")
# Download the ZIP file
file(DOWNLOAD
${ZIP_URL}
${ZIP_FILE}
SHOW_PROGRESS
# Uncomment and add EXPECTED_HASH if you know the SHA256 checksum
EXPECTED_HASH SHA256=4edc13d878b4ec49c2f1a6e9161abb093bbaefc8b7d129f3b3f57a22a4a41d38
)
message(STATUS "Extracting compiler-rt builtins library...")
# Extract the specific file from the ZIP
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xvf "${ZIP_FILE}" "${LIB_PATH}"
WORKING_DIRECTORY "${DOWNLOAD_DIR}"
RESULT_VARIABLE extraction_result
)
if(NOT extraction_result EQUAL 0)
message(FATAL_ERROR "Failed to extract library: ${extraction_result}")
endif()
endif()
# Create imported target for the library
add_library(llvm-mingw-runtime STATIC IMPORTED)
set_target_properties(llvm-mingw-runtime PROPERTIES
IMPORTED_LOCATION "${EXTRACTED_LIB}"
)
# Link the library to all executables in the project
link_libraries(llvm-mingw-runtime)
endif()
if (YUZU_USE_FASTER_LD AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# We will assume that if the compiler is GCC, it will attempt to use ld.bfd by default.
# Try to pick a faster linker.

View File

@ -98,22 +98,22 @@ function(copy_yuzu_Qt5_deps target_dir)
"${Qt5_XCBGLINTEGRATIONS_DIR}libqxcb-glx-integration.so"
)
foreach(LIB ${Qt5_DLLS})
file(COPY ${LIB} DESTINATION "${DLL_DEST}/lib" FOLLOW_SYMLINK_CHAIN)
file(COPY "${LIB}" DESTINATION "${DLL_DEST}/lib" FOLLOW_SYMLINK_CHAIN)
endforeach()
foreach(LIB ${Qt5_IMAGEFORMAT_DLLS})
file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/imageformats/" FOLLOW_SYMLINK_CHAIN)
file(COPY "${LIB}" DESTINATION "${DLL_DEST}plugins/imageformats/" FOLLOW_SYMLINK_CHAIN)
endforeach()
foreach(LIB ${Qt5_PLATFORMTHEME_DLLS})
file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/platformthemes/" FOLLOW_SYMLINK_CHAIN)
file(COPY "${LIB}" DESTINATION "${DLL_DEST}plugins/platformthemes/" FOLLOW_SYMLINK_CHAIN)
endforeach()
foreach(LIB ${Qt5_PLATFORM_DLLS})
file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/platforms/" FOLLOW_SYMLINK_CHAIN)
file(COPY "${LIB}" DESTINATION "${DLL_DEST}plugins/platforms/" FOLLOW_SYMLINK_CHAIN)
endforeach()
foreach(LIB ${Qt5_PLATFORMINPUTCONTEXT_DLLS})
file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/platforminputcontexts/" FOLLOW_SYMLINK_CHAIN)
file(COPY "${LIB}" DESTINATION "${DLL_DEST}plugins/platforminputcontexts/" FOLLOW_SYMLINK_CHAIN)
endforeach()
foreach(LIB ${Qt5_XCBGLINTEGRATION_DLLS})
file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/xcbglintegrations/" FOLLOW_SYMLINK_CHAIN)
file(COPY "${LIB}" DESTINATION "${DLL_DEST}plugins/xcbglintegrations/" FOLLOW_SYMLINK_CHAIN)
endforeach()
endif()

View File

@ -12,16 +12,25 @@ set(__windows_copy_files YES)
# Any number of files to copy from SOURCE_DIR to DEST_DIR can be specified after DEST_DIR.
# This copying happens post-build.
function(windows_copy_files TARGET SOURCE_DIR DEST_DIR)
# windows commandline expects the / to be \ so switch them
string(REPLACE "/" "\\\\" SOURCE_DIR ${SOURCE_DIR})
string(REPLACE "/" "\\\\" DEST_DIR ${DEST_DIR})
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
function(windows_copy_files TARGET SOURCE_DIR DEST_DIR)
# windows commandline expects the / to be \ so switch them
string(REPLACE "/" "\\\\" SOURCE_DIR ${SOURCE_DIR})
string(REPLACE "/" "\\\\" DEST_DIR ${DEST_DIR})
# /NJH /NJS /NDL /NFL /NC /NS /NP - Silence any output
# cmake adds an extra check for command success which doesn't work too well with robocopy
# so trick it into thinking the command was successful with the || cmd /c "exit /b 0"
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEST_DIR}
COMMAND robocopy ${SOURCE_DIR} ${DEST_DIR} ${ARGN} /NJH /NJS /NDL /NFL /NC /NS /NP || cmd /c "exit /b 0"
)
endfunction()
# /NJH /NJS /NDL /NFL /NC /NS /NP - Silence any output
# cmake adds an extra check for command success which doesn't work too well with robocopy
# so trick it into thinking the command was successful with the || cmd /c "exit /b 0"
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEST_DIR}
COMMAND robocopy ${SOURCE_DIR} ${DEST_DIR} ${ARGN} /NJH /NJS /NDL /NFL /NC /NS /NP || cmd /c "exit /b 0"
)
endfunction()
else()
function(windows_copy_files TARGET SOURCE_DIR DEST_DIR)
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEST_DIR}
COMMAND cp -ra ${SOURCE_DIR}/. ${DEST_DIR}
)
endfunction()
endif()

24
boost-1.88.0-fix.patch Normal file
View File

@ -0,0 +1,24 @@
diff -ruN boost-src/libs/cobalt/include/boost/cobalt/concepts.hpp boost-src-patched/libs/cobalt/include/boost/cobalt/concepts.hpp
--- boost-src/libs/cobalt/include/boost/cobalt/concepts.hpp 2025-04-12 18:25:53.791233755 +0200
+++ boost-src-patched/libs/cobalt/include/boost/cobalt/concepts.hpp 2025-04-12 18:29:50.304496166 +0200
@@ -62,7 +62,7 @@
template <typename T>
concept with_get_executor = requires (T& t)
{
- {t.get_executor()} -> asio::execution::executor;
+ t.get_executor();
};
diff -ruN boost-src/libs/context/CMakeLists.txt boost-src-patched/libs/context/CMakeLists.txt
--- boost-src/libs/context/CMakeLists.txt 2025-04-12 18:25:53.847233801 +0200
+++ boost-src-patched/libs/context/CMakeLists.txt 2025-04-12 18:29:33.436479899 +0200
@@ -189,7 +189,7 @@
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set_property(SOURCE ${ASM_SOURCES} APPEND PROPERTY COMPILE_OPTIONS "-x" "assembler-with-cpp")
- elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT MSVC)
set_property(SOURCE ${ASM_SOURCES} APPEND PROPERTY COMPILE_OPTIONS "-Wno-unused-command-line-argument")
endif()

View File

@ -182,32 +182,29 @@ endif()
#
# Install
#
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
# Only try to install if boost wasn't included as submodule
if (NOT TARGET boost_headers)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
# Hack to get CPM.cmake working with this (should be fine though)
set(BOOST_TARGET )
if (TARGET boost_headers)
set(BOOST_TARGET boost_headers)
install(TARGETS dynarmic EXPORT dynarmicTargets)
install(EXPORT dynarmicTargets
NAMESPACE dynarmic::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/dynarmic"
)
configure_package_config_file(CMakeModules/dynarmicConfig.cmake.in
dynarmicConfig.cmake
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/dynarmic"
)
write_basic_package_version_file(dynarmicConfigVersion.cmake
COMPATIBILITY SameMajorVersion
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/dynarmicConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/dynarmicConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/dynarmic"
)
install(DIRECTORY src/dynarmic TYPE INCLUDE FILES_MATCHING PATTERN "*.h")
endif()
install(TARGETS dynarmic ${BOOST_TARGET} EXPORT dynarmicTargets)
install(EXPORT dynarmicTargets
NAMESPACE dynarmic::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/dynarmic"
)
configure_package_config_file(CMakeModules/dynarmicConfig.cmake.in
dynarmicConfig.cmake
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/dynarmic"
)
write_basic_package_version_file(dynarmicConfigVersion.cmake
COMPATIBILITY SameMajorVersion
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/dynarmicConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/dynarmicConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/dynarmic"
)
install(DIRECTORY src/dynarmic TYPE INCLUDE FILES_MATCHING PATTERN "*.h")

View File

@ -510,7 +510,7 @@ target_link_libraries(dynarmic
if (TARGET boost_headers)
target_link_libraries(dynarmic
PRIVATE
boost_headers
boost_headers boost_variant boost_icl
)
else()
target_link_libraries(dynarmic

View File

@ -57,8 +57,7 @@ if (MSVC)
/EHsc
/Zc:throwingNew # Assumes new never returns null
/Zc:inline # Omits inline functions from object-file output
/DNOMINMAX
/WX)
/DNOMINMAX)
if (CMAKE_VS_PLATFORM_TOOLSET MATCHES "LLVM-vs[0-9]+")
list(APPEND SIRIT_CXX_FLAGS
@ -76,8 +75,7 @@ else()
-Wno-missing-braces
-Wconversion
-Wsign-conversion
-Wshadow
-Werror)
-Wshadow)
endif()
# Enable unit-testing.

View File

@ -110,11 +110,17 @@ else()
add_compile_options(
-fwrapv
-Werror=all
-Werror=extra
-Werror=missing-declarations
-Werror=shadow
-Werror=unused
# These cause issues with Boost, let's just set them to regular warnings instead (for now)
#-Werror=all
#-Werror=extra
#-Werror=missing-declarations
#-Werror=shadow
#-Werror=unused
-Wall
-Wextra
-Wmissing-declarations
-Wshadow
-Wunused
-Wno-attributes
-Wno-invalid-offsetof

View File

@ -53,7 +53,7 @@ add_library(audio_core STATIC
out/audio_out.h
out/audio_out_system.cpp
out/audio_out_system.h
precompiled_headers.h
precompiled_headers.hpp
renderer/audio_device.cpp
renderer/audio_device.h
renderer/audio_renderer.h
@ -261,7 +261,7 @@ if (ANDROID)
endif()
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(audio_core PRIVATE precompiled_headers.h)
target_precompile_headers(audio_core PRIVATE precompiled_headers.hpp)
endif()
create_target_directory_groups(audio_core)

View File

@ -3,4 +3,4 @@
#pragma once
#include "common/common_precompiled_headers.h"
#include "common/common_precompiled_headers.hpp"

View File

@ -34,7 +34,7 @@ add_library(common STATIC
cityhash.cpp
cityhash.h
common_funcs.h
common_precompiled_headers.h
common_precompiled_headers.hpp
common_types.h
concepts.h
container_hash.h
@ -103,7 +103,7 @@ add_library(common STATIC
param_package.h
parent_of_member.h
point.h
precompiled_headers.h
precompiled_headers.hpp
quaternion.h
range_map.h
range_mutex.h
@ -260,6 +260,9 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
endif()
target_link_libraries(common PUBLIC Boost::context Boost::headers fmt::fmt microprofile stb::headers Threads::Threads)
if (YUZU_USE_CPM)
target_link_libraries(common PUBLIC Boost::icl)
endif()
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle)
if (ANDROID)
@ -268,7 +271,7 @@ if (ANDROID)
endif()
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(common PRIVATE precompiled_headers.h)
target_precompile_headers(common PRIVATE precompiled_headers.hpp)
endif()
create_target_directory_groups(common)

View File

@ -3,4 +3,4 @@
#pragma once
#include "common/common_precompiled_headers.h"
#include "common/common_precompiled_headers.hpp"

View File

@ -5,7 +5,11 @@
#include <utility>
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
#define MSV_BUT_NOT_CLANG
#endif
#ifdef MSV_BUT_NOT_CLANG
#include <intrin.h>
#pragma intrinsic(__umulh)
#pragma intrinsic(_umul128)
@ -20,7 +24,7 @@ namespace Common {
// This function multiplies 2 u64 values and divides it by a u64 value.
[[nodiscard]] static inline u64 MultiplyAndDivide64(u64 a, u64 b, u64 d) {
#ifdef _MSC_VER
#ifdef MSV_BUT_NOT_CLANG
u128 r{};
r[0] = _umul128(a, b, &r[1]);
u64 remainder;
@ -41,7 +45,7 @@ namespace Common {
// This function multiplies 2 u64 values and produces a u128 value;
[[nodiscard]] static inline u128 Multiply64Into128(u64 a, u64 b) {
u128 result;
#ifdef _MSC_VER
#ifdef MSV_BUT_NOT_CLANG
result[0] = _umul128(a, b, &result[1]);
#else
unsigned __int128 tmp = a;

View File

@ -24,7 +24,7 @@ constexpr auto PauseCycles = 100'000U;
} // Anonymous namespace
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
__forceinline static void TPAUSE() {
static constexpr auto RequestC02State = 0U;
_tpause(RequestC02State, FencedRDTSC() + PauseCycles);

View File

@ -1133,7 +1133,7 @@ add_library(core STATIC
memory/dmnt_cheat_vm.h
perf_stats.cpp
perf_stats.h
precompiled_headers.h
precompiled_headers.hpp
reporter.cpp
reporter.h
tools/freezer.cpp
@ -1150,7 +1150,9 @@ if (MSVC)
)
else()
target_compile_options(core PRIVATE
-Werror=conversion
# Currently causes issues with Boost, degrading it to just a warning for now...
#-Werror=conversion
-Wconversion
-Wno-sign-conversion
-Wno-cast-function-type
@ -1161,6 +1163,9 @@ endif()
target_link_libraries(core PUBLIC common PRIVATE audio_core hid_core network video_core nx_tzdb tz)
target_link_libraries(core PUBLIC Boost::headers PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls RenderDoc::API)
if (YUZU_USE_CPM)
target_link_libraries(core PUBLIC Boost::heap Boost::asio Boost::process Boost::crc)
endif()
if (MINGW)
target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY})
endif()
@ -1230,7 +1235,7 @@ else()
endif()
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(core PRIVATE precompiled_headers.h)
target_precompile_headers(core PRIVATE precompiled_headers.hpp)
endif()
if (YUZU_ENABLE_LTO)

View File

@ -6,7 +6,7 @@
#include <thread>
#include <boost/asio.hpp>
#include <boost/process/async_pipe.hpp>
#include <boost/process/v1/async_pipe.hpp>
#include "common/logging/log.h"
#include "common/polyfill_thread.h"
@ -326,7 +326,7 @@ private:
struct ConnectionState {
boost::asio::ip::tcp::socket client_socket;
boost::process::async_pipe signal_pipe;
boost::process::v1::async_pipe signal_pipe;
SignalInfo info;
Kernel::KScopedAutoObject<Kernel::KThread> active_thread;

View File

@ -191,12 +191,12 @@ private:
struct VM {
static constexpr u32 YUZU_PAGESIZE{0x1000};
static constexpr u32 PAGE_SIZE_BITS{std::countr_zero(YUZU_PAGESIZE)};
static constexpr u32 PAGE_SIZE_BITS{static_cast<u32>(std::countr_zero(YUZU_PAGESIZE))};
static constexpr u32 SUPPORTED_BIG_PAGE_SIZES{0x30000};
static constexpr u32 DEFAULT_BIG_PAGE_SIZE{0x20000};
u32 big_page_size{DEFAULT_BIG_PAGE_SIZE};
u32 big_page_size_bits{std::countr_zero(DEFAULT_BIG_PAGE_SIZE)};
u32 big_page_size_bits{static_cast<u32>(std::countr_zero(DEFAULT_BIG_PAGE_SIZE))};
static constexpr u32 VA_START_SHIFT{10};
static constexpr u64 DEFAULT_VA_SPLIT{1ULL << 34};

View File

@ -6,6 +6,6 @@
#include <boost/container/flat_map.hpp> // used by service.h which is heavily included
#include <boost/intrusive/rbtree.hpp> // used by k_auto_object.h which is heavily included
#include "common/common_precompiled_headers.h"
#include "common/common_precompiled_headers.hpp"
#include "core/hle/kernel/k_process.h"

View File

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
add_executable(yuzu-room
precompiled_headers.h
precompiled_headers.hpp
yuzu_room.cpp
yuzu_room.rc
)
@ -24,7 +24,7 @@ if(UNIX AND NOT APPLE)
endif()
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(yuzu-room PRIVATE precompiled_headers.h)
target_precompile_headers(yuzu-room PRIVATE precompiled_headers.hpp)
endif()
create_target_directory_groups(yuzu-room)

View File

@ -3,4 +3,4 @@
#pragma once
#include "common/common_precompiled_headers.h"
#include "common/common_precompiled_headers.hpp"

View File

@ -134,7 +134,7 @@ add_library(hid_core STATIC
hid_result.h
hid_types.h
hid_util.h
precompiled_headers.h
precompiled_headers.hpp
resource_manager.cpp
resource_manager.h
)
@ -160,5 +160,5 @@ create_target_directory_groups(hid_core)
target_link_libraries(hid_core PUBLIC core)
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(hid_core PRIVATE precompiled_headers.h)
target_precompile_headers(hid_core PRIVATE precompiled_headers.hpp)
endif()

View File

@ -3,4 +3,4 @@
#pragma once
#include "common/common_precompiled_headers.h"
#include "common/common_precompiled_headers.hpp"

View File

@ -32,7 +32,7 @@ add_library(input_common STATIC
input_poller.h
main.cpp
main.h
precompiled_headers.h
precompiled_headers.hpp
)
if (MSVC)
@ -42,7 +42,9 @@ if (MSVC)
)
else()
target_compile_options(input_common PRIVATE
-Werror=conversion
# Causes Boost to fail to compile, let's just let it be a warning for now.
#-Werror=conversion
-Wconversion
)
endif()
@ -89,7 +91,7 @@ create_target_directory_groups(input_common)
target_link_libraries(input_common PUBLIC hid_core PRIVATE common Boost::headers)
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(input_common PRIVATE precompiled_headers.h)
target_precompile_headers(input_common PRIVATE precompiled_headers.hpp)
endif()
if (ANDROID)

View File

@ -26,8 +26,8 @@ public:
using clock = std::chrono::system_clock;
explicit Socket(const std::string& host, u16 port, SocketCallback callback_)
: callback(std::move(callback_)), timer(io_service),
socket(io_service, udp::endpoint(udp::v4(), 0)), client_id(GenerateRandomClientId()) {
: callback(std::move(callback_)), timer(io_context),
socket(io_context, udp::endpoint(udp::v4(), 0)), client_id(GenerateRandomClientId()) {
boost::system::error_code ec{};
auto ipv4 = boost::asio::ip::make_address_v4(host, ec);
if (ec.value() != boost::system::errc::success) {
@ -39,11 +39,11 @@ public:
}
void Stop() {
io_service.stop();
io_context.stop();
}
void Loop() {
io_service.run();
io_context.run();
}
void StartSend(const clock::time_point& from) {
@ -113,7 +113,7 @@ private:
}
SocketCallback callback;
boost::asio::io_service io_service;
boost::asio::io_context io_context;
boost::asio::basic_waitable_timer<clock> timer;
udp::socket socket;

View File

@ -1,6 +0,0 @@
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/common_precompiled_headers.h"

View File

@ -0,0 +1,6 @@
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/common_precompiled_headers.hpp"

View File

@ -8,7 +8,7 @@ add_library(network STATIC
network.h
packet.cpp
packet.h
precompiled_headers.h
precompiled_headers.hpp
room.cpp
room.h
room_member.cpp
@ -26,5 +26,5 @@ if (ENABLE_WEB_SERVICE)
endif()
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(network PRIVATE precompiled_headers.h)
target_precompile_headers(network PRIVATE precompiled_headers.hpp)
endif()

View File

@ -1,6 +0,0 @@
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/common_precompiled_headers.h"

View File

@ -0,0 +1,6 @@
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/common_precompiled_headers.hpp"

View File

@ -234,7 +234,7 @@ add_library(shader_recompiler STATIC
ir_opt/vendor_workaround_pass.cpp
ir_opt/verification_pass.cpp
object_pool.h
precompiled_headers.h
precompiled_headers.hpp
profile.h
program_header.h
runtime_info.h
@ -269,5 +269,5 @@ endif()
create_target_directory_groups(shader_recompiler)
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(shader_recompiler PRIVATE precompiled_headers.h)
target_precompile_headers(shader_recompiler PRIVATE precompiled_headers.hpp)
endif()

View File

@ -3,5 +3,5 @@
#pragma once
#include "common/common_precompiled_headers.h"
#include "common/common_precompiled_headers.hpp"
#include "frontend/maxwell/translate/impl/impl.h"

View File

@ -14,7 +14,7 @@ add_executable(tests
common/unique_function.cpp
core/core_timing.cpp
core/internal_network/network.cpp
precompiled_headers.h
precompiled_headers.hpp
video_core/memory_tracker.cpp
input_common/calibration_configuration_job.cpp
)
@ -27,5 +27,5 @@ target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Catch2::Catch2WithMain
add_test(NAME tests COMMAND tests)
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(tests PRIVATE precompiled_headers.h)
target_precompile_headers(tests PRIVATE precompiled_headers.hpp)
endif()

View File

@ -14,7 +14,7 @@
class FakeCemuhookServer {
public:
FakeCemuhookServer()
: socket(io_service, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 0)) {}
: socket(io_context, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 0)) {}
~FakeCemuhookServer() {
is_running = false;
@ -82,7 +82,7 @@ public:
}
private:
boost::asio::io_service io_service;
boost::asio::io_context io_context;
boost::asio::ip::udp::socket socket;
std::array<u8, InputCommon::CemuhookUDP::MAX_PACKET_SIZE> send_buffer;
std::array<u8, InputCommon::CemuhookUDP::MAX_PACKET_SIZE> receive_buffer;

View File

@ -1,6 +0,0 @@
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/common_precompiled_headers.h"

View File

@ -0,0 +1,6 @@
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/common_precompiled_headers.hpp"

View File

@ -99,7 +99,7 @@ add_library(video_core STATIC
invalidation_accumulator.h
memory_manager.cpp
memory_manager.h
precompiled_headers.h
precompiled_headers.hpp
present.h
pte_kind.h
query_cache/bank_base.h
@ -372,10 +372,6 @@ if (ARCHITECTURE_x86_64)
macro/macro_jit_x64.h
)
target_link_libraries(video_core PUBLIC xbyak::xbyak)
if (NOT MSVC)
target_compile_options(video_core PRIVATE -msse4.1)
endif()
endif()
if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
@ -383,7 +379,7 @@ if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
endif()
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(video_core PRIVATE precompiled_headers.h)
target_precompile_headers(video_core PRIVATE precompiled_headers.hpp)
endif()
if (YUZU_ENABLE_LTO)

View File

@ -1,6 +0,0 @@
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/common_precompiled_headers.h"

View File

@ -0,0 +1,6 @@
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/common_precompiled_headers.hpp"

View File

@ -4,7 +4,7 @@
add_library(web_service STATIC
announce_room_json.cpp
announce_room_json.h
precompiled_headers.h
precompiled_headers.hpp
verify_login.cpp
verify_login.h
verify_user_jwt.cpp
@ -18,5 +18,5 @@ create_target_directory_groups(web_service)
target_link_libraries(web_service PRIVATE common network nlohmann_json::nlohmann_json httplib::httplib cpp-jwt::cpp-jwt)
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(web_service PRIVATE precompiled_headers.h)
target_precompile_headers(web_service PRIVATE precompiled_headers.hpp)
endif()

View File

@ -1,6 +0,0 @@
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/common_precompiled_headers.h"

View File

@ -0,0 +1,6 @@
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/common_precompiled_headers.hpp"

View File

@ -203,7 +203,7 @@ add_executable(yuzu
multiplayer/validation.h
play_time_manager.cpp
play_time_manager.h
precompiled_headers.h
precompiled_headers.hpp
qt_common.cpp
qt_common.h
startup_checks.cpp
@ -382,8 +382,11 @@ elseif(WIN32)
endif()
target_link_libraries(yuzu PRIVATE common core input_common frontend_common network video_core)
target_link_libraries(yuzu PRIVATE Boost::headers glad Qt${QT_MAJOR_VERSION}::Widgets)
target_link_libraries(yuzu PRIVATE Boost::headers httplib::httplib glad Qt${QT_MAJOR_VERSION}::Widgets)
target_link_libraries(yuzu PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
if (TARGET nlohmann::json)
target_link_libraries(yuzu PRIVATE nlohmann::json)
endif()
if (ENABLE_WEB_SERVICE)
target_link_libraries(yuzu PRIVATE httplib::httplib)
endif()
@ -477,7 +480,7 @@ if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
endif()
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(yuzu PRIVATE precompiled_headers.h)
target_precompile_headers(yuzu PRIVATE precompiled_headers.hpp)
endif()
create_target_directory_groups(yuzu)

View File

@ -1,6 +0,0 @@
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/common_precompiled_headers.h"

View File

@ -0,0 +1,6 @@
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/common_precompiled_headers.hpp"

View File

@ -22,7 +22,7 @@ if (YUZU_CMD)
emu_window/emu_window_sdl2_null.h
emu_window/emu_window_sdl2_vk.cpp
emu_window/emu_window_sdl2_vk.h
precompiled_headers.h
precompiled_headers.hpp
sdl_config.cpp
sdl_config.h
yuzu.cpp
@ -60,7 +60,7 @@ if (YUZU_CMD)
endif()
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(yuzu-cmd PRIVATE precompiled_headers.h)
target_precompile_headers(yuzu-cmd PRIVATE precompiled_headers.hpp)
endif()
create_target_directory_groups(yuzu-cmd)

View File

@ -1,6 +0,0 @@
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/common_precompiled_headers.h"

View File

@ -0,0 +1,6 @@
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/common_precompiled_headers.hpp"