From cae6c13ffbb57fba3186c1c4cfdd7b4fbc631b5a Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Tue, 22 Nov 2022 17:38:43 -0500 Subject: [PATCH 1/6] value.h: remove recursive include --- src/shader_recompiler/frontend/ir/value.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/shader_recompiler/frontend/ir/value.h b/src/shader_recompiler/frontend/ir/value.h index e8bbb93a5..8b34356fd 100644 --- a/src/shader_recompiler/frontend/ir/value.h +++ b/src/shader_recompiler/frontend/ir/value.h @@ -23,7 +23,6 @@ #include "shader_recompiler/frontend/ir/pred.h" #include "shader_recompiler/frontend/ir/reg.h" #include "shader_recompiler/frontend/ir/type.h" -#include "shader_recompiler/frontend/ir/value.h" namespace Shader::IR { From 5695ae6bdd52ca9e5f23f6892894c75c7bd7eda0 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Tue, 22 Nov 2022 17:48:32 -0500 Subject: [PATCH 2/6] externals: Update dynarmic Includes precompiled headers commit --- externals/dynarmic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/externals/dynarmic b/externals/dynarmic index 07c614f91..a5b57bb9c 160000 --- a/externals/dynarmic +++ b/externals/dynarmic @@ -1 +1 @@ -Subproject commit 07c614f91b0af5335e1f9c0653c2d75e7b5f53bd +Subproject commit a5b57bb9cd1500a6e0a3c800b35c1984211dff1d From 37bc5118ea8f5891741faba8963ce9ae5f88e946 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Tue, 22 Nov 2022 18:38:23 -0500 Subject: [PATCH 3/6] CMake: Use precompiled headers --- CMakeLists.txt | 2 ++ src/CMakeLists.txt | 7 ++++++- src/audio_core/CMakeLists.txt | 5 +++++ src/audio_core/precompiled_headers.h | 12 ++++++++++++ src/common/CMakeLists.txt | 6 ++++++ src/common/precompiled_headers.h | 12 ++++++++++++ src/core/CMakeLists.txt | 5 +++++ src/core/precompiled_headers.h | 14 ++++++++++++++ src/dedicated_room/CMakeLists.txt | 5 +++++ src/dedicated_room/precompiled_headers.h | 12 ++++++++++++ src/input_common/CMakeLists.txt | 5 +++++ src/input_common/precompiled_headers.h | 12 ++++++++++++ src/network/CMakeLists.txt | 5 +++++ src/network/precompiled_headers.h | 12 ++++++++++++ src/shader_recompiler/CMakeLists.txt | 5 +++++ src/shader_recompiler/precompiled_headers.h | 13 +++++++++++++ src/tests/CMakeLists.txt | 5 +++++ src/tests/precompiled_headers.h | 12 ++++++++++++ src/video_core/CMakeLists.txt | 5 +++++ src/video_core/precompiled_headers.h | 12 ++++++++++++ src/web_service/CMakeLists.txt | 5 +++++ src/web_service/precompiled_headers.h | 12 ++++++++++++ src/yuzu/CMakeLists.txt | 5 +++++ src/yuzu/precompiled_headers.h | 12 ++++++++++++ src/yuzu_cmd/CMakeLists.txt | 5 +++++ src/yuzu_cmd/precompiled_headers.h | 12 ++++++++++++ 26 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 src/audio_core/precompiled_headers.h create mode 100644 src/common/precompiled_headers.h create mode 100644 src/core/precompiled_headers.h create mode 100644 src/dedicated_room/precompiled_headers.h create mode 100644 src/input_common/precompiled_headers.h create mode 100644 src/network/precompiled_headers.h create mode 100644 src/shader_recompiler/precompiled_headers.h create mode 100644 src/tests/precompiled_headers.h create mode 100644 src/video_core/precompiled_headers.h create mode 100644 src/web_service/precompiled_headers.h create mode 100644 src/yuzu/precompiled_headers.h create mode 100644 src/yuzu_cmd/precompiled_headers.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d2761ec1..901a04857 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,8 @@ option(YUZU_USE_BUNDLED_OPUS "Compile bundled opus" ON) option(YUZU_TESTS "Compile tests" ON) +option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON) + CMAKE_DEPENDENT_OPTION(YUZU_CRASH_DUMPS "Compile Windows crash dump (Minidump) support" OFF "WIN32" OFF) option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" "${MSVC}") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0ac3d254e..25703e9d5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -82,8 +82,9 @@ if (MSVC) /wd4324 # 'struct_name': structure was padded due to __declspec(align()) ) - if (USE_CCACHE) + if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS) # when caching, we need to use /Z7 to downgrade debug info to use an older but more cachable format + # Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21 add_compile_options(/Z7) else() add_compile_options(/Zi) @@ -151,6 +152,10 @@ else() endif() endif() +if (YUZU_USE_PRECOMPILED_HEADERS) + set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON) +endif() + add_subdirectory(common) add_subdirectory(core) add_subdirectory(audio_core) diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt index 8e3a8f5a8..0a8c4280c 100644 --- a/src/audio_core/CMakeLists.txt +++ b/src/audio_core/CMakeLists.txt @@ -31,6 +31,7 @@ add_library(audio_core STATIC out/audio_out.h out/audio_out_system.cpp out/audio_out_system.h + precompiled_headers.h renderer/adsp/adsp.cpp renderer/adsp/adsp.h renderer/adsp/audio_renderer.cpp @@ -229,3 +230,7 @@ if(ENABLE_SDL2) target_link_libraries(audio_core PRIVATE SDL2) target_compile_definitions(audio_core PRIVATE HAVE_SDL2) endif() + +if (YUZU_USE_PRECOMPILED_HEADERS) + target_precompile_headers(audio_core PRIVATE precompiled_headers.h) +endif() diff --git a/src/audio_core/precompiled_headers.h b/src/audio_core/precompiled_headers.h new file mode 100644 index 000000000..5f81bef98 --- /dev/null +++ b/src/audio_core/precompiled_headers.h @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include + +#include + +#include "common/assert.h" diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index b7c15c191..25fe5f56f 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -95,6 +95,7 @@ add_library(common STATIC param_package.h parent_of_member.h point.h + precompiled_headers.h quaternion.h reader_writer_queue.h ring_buffer.h @@ -183,3 +184,8 @@ else() target_link_libraries(common PRIVATE $,zstd::libzstd_shared,zstd::libzstd_static>) endif() + +if (YUZU_USE_PRECOMPILED_HEADERS) + target_precompile_headers(common PRIVATE precompiled_headers.h) + set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON) +endif() diff --git a/src/common/precompiled_headers.h b/src/common/precompiled_headers.h new file mode 100644 index 000000000..5f81bef98 --- /dev/null +++ b/src/common/precompiled_headers.h @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include + +#include + +#include "common/assert.h" diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 5629980d9..6530d3c60 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -771,6 +771,7 @@ add_library(core STATIC memory.h perf_stats.cpp perf_stats.h + precompiled_headers.h reporter.cpp reporter.h telemetry_session.cpp @@ -825,3 +826,7 @@ if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) ) target_link_libraries(core PRIVATE dynarmic) endif() + +if (YUZU_USE_PRECOMPILED_HEADERS) + target_precompile_headers(core PRIVATE precompiled_headers.h) +endif() diff --git a/src/core/precompiled_headers.h b/src/core/precompiled_headers.h new file mode 100644 index 000000000..d224877ea --- /dev/null +++ b/src/core/precompiled_headers.h @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include + +#include // used by service.h which is heavily included +#include // used by k_auto_object.h which is heavily included +#include + +#include "common/assert.h" diff --git a/src/dedicated_room/CMakeLists.txt b/src/dedicated_room/CMakeLists.txt index 2d9731f19..5bbe1d4b5 100644 --- a/src/dedicated_room/CMakeLists.txt +++ b/src/dedicated_room/CMakeLists.txt @@ -4,6 +4,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) add_executable(yuzu-room + precompiled_headers.h yuzu_room.cpp yuzu_room.rc ) @@ -25,3 +26,7 @@ target_link_libraries(yuzu-room PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) if(UNIX AND NOT APPLE) install(TARGETS yuzu-room) endif() + +if (YUZU_USE_PRECOMPILED_HEADERS) + target_precompile_headers(yuzu-room PRIVATE precompiled_headers.h) +endif() diff --git a/src/dedicated_room/precompiled_headers.h b/src/dedicated_room/precompiled_headers.h new file mode 100644 index 000000000..5f81bef98 --- /dev/null +++ b/src/dedicated_room/precompiled_headers.h @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include + +#include + +#include "common/assert.h" diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt index cc6f0ffc0..77bfe4b58 100644 --- a/src/input_common/CMakeLists.txt +++ b/src/input_common/CMakeLists.txt @@ -34,6 +34,7 @@ add_library(input_common STATIC input_poller.h main.cpp main.h + precompiled_headers.h ) if (MSVC) @@ -63,3 +64,7 @@ target_link_libraries(input_common PRIVATE usb) create_target_directory_groups(input_common) target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost) + +if (YUZU_USE_PRECOMPILED_HEADERS) + target_precompile_headers(input_common PRIVATE precompiled_headers.h) +endif() diff --git a/src/input_common/precompiled_headers.h b/src/input_common/precompiled_headers.h new file mode 100644 index 000000000..5f81bef98 --- /dev/null +++ b/src/input_common/precompiled_headers.h @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include + +#include + +#include "common/assert.h" diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt index 6f8ca4b90..c85c308de 100644 --- a/src/network/CMakeLists.txt +++ b/src/network/CMakeLists.txt @@ -8,6 +8,7 @@ add_library(network STATIC network.h packet.cpp packet.h + precompiled_headers.h room.cpp room.h room_member.cpp @@ -23,3 +24,7 @@ if (ENABLE_WEB_SERVICE) target_compile_definitions(network PRIVATE -DENABLE_WEB_SERVICE) target_link_libraries(network PRIVATE web_service) endif() + +if (YUZU_USE_PRECOMPILED_HEADERS) + target_precompile_headers(network PRIVATE precompiled_headers.h) +endif() diff --git a/src/network/precompiled_headers.h b/src/network/precompiled_headers.h new file mode 100644 index 000000000..5f81bef98 --- /dev/null +++ b/src/network/precompiled_headers.h @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include + +#include + +#include "common/assert.h" diff --git a/src/shader_recompiler/CMakeLists.txt b/src/shader_recompiler/CMakeLists.txt index 545d69c7e..967ec9ba7 100644 --- a/src/shader_recompiler/CMakeLists.txt +++ b/src/shader_recompiler/CMakeLists.txt @@ -230,6 +230,7 @@ add_library(shader_recompiler STATIC ir_opt/texture_pass.cpp ir_opt/verification_pass.cpp object_pool.h + precompiled_headers.h profile.h program_header.h runtime_info.h @@ -258,3 +259,7 @@ else() endif() create_target_directory_groups(shader_recompiler) + +if (YUZU_USE_PRECOMPILED_HEADERS) + target_precompile_headers(shader_recompiler PRIVATE precompiled_headers.h) +endif() diff --git a/src/shader_recompiler/precompiled_headers.h b/src/shader_recompiler/precompiled_headers.h new file mode 100644 index 000000000..bd8f64a2e --- /dev/null +++ b/src/shader_recompiler/precompiled_headers.h @@ -0,0 +1,13 @@ +// SPDX-FileCopyrightText: 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include + +#include + +#include "common/assert.h" +#include "frontend/maxwell/translate/impl/impl.h" diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 43ad2c7ff..348d1edf4 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -11,6 +11,7 @@ add_executable(tests common/unique_function.cpp core/core_timing.cpp core/internal_network/network.cpp + precompiled_headers.h tests.cpp video_core/buffer_base.cpp input_common/calibration_configuration_job.cpp @@ -22,3 +23,7 @@ target_link_libraries(tests PRIVATE common core input_common) target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Catch2::Catch2 Threads::Threads) add_test(NAME tests COMMAND tests) + +if (YUZU_USE_PRECOMPILED_HEADERS) + target_precompile_headers(tests PRIVATE precompiled_headers.h) +endif() diff --git a/src/tests/precompiled_headers.h b/src/tests/precompiled_headers.h new file mode 100644 index 000000000..5f81bef98 --- /dev/null +++ b/src/tests/precompiled_headers.h @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include + +#include + +#include "common/assert.h" diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index b03a30992..97609ded4 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -84,6 +84,7 @@ add_library(video_core STATIC gpu_thread.h memory_manager.cpp memory_manager.h + precompiled_headers.h pte_kind.h query_cache.h rasterizer_accelerated.cpp @@ -300,3 +301,7 @@ endif() if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) target_link_libraries(video_core PRIVATE dynarmic) endif() + +if (YUZU_USE_PRECOMPILED_HEADERS) + target_precompile_headers(video_core PRIVATE precompiled_headers.h) +endif() diff --git a/src/video_core/precompiled_headers.h b/src/video_core/precompiled_headers.h new file mode 100644 index 000000000..5f81bef98 --- /dev/null +++ b/src/video_core/precompiled_headers.h @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include + +#include + +#include "common/assert.h" diff --git a/src/web_service/CMakeLists.txt b/src/web_service/CMakeLists.txt index 3f75d97d1..19534b9e4 100644 --- a/src/web_service/CMakeLists.txt +++ b/src/web_service/CMakeLists.txt @@ -4,6 +4,7 @@ add_library(web_service STATIC announce_room_json.cpp announce_room_json.h + precompiled_headers.h telemetry_json.cpp telemetry_json.h verify_login.cpp @@ -17,3 +18,7 @@ add_library(web_service STATIC create_target_directory_groups(web_service) target_link_libraries(web_service PRIVATE common network nlohmann_json::nlohmann_json httplib cpp-jwt) + +if (YUZU_USE_PRECOMPILED_HEADERS) + target_precompile_headers(web_service PRIVATE precompiled_headers.h) +endif() diff --git a/src/web_service/precompiled_headers.h b/src/web_service/precompiled_headers.h new file mode 100644 index 000000000..5f81bef98 --- /dev/null +++ b/src/web_service/precompiled_headers.h @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include + +#include + +#include "common/assert.h" diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 0aa109dd3..4de45c9ba 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -186,6 +186,7 @@ add_executable(yuzu multiplayer/state.cpp multiplayer/state.h multiplayer/validation.h + precompiled_headers.h startup_checks.cpp startup_checks.h uisettings.cpp @@ -405,3 +406,7 @@ endif() if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) target_link_libraries(yuzu PRIVATE dynarmic) endif() + +if (YUZU_USE_PRECOMPILED_HEADERS) + target_precompile_headers(yuzu PRIVATE precompiled_headers.h) +endif() diff --git a/src/yuzu/precompiled_headers.h b/src/yuzu/precompiled_headers.h new file mode 100644 index 000000000..5f81bef98 --- /dev/null +++ b/src/yuzu/precompiled_headers.h @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include + +#include + +#include "common/assert.h" diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt index 7d8ca3d8a..daabf608d 100644 --- a/src/yuzu_cmd/CMakeLists.txt +++ b/src/yuzu_cmd/CMakeLists.txt @@ -24,6 +24,7 @@ add_executable(yuzu-cmd emu_window/emu_window_sdl2_gl.h emu_window/emu_window_sdl2_vk.cpp emu_window/emu_window_sdl2_vk.h + precompiled_headers.h yuzu.cpp yuzu.rc ) @@ -55,3 +56,7 @@ if (MSVC) include(CopyYuzuSDLDeps) copy_yuzu_SDL_deps(yuzu-cmd) endif() + +if (YUZU_USE_PRECOMPILED_HEADERS) + target_precompile_headers(yuzu-cmd PRIVATE precompiled_headers.h) +endif() diff --git a/src/yuzu_cmd/precompiled_headers.h b/src/yuzu_cmd/precompiled_headers.h new file mode 100644 index 000000000..5f81bef98 --- /dev/null +++ b/src/yuzu_cmd/precompiled_headers.h @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include + +#include + +#include "common/assert.h" From 51358d2b5e05b476c450402da1351855fb723135 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Tue, 29 Nov 2022 23:01:32 -0500 Subject: [PATCH 4/6] CMake: Disable PCH on MSVC + Buildcache configs --- CMakeLists.txt | 14 ++++++++++++++ src/CMakeLists.txt | 4 ---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 901a04857..9a6536fd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,20 @@ elseif(NOT "$ENV{VCPKG_TOOLCHAIN_FILE}" STREQUAL "") include("$ENV{VCPKG_TOOLCHAIN_FILE}") endif() +if (YUZU_USE_PRECOMPILED_HEADERS) + if (MSVC AND CCACHE) + # buildcache does not properly cache PCH files, leading to compilation errors. + # See https://github.com/mbitsnbites/buildcache/discussions/230 + message(WARNING "buildcache does not properly support Precompiled Headers. Disabling PCH") + set(YUZU_USE_PRECOMPILED_HEADERS OFF) + endif() +endif() +if (YUZU_USE_PRECOMPILED_HEADERS) + message(STATUS "Using Precompiled Headers.") + set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON) +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/src/CMakeLists.txt b/src/CMakeLists.txt index 25703e9d5..fc53e76b9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -152,10 +152,6 @@ else() endif() endif() -if (YUZU_USE_PRECOMPILED_HEADERS) - set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON) -endif() - add_subdirectory(common) add_subdirectory(core) add_subdirectory(audio_core) From 3c39c0ac3e710df45af1f812a9015378b2d7ada4 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Tue, 29 Nov 2022 23:03:30 -0500 Subject: [PATCH 5/6] string_util: Fix Mingw compile error Co-Authored-By: liamwhite <9658600+liamwhite@users.noreply.github.com> --- src/common/string_util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 7a495bc79..b26db4796 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -141,7 +141,7 @@ static std::wstring CPToUTF16(u32 code_page, const std::string& input) { MultiByteToWideChar(code_page, 0, input.data(), static_cast(input.size()), nullptr, 0); if (size == 0) { - return L""; + return {}; } std::wstring output(size, L'\0'); @@ -158,7 +158,7 @@ std::string UTF16ToUTF8(const std::wstring& input) { const auto size = WideCharToMultiByte(CP_UTF8, 0, input.data(), static_cast(input.size()), nullptr, 0, nullptr, nullptr); if (size == 0) { - return ""; + return {}; } std::string output(size, '\0'); From 5b5612c1cc1ef7a4888e7c45e41b15433127a2e5 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Tue, 29 Nov 2022 23:22:03 -0500 Subject: [PATCH 6/6] CMake: Consolidate common PCH headers --- src/audio_core/precompiled_headers.h | 8 +------- src/common/CMakeLists.txt | 2 +- src/common/common_precompiled_headers.h | 14 ++++++++++++++ src/common/precompiled_headers.h | 8 +------- src/core/precompiled_headers.h | 9 +++------ src/dedicated_room/precompiled_headers.h | 8 +------- src/input_common/precompiled_headers.h | 8 +------- src/network/precompiled_headers.h | 8 +------- src/shader_recompiler/precompiled_headers.h | 8 +------- src/tests/precompiled_headers.h | 8 +------- src/video_core/precompiled_headers.h | 8 +------- src/web_service/precompiled_headers.h | 8 +------- src/yuzu/precompiled_headers.h | 8 +------- src/yuzu_cmd/precompiled_headers.h | 8 +------- 14 files changed, 29 insertions(+), 84 deletions(-) create mode 100644 src/common/common_precompiled_headers.h diff --git a/src/audio_core/precompiled_headers.h b/src/audio_core/precompiled_headers.h index 5f81bef98..aabae730b 100644 --- a/src/audio_core/precompiled_headers.h +++ b/src/audio_core/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_precompiled_headers.h" diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 25fe5f56f..a12edc584 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -37,6 +37,7 @@ add_library(common STATIC cache_management.cpp cache_management.h common_funcs.h + common_precompiled_headers.h common_types.h concepts.h div_ceil.h @@ -187,5 +188,4 @@ endif() if (YUZU_USE_PRECOMPILED_HEADERS) target_precompile_headers(common PRIVATE precompiled_headers.h) - set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON) endif() diff --git a/src/common/common_precompiled_headers.h b/src/common/common_precompiled_headers.h new file mode 100644 index 000000000..be7e5b5f9 --- /dev/null +++ b/src/common/common_precompiled_headers.h @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include +#include + +#include + +#include "common/assert.h" +#include "common/common_types.h" diff --git a/src/common/precompiled_headers.h b/src/common/precompiled_headers.h index 5f81bef98..aabae730b 100644 --- a/src/common/precompiled_headers.h +++ b/src/common/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_precompiled_headers.h" diff --git a/src/core/precompiled_headers.h b/src/core/precompiled_headers.h index d224877ea..30a31001d 100644 --- a/src/core/precompiled_headers.h +++ b/src/core/precompiled_headers.h @@ -3,12 +3,9 @@ #pragma once -#include -#include -#include - #include // used by service.h which is heavily included #include // used by k_auto_object.h which is heavily included -#include -#include "common/assert.h" +#include "common/common_precompiled_headers.h" + +#include "core/hle/kernel/k_process.h" diff --git a/src/dedicated_room/precompiled_headers.h b/src/dedicated_room/precompiled_headers.h index 5f81bef98..aabae730b 100644 --- a/src/dedicated_room/precompiled_headers.h +++ b/src/dedicated_room/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_precompiled_headers.h" diff --git a/src/input_common/precompiled_headers.h b/src/input_common/precompiled_headers.h index 5f81bef98..aabae730b 100644 --- a/src/input_common/precompiled_headers.h +++ b/src/input_common/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_precompiled_headers.h" diff --git a/src/network/precompiled_headers.h b/src/network/precompiled_headers.h index 5f81bef98..aabae730b 100644 --- a/src/network/precompiled_headers.h +++ b/src/network/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_precompiled_headers.h" diff --git a/src/shader_recompiler/precompiled_headers.h b/src/shader_recompiler/precompiled_headers.h index bd8f64a2e..5dd6b7eca 100644 --- a/src/shader_recompiler/precompiled_headers.h +++ b/src/shader_recompiler/precompiled_headers.h @@ -3,11 +3,5 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_precompiled_headers.h" #include "frontend/maxwell/translate/impl/impl.h" diff --git a/src/tests/precompiled_headers.h b/src/tests/precompiled_headers.h index 5f81bef98..aabae730b 100644 --- a/src/tests/precompiled_headers.h +++ b/src/tests/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_precompiled_headers.h" diff --git a/src/video_core/precompiled_headers.h b/src/video_core/precompiled_headers.h index 5f81bef98..aabae730b 100644 --- a/src/video_core/precompiled_headers.h +++ b/src/video_core/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_precompiled_headers.h" diff --git a/src/web_service/precompiled_headers.h b/src/web_service/precompiled_headers.h index 5f81bef98..aabae730b 100644 --- a/src/web_service/precompiled_headers.h +++ b/src/web_service/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_precompiled_headers.h" diff --git a/src/yuzu/precompiled_headers.h b/src/yuzu/precompiled_headers.h index 5f81bef98..aabae730b 100644 --- a/src/yuzu/precompiled_headers.h +++ b/src/yuzu/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_precompiled_headers.h" diff --git a/src/yuzu_cmd/precompiled_headers.h b/src/yuzu_cmd/precompiled_headers.h index 5f81bef98..aabae730b 100644 --- a/src/yuzu_cmd/precompiled_headers.h +++ b/src/yuzu_cmd/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_precompiled_headers.h"