mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 22:05:38 +00:00
186 lines
8.7 KiB
XML
186 lines
8.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<PropertyGroup Label="UserMacros">
|
|
<BinaryOutputDir>$(SolutionDir)bin\$(Platform)\</BinaryOutputDir>
|
|
<QTDIRDefault>$(SolutionDir)dep\msvc\qt\5.15.0\msvc2017_64\</QTDIRDefault>
|
|
<QTDIR Condition="Exists('$(QTDIRDefault)') And ('$(QTDIR)'=='' Or !Exists('$(QTDIR)'))">$(QTDIRDefault)</QTDIR>
|
|
<QTDIR Condition="Exists('$(QTDIR)') And !HasTrailingSlash('$(QTDIR)')">$(QTDIR)\</QTDIR>
|
|
<QtDirValid>false</QtDirValid>
|
|
<QtDirValid Condition="Exists('$(QTDIR)')">true</QtDirValid>
|
|
<QtIncludeDir>$(QTDIR)include\</QtIncludeDir>
|
|
<QtLibDir>$(QTDIR)lib\</QtLibDir>
|
|
<QtBinDir>$(QTDIR)bin\</QtBinDir>
|
|
<QtPluginsDir>$(QTDIR)plugins\</QtPluginsDir>
|
|
<QtToolOutDir>$(SolutionDir)build\$(ProjectName)-$(Platform)-$(Configuration)\</QtToolOutDir>
|
|
<QtMocOutPrefix>$(QtToolOutDir)moc_</QtMocOutPrefix>
|
|
<QtTsOutDir>$(BinaryOutputDir)translations\</QtTsOutDir>
|
|
<QtDebugSuffix>d</QtDebugSuffix>
|
|
<QtLibSuffix Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='DebugFast'">$(QtDebugSuffix)</QtLibSuffix>
|
|
<QtPluginFolder>QtPlugins</QtPluginFolder>
|
|
</PropertyGroup>
|
|
<ItemDefinitionGroup>
|
|
<ClCompile>
|
|
<PreprocessorDefinitions Condition="'$(Configuration)'=='Release' Or '$(Configuration)'=='ReleaseLTCG'">QT_NO_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
<AdditionalIncludeDirectories>$(QtToolOutDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
<AdditionalIncludeDirectories>$(QtIncludeDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
</ClCompile>
|
|
<Link>
|
|
<AdditionalLibraryDirectories>$(QtLibDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
<AdditionalDependencies>qtmain$(QtLibSuffix).lib;Qt5Core$(QtLibSuffix).lib;Qt5Gui$(QtLibSuffix).lib;Qt5Widgets$(QtLibSuffix).lib;Qt5Network$(QtLibSuffix).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
</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" />
|
|
<Error Condition="!$(QtDirValid)" Text="QTDIR not set or non-existent (pull the submodule?)" />
|
|
<MakeDir Directories="$(QtToolOutDir)" />
|
|
<Exec Command=""$(QtBinDir)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" />
|
|
<Error Condition="!$(QtDirValid)" Text="QTDIR not set or non-existent (pull the submodule?)" />
|
|
<MakeDir Directories="$(QtToolOutDir)" />
|
|
<Exec Command=""$(QtBinDir)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)'=='Release' Or '$(Configuration)'=='ReleaseLTCG'">-DQT_NO_DEBUG -DNDEBUG $(MocDefines)</MocDefines>
|
|
<!-- !!!HOLY UGLY BATMAN!!!
|
|
Be very careful here when adding include directories. Each path must have the whole arg surrounded by doublequotes - HOWEVER,
|
|
the ending doublequote cannot be directly preceeded by a directory seperator. In other words, you must use:
|
|
"-I$(SomeDir) "
|
|
instead of
|
|
"-I$(SomeDir)"
|
|
in order to prevent the trailing slash from escaping the doublequote after value replacement.
|
|
-->
|
|
<MocIncludes>"-I$(QtIncludeDir)" "-I$(SolutionDir)src" -I.</MocIncludes>
|
|
</PropertyGroup>
|
|
<Target Name="QtMoc"
|
|
BeforeTargets="ClCompile"
|
|
Condition="'@(QtMoc)'!=''"
|
|
Inputs="%(QtMoc.Identity);%(QtMoc.AdditionalDependencies);$(MSBuildProjectFile)"
|
|
Outputs="$(QtToolOutDir)moc_%(QtMoc.Filename).cpp">
|
|
<Message Text="moc %(QtMoc.Filename) $(QtToolOutDir)moc_%(QtMoc.Filename).cpp" Importance="High" />
|
|
<Error Condition="!$(QtDirValid)" Text="QTDIR not set or non-existent (pull the submodule?)" />
|
|
<MakeDir Directories="$(QtToolOutDir)" />
|
|
<Exec Command=""$(QtBinDir)moc.exe" "%(QtMoc.FullPath)" -o "$(QtToolOutDir)moc_%(QtMoc.Filename).cpp" -f%(QtMoc.Filename)%(QtMoc.Extension) $(MocDefines) $(MocIncludes)" />
|
|
</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>
|
|
<QtLibNames Include="Qt5Core$(QtLibSuffix);Qt5Gui$(QtLibSuffix);Qt5Widgets$(QtLibSuffix);Qt5Network$(QtLibSuffix)" />
|
|
<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)'=='Debug' Or '$(Configuration)'=='DebugFast'" Include="@(QtAllPlugins)" />
|
|
<QtPlugins Condition="'$(Configuration)'=='Release' Or '$(Configuration)'=='ReleaseLTCG'" Exclude="$(QtPluginsDir)**\*$(QtDebugSuffix).dll" Include="@(QtAllPlugins)" />
|
|
<QtPluginsDest Include="@(QtPlugins -> '$(BinaryOutputDir)$(QtPluginFolder)\%(RecursiveDir)%(Filename)%(Extension)')" />
|
|
</ItemGroup>
|
|
<PropertyGroup>
|
|
<QtConfFile>$(BinaryOutputDir)qt.conf</QtConfFile>
|
|
</PropertyGroup>
|
|
<Target Name="QtCopyBinaries"
|
|
AfterTargets="Build"
|
|
Inputs="@(QtDlls);@(QtPlugins)"
|
|
Outputs="@(QtDlls -> '$(BinaryOutputDir)%(RecursiveDir)%(Filename)%(Extension)');@(QtPlugins -> '$(BinaryOutputDir)$(QtPluginFolder)\%(RecursiveDir)%(Filename)%(Extension)')">
|
|
<Message Text="Copying Qt .dlls" Importance="High" />
|
|
<Copy
|
|
SourceFiles="@(QtDlls)"
|
|
DestinationFolder="$(BinaryOutputDir)"
|
|
SkipUnchangedFiles="true"
|
|
/>
|
|
<Copy
|
|
SourceFiles="@(QtPlugins)"
|
|
DestinationFiles="@(QtPluginsDest)"
|
|
SkipUnchangedFiles="true"
|
|
/>
|
|
</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>
|
|
|
|
<!--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" />
|
|
<Error Condition="!$(QtDirValid)" Text="QTDIR not set or non-existent (pull the submodule?)" />
|
|
<MakeDir Directories="$(QtTsOutDir)" />
|
|
<Exec Command=""$(QtBinDir)lrelease.exe" "%(TsFiles.FullPath)" -qm "$(QtTsOutDir)%(TsFiles.Filename).qm"" />
|
|
</Target>
|
|
<ItemGroup>
|
|
<TsOutputs Include="$(QtTsOutDir)*.qm" />
|
|
</ItemGroup>
|
|
<Target Name="QtTsClean">
|
|
<Delete Files="@(TsOutputs)" />
|
|
</Target>
|
|
</Project>
|