mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
msbuild: use the moc dispatcher from Qt's vstools
The new method supports build parallelism and cleaner integration into msbuild dependency flows.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<QTDIRDefault Condition="'$(Platform)'=='x64'">$(ExternalsDir)Qt\Qt5.15.0\msvc2019_64\</QTDIRDefault>
|
||||
<QTDIRDefault Condition="'$(Platform)'=='ARM64'">$(ExternalsDir)Qt\Qt5.15.0\msvc2019_arm64\</QTDIRDefault>
|
||||
@ -12,7 +12,6 @@
|
||||
<QtBinDir>$(QTDIR)bin\</QtBinDir>
|
||||
<QtPluginsDir>$(QTDIR)plugins\</QtPluginsDir>
|
||||
<QtToolOutDir>$(IntDir)</QtToolOutDir>
|
||||
<QtMocOutPrefix>$(QtToolOutDir)moc_</QtMocOutPrefix>
|
||||
<QtDebugSuffix>d</QtDebugSuffix>
|
||||
<QtLibSuffix Condition="'$(Configuration)'=='Debug'">$(QtDebugSuffix)</QtLibSuffix>
|
||||
<QtPluginFolder>QtPlugins</QtPluginFolder>
|
||||
@ -22,7 +21,6 @@
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)'=='Release'">QT_NO_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>QT_DLL;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>QT_USE_QSTRINGBUILDER;QT_NO_CAST_FROM_ASCII;QT_NO_CAST_TO_ASCII;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(QtToolOutDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(QtIncludeDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(QtIncludeDir)QtCore;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -45,46 +43,32 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
<!--Compile files needed to MOC and output in the build directory-->
|
||||
<!--TODO find a way to autocreate from ClCompile settings-->
|
||||
<PropertyGroup>
|
||||
<MocDefines>-DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -D_SECURE_SCL=0 -D_ARCH_64=1 -D_M_X86_64=1 -D_M_X86=1 -DUSE_UPNP -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_UNICODE -DUNICODE</MocDefines>
|
||||
<MocDefines Condition="'$(Configuration)'=='Release'">-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)QtWidgets" "-I$(QtIncludeDir)QtGui" "-I$(QtIncludeDir)QtCore" "-I$(QtIncludeDir) " "-I$(QtToolOutDir) " -I.</MocIncludes>
|
||||
<MocIncludes>"-I$(ExternalsDir)xxhash" "-I$(ExternalsDir)zlib" "-I$(ExternalsDir)SFML\include" "-I$(ExternalsDir)mbedtls\include" "-I$(ExternalsDir)miniupnpc\src" "-I$(ExternalsDir)LZO" "-I$(ExternalsDir)libusbx\libusb" "-I$(ExternalsDir)libpng" "-I$(ExternalsDir)GL" "-I$(ExternalsDir)Bochs_disasm" "-I$(CoreDir) " $(MocIncludes)</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)" 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)" />
|
||||
<!--
|
||||
Use the moc implementation provided by "Qt VS Tools"
|
||||
see: https://code.qt.io/cgit/qt-labs/vstools.git/tree/src/qtmsbuild
|
||||
This provides a wrapper around moc which deals with parallel dispatch to moc,
|
||||
as well as creating ClCompile inputs from the moc outputs.
|
||||
Note that we currently pass the same ClCompile.PreprocessorDefinitions to moc,
|
||||
but not the include paths, as passing include paths drastically slows down
|
||||
moc, and it doesn't appear to actually need them anyway.
|
||||
-->
|
||||
<Import Project="qtmoc.props" />
|
||||
<ItemDefinitionGroup>
|
||||
<QtMoc>
|
||||
<OutputFile>$(QtToolOutDir)moc_%(Filename).cpp</OutputFile>
|
||||
<QtMocDir>$(QtToolOutDir)</QtMocDir>
|
||||
</QtMoc>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="qt_globals.targets"/>
|
||||
<Import Project="qt_tasks.targets"/>
|
||||
<Import Project="qtmoc.targets" />
|
||||
<Target Name="QtCheckQtDir" BeforeTargets="QtMocInit" Condition="!$(QtDirValid)">
|
||||
<Error Text="QTDIR not set or non-existent (pull the submodule?)" />
|
||||
</Target>
|
||||
|
||||
<!--Expose the new targets to VS-->
|
||||
<ItemGroup>
|
||||
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
|
||||
<AvailableItemName Include="QtMoc">
|
||||
<Targets>QtMoc</Targets>
|
||||
</AvailableItemName>
|
||||
</ItemGroup>
|
||||
|
||||
<!--Copy the needed dlls-->
|
||||
|
Reference in New Issue
Block a user