From: Zoltan Varga Date: Mon, 4 Jan 2021 17:40:08 +0000 (-0500) Subject: Add support for rebuilding the wasm executable in non-aot mode. (#45072) X-Git-Tag: submit/tizen/20210909.063632~3970 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a98a9439ece097d4b4dd5ce78db61dc6f2f91276;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Add support for rebuilding the wasm executable in non-aot mode. (#45072) * Add support for rebuilding the wasm executable in non-AOT mode. * Run the pinvoke generator as well. * Strip the final executable. * Document some of the public msbuild properties. * Add some properties to make things more readable. * Fix AOT support. * Fix AOT. --- diff --git a/src/mono/netcore/sample/wasm/console/Makefile b/src/mono/netcore/sample/wasm/console/Makefile index dd7fc3b..7bf3273 100644 --- a/src/mono/netcore/sample/wasm/console/Makefile +++ b/src/mono/netcore/sample/wasm/console/Makefile @@ -17,7 +17,7 @@ CONFIG?=Release all: build build: - EMSDK_PATH=$(realpath $(TOP)/src/mono/wasm/emsdk) $(DOTNET) publish $(DOTNET_Q_ARGS) $(DOTNET_RUN_AOT_COMPILATION_ARGS) /p:TargetArchitecture=wasm /p:TargetOS=Browser /p:Configuration=$(CONFIG) $(MSBUILD_ARGS) WasmSample.csproj + EMSDK_PATH=$(realpath $(TOP)/src/mono/wasm/emsdk) $(DOTNET) publish $(DOTNET_Q_ARGS) $(DOTNET_RUN_AOT_COMPILATION_ARGS) $(DOTNET_EXTRA_ARGS) /p:TargetArchitecture=wasm /p:TargetOS=Browser /p:Configuration=$(CONFIG) $(MSBUILD_ARGS) WasmSample.csproj clean: rm -rf bin diff --git a/src/mono/netcore/sample/wasm/console/WasmSample.csproj b/src/mono/netcore/sample/wasm/console/WasmSample.csproj index 6cd0bd9..4cae8bb 100644 --- a/src/mono/netcore/sample/wasm/console/WasmSample.csproj +++ b/src/mono/netcore/sample/wasm/console/WasmSample.csproj @@ -39,9 +39,9 @@ $(AppBundleDir) - $(MSBuildProjectDirectory)\$(PublishDir)\ + $(MSBuildProjectDirectory)\$(PublishDir)\ $(MonoProjectRoot)\wasm\runtime-test.js - $(WasmAotDir)WasmSample.dll + $(WasmBuildDir)WasmSample.dll true diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index 9c1d941..a3f2815 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -3,19 +3,28 @@ + + + + + + false + true + true + - _BeforeWasmBuildApp;_WasmResolveReferences;_WasmAOT + _BeforeWasmBuildApp;_WasmResolveReferences;_WasmBuildNative - - - $(MicrosoftNetCoreAppRuntimePackRidDir)native\src\emcc-flags.txt - $(MicrosoftNetCoreAppRuntimePackRidDir)native\src\emcc-version.txt - $(WasmAOTDir)emcc-version.txt - + @@ -37,7 +46,7 @@ OutputType="AsmOnly" Assemblies="@(AotInputAssemblies)" UseAotDataFile="false" - AotModulesTablePath="$(WasmAOTDir)driver-gen.c" + AotModulesTablePath="$(WasmBuildDir)driver-gen.c" UseLLVM="true" DisableParallelAot="true" LLVMPath="$(EMSDK_PATH)\upstream\bin"> @@ -63,10 +72,9 @@ - + - <_WasmAssemblies Include="$(WasmMainAssemblyPath);@(WasmAssembliesToBundle)" /> @@ -99,29 +107,75 @@ - + + + $(MicrosoftNetCoreAppRuntimePackRidDir)native\src\emcc-flags.txt + $(MicrosoftNetCoreAppRuntimePackRidDir)native\src\emcc-version.txt + $(WasmBuildDir)emcc-version.txt + $(EmccFlags) -s DISABLE_EXCEPTION_CATCHING=0 + $(EmccFlags) -DENABLE_AOT=1 -DDRIVER_GEN=1 - + - - - - + + + + + <_WasmPInvokeModules Include="libSystem.Native" /> + <_WasmPInvokeModules Include="libSystem.IO.Compression.Native" /> + <_WasmPInvokeModules Include="libSystem.Globalization.Native" /> + <_WasmPInvokeAssemblies Include="$(WasmBuildDir)\*.dll" /> + + + + + + <_WasmObjects Include="libmono-ee-interp.a"/> + <_WasmObjects Include="libmonosgen-2.0.a"/> + <_WasmObjects Include="libmono-ilgen.a"/> + <_WasmObjects Include="libmono-icall-table.a"/> + <_WasmObjects Include="libSystem.Native.a"/> + <_WasmObjects Include="libSystem.IO.Compression.Native.a"/> + <_WasmObjects Include="libicuuc.a"/> + <_WasmObjects Include="libicui18n.a"/> + <_WasmObjects Include="driver.o"/> + <_WasmObjects Include="pinvoke.o"/> + <_WasmObjects Include="corebindings.o"/> + + + + <_WasmIncludeDir>$(MicrosoftNetCoreAppRuntimePackRidDir)native/include + <_WasmSrcDir>$(MicrosoftNetCoreAppRuntimePackRidDir)native/src + <_WasmEmcc>source $(EMSDK_PATH)/emsdk_env.sh && emcc + $(EmccFlags) -DCORE_BINDINGS -DGEN_PINVOKE=1 -I$(WasmBuildDir) -I$(_WasmIncludeDir)/mono-2.0 -I$(_WasmIncludeDir)/wasm + $(EmccFlags) -s TOTAL_MEMORY=536870912 + + + + + + +