2021-12-13 12:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
|
|
<PropertyGroup Label="UserMacros">
|
2023-07-19 12:52:25 +00:00
|
|
|
<QtBinaryOutputDir>$(SolutionDir)bin\</QtBinaryOutputDir>
|
|
|
|
<PCSX2QTDIRDefault Condition="'$(Platform)'=='x64'">$(SolutionDir)deps\</PCSX2QTDIRDefault>
|
|
|
|
<PCSX2QTDIRDefault Condition="'$(Platform)'=='ARM64'">$(SolutionDir)deps-arm64\</PCSX2QTDIRDefault>
|
2022-01-31 12:40:09 +00:00
|
|
|
<PCSX2QTDIR Condition="Exists('$(PCSX2QTDIRDefault)') And ('$(PCSX2QTDIR)'=='' Or !Exists('$(PCSX2QTDIR)'))">$(PCSX2QTDIRDefault)</PCSX2QTDIR>
|
|
|
|
<PCSX2QTDIR Condition="Exists('$(PCSX2QTDIR)') And !HasTrailingSlash('$(PCSX2QTDIR)')">$(PCSX2QTDIR)\</PCSX2QTDIR>
|
2023-07-19 12:52:25 +00:00
|
|
|
<PCSX2QTDIRHost>$(SolutionDir)deps\</PCSX2QTDIRHost>
|
2021-12-13 12:12:54 +00:00
|
|
|
<QtDirValid>false</QtDirValid>
|
2022-01-31 12:40:09 +00:00
|
|
|
<QtDirValid Condition="Exists('$(PCSX2QTDIR)')">true</QtDirValid>
|
|
|
|
<QtIncludeDir>$(PCSX2QTDIR)include\</QtIncludeDir>
|
|
|
|
<QtLibDir>$(PCSX2QTDIR)lib\</QtLibDir>
|
|
|
|
<QtBinDir>$(PCSX2QTDIR)bin\</QtBinDir>
|
|
|
|
<QtHostBinDir>$(PCSX2QTDIRHost)bin\</QtHostBinDir>
|
|
|
|
<QtPluginsDir>$(PCSX2QTDIR)plugins\</QtPluginsDir>
|
|
|
|
<QtTranslationsDir>$(PCSX2QTDIR)translations\</QtTranslationsDir>
|
2021-12-13 12:12:54 +00:00
|
|
|
<QtToolOutDir>$(IntDir)</QtToolOutDir>
|
|
|
|
<QtMocOutPrefix>$(QtToolOutDir)moc_</QtMocOutPrefix>
|
2023-07-19 12:52:25 +00:00
|
|
|
<QtTsOutDir>$(QtBinaryOutputDir)translations\</QtTsOutDir>
|
2021-12-13 12:12:54 +00:00
|
|
|
<QtDebugSuffix>d</QtDebugSuffix>
|
|
|
|
<QtLibSuffix Condition="$(Configuration.Contains(Debug))">$(QtDebugSuffix)</QtLibSuffix>
|
|
|
|
<QtPluginFolder>QtPlugins</QtPluginFolder>
|
2022-04-13 10:28:40 +00:00
|
|
|
<QtEntryPointLib>$(QtLibDir)Qt6EntryPoint$(QtLibSuffix).lib</QtEntryPointLib>
|
2021-12-13 12:12:54 +00:00
|
|
|
</PropertyGroup>
|
|
|
|
<ItemDefinitionGroup>
|
|
|
|
<ClCompile>
|
|
|
|
<PreprocessorDefinitions Condition="!$(Configuration.Contains(Debug))">QT_NO_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
|
|
<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
|
|
<AdditionalIncludeDirectories>$(QtToolOutDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
|
|
<AdditionalIncludeDirectories>$(QtIncludeDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
|
|
</ClCompile>
|
|
|
|
<Link>
|
|
|
|
<AdditionalLibraryDirectories>$(QtLibDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
2022-07-17 05:24:59 +00:00
|
|
|
<AdditionalDependencies>Qt6Core$(QtLibSuffix).lib;Qt6Gui$(QtLibSuffix).lib;Qt6Widgets$(QtLibSuffix).lib;Qt6Network$(QtLibSuffix).lib;Qt6Concurrent$(QtLibSuffix).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
2021-12-13 12:12:54 +00:00
|
|
|
</Link>
|
|
|
|
</ItemDefinitionGroup>
|
|
|
|
|
|
|
|
<!--Passes all .qrc files to rcc and puts output in the build directory-->
|
|
|
|
<ItemGroup>
|
|
|
|
<ResFiles Include="$(MSBuildProjectDirectory)\**\*.qrc" />
|
|
|
|
</ItemGroup>
|
|
|
|
<Target Name="QtResource"
|
|
|
|
BeforeTargets="ClCompile"
|
|
|
|
Inputs="@(ResFiles)"
|
|
|
|
Condition="'@(QtResource)'!=''"
|
|
|
|
Outputs="@(ResFiles->'$(QtToolOutDir)qrc_%(Filename).cpp')">
|
|
|
|
<Message Text="rcc %(ResFiles.Filename)" Importance="High" />
|
2022-01-31 12:40:09 +00:00
|
|
|
<Error Condition="!$(QtDirValid)" Text="Qt directory non-existent (download/extract the zip)" />
|
2021-12-13 12:12:54 +00:00
|
|
|
<MakeDir Directories="$(QtToolOutDir)" />
|
|
|
|
<Exec Command=""$(QtHostBinDir)rcc.exe" "%(ResFiles.FullPath)" -o "$(QtToolOutDir)qrc_%(ResFiles.Filename).cpp"" />
|
|
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="QtResourceClean">
|
|
|
|
<Delete Files="@(ResFiles->'$(QtToolOutDir)qrc_%(Filename).cpp')" />
|
|
|
|
</Target>
|
|
|
|
|
|
|
|
<!--Passes all .ui files to uic and puts output in the build directory-->
|
|
|
|
<ItemGroup>
|
|
|
|
<UiFiles Include="$(MSBuildProjectDirectory)\**\*.ui" />
|
|
|
|
</ItemGroup>
|
|
|
|
<Target Name="QtUi"
|
|
|
|
BeforeTargets="ClCompile"
|
|
|
|
Inputs="@(UiFiles)"
|
|
|
|
Condition="'@(QtUi)'!=''"
|
|
|
|
Outputs="@(UiFiles->'$(QtToolOutDir)ui_%(Filename).h')">
|
|
|
|
<Message Text="uic %(UiFiles.Filename)" Importance="High" />
|
2022-01-31 12:40:09 +00:00
|
|
|
<Error Condition="!$(QtDirValid)" Text="Qt directory non-existent (download/extract the zip)" />
|
2021-12-13 12:12:54 +00:00
|
|
|
<MakeDir Directories="$(QtToolOutDir)" />
|
|
|
|
<Exec Command=""$(QtHostBinDir)uic.exe" "%(UiFiles.FullPath)" -o "$(QtToolOutDir)ui_%(UiFiles.Filename).h"" />
|
|
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="QtUiClean">
|
|
|
|
<Delete Files="@(UiFiles->'$(QtToolOutDir)ui_%(Filename).h')" />
|
|
|
|
</Target>
|
|
|
|
|
|
|
|
<!--Compile files needed to MOC and output in the build directory-->
|
|
|
|
<!--TODO find a way to autocreate from ClCompile settings-->
|
|
|
|
<PropertyGroup>
|
|
|
|
<MocDefines></MocDefines>
|
|
|
|
<MocDefines Condition="!$(Configuration.Contains(Debug))">-DQT_NO_DEBUG -DNDEBUG $(MocDefines)</MocDefines>
|
2022-06-18 11:11:02 +00:00
|
|
|
<MocIncludes>-I"$(QtIncludeDir)." -I"$(SolutionDir)pcsx2" "-I$(SolutionDir)." -I.</MocIncludes>
|
2021-12-13 12:12:54 +00:00
|
|
|
</PropertyGroup>
|
|
|
|
<Target Name="QtMoc"
|
|
|
|
BeforeTargets="ClCompile"
|
|
|
|
Condition="'@(QtMoc)'!=''"
|
|
|
|
Inputs="%(QtMoc.Identity);%(QtMoc.AdditionalDependencies);$(MSBuildProjectFile)"
|
2023-07-19 12:52:25 +00:00
|
|
|
Outputs="$(QtToolOutDir)%(QtMoc.RelativeDir)moc_%(QtMoc.Filename).cpp">
|
|
|
|
<Message Text="moc %(QtMoc.Filename) $(QtToolOutDir)%(QtMoc.RelativeDir)moc_%(QtMoc.Filename).cpp" Importance="High" />
|
2022-01-31 12:40:09 +00:00
|
|
|
<Error Condition="!$(QtDirValid)" Text="Qt directory non-existent (download/extract the zip)" />
|
2023-07-19 12:52:25 +00:00
|
|
|
<MakeDir Directories="$(QtToolOutDir)%(QtMoc.RelativeDir)" />
|
|
|
|
<Exec Command=""$(QtHostBinDir)moc.exe" "%(QtMoc.FullPath)" -b "PrecompiledHeader.h" -o "$(QtToolOutDir)%(QtMoc.RelativeDir)moc_%(QtMoc.Filename).cpp" -f%(QtMoc.Filename)%(QtMoc.Extension) $(MocDefines) $(MocIncludes)" />
|
2021-12-13 12:12:54 +00:00
|
|
|
</Target>
|
|
|
|
|
|
|
|
<ItemGroup>
|
|
|
|
<MocOutputs Include="$(QtToolOutDir)moc_*.cpp" />
|
|
|
|
</ItemGroup>
|
|
|
|
<Target Name="QtMocClean">
|
|
|
|
<Delete Files="@(MocOutputs)" />
|
|
|
|
</Target>
|
|
|
|
|
|
|
|
<!--Expose the new targets to VS-->
|
|
|
|
<ItemGroup>
|
|
|
|
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
|
|
|
|
<AvailableItemName Include="QtResource">
|
|
|
|
<Targets>QtResource</Targets>
|
|
|
|
</AvailableItemName>
|
|
|
|
<AvailableItemName Include="QtUi">
|
|
|
|
<Targets>QtUi</Targets>
|
|
|
|
</AvailableItemName>
|
|
|
|
<AvailableItemName Include="QtMoc">
|
|
|
|
<Targets>QtMoc</Targets>
|
|
|
|
</AvailableItemName>
|
|
|
|
<AvailableItemName Include="QtTs">
|
|
|
|
<Targets>QtTs</Targets>
|
|
|
|
</AvailableItemName>
|
|
|
|
</ItemGroup>
|
|
|
|
|
|
|
|
<!--Copy the needed dlls-->
|
|
|
|
<ItemGroup>
|
2022-07-17 05:24:59 +00:00
|
|
|
<QtLibNames Include="Qt6Core$(QtLibSuffix);Qt6Gui$(QtLibSuffix);Qt6Widgets$(QtLibSuffix);Qt6Network$(QtLibSuffix);Qt6Svg$(QtLibSuffix);Qt6Concurrent$(QtLibSuffix)" />
|
2021-12-13 12:12:54 +00:00
|
|
|
<QtDlls Include="@(QtLibNames -> '$(QtBinDir)%(Identity).dll')" />
|
|
|
|
<!--Filter plugins to copy based on the observation that all debug versions end in "d"-->
|
|
|
|
<QtAllPlugins Include="$(QtPluginsDir)**\*$(QtLibSuffix).dll" />
|
|
|
|
<QtPlugins Condition="$(Configuration.Contains(Debug))" Include="@(QtAllPlugins)" />
|
|
|
|
<QtPlugins Condition="!$(Configuration.Contains(Debug))" Exclude="$(QtPluginsDir)**\*$(QtDebugSuffix).dll" Include="@(QtAllPlugins)" />
|
2023-07-19 12:52:25 +00:00
|
|
|
<QtPluginsDest Include="@(QtPlugins -> '$(QtBinaryOutputDir)$(QtPluginFolder)\%(RecursiveDir)%(Filename)%(Extension)')" />
|
2022-04-13 10:23:21 +00:00
|
|
|
<!--Our normal *d filter fails for the TLS DLLs, because backend ends in d. -->
|
|
|
|
<QtTLSDlls Include="$(QtPluginsDir)tls\qcertonlybackend$(QtLibSuffix).dll;$(QtPluginsDir)tls\qschannelbackend$(QtLibSuffix).dll" />
|
2023-07-19 12:52:25 +00:00
|
|
|
<QtTLSDllsDest Include="@(QtTLSDlls -> '$(QtBinaryOutputDir)$(QtPluginFolder)\tls\%(Filename)%(Extension)')" />
|
2021-12-13 12:12:54 +00:00
|
|
|
</ItemGroup>
|
|
|
|
<PropertyGroup>
|
2023-07-19 12:52:25 +00:00
|
|
|
<QtConfFile>$(QtBinaryOutputDir)qt.conf</QtConfFile>
|
2021-12-13 12:12:54 +00:00
|
|
|
</PropertyGroup>
|
|
|
|
<Target Name="QtCopyBinaries"
|
|
|
|
AfterTargets="Build"
|
2022-04-13 10:23:21 +00:00
|
|
|
Inputs="@(QtDlls);@(QtPlugins);@(QtTLSDlls)"
|
2023-07-19 12:52:25 +00:00
|
|
|
Outputs="@(QtDlls -> '$(QtBinaryOutputDir)%(RecursiveDir)%(Filename)%(Extension)');@(QtPluginsDest);@(QtTLSDllsDest)">
|
2021-12-13 12:12:54 +00:00
|
|
|
<Message Text="Copying Qt .dlls" Importance="High" />
|
|
|
|
<Copy
|
|
|
|
SourceFiles="@(QtDlls)"
|
2023-07-19 12:52:25 +00:00
|
|
|
DestinationFolder="$(QtBinaryOutputDir)"
|
2021-12-13 12:12:54 +00:00
|
|
|
SkipUnchangedFiles="true"
|
|
|
|
/>
|
|
|
|
<Copy
|
|
|
|
SourceFiles="@(QtPlugins)"
|
|
|
|
DestinationFiles="@(QtPluginsDest)"
|
|
|
|
SkipUnchangedFiles="true"
|
|
|
|
/>
|
2022-04-13 10:23:21 +00:00
|
|
|
<Copy
|
|
|
|
SourceFiles="@(QtTLSDlls)"
|
|
|
|
DestinationFiles="@(QtTLSDllsDest)"
|
|
|
|
SkipUnchangedFiles="true"
|
|
|
|
/>
|
2021-12-13 12:12:54 +00:00
|
|
|
</Target>
|
|
|
|
<Target Name="QtCreateConf"
|
|
|
|
BeforeTargets="QtCopyBinaries"
|
|
|
|
Condition="!Exists('$(QtConfFile)')">
|
|
|
|
<!--
|
|
|
|
Create a file which tells Qt where to look for "plugins".
|
|
|
|
Otherwise Qt only looks in ./<subtype>/type.dll instead of ./$(QtPluginFolder)/<subtype>/type.dll, which is messy
|
|
|
|
-->
|
|
|
|
<WriteLinesToFile
|
|
|
|
File="$(QtConfFile)"
|
|
|
|
Lines="[Paths];Plugins = ./$(QtPluginFolder)"
|
|
|
|
Overwrite="true"
|
|
|
|
/>
|
|
|
|
</Target>
|
|
|
|
|
2023-09-16 15:37:11 +00:00
|
|
|
<!--Copies base translation files, and combines split into one -->
|
2021-12-13 12:12:54 +00:00
|
|
|
<ItemGroup>
|
2023-09-16 15:37:11 +00:00
|
|
|
<AllQmFiles Include="$(QtTranslationsDir)qt*.qm">
|
|
|
|
<Language>$([System.String]::Copy('%(Filename)').Substring($([MSBuild]::Add($([System.String]::Copy('%(Filename)').IndexOf('_')), 1))))</Language>
|
|
|
|
</AllQmFiles>
|
|
|
|
<BaseQmFiles Include="$(QtTranslationsDir)qtbase_*.qm" />
|
|
|
|
<SourceMergeQmFileNames Include="@(BaseQmFiles -> '%(Filename)%(Extension)'->Replace('qtbase_', 'qt_'))" />
|
|
|
|
<SourceMergeQmFiles Include="@(SourceMergeQmFileNames -> '$(QtTranslationsDir)%(Filename)%(Extension)')" />
|
|
|
|
<MergedQmFiles Include="@(SourceMergeQmFileNames -> '$(QtTsOutDir)%(Filename)%(Extension)')">
|
|
|
|
<Language>$([System.String]::Copy('%(Filename)').Replace('qt_', ''))</Language>
|
|
|
|
</MergedQmFiles>
|
|
|
|
<CopyTsFilesSource Include="$(QtTranslationsDir)qt_*.qm" Exclude="@(SourceMergeQmFiles);$(QtTranslationsDir)\qt_help_*.qm" />
|
|
|
|
<CopyTsFilesDest Include="@(CopyTsFilesSource -> '$(QtTsOutDir)%(Filename)%(Extension)')" />
|
2021-12-13 12:12:54 +00:00
|
|
|
</ItemGroup>
|
2023-09-16 15:37:11 +00:00
|
|
|
<Target Name="QtGenerateBaseTranslations" AfterTargets="Build" Inputs="@(SourceMergeQmFiles)" Outputs="%(MergedQmFiles.FullPath)">
|
|
|
|
<PropertyGroup>
|
|
|
|
<Language>%(MergedQmFiles.Language)</Language>
|
|
|
|
</PropertyGroup>
|
|
|
|
<Message Text="Generate Base Translation qt_$(Language).qm" Importance="High" />
|
|
|
|
<ItemGroup>
|
|
|
|
<SourceQmFiles Include="%(AllQmFiles.FullPath)" Condition="'%(AllQmFiles.Language)' == '$(Language)'" />
|
|
|
|
</ItemGroup>
|
|
|
|
<Error Condition="!$(QtDirValid)" Text="Qt directory non-existent (download/extract the zip)" />
|
|
|
|
<MakeDir Directories="$(QtTsOutDir)" />
|
|
|
|
<Exec Command=""$(QtHostBinDir)lconvert.exe" -verbose -of qm -o "$(QtTsOutDir)qt_$(Language).qm" @(SourceQmFiles -> '"%(FullPath)"', ' ')" />
|
|
|
|
</Target>
|
2021-12-13 12:12:54 +00:00
|
|
|
<Target Name="QtCopyBaseTranslations"
|
|
|
|
AfterTargets="Build"
|
2023-09-16 15:37:11 +00:00
|
|
|
Inputs="@(CopyTsFilesSource)"
|
|
|
|
Outputs="@(CopyTsFilesDest.FullPath)">
|
|
|
|
<Message Text="Copy Base Translation %(CopyTsFilesSource.Filename)%(CopyTsFilesSource.Extension)" />
|
|
|
|
<Copy SourceFiles="@(CopyTsFilesSource)" DestinationFiles="@(CopyTsFilesDest)" SkipUnchangedFiles="true" />
|
2021-12-13 12:12:54 +00:00
|
|
|
</Target>
|
|
|
|
|
|
|
|
<!--Compiles all translation files-->
|
|
|
|
<ItemGroup>
|
|
|
|
<TsFiles Include="$(MSBuildProjectDirectory)\**\*.ts" />
|
|
|
|
</ItemGroup>
|
|
|
|
<Target Name="QtTs"
|
|
|
|
BeforeTargets="ClCompile"
|
|
|
|
Inputs="@(TsFiles)"
|
|
|
|
Condition="'@(QtTs)'!=''"
|
|
|
|
Outputs="@(TsFiles->'$(QtTsOutDir)%(Filename).qm')">
|
|
|
|
<Message Text="lrelease %(TsFiles.Filename)" Importance="High" />
|
2022-01-31 12:40:09 +00:00
|
|
|
<Error Condition="!$(QtDirValid)" Text="Qt directory non-existent (download/extract the zip)" />
|
2021-12-13 12:12:54 +00:00
|
|
|
<MakeDir Directories="$(QtTsOutDir)" />
|
|
|
|
<Exec Command=""$(QtHostBinDir)lrelease.exe" "%(TsFiles.FullPath)" -qm "$(QtTsOutDir)%(TsFiles.Filename).qm"" />
|
|
|
|
</Target>
|
|
|
|
<ItemGroup>
|
|
|
|
<TsOutputs Include="$(QtTsOutDir)*.qm" />
|
|
|
|
</ItemGroup>
|
|
|
|
<Target Name="QtTsClean">
|
|
|
|
<Delete Files="@(TsOutputs)" />
|
|
|
|
</Target>
|
|
|
|
</Project>
|