Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make DNNE build incrementally #172

Merged
merged 6 commits into from
Jul 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 27 additions & 13 deletions src/msbuild/DNNE.targets
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,33 @@ DNNE.targets
<DnneSupportedTFM Condition="!$([MSBuild]::IsOsPlatform('Windows')) AND '$(DnneIsNetFramework)' == 'true'">false</DnneSupportedTFM>

<DnneCompiledToBinPath>$(DnneGeneratedBinPath)/$(DnneNativeExportsBinaryName)$(DnneNativeBinaryExt)</DnneCompiledToBinPath>
<DnneGeneratedSourceFileName>$(DnneGeneratedOutputPath)/$(TargetName).g.c</DnneGeneratedSourceFileName>
</PropertyGroup>

<ItemGroup>
<DnneGeneratedSourceFile Include="$(DnneGeneratedOutputPath)/$(TargetName).g.c" />
<DnneNativeExportsOutputs Include="$(DnneNativeExportsBinaryPath)$(DnneNativeExportsBinaryName)$(DnneNativeBinaryExt);$(DnneNativeExportsBinaryPath)$(DnneNativeExportsBinaryName).h;$(DnneNativeExportsBinaryPath)dnne.h" />
<DnneGeneratedSourceFile Include="$(DnneGeneratedSourceFileName)" />

<DnneNativeExportsInput Include="$(DnneCompiledToBinPath)">
<OutputFileName>$(DnneNativeExportsBinaryName)$(DnneNativeBinaryExt)</OutputFileName>
</DnneNativeExportsInput>

<DnneNativeExportsInput Include="$(DnneGeneratedSourceFileName)" >
<OutputFileName>$(DnneNativeExportsBinaryName).h</OutputFileName>
</DnneNativeExportsInput>

<DnneNativeExportsInput Include="$(DnnePlatformSourcePath)/dnne.h" >
<OutputFileName>dnne.h</OutputFileName>
</DnneNativeExportsInput>

<!-- Import libs exist only on the Windows platform -->
<DnneNativeExportsInput
Include="$(DnneGeneratedBinPath)/$(DnneNativeExportsBinaryName).lib"
Condition="$([MSBuild]::IsOsPlatform('Windows'))" >
<OutputFileName>$(DnneNativeExportsBinaryName).lib</OutputFileName>
</DnneNativeExportsInput>

<!-- Add outputs and general glob to help with project cleanup -->
<Clean Include="@(DnneNativeExportsOutputs);$(DnneNativeExportsBinaryPath)$(DnneNativeExportsBinaryName).*"/>
<Clean Include="@(DnneNativeExportsInput->'$(DnneNativeExportsBinaryPath)%(OutputFileName)');$(DnneNativeExportsBinaryPath)$(DnneNativeExportsBinaryName).*"/>
</ItemGroup>

<Target
Expand Down Expand Up @@ -92,7 +111,7 @@ DNNE.targets
they flow through project references.
-->
<ItemGroup Condition="'$(DnneBuildExports)' == 'true' AND '$(DnneAddGeneratedBinaryToProject)' == 'true'">
<None Include="@(DnneNativeExportsOutputs->'%(FullPath)')">
<None Include="@(DnneNativeExportsInput->'$(DnneNativeExportsBinaryPath)%(OutputFileName)')">
<Link>%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
Expand All @@ -112,8 +131,8 @@ DNNE.targets
<Target
Name="DnneBuildNativeExports"
Condition="('$(DesignTimeBuild)' != 'true' OR '$(BuildingProject)' == 'true') AND '$(DnneSupportedTFM)' == 'true' AND '$(DnneBuildExports)' == 'true'"
Inputs="@(DnneGeneratedSourceFile)"
Outputs="@(DnneNativeExportsOutputs)"
Inputs="@(DnneNativeExportsInput)"
Outputs="@(DnneNativeExportsInput->'$(DnneNativeExportsBinaryPath)%(OutputFileName)')"
AfterTargets="DnneGenerateNativeExports"
DependsOnTargets="ResolvePackageAssets;ResolveFrameworkReferences">
<Message Text="Building native exports binary from @(DnneGeneratedSourceFile)" Importance="$(DnneMSBuildLogging)" />
Expand Down Expand Up @@ -173,14 +192,9 @@ DNNE.targets
Deploy the official 'dnne.h' header.
-->
<Copy
SourceFiles="$(DnneCompiledToBinPath);$(__DnneGeneratedSourceFile);$(DnnePlatformSourcePath)/dnne.h"
DestinationFiles="@(DnneNativeExportsOutputs)" />
SourceFiles="@(DnneNativeExportsInput)"
DestinationFiles="@(DnneNativeExportsInput->'$(DnneNativeExportsBinaryPath)%(OutputFileName)')" />

<!-- Import libs exist only on the Windows platform -->
<Copy
Condition="$([MSBuild]::IsOsPlatform('Windows'))"
SourceFiles="$(DnneGeneratedBinPath)/$(DnneNativeExportsBinaryName).lib"
DestinationFolder="$(DnneNativeExportsBinaryPath)" />
</Target>

<!--
Expand Down