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

Fix issue with generating and building generated content. #193

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sample/Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DNNE" Version="2.0.6" />
<PackageReference Include="DNNE" Version="2.0.7" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/dnne-gen/dnne-gen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>DNNE</RootNamespace>
<RollForward>major</RollForward>
<RollForward>Major</RollForward>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion src/dnne-pkg/dnne-pkg.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<PropertyGroup>
<PackageId>DNNE</PackageId>
<Version>2.0.6</Version>
<Version>2.0.7</Version>
<Authors>AaronRobinsonMSFT</Authors>
<Owners>AaronRobinsonMSFT</Owners>
<Description>Package used to generated native exports for .NET assemblies.</Description>
Expand Down
46 changes: 37 additions & 9 deletions src/msbuild/DNNE.targets
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,32 @@ DNNE.targets
</PropertyGroup>

<ItemGroup>
<DnneGeneratedSourceFile Include="$(DnneGeneratedSourceFileName)" />
<DnneGeneratedSourceFile
Include="$(DnneGeneratedSourceFileName)"
Condition="'$(DnneGenerateExports)' == 'true'" />

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

<DnneNativeExportsInput Include="$(DnneGeneratedSourceFileName)" >
<DnneNativeExportsInput
Include="$(DnneGeneratedSourceFileName)"
Condition="'$(DnneGenerateExports)' == 'true'" >
<OutputFileName>$(DnneNativeExportsBinaryName).h</OutputFileName>
</DnneNativeExportsInput>

<DnneNativeExportsInput Include="$(DnnePlatformSourcePath)/dnne.h" >
<DnneNativeExportsInput
Include="$(DnnePlatformSourcePath)/dnne.h"
Condition="'$(DnneGenerateExports)' == 'true'" >
<OutputFileName>dnne.h</OutputFileName>
</DnneNativeExportsInput>

<DnneNativeExportsInput
Include="$(DnneCompiledToBinPath)"
Condition="'$(DnneBuildExports)' == 'true'" >
<OutputFileName>$(DnneNativeExportsBinaryName)$(DnneNativeBinaryExt)</OutputFileName>
</DnneNativeExportsInput>

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

Expand All @@ -87,7 +95,7 @@ DNNE.targets

<Target
Name="DnneGenerateNativeExports"
Condition="('$(DesignTimeBuild)' != 'true' OR '$(BuildingProject)' == 'true') AND '$(DnneSupportedTFM)' == 'true' AND '$(DnneBuildExports)' == 'true'"
Condition="('$(DesignTimeBuild)' != 'true' OR '$(BuildingProject)' == 'true') AND '$(DnneSupportedTFM)' == 'true' AND '$(DnneGenerateExports)' == 'true'"
Inputs="@(IntermediateAssembly)"
Outputs="@(DnneGeneratedSourceFile)"
AfterTargets="CoreCompile">
Expand Down Expand Up @@ -199,6 +207,26 @@ DNNE.targets

</Target>

<!--
This target is used to deploy the header file assets when DNNE is _not_ building an export binary.
-->
<Target
Name="DnneCopyGeneratedHeaders"
Condition="('$(DesignTimeBuild)' != 'true' OR '$(BuildingProject)' == 'true') AND '$(DnneSupportedTFM)' == 'true' AND '$(DnneGenerateExports)' == 'true' AND '$(DnneBuildExports)' != 'true'"
Inputs="@(DnneNativeExportsInput)"
Outputs="@(DnneNativeExportsInput->'$(DnneNativeExportsBinaryPath)%(OutputFileName)')"
AfterTargets="DnneGenerateNativeExports" >

<!--
The dnne-gen tool generates a C99 file that can act as both compilation unit and header.
Deploy the official 'dnne.h' header.
-->
<Copy
SourceFiles="@(DnneNativeExportsInput)"
DestinationFiles="@(DnneNativeExportsInput->'$(DnneNativeExportsBinaryPath)%(OutputFileName)')" />

</Target>

<!--
The Target below is used to mitigate a limitation when referencing
application projects. The work to improve this is tracked with:
Expand Down
Loading