Skip to content
Merged
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
32 changes: 21 additions & 11 deletions src/mono/wasi/build/WasiApp.Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@
</PropertyGroup>

<ItemGroup>
<WasiAfterRuntimeLoadedDeclarations Include="@(WasiAfterRuntimeLoaded->'void %(Identity)();')" />
<WasiAfterRuntimeLoadedCalls Include="@(WasiAfterRuntimeLoaded->'%(Identity)();')" />

<_WasmCommonIncludePaths Include="$(_WasmIntermediateOutputPath.TrimEnd('\/'))" />
<_WasmCommonIncludePaths Include="$(_WasmRuntimePackIncludeDir)mono-2.0" />
<_WasmCommonIncludePaths Include="$(_WasmRuntimePackIncludeDir)wasm" />
Expand Down Expand Up @@ -410,13 +413,7 @@
<Delete Files="@(WasmBundleFileToDelete)" />
</Target>

<!-- replace with wasmlinkdotnet -->
<Target Name="_WasiLinkDotNet"
DependsOnTargets="_CheckWasiClangIsExpectedVersion;_WasmSelectRuntimeComponentsForLinking;_WasmCompileAssemblyBitCodeFilesForAOT;_WasmWriteRspFilesForLinking"
Inputs="@(_WasmLinkDependencies);$(_WasiClangDefaultFlagsRsp);$(_WasiClangDefaultLinkFlagsRsp);$(_WasiClangLinkRsp)"
Outputs="$(_WasmOutputFileName)"
Returns="@(FileWrites)">

<Target Name="_WasmWriteRspFilesForLinking" DependsOnTargets="_CheckWasiClangIsExpectedVersion;_WasmCalculateInitialHeapSize">
<!-- Generate a file entrypoint_YourAssemblyName.c containing the dotnet_wasi_getentrypointassemblyname symbol.
This means we don't have to hardcode the assembly name in main.c -->
<PropertyGroup>
Expand All @@ -434,9 +431,9 @@
WriteOnlyWhenDifferent="true" />
<ItemGroup>
<FileWrites Include="$(_WasiGetEntrypointCFile)" />
<WasiAfterRuntimeLoadedDeclarations Include="@(WasiAfterRuntimeLoaded->'void %(Identity)();')" />
<WasiAfterRuntimeLoadedCalls Include="@(WasiAfterRuntimeLoaded->'%(Identity)();')" />
</ItemGroup>

<ItemGroup>
<_WasiClangXLinkerFlags Include="--initial-memory=$(WasmInitialHeapSize)" />

<_WasmNativeFileForLinking Include="@(NativeFileReference)" />
Expand All @@ -445,6 +442,8 @@
<_WasiFilePathForFixup Include="@(_WasiObjectFilesForBundle)" />
<_WasiFilePathForFixup Include="@(_WasmNativeFileForLinking)" />

<_WasmLinkDependencies Include="@(_WasiFilePathForFixup)" />

<_WasiSdkClangArgs Condition="'$(OS)' == 'Windows_NT'" Include="&quot;$([System.String]::new(%(_WasiFilePathForFixup.Identity)).Replace('\', '/'))&quot;" />
<_WasiSdkClangArgs Condition="'$(OS)' != 'Windows_NT'" Include="@(_WasiFilePathForFixup -> '&quot;%(Identity)&quot;')" />

Expand All @@ -460,7 +459,18 @@
<_WasiSdkClangArgs Include="-o &quot;$(_WasmOutputFileName.Replace('\', '/'))&quot;" />
</ItemGroup>

<WriteLinesToFile Lines="@(_WasiSdkClangArgs)" File="$(_WasiClangLinkRsp)" Overwrite="true" />
<WriteLinesToFile Lines="@(_WasiSdkClangArgs)" File="$(_WasiClangLinkRsp)" Overwrite="true" WriteOnlyWhenDifferent="true" />
<ItemGroup>
<_WasmLinkDependencies Include="$(_WasiClangLinkRsp)" />
</ItemGroup>
</Target>

<!-- replace with wasmlinkdotnet -->
<Target Name="_WasiLinkDotNet"
DependsOnTargets="_CheckWasiClangIsExpectedVersion;_WasmSelectRuntimeComponentsForLinking;_WasmCompileAssemblyBitCodeFilesForAOT;_WasmWriteRspFilesForLinking"
Inputs="@(_WasmLinkDependencies);$(_WasiClangDefaultFlagsRsp);$(_WasiClangDefaultLinkFlagsRsp);$(_WasiClangLinkRsp)"
Outputs="$(_WasmOutputFileName)"
Returns="@(FileWrites)">

<!--<Message Importance="High" Text="Performing WASI SDK build: &quot;$(WasiClang)&quot; @(_WasiSdkClangArgs, ' ')" />-->
<Message Importance="High" Text="Performing WASI SDK build: &quot;$(WasiClang)&quot; &quot;$(_WasiClangLinkRsp)&quot;" />
Expand Down Expand Up @@ -614,5 +624,5 @@
</Target>

<Target Name="_CheckWasiClangIsExpectedVersion" />
<Target Name="_WasmWriteRspFilesForLinking" />
<Target Name="_WasmCalculateInitialHeapSize" />
</Project>