Build: Use precompiled headers

This commit is contained in:
Stenzek 2023-09-02 13:41:41 +10:00
parent 817129328b
commit cee4f93097
36 changed files with 198 additions and 46 deletions

View File

@ -78,12 +78,12 @@ if(WIN32 AND USE_SDL2)
set(SDL2_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib64/SDL2.lib") set(SDL2_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib64/SDL2.lib")
set(SDL2MAIN_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib64/SDL2main.lib") set(SDL2MAIN_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib64/SDL2main.lib")
set(SDL2_DLL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/bin64/SDL2.dll") set(SDL2_DLL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/bin64/SDL2.dll")
set(Qt6_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/qt/6.1.0/msvc2019_64/lib/cmake/Qt6") set(Qt6_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/qt/6.5.0/msvc2022_64/lib/cmake/Qt6")
else() else()
set(SDL2_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib32/SDL2.lib") set(SDL2_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib32/SDL2.lib")
set(SDL2MAIN_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib32/SDL2main.lib") set(SDL2MAIN_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/lib32/SDL2main.lib")
set(SDL2_DLL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/bin32/SDL2.dll") set(SDL2_DLL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/sdl2/bin32/SDL2.dll")
set(Qt6_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/qt/6.1.0/msvc2019_32/lib/cmake/Qt6") set(Qt6_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dep/msvc/qt/6.5.0/msvc2022_32/lib/cmake/Qt6")
endif() endif()
endif() endif()
@ -144,19 +144,6 @@ if(MSVC)
# COMDAT folding/remove unused functions. # COMDAT folding/remove unused functions.
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF /OPT:ICF") set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF /OPT:ICF")
# Enable LTO/LTCG on Release builds.
if(${CMAKE_BUILD_TYPE} STREQUAL "Release")
cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_IS_SUPPORTED)
if(IPO_IS_SUPPORTED)
message(STATUS "Enabling LTCG/IPO.")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
else()
message(WARNING "LTCG/IPO is not supported, this will make the build slightly slower.")
endif()
endif()
endif() endif()
@ -223,8 +210,14 @@ endif()
# We don't need exceptions, disable them to save a bit of code size. # We don't need exceptions, disable them to save a bit of code size.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") if(MSVC)
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_HAS_EXCEPTIONS=0 /permissive-")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
endif()
# Write binaries to a seperate directory. # Write binaries to a seperate directory.
if(WIN32) if(WIN32)

View File

@ -43,6 +43,11 @@ if(${CPU_ARCH} STREQUAL "riscv64")
add_subdirectory(riscv-disas) add_subdirectory(riscv-disas)
endif() endif()
if(WIN32)
add_subdirectory(d3d12ma)
add_subdirectory(winpixeventruntime)
endif()
if(APPLE) if(APPLE)
add_subdirectory(spirv-cross) add_subdirectory(spirv-cross)
endif() endif()

View File

@ -0,0 +1,6 @@
add_library(d3d12ma
include/D3D12MemAlloc.h
src/D3D12MemAlloc.cpp
)
target_include_directories(d3d12ma PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")

View File

@ -68,15 +68,16 @@ if(WIN32)
http_downloader_winhttp.h http_downloader_winhttp.h
thirdparty/StackWalker.cpp thirdparty/StackWalker.cpp
thirdparty/StackWalker.h thirdparty/StackWalker.h
win32_progress_callback.cpp
win32_progress_callback.h
windows_headers.h windows_headers.h
) )
target_link_libraries(common PRIVATE d3dcompiler.lib) target_link_libraries(common PRIVATE winhttp.lib)
endif()
if(MSVC)
if(${CPU_ARCH} STREQUAL "x64") if(${CPU_ARCH} STREQUAL "x64")
enable_language(ASM_MASM) enable_language(ASM_MASM)
target_sources(common PRIVATE fastjmp_x86.asm) target_sources(common PRIVATE fastjmp_x86.asm)
set_source_files_properties(fastjmp_x86.asm PROPERTIES COMPILE_FLAGS "/D_M_X86_64")
elseif(${CPU_ARCH} STREQUAL "aarch32" OR ${CPU_ARCH} STREQUAL "aarch64") elseif(${CPU_ARCH} STREQUAL "aarch32" OR ${CPU_ARCH} STREQUAL "aarch64")
enable_language(ASM_MARMASM) enable_language(ASM_MARMASM)
target_sources(common PRIVATE fastjmp_arm.asm) target_sources(common PRIVATE fastjmp_arm.asm)

View File

@ -8,7 +8,7 @@
<ItemDefinitionGroup> <ItemDefinitionGroup>
<Link> <Link>
<AdditionalDependencies>%(AdditionalDependencies);Comctl32.lib;winhttp.lib</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies);winhttp.lib</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
</Project> </Project>

View File

@ -41,7 +41,6 @@
<ClInclude Include="timer.h" /> <ClInclude Include="timer.h" />
<ClInclude Include="types.h" /> <ClInclude Include="types.h" />
<ClInclude Include="minizip_helpers.h" /> <ClInclude Include="minizip_helpers.h" />
<ClInclude Include="win32_progress_callback.h" />
<ClInclude Include="windows_headers.h" /> <ClInclude Include="windows_headers.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -66,7 +65,6 @@
<ClCompile Include="thirdparty\StackWalker.cpp" /> <ClCompile Include="thirdparty\StackWalker.cpp" />
<ClCompile Include="threading.cpp" /> <ClCompile Include="threading.cpp" />
<ClCompile Include="timer.cpp" /> <ClCompile Include="timer.cpp" />
<ClCompile Include="win32_progress_callback.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Natvis Include="bitfield.natvis" /> <Natvis Include="bitfield.natvis" />
@ -120,4 +118,4 @@
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<Import Project="..\..\dep\msvc\vsprops\Targets.props" /> <Import Project="..\..\dep\msvc\vsprops\Targets.props" />
</Project> </Project>

View File

@ -21,7 +21,6 @@
<ClInclude Include="dimensional_array.h" /> <ClInclude Include="dimensional_array.h" />
<ClInclude Include="image.h" /> <ClInclude Include="image.h" />
<ClInclude Include="minizip_helpers.h" /> <ClInclude Include="minizip_helpers.h" />
<ClInclude Include="win32_progress_callback.h" />
<ClInclude Include="make_array.h" /> <ClInclude Include="make_array.h" />
<ClInclude Include="thirdparty\StackWalker.h"> <ClInclude Include="thirdparty\StackWalker.h">
<Filter>thirdparty</Filter> <Filter>thirdparty</Filter>
@ -57,7 +56,6 @@
<ClCompile Include="progress_callback.cpp" /> <ClCompile Include="progress_callback.cpp" />
<ClCompile Include="image.cpp" /> <ClCompile Include="image.cpp" />
<ClCompile Include="minizip_helpers.cpp" /> <ClCompile Include="minizip_helpers.cpp" />
<ClCompile Include="win32_progress_callback.cpp" />
<ClCompile Include="thirdparty\StackWalker.cpp"> <ClCompile Include="thirdparty\StackWalker.cpp">
<Filter>thirdparty</Filter> <Filter>thirdparty</Filter>
</ClCompile> </ClCompile>
@ -85,4 +83,4 @@
<ItemGroup> <ItemGroup>
<MARMASM Include="fastjmp_arm.asm" /> <MARMASM Include="fastjmp_arm.asm" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -119,6 +119,7 @@ set(RECOMPILER_SRCS
cpu_recompiler_types.h cpu_recompiler_types.h
) )
target_precompile_headers(core PRIVATE "pch.h")
target_include_directories(core PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..") target_include_directories(core PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_include_directories(core PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..") target_include_directories(core PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(core PUBLIC Threads::Threads common util zlib) target_link_libraries(core PUBLIC Threads::Threads common util zlib)

View File

@ -61,6 +61,9 @@
<ClCompile Include="pad.cpp" /> <ClCompile Include="pad.cpp" />
<ClCompile Include="controller.cpp" /> <ClCompile Include="controller.cpp" />
<ClCompile Include="pcdrv.cpp" /> <ClCompile Include="pcdrv.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="pgxp.cpp" /> <ClCompile Include="pgxp.cpp" />
<ClCompile Include="playstation_mouse.cpp" /> <ClCompile Include="playstation_mouse.cpp" />
<ClCompile Include="psf_loader.cpp" /> <ClCompile Include="psf_loader.cpp" />
@ -129,6 +132,7 @@
<ClInclude Include="pad.h" /> <ClInclude Include="pad.h" />
<ClInclude Include="controller.h" /> <ClInclude Include="controller.h" />
<ClInclude Include="pcdrv.h" /> <ClInclude Include="pcdrv.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="pgxp.h" /> <ClInclude Include="pgxp.h" />
<ClInclude Include="playstation_mouse.h" /> <ClInclude Include="playstation_mouse.h" />
<ClInclude Include="psf_loader.h" /> <ClInclude Include="psf_loader.h" />
@ -189,6 +193,9 @@
<PreprocessorDefinitions>ZYDIS_DISABLE_ENCODER;ZYDIS_DISABLE_AVX512;ZYDIS_DISABLE_KNC;ZYDIS_STATIC_BUILD;ZYCORE_STATIC_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>ZYDIS_DISABLE_ENCODER;ZYDIS_DISABLE_AVX512;ZYDIS_DISABLE_KNC;ZYDIS_STATIC_BUILD;ZYCORE_STATIC_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='x64'">$(SolutionDir)dep\zydis\include;$(SolutionDir)dep\zydis\dependencies\zycore\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories Condition="'$(Platform)'=='x64'">$(SolutionDir)dep\zydis\include;$(SolutionDir)dep\zydis\dependencies\zycore\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ObjectFileName>$(IntDir)/%(RelativeDir)/</ObjectFileName> <ObjectFileName>$(IntDir)/%(RelativeDir)/</ObjectFileName>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<Import Project="..\..\dep\msvc\vsprops\Targets.props" /> <Import Project="..\..\dep\msvc\vsprops\Targets.props" />

View File

@ -59,6 +59,7 @@
<ClCompile Include="achievements.cpp" /> <ClCompile Include="achievements.cpp" />
<ClCompile Include="hotkeys.cpp" /> <ClCompile Include="hotkeys.cpp" />
<ClCompile Include="gpu_shadergen.cpp" /> <ClCompile Include="gpu_shadergen.cpp" />
<ClCompile Include="pch.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="types.h" /> <ClInclude Include="types.h" />
@ -122,5 +123,6 @@
<ClInclude Include="fullscreen_ui.h" /> <ClInclude Include="fullscreen_ui.h" />
<ClInclude Include="shader_cache_version.h" /> <ClInclude Include="shader_cache_version.h" />
<ClInclude Include="gpu_shadergen.h" /> <ClInclude Include="gpu_shadergen.h" />
<ClInclude Include="pch.h" />
</ItemGroup> </ItemGroup>
</Project> </Project>

4
src/core/pch.cpp Normal file
View File

@ -0,0 +1,4 @@
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "pch.h"

6
src/core/pch.h Normal file
View File

@ -0,0 +1,6 @@
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "util/pch.h"

View File

@ -4,6 +4,7 @@ add_executable(duckstation-nogui
nogui_platform.h nogui_platform.h
) )
target_precompile_headers(duckstation-nogui PRIVATE "pch.h")
target_link_libraries(duckstation-nogui PRIVATE core util common imgui scmversion) target_link_libraries(duckstation-nogui PRIVATE core util common imgui scmversion)
if(WIN32) if(WIN32)

View File

@ -3,6 +3,9 @@
<Import Project="..\..\dep\msvc\vsprops\Configurations.props" /> <Import Project="..\..\dep\msvc\vsprops\Configurations.props" />
<ItemGroup> <ItemGroup>
<ClCompile Include="nogui_host.cpp" /> <ClCompile Include="nogui_host.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="wayland_nogui_platform.cpp"> <ClCompile Include="wayland_nogui_platform.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild> <ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile> </ClCompile>
@ -14,6 +17,7 @@
<ItemGroup> <ItemGroup>
<ClInclude Include="nogui_host.h" /> <ClInclude Include="nogui_host.h" />
<ClInclude Include="nogui_platform.h" /> <ClInclude Include="nogui_platform.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="wayland_nogui_platform.h"> <ClInclude Include="wayland_nogui_platform.h">
<ExcludedFromBuild>true</ExcludedFromBuild> <ExcludedFromBuild>true</ExcludedFromBuild>
@ -48,5 +52,12 @@
</PropertyGroup> </PropertyGroup>
<Import Project="..\..\dep\msvc\vsprops\Win32Application.props" /> <Import Project="..\..\dep\msvc\vsprops\Win32Application.props" />
<Import Project="..\core\core.props" /> <Import Project="..\core\core.props" />
<ItemDefinitionGroup>
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
</ClCompile>
</ItemDefinitionGroup>
<Import Project="..\..\dep\msvc\vsprops\Targets.props" /> <Import Project="..\..\dep\msvc\vsprops\Targets.props" />
</Project> </Project>

View File

@ -5,6 +5,7 @@
<ClCompile Include="win32_nogui_platform.cpp" /> <ClCompile Include="win32_nogui_platform.cpp" />
<ClCompile Include="wayland_nogui_platform.cpp" /> <ClCompile Include="wayland_nogui_platform.cpp" />
<ClCompile Include="x11_nogui_platform.cpp" /> <ClCompile Include="x11_nogui_platform.cpp" />
<ClCompile Include="pch.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
@ -13,6 +14,7 @@
<ClInclude Include="nogui_platform.h" /> <ClInclude Include="nogui_platform.h" />
<ClInclude Include="wayland_nogui_platform.h" /> <ClInclude Include="wayland_nogui_platform.h" />
<ClInclude Include="x11_nogui_platform.h" /> <ClInclude Include="x11_nogui_platform.h" />
<ClInclude Include="pch.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Manifest Include="duckstation-nogui.manifest" /> <Manifest Include="duckstation-nogui.manifest" />

View File

@ -426,9 +426,6 @@ void NoGUIHost::ProcessPlatformWindowResize(s32 width, s32 height, float scale)
void NoGUIHost::ProcessPlatformMouseMoveEvent(float x, float y) void NoGUIHost::ProcessPlatformMouseMoveEvent(float x, float y)
{ {
if (g_gpu_device)
g_gpu_device->SetMousePosition(static_cast<s32>(x), static_cast<s32>(y));
InputManager::UpdatePointerAbsolutePosition(0, x, y); InputManager::UpdatePointerAbsolutePosition(0, x, y);
ImGuiManager::UpdateMousePosition(x, y); ImGuiManager::UpdateMousePosition(x, y);
} }
@ -650,7 +647,7 @@ void NoGUIHost::CPUThreadMainLoop()
Host::PumpMessagesOnCPUThread(); Host::PumpMessagesOnCPUThread();
System::Internal::IdlePollUpdate(); System::Internal::IdlePollUpdate();
Host::RenderDisplay(false); System::PresentDisplay(false);
if (!g_gpu_device->IsVsyncEnabled()) if (!g_gpu_device->IsVsyncEnabled())
g_gpu_device->ThrottlePresentation(); g_gpu_device->ThrottlePresentation();
} }

View File

@ -0,0 +1,4 @@
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "pch.h"

View File

@ -0,0 +1,6 @@
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "core/pch.h"

View File

@ -165,10 +165,13 @@ set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_RUNT
qt6_add_translation(QM_FILES ${TS_FILES}) qt6_add_translation(QM_FILES ${TS_FILES})
add_executable(duckstation-qt ${SRCS} ${QM_FILES}) add_executable(duckstation-qt ${SRCS} ${QM_FILES})
target_precompile_headers(duckstation-qt PRIVATE "pch.h")
target_include_directories(duckstation-qt PRIVATE "${Qt6Gui_PRIVATE_INCLUDE_DIRS}" "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(duckstation-qt PRIVATE "${Qt6Gui_PRIVATE_INCLUDE_DIRS}" "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(duckstation-qt PRIVATE core common imgui minizip scmversion Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network) target_link_libraries(duckstation-qt PRIVATE core common imgui minizip scmversion Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network)
if(WIN32) if(WIN32)
target_sources(duckstation-qt PRIVATE duckstation-qt.rc)
# We want a Windows subsystem application not console. # We want a Windows subsystem application not console.
set_target_properties(duckstation-qt PROPERTIES set_target_properties(duckstation-qt PROPERTIES
WIN32_EXECUTABLE TRUE WIN32_EXECUTABLE TRUE
@ -185,7 +188,6 @@ if(WIN32)
$<IF:$<CONFIG:Debug>,--debug,--release> $<IF:$<CONFIG:Debug>,--debug,--release>
--no-translations --no-translations
--no-compiler-runtime --no-compiler-runtime
--no-angle
"$<TARGET_FILE:duckstation-qt>" "$<TARGET_FILE:duckstation-qt>"
) )
add_custom_command(TARGET duckstation-qt POST_BUILD add_custom_command(TARGET duckstation-qt POST_BUILD

View File

@ -41,6 +41,9 @@
<ClCompile Include="mainwindow.cpp" /> <ClCompile Include="mainwindow.cpp" />
<ClCompile Include="memorycardsettingswidget.cpp" /> <ClCompile Include="memorycardsettingswidget.cpp" />
<ClCompile Include="memorycardeditordialog.cpp" /> <ClCompile Include="memorycardeditordialog.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="postprocessingsettingswidget.cpp" /> <ClCompile Include="postprocessingsettingswidget.cpp" />
<ClCompile Include="qttranslations.cpp" /> <ClCompile Include="qttranslations.cpp" />
<ClCompile Include="qthost.cpp" /> <ClCompile Include="qthost.cpp" />
@ -81,6 +84,7 @@
<QtMoc Include="colorpickerbutton.h" /> <QtMoc Include="colorpickerbutton.h" />
<ClInclude Include="controllersettingwidgetbinder.h" /> <ClInclude Include="controllersettingwidgetbinder.h" />
<QtMoc Include="memoryviewwidget.h" /> <QtMoc Include="memoryviewwidget.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="settingwidgetbinder.h" /> <ClInclude Include="settingwidgetbinder.h" />
<QtMoc Include="consolesettingswidget.h" /> <QtMoc Include="consolesettingswidget.h" />
@ -354,6 +358,13 @@
<Import Project="..\..\dep\msvc\vsprops\Win32Application.props" /> <Import Project="..\..\dep\msvc\vsprops\Win32Application.props" />
<Import Project="..\..\dep\msvc\vsprops\QtCompile.props" /> <Import Project="..\..\dep\msvc\vsprops\QtCompile.props" />
<Import Project="..\core\core.props" /> <Import Project="..\core\core.props" />
<ItemDefinitionGroup>
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup> <ItemDefinitionGroup>
<Link> <Link>
<AdditionalDependencies>$(QtEntryPointLib);%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>$(QtEntryPointLib);%(AdditionalDependencies)</AdditionalDependencies>
@ -371,4 +382,4 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<Import Project="..\..\dep\msvc\vsprops\Targets.props" /> <Import Project="..\..\dep\msvc\vsprops\Targets.props" />
<Import Project="..\..\dep\msvc\vsprops\QtCompile.targets" /> <Import Project="..\..\dep\msvc\vsprops\QtCompile.targets" />
</Project> </Project>

View File

@ -91,12 +91,14 @@
<ClCompile Include="$(IntDir)moc_coverdownloaddialog.cpp" /> <ClCompile Include="$(IntDir)moc_coverdownloaddialog.cpp" />
<ClCompile Include="colorpickerbutton.cpp" /> <ClCompile Include="colorpickerbutton.cpp" />
<ClCompile Include="$(IntDir)moc_colorpickerbutton.cpp" /> <ClCompile Include="$(IntDir)moc_colorpickerbutton.cpp" />
<ClCompile Include="pch.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="qtutils.h" /> <ClInclude Include="qtutils.h" />
<ClInclude Include="settingwidgetbinder.h" /> <ClInclude Include="settingwidgetbinder.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="controllersettingwidgetbinder.h" /> <ClInclude Include="controllersettingwidgetbinder.h" />
<ClInclude Include="pch.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="resources"> <Filter Include="resources">
@ -257,4 +259,4 @@
<Filter>translations</Filter> <Filter>translations</Filter>
</QtTs> </QtTs>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,4 @@
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "pch.h"

14
src/duckstation-qt/pch.h Normal file
View File

@ -0,0 +1,14 @@
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "core/pch.h"
#include <QtCore/QByteArray>
#include <QtCore/QMetaType>
#include <QtCore/QObject>
#include <QtCore/QSemaphore>
#include <QtCore/QString>
#include <QtCore/QtCore>
#include <QtWidgets/QWidget>

View File

@ -18,7 +18,6 @@
#include <QtCore/QMetaType> #include <QtCore/QMetaType>
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QSemaphore> #include <QtCore/QSemaphore>
#include <QtCore/QSettings>
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QThread> #include <QtCore/QThread>
#include <atomic> #include <atomic>

View File

@ -8,5 +8,9 @@ target_link_libraries(updater PRIVATE common minizip zlib)
if(WIN32) if(WIN32)
target_sources(updater PRIVATE target_sources(updater PRIVATE
win32_main.cpp win32_main.cpp
win32_progress_callback.cpp
win32_progress_callback.h
) )
target_link_libraries(updater PRIVATE "Comctl32.lib")
set_target_properties(updater PROPERTIES WIN32_EXECUTABLE TRUE)
endif() endif()

View File

@ -2,11 +2,13 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0) // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "updater.h" #include "updater.h"
#include "win32_progress_callback.h"
#include "common/file_system.h" #include "common/file_system.h"
#include "common/log.h" #include "common/log.h"
#include "common/minizip_helpers.h" #include "common/minizip_helpers.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "common/win32_progress_callback.h"
#include <algorithm> #include <algorithm>
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>

View File

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\dep\msvc\vsprops\Configurations.props" /> <Import Project="..\..\dep\msvc\vsprops\Configurations.props" />
<ItemGroup> <ItemGroup>
<ClCompile Include="win32_main.cpp" /> <ClCompile Include="win32_main.cpp" />
<ClCompile Include="updater.cpp" /> <ClCompile Include="updater.cpp" />
<ClCompile Include="win32_progress_callback.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Manifest Include="updater.manifest" /> <Manifest Include="updater.manifest" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="updater.h" /> <ClInclude Include="updater.h" />
<ClInclude Include="win32_progress_callback.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\dep\minizip\minizip.vcxproj"> <ProjectReference Include="..\..\dep\minizip\minizip.vcxproj">
<Project>{8bda439c-6358-45fb-9994-2ff083babe06}</Project> <Project>{8bda439c-6358-45fb-9994-2ff083babe06}</Project>
@ -24,19 +24,18 @@
<Project>{ee054e08-3799-4a59-a422-18259c105ffd}</Project> <Project>{ee054e08-3799-4a59-a422-18259c105ffd}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{32EEAF44-57F8-4C6C-A6F0-DE5667123DD5}</ProjectGuid> <ProjectGuid>{32EEAF44-57F8-4C6C-A6F0-DE5667123DD5}</ProjectGuid>
</PropertyGroup> </PropertyGroup>
<Import Project="..\..\dep\msvc\vsprops\Win32Application.props" /> <Import Project="..\..\dep\msvc\vsprops\Win32Application.props" />
<Import Project="..\common\common.props" /> <Import Project="..\common\common.props" />
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)dep\minizip\include;$(SolutionDir)dep\zlib\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)dep\minizip\include;$(SolutionDir)dep\zlib\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies);Comctl32.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<Import Project="..\..\dep\msvc\vsprops\Targets.props" /> <Import Project="..\..\dep\msvc\vsprops\Targets.props" />
</Project> </Project>

View File

@ -3,11 +3,13 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="updater.cpp" /> <ClCompile Include="updater.cpp" />
<ClCompile Include="win32_main.cpp" /> <ClCompile Include="win32_main.cpp" />
<ClCompile Include="win32_progress_callback.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Manifest Include="updater.manifest" /> <Manifest Include="updater.manifest" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="updater.h" /> <ClInclude Include="updater.h" />
<ClInclude Include="win32_progress_callback.h" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,12 +1,14 @@
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com> // SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0) // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "updater.h"
#include "win32_progress_callback.h"
#include "common/file_system.h" #include "common/file_system.h"
#include "common/log.h" #include "common/log.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "common/win32_progress_callback.h"
#include "common/windows_headers.h" #include "common/windows_headers.h"
#include "updater.h"
#include <shellapi.h> #include <shellapi.h>
static void WaitForProcessToExit(int process_id) static void WaitForProcessToExit(int process_id)

View File

@ -3,7 +3,7 @@
#pragma once #pragma once
#include "common/progress_callback.h" #include "common/progress_callback.h"
#include "windows_headers.h" #include "common/windows_headers.h"
class Win32ProgressCallback final : public BaseProgressCallback class Win32ProgressCallback final : public BaseProgressCallback
{ {

View File

@ -68,6 +68,7 @@ add_library(util
window_info.h window_info.h
) )
target_precompile_headers(util PRIVATE "pch.h")
target_include_directories(util PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..") target_include_directories(util PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_include_directories(util PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..") target_include_directories(util PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(util PUBLIC common simpleini imgui) target_link_libraries(util PUBLIC common simpleini imgui)
@ -116,6 +117,7 @@ if(ENABLE_OPENGL)
gl/context_wgl.cpp gl/context_wgl.cpp
gl/context_wgl.h gl/context_wgl.h
) )
target_link_libraries(util PRIVATE "opengl32.lib")
endif() endif()
if(LINUX OR FREEBSD OR ANDROID) if(LINUX OR FREEBSD OR ANDROID)
@ -222,6 +224,28 @@ endif()
if(WIN32) if(WIN32)
target_sources(util PRIVATE target_sources(util PRIVATE
d3d_common.cpp
d3d_common.h
d3d11_device.cpp
d3d11_device.h
d3d11_pipeline.cpp
d3d11_pipeline.h
d3d11_stream_buffer.cpp
d3d11_stream_buffer.h
d3d11_texture.cpp
d3d11_texture.h
d3d12_builders.cpp
d3d12_builders.h
d3d12_descriptor_heap_manager.cpp
d3d12_descriptor_heap_manager.h
d3d12_device.cpp
d3d12_device.h
d3d12_pipeline.cpp
d3d12_pipeline.h
d3d12_stream_buffer.cpp
d3d12_stream_buffer.h
d3d12_texture.cpp
d3d12_texture.h
dinput_source.cpp dinput_source.cpp
dinput_source.h dinput_source.h
platform_misc_win32.cpp platform_misc_win32.cpp
@ -232,9 +256,14 @@ if(WIN32)
xinput_source.cpp xinput_source.cpp
xinput_source.h xinput_source.h
) )
target_link_libraries(util PRIVATE d3d11.lib d3d12.lib d3dcompiler.lib dxgi.lib winmm.lib) target_link_libraries(util PRIVATE d3d12ma)
target_link_libraries(util PRIVATE d3d11.lib d3d12.lib d3dcompiler.lib dxgi.lib winmm.lib Dwmapi.lib)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
target_link_libraries(util PRIVATE WinPixEventRuntime::WinPixEventRuntime)
endif()
elseif(APPLE) elseif(APPLE)
target_sources(util PRIVATE set(MAC_SOURCES
cocoa_tools.h cocoa_tools.h
metal_device.h metal_device.h
metal_device.mm metal_device.mm
@ -242,10 +271,12 @@ elseif(APPLE)
metal_stream_buffer.mm metal_stream_buffer.mm
platform_misc_mac.mm platform_misc_mac.mm
) )
target_sources(util PRIVATE ${MAC_SOURCES})
find_library(IOK_LIBRARY IOKit REQUIRED) find_library(IOK_LIBRARY IOKit REQUIRED)
find_library(METAL_LIBRARY Metal) find_library(METAL_LIBRARY Metal)
find_library(QUARTZCORE_LIBRARY QuartzCore) find_library(QUARTZCORE_LIBRARY QuartzCore)
target_link_libraries(util PRIVATE ${METAL_LIBRARY} ${QUARTZCORE_LIBRARY} ${IOK_LIBRARY}) target_link_libraries(util PRIVATE ${METAL_LIBRARY} ${QUARTZCORE_LIBRARY} ${IOK_LIBRARY})
set_source_files_properties(${MAC_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
elseif(NOT ANDROID) elseif(NOT ANDROID)
target_sources(util PRIVATE target_sources(util PRIVATE
platform_misc_unix.cpp platform_misc_unix.cpp

4
src/util/pch.cpp Normal file
View File

@ -0,0 +1,4 @@
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "pch.h"

25
src/util/pch.h Normal file
View File

@ -0,0 +1,25 @@
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "common/types.h"
#include "fmt/format.h"
#include "gsl/span"
#include <array>
#include <atomic>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <initializer_list>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <string_view>
#include <tuple>
#include <utility>
#include <vector>

View File

@ -61,6 +61,7 @@
<ClInclude Include="memory_arena.h" /> <ClInclude Include="memory_arena.h" />
<ClInclude Include="page_fault_handler.h" /> <ClInclude Include="page_fault_handler.h" />
<ClInclude Include="cd_subchannel_replacement.h" /> <ClInclude Include="cd_subchannel_replacement.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="platform_misc.h" /> <ClInclude Include="platform_misc.h" />
<ClInclude Include="postprocessing.h" /> <ClInclude Include="postprocessing.h" />
<ClInclude Include="postprocessing_shader.h" /> <ClInclude Include="postprocessing_shader.h" />
@ -162,6 +163,9 @@
<ClCompile Include="opengl_texture.cpp"> <ClCompile Include="opengl_texture.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="platform_misc_win32.cpp" /> <ClCompile Include="platform_misc_win32.cpp" />
<ClCompile Include="postprocessing.cpp" /> <ClCompile Include="postprocessing.cpp" />
<ClCompile Include="postprocessing_shader.cpp" /> <ClCompile Include="postprocessing_shader.cpp" />
@ -245,6 +249,9 @@
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SolutionDir)dep\reshadefx\include</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SolutionDir)dep\reshadefx\include</AdditionalIncludeDirectories>
<ObjectFileName>$(IntDir)/%(RelativeDir)/</ObjectFileName> <ObjectFileName>$(IntDir)/%(RelativeDir)/</ObjectFileName>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<Import Project="..\..\dep\msvc\vsprops\Targets.props" /> <Import Project="..\..\dep\msvc\vsprops\Targets.props" />

View File

@ -70,6 +70,7 @@
<ClInclude Include="d3d11_texture.h" /> <ClInclude Include="d3d11_texture.h" />
<ClInclude Include="host.h" /> <ClInclude Include="host.h" />
<ClInclude Include="postprocessing_shader_fx.h" /> <ClInclude Include="postprocessing_shader_fx.h" />
<ClInclude Include="pch.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="jit_code_buffer.cpp" /> <ClCompile Include="jit_code_buffer.cpp" />
@ -146,6 +147,7 @@
<ClCompile Include="d3d11_texture.cpp" /> <ClCompile Include="d3d11_texture.cpp" />
<ClCompile Include="host.cpp" /> <ClCompile Include="host.cpp" />
<ClCompile Include="postprocessing_shader_fx.cpp" /> <ClCompile Include="postprocessing_shader_fx.cpp" />
<ClCompile Include="pch.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="gl"> <Filter Include="gl">