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

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

View File

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

View File

@@ -91,12 +91,14 @@
<ClCompile Include="$(IntDir)moc_coverdownloaddialog.cpp" />
<ClCompile Include="colorpickerbutton.cpp" />
<ClCompile Include="$(IntDir)moc_colorpickerbutton.cpp" />
<ClCompile Include="pch.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="qtutils.h" />
<ClInclude Include="settingwidgetbinder.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="controllersettingwidgetbinder.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<Filter Include="resources">
@@ -257,4 +259,4 @@
<Filter>translations</Filter>
</QtTs>
</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/QObject>
#include <QtCore/QSemaphore>
#include <QtCore/QSettings>
#include <QtCore/QString>
#include <QtCore/QThread>
#include <atomic>