From 6956ce2f3d2c0043e495e5398528059db426219c Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 19 May 2021 17:12:08 -0400 Subject: [PATCH 1/7] [wasm] Use new `emcc-default.rsp`, and `Emcc.props` `emcc-default.rsp`: - this replaces `emcc-flags.txt` which was generated at wasm build time as the default set of flags. `Emcc.props`: - this replaces `emcc-version.txt` which was generated at wasm build time, and contained the output of `emcc --version`, eg: `emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.12 (d0e647bf266caad50943e78c9841e05e9c499a5d)` - Instead of this, we now generate `Emcc.props`, which has: `$(RuntimeEmccVersionRaw)` - full version string (`emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.12 (d0e647bf266caad50943e78c9841e05e9c499a5d)`) `$(RuntimeEmccVersion)` - parsed version (`2.0.12`) `$(RuntimeEmccVersionHash)` - parsed hash (`d0e647bf266caad50943e78c9841e05e9c499a5d`) - these might be useful for nugets with native libraries for use with wasm, for example - The default options being used in the `Makefile` have been moved to `wasm.proj`, and used to populate the new files - this tries to retain the same flags as are being used currently, on various platforms (eg. for windows the optimization flags differ) --- eng/liveBuilds.targets | 4 +- .../Directory.Build.props | 4 +- src/mono/wasm/Makefile | 29 ++-- src/mono/wasm/build/WasmApp.targets | 41 +++--- src/mono/wasm/wasm.proj | 129 +++++++++++++----- src/tests/Common/Directory.Build.targets | 8 +- 6 files changed, 135 insertions(+), 80 deletions(-) diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index 66da71ac53f75..11ea3bf8f3aea 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -175,8 +175,8 @@ Include=" $(LibrariesNativeArtifactsPath)src\*.c; $(LibrariesNativeArtifactsPath)src\*.js; - $(LibrariesNativeArtifactsPath)src\emcc-flags.txt; - $(LibrariesNativeArtifactsPath)src\emcc-version.txt;" + $(LibrariesNativeArtifactsPath)src\emcc-default.rsp; + $(LibrariesNativeArtifactsPath)src\Emcc.props;" NativeSubDirectory="src" IsNative="true" /> - - + + diff --git a/src/mono/wasm/Makefile b/src/mono/wasm/Makefile index abb93b97f4068..2ad9f5a7d5dd4 100644 --- a/src/mono/wasm/Makefile +++ b/src/mono/wasm/Makefile @@ -20,10 +20,9 @@ MONO_BIN_DIR?=$(BINDIR)/mono/Browser.wasm.$(CONFIG) NATIVE_BIN_DIR?=$(BINDIR)/native/net6.0-Browser-$(CONFIG)-wasm ICU_LIBDIR?= SYSTEM_NATIVE_LIBDIR?=$(TOP)/src/libraries/Native/Unix/System.Native -ENABLE_ES6?=false _MSBUILD_WASM_BUILD_ARGS=/p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=$(CONFIG) -ENABLE_METADATA_UPDATE?=false XHARNESS_BROWSER?=chrome +EMCC_DEFAULT_RSP=$(NATIVE_BIN_DIR)/src/emcc-default.rsp all: build-native icu-files source-files header-files @@ -63,14 +62,6 @@ MONO_LIBS = \ $(ICU_LIBDIR)/libicuuc.a \ $(ICU_LIBDIR)/libicui18n.a -EMCC_FLAGS=--profiling-funcs -s ALLOW_MEMORY_GROWTH=1 -s NO_EXIT_RUNTIME=1 -s FORCE_FILESYSTEM=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['ccall', 'FS_createPath', 'FS_createDataFile', 'cwrap', 'setValue', 'getValue', 'UTF8ToString', 'UTF8ArrayToString', 'addFunction']" -s "EXPORTED_FUNCTIONS=['_putchar']" --source-map-base http://example.com -emit-llvm -ifneq ($(ENABLE_ES6),false) - EMCC_FLAGS+=-s MODULARIZE=1 -s EXPORT_ES6=1 -endif -ifeq ($(ENABLE_METADATA_UPDATE),true) - EMCC_FLAGS+=-DENABLE_METADATA_UPDATE=1 -endif - EMCC_DEBUG_FLAGS =-g -Os -s ASSERTIONS=1 -DDEBUG=1 EMCC_RELEASE_FLAGS=-Oz --llvm-opts 2 @@ -102,27 +93,27 @@ $(BUILDS_OBJ_DIR): mkdir -p $$@ $(NATIVE_BIN_DIR)/dotnet.js: $(BUILDS_OBJ_DIR)/driver.o $(BUILDS_OBJ_DIR)/pinvoke.o $(BUILDS_OBJ_DIR)/corebindings.o runtime/library_mono.js runtime/binding_support.js runtime/dotnet_support.js $(SYSTEM_NATIVE_LIBDIR)/pal_random.js $(2) | $(NATIVE_BIN_DIR) - $(EMCC) $(EMCC_FLAGS) $(1) --js-library runtime/library_mono.js --js-library runtime/binding_support.js --js-library runtime/dotnet_support.js --js-library $(SYSTEM_NATIVE_LIBDIR)/pal_random.js $(BUILDS_OBJ_DIR)/driver.o $(BUILDS_OBJ_DIR)/pinvoke.o $(BUILDS_OBJ_DIR)/corebindings.o $(2) -o $(NATIVE_BIN_DIR)/dotnet.js $(3) + $(EMCC) @$(EMCC_DEFAULT_RSP) $(1) --js-library runtime/library_mono.js --js-library runtime/binding_support.js --js-library runtime/dotnet_support.js --js-library $(SYSTEM_NATIVE_LIBDIR)/pal_random.js $(BUILDS_OBJ_DIR)/driver.o $(BUILDS_OBJ_DIR)/pinvoke.o $(BUILDS_OBJ_DIR)/corebindings.o $(2) -o $(NATIVE_BIN_DIR)/dotnet.js $(3) $(BUILDS_OBJ_DIR)/pinvoke-table.h: $(PINVOKE_TABLE) | $(BUILDS_OBJ_DIR) if cmp -s $(PINVOKE_TABLE) $$@ ; then : ; else cp $(PINVOKE_TABLE) $$@ ; fi $(BUILDS_OBJ_DIR)/driver.o: runtime/driver.c | $(BUILDS_OBJ_DIR) - $(EMCC) $(EMCC_FLAGS) $(1) -Oz -DCORE_BINDINGS -I$(BUILDS_OBJ_DIR) -I$(MONO_INCLUDE_DIR) runtime/driver.c -c -o $$@ + $(EMCC) @$(EMCC_DEFAULT_RSP) $(1) -Oz -DCORE_BINDINGS -I$(BUILDS_OBJ_DIR) -I$(MONO_INCLUDE_DIR) runtime/driver.c -c -o $$@ $(BUILDS_OBJ_DIR)/pinvoke.o: runtime/pinvoke.c runtime/pinvoke.h $(BUILDS_OBJ_DIR)/pinvoke-table.h | $(BUILDS_OBJ_DIR) - $(EMCC) $(EMCC_FLAGS) $(1) -Oz -DGEN_PINVOKE=1 -I$(BUILDS_OBJ_DIR) runtime/pinvoke.c -c -o $$@ + $(EMCC) @$(EMCC_DEFAULT_RSP) $(1) -Oz -DGEN_PINVOKE=1 -I$(BUILDS_OBJ_DIR) runtime/pinvoke.c -c -o $$@ $(BUILDS_OBJ_DIR)/corebindings.o: runtime/corebindings.c | $(BUILDS_OBJ_DIR) - $(EMCC) $(EMCC_FLAGS) $(1) -Oz -I$(MONO_INCLUDE_DIR) runtime/corebindings.c -c -o $$@ + $(EMCC) @$(EMCC_DEFAULT_RSP) $(1) -Oz -I$(MONO_INCLUDE_DIR) runtime/corebindings.c -c -o $$@ -$(NATIVE_BIN_DIR)/src/emcc-flags.txt: | $(NATIVE_BIN_DIR)/src Makefile - echo "$(call escape_quote,$(EMCC_FLAGS)) $(1)" > $$@ +$(EMCC_DEFAULT_RSP): | $(NATIVE_BIN_DIR)/src Makefile + $(DOTNET) build $(CURDIR)/wasm.proj /p:Configuration=$(CONFIG) /t:GenerateEmccPropsAndRspFiles -$(NATIVE_BIN_DIR)/src/emcc-version.txt: $(EMSDK_PATH)/upstream/.emsdk_version | $(NATIVE_BIN_DIR)/src - $(EMCC) --version | head -1 > $$@ +$(NATIVE_BIN_DIR)/src/Emcc.props: $(EMSDK_PATH)/upstream/.emsdk_version | $(NATIVE_BIN_DIR)/src + $(DOTNET) build $(CURDIR)/wasm.proj /p:Configuration=$(CONFIG) /t:GenerateEmccPropsAndRspFiles -build-native: $(NATIVE_BIN_DIR)/dotnet.js $(NATIVE_BIN_DIR)/src/emcc-flags.txt $(NATIVE_BIN_DIR)/src/emcc-version.txt +build-native: $(NATIVE_BIN_DIR)/dotnet.js $(NATIVE_BIN_DIR)/src/emcc-default.rsp $(NATIVE_BIN_DIR)/src/Emcc.props endef diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index 0467636bd6c72..7f1b7fa246de1 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -96,6 +96,15 @@ _WasmLinkDotNet; _CompleteWasmBuildNative + + $([MSBuild]::NormalizeDirectory($(NuGetPackageRoot), 'microsoft.netcore.app.runtime.mono.browser-wasm', '$(BundledNETCoreAppPackageVersion)')) + $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackDir), 'runtimes', 'browser-wasm')) + $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir))) + $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir), 'native')) + + <_WasmRuntimePackIncludeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include')) + <_WasmRuntimePackSrcDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'src')) + <_EmccPropsPath>$(_WasmRuntimePackSrcDir)Emcc.props @@ -235,11 +244,6 @@ - - $([MSBuild]::NormalizeDirectory($(NuGetPackageRoot), 'microsoft.netcore.app.runtime.mono.browser-wasm', '$(BundledNETCoreAppPackageVersion)')) - $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackDir), 'runtimes', 'browser-wasm')) - - @@ -251,8 +255,6 @@ $(TargetFileName) $([MSBuild]::NormalizeDirectory($(WasmAppDir))) - $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir))) - $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir), 'native')) <_WasmIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm')) @@ -385,7 +387,7 @@ Text="$(_EMSDKMissingErrorMessage) Emscripten SDK is required for building native files." /> - $([MSBuild]::NormalizePath($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'src', 'emcc-flags.txt')) + <_EmccDefaultFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-default.rsp')) true $(WasmBuildNative) <_WasmICallTablePath>$(_WasmIntermediateOutputPath)icall-table.h @@ -393,17 +395,15 @@ <_WasmPInvokeTablePath>$(_WasmIntermediateOutputPath)pinvoke-table.h <_EmccOptimizationFlagDefault Condition="'$(_WasmDevel)' == 'true'">-O0 + <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == '' and '$(OS)' != 'Windows_NT' and '$(Configuration)' == 'Debug'">-Os + <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == '' and '$(Configuration)' != 'Debug'">-Oz + <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == ''">-Oz $(_EmccOptimizationFlagDefault) $(_EmccOptimizationFlagDefault) - - - - - <_EmccCommonFlags Include="$(_DefaultEmccFlags)" /> <_EmccCommonFlags Include="$(EmccFlags)" /> <_EmccCommonFlags Include="-s DISABLE_EXCEPTION_CATCHING=0" /> <_EmccCommonFlags Include="-g" Condition="'$(WasmNativeStrip)' == 'false'" /> @@ -478,7 +478,7 @@ - + @@ -504,9 +504,9 @@ <_EmccLinkRsp>$(_WasmIntermediateOutputPath)emcc-link.rsp - + - + @@ -560,9 +560,8 @@ EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_ - - - + @@ -574,10 +573,10 @@ EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_ <_ReversedVersionLines Include="@(_VersionLines->Reverse())" /> - %(_ReversedVersionLines.Identity) + %(_ReversedVersionLines.Identity) - + diff --git a/src/mono/wasm/wasm.proj b/src/mono/wasm/wasm.proj index dda6fa29f6272..489e3ee151b34 100644 --- a/src/mono/wasm/wasm.proj +++ b/src/mono/wasm/wasm.proj @@ -16,6 +16,9 @@ false false true + emcc + $(ArtifactsObjDir)wasm + <_EmccDefaultsRspPath>$(NativeBinDir)src\emcc-default.rsp @@ -70,11 +73,90 @@ OutputFileName="$(TimeZonesDataPath)" /> + + + <_EmccCommonFlags Include="-s ALLOW_MEMORY_GROWTH=1" /> + <_EmccCommonFlags Include="-s NO_EXIT_RUNTIME=1" /> + <_EmccCommonFlags Include="-s FORCE_FILESYSTEM=1" /> + <_EmccCommonFlags Include="-s "EXTRA_EXPORTED_RUNTIME_METHODS=['ccall', 'FS_createPath', 'FS_createDataFile', 'cwrap', 'setValue', 'getValue', 'UTF8ToString', 'UTF8ArrayToString', 'addFunction']"" /> + <_EmccCommonFlags Include="-s "EXPORTED_FUNCTIONS=['_putchar']"" /> + <_EmccCommonFlags Include="--source-map-base http://example.com" /> + <_EmccCommonFlags Include="-emit-llvm" /> + + <_EmccCommonFlags Include="-s MODULARIZE=1" Condition="'$(WasmEnableES6)' != 'false'" /> + <_EmccCommonFlags Include="-s EXPORT_ES6=1" Condition="'$(WasmEnableES6)' != 'false'" /> + + + + <_EmccFlags Include="--profiling-funcs" /> + <_EmccFlags Include="@(_EmccCommonFlags)" /> + + <_EmccFlags Include="-DENABLE_METADATA_UPDATE=1" Condition="'$(WasmEnableMetadataUpdate)' == 'true'" /> + + + + <_EmccFlags Include="@(_EmccCommonFlags)" /> + + <_EmccFlags Include="-s WASM=1" /> + <_EmccFlags Include="-s BINARYEN=1" /> + <_EmccFlags Include="-s ALIASING_FUNCTION_POINTERS=0" /> + <_EmccFlags Include="-s USE_ZLIB=1" /> + <_EmccFlags Include="-DENABLE_NETCORE=1" Condition="'$(Configuration)' == 'Release'" /> + + + + + + + + + + + + + <_ReversedVersionLines Include="@(_VersionLines->Reverse())" /> + + + <_EmccVersionRaw>%(_ReversedVersionLines.Identity) + + <_EmccVersionRegexPattern>^ *emcc \([^\)]+\) *([^ \(]+) *\(([^\)]+)\)$ + <_EmccVersion>$([System.Text.RegularExpressions.Regex]::Match($(_EmccVersionRaw), $(_EmccVersionRegexPattern)).Groups[1].Value) + <_EmccVersionHash>$([System.Text.RegularExpressions.Regex]::Match($(_EmccVersionRaw), $(_EmccVersionRegexPattern)).Groups[2].Value) + + <_EmccPropsContent> + + + $(_EmccVersionRaw) + $(_EmccVersion) + $(_EmccVersionHash) + + +]]> + + + + + + + + + DependsOnTargets="GenerateEmccPropsAndRspFiles;BuildPInvokeTable;BundleTimeZones"> @@ -83,8 +165,8 @@ + $(_EmccDefaultsRspPath); + $(NativeBinDir)src\Emcc.props" /> @@ -112,17 +194,12 @@ + DependsOnTargets="GenerateEmccPropsAndRspFiles;BuildPInvokeTable;BundleTimezones"> - emcc - --profiling-funcs -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s BINARYEN=1 -s ALIASING_FUNCTION_POINTERS=0 -s NO_EXIT_RUNTIME=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['ccall', 'FS_createPath', 'FS_createDataFile', 'cwrap', 'setValue', 'getValue', 'UTF8ToString', 'UTF8ArrayToString', 'addFunction']" -s "EXPORTED_FUNCTIONS=['_putchar']" --source-map-base http://example.com -emit-llvm -s FORCE_FILESYSTEM=1 -s USE_ZLIB=1 - $(EmccFlags) -s MODULARIZE=1 -s EXPORT_ES6=1 -g -Os -s ASSERTIONS=1 -DENABLE_NETCORE=1 -DDEBUG=1 -Oz --llvm-opts 2 -DENABLE_NETCORE=1 "$(EMSDK_PATH)/upstream/bin/wasm-opt" --strip-dwarf "$(NativeBinDir)/dotnet.wasm" -o "$(NativeBinDir)/dotnet.wasm" - $(ArtifactsObjDir)wasm - $(WasmObjDir)\emcc-version.txt $(MonoArtifactsPath)include/mono-2.0 $(RepoRoot)src\libraries\Native\Unix\System.Native @@ -140,11 +217,11 @@ - - @@ -152,11 +229,11 @@ DestinationFolder="$(MonoObjDir)" SkipUnchangedFiles="true" /> - - @@ -167,31 +244,17 @@ - - - <_ReversedVersionLines Include="@(_VersionLines->Reverse())" /> - - - %(_ReversedVersionLines.Identity) - - - - - + @@ -199,10 +262,6 @@ DestinationFolder="$(NativeBinDir)" SkipUnchangedFiles="true" /> - - + $(_EmccDefaultsRspPath); + $(NativeBinDir)src\Emcc.props" /> diff --git a/src/tests/Common/Directory.Build.targets b/src/tests/Common/Directory.Build.targets index bf9be0cc4d712..31e55c12ccfc0 100644 --- a/src/tests/Common/Directory.Build.targets +++ b/src/tests/Common/Directory.Build.targets @@ -129,7 +129,13 @@ WasmAppBuilder expects in native/--> + TargetDir="runtimepack/native/%(LibrariesRuntimeFiles.NativeSubDirectory)/" + Condition="'%(LibrariesRuntimeFiles.NativeSubDirectory)' != ''" /> + + Date: Wed, 19 May 2021 17:18:03 -0400 Subject: [PATCH 2/7] [wasm] Split native targets into `Wasm.Native.targets` - this is being done mainly to aid readability, and clarity - a new target `WasmBuildNativeOnly` has been added, which should (eventually) be usable before `publish`. - this commit makes the changes for it, but it hasn't been tested in it's final form --- src/mono/wasm/build/WasmApp.Native.targets | 445 +++++++++++++++++++++ src/mono/wasm/build/WasmApp.props | 2 +- src/mono/wasm/build/WasmApp.targets | 418 +------------------ 3 files changed, 460 insertions(+), 405 deletions(-) create mode 100644 src/mono/wasm/build/WasmApp.Native.targets diff --git a/src/mono/wasm/build/WasmApp.Native.targets b/src/mono/wasm/build/WasmApp.Native.targets new file mode 100644 index 0000000000000..9288eb7f01986 --- /dev/null +++ b/src/mono/wasm/build/WasmApp.Native.targets @@ -0,0 +1,445 @@ + + + + + + + + <_WasmBuildNativeCoreDependsOn> + _CheckEmccIsExpectedVersion; + _PrepareForWasmBuildNative; + _GenerateDriverGenC; + _GeneratePInvokeTable; + _GenerateICallTable; + _WasmCompileNativeFiles; + _WasmLinkDotNet; + _CompleteWasmBuildNative + + + + _PrepareForWasmBuildNativeOnly; + _WasmBuildNativeCore; + + + <_BeforeWasmBuildAppDependsOn> + $(_BeforeWasmBuildAppDependsOn); + _SetupEmscripten; + _SetWasmBuildNativeDefaults + + + <_ExeExt Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">.exe + true + + $([MSBuild]::NormalizeDirectory($(NuGetPackageRoot), 'microsoft.netcore.app.runtime.mono.browser-wasm', '$(BundledNETCoreAppPackageVersion)')) + $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackDir), 'runtimes', 'browser-wasm')) + $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir))) + $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir), 'native')) + + <_WasmRuntimePackIncludeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include')) + <_WasmRuntimePackSrcDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'src')) + <_EmccPropsPath>$(_WasmRuntimePackSrcDir)Emcc.props + + + + + + + + + + + + + <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> + <_WasmAssembliesInternal Include="@(WasmAssembliesToBundle->Distinct())" /> + + + + + + + <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenSdkToolsPath)' == '' or !Exists('$(EmscriptenSdkToolsPath)'))">%24(EmscriptenSdkToolsPath)=$(EmscriptenSdkToolsPath) + <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenNodeToolsPath)' == '' or !Exists('$(EmscriptenNodeToolsPath)'))">%24(EmscriptenNodeToolsPath)=$(EmscriptenNodeToolsPath) + <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenUpstreamBinPath)' == '' or !Exists('$(EmscriptenUpstreamBinPath)'))">%24(EmscriptenUpstreamBinPath)=$(EmscriptenUpstreamBinPath) + + + + <_EMSDKMissingErrorMessage Condition="'$(EMSDK_PATH)' == '' and '$(EmscriptenSdkToolsPath)' == ''">Could not find emscripten sdk. Either set %24(EMSDK_PATH), or use workloads to get the sdk. + + <_EMSDKMissingErrorMessage Condition="'$(_EMSDKMissingErrorMessage)' == '' and '$(_UsingEMSDK_PATH)' != 'true' and '$(_EMSDKMissingPaths)' != ''">Emscripten from the workload is missing some paths: $(_EMSDKMissingPaths). + <_EMSDKMissingErrorMessage Condition="'$(_EMSDKMissingErrorMessage)' == '' and '$(_UsingEMSDK_PATH)' == 'true' and !Exists($(EMSDK_PATH))">Could not find Emscripten sdk at %24(EMSDK_PATH)=$(EMSDK_PATH) . + <_EMSDKMissingErrorMessage Condition="'$(_EMSDKMissingErrorMessage)' == '' and '$(_UsingEMSDK_PATH)' == 'true' and '$(_EMSDKMissingPaths)' != ''">Specified Emscripten sdk at %24(EMSDK_PATH)=$(EMSDK_PATH) is missing some paths: $(_EMSDKMissingPaths). + + <_IsEMSDKMissing Condition="'$(_EMSDKMissingErrorMessage)' != ''">true + + + + $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath))) + $([MSBuild]::NormalizeDirectory($(EmscriptenNodeToolsPath))) + $([MSBuild]::NormalizeDirectory($(EmscriptenUpstreamBinPath))) + + + + + + + + + + + <_EmscriptenPrependPATHTrimmed Include="$([MSBuild]::ValueOrDefault('%(EmscriptenPrependPATH.Identity)\', '').TrimEnd('\/'))" /> + + + + + + + <_PathSeparator Condition="'$(OS)' == 'Windows_NT'">%3B + <_PathSeparator Condition="'$(OS)' != 'Windows_NT'">: + + <_EmscriptenPrependPATHProperty>@(EmscriptenPrependPATH -> '%(Identity)', '$(_PathSeparator)') + + + + + + + + + + + + + + + true + false + true + false + + + + + + + false + + + + + + + + + + <_EmccDefaultFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-default.rsp')) + true + true + $(WasmBuildNative) + <_WasmICallTablePath>$(_WasmIntermediateOutputPath)icall-table.h + <_WasmRuntimeICallTablePath>$(_WasmIntermediateOutputPath)runtime-icall-table.h + <_WasmPInvokeTablePath>$(_WasmIntermediateOutputPath)pinvoke-table.h + + <_EmccOptimizationFlagDefault Condition="'$(_WasmDevel)' == 'true'">-O0 + <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == '' and '$(OS)' != 'Windows_NT' and '$(Configuration)' == 'Debug'">-Os + <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == '' and '$(Configuration)' != 'Debug'">-Oz + <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == ''">-Oz + + $(_EmccOptimizationFlagDefault) + $(_EmccOptimizationFlagDefault) + + + + <_EmccCommonFlags Include="$(_DefaultEmccFlags)" /> + <_EmccCommonFlags Include="$(EmccFlags)" /> + <_EmccCommonFlags Include="-s DISABLE_EXCEPTION_CATCHING=0" /> + <_EmccCommonFlags Include="-g" Condition="'$(WasmNativeStrip)' == 'false'" /> + <_EmccCommonFlags Include="-DENABLE_AOT=1" Condition="'$(RunAOTCompilation)' == 'true'" /> + <_EmccCommonFlags Include="-DDRIVER_GEN=1" Condition="'$(RunAOTCompilation)' == 'true'" /> + <_EmccCommonFlags Include="-DINVARIANT_GLOBALIZATION=1" Condition="'$(InvariantGlobalization)' == 'true'" /> + <_EmccCommonFlags Include="-DLINK_ICALLS=1" Condition="'$(WasmLinkIcalls)' == 'true'" /> + <_EmccCommonFlags Include="-v" Condition="'$(EmccVerbose)' != 'false'" /> + + + + <_WasmRuntimePackIncludeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include')) + <_WasmRuntimePackSrcDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'src')) + + + + <_WasmObjectsToBuild Include="$(_WasmRuntimePackSrcDir)\*.c" /> + <_WasmObjectsToBuild OutputPath="$(_WasmIntermediateOutputPath)%(FileName).o" /> + + <_DotnetJSSrcFile Include="$(_WasmRuntimePackSrcDir)\*.js" /> + <_WasmPInvokeModules Include="%(_WasmNativeFileForLinking.FileName)" /> + + + + + + <_WasmPInvokeModules Include="libSystem.Native" /> + <_WasmPInvokeModules Include="libSystem.IO.Compression.Native" /> + <_WasmPInvokeModules Include="libSystem.Globalization.Native" /> + + + + + + + + + + + + + + + <_EmccIncludePaths Include="$(_WasmIntermediateOutputPath.TrimEnd('\/'))" /> + <_EmccIncludePaths Include="$(_WasmRuntimePackIncludeDir)mono-2.0" /> + <_EmccIncludePaths Include="$(_WasmRuntimePackIncludeDir)wasm" /> + + + <_EmccCFlags Include="$(EmccCompileOptimizationFlag)" /> + <_EmccCFlags Include="@(_EmccCommonFlags)" /> + <_EmccCFlags Include="-DCORE_BINDINGS" /> + <_EmccCFlags Include="-DGEN_PINVOKE=1" /> + <_EmccCFlags Include=""-I%(_EmccIncludePaths.Identity)"" /> + <_EmccCFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" /> + <_EmccCFlags Include="-s EXPORTED_FUNCTIONS='[@(_ExportedFunctions->'"%(Identity)"', ',')]'" Condition="@(_ExportedFunctions->Count()) > 0" /> + + <_EmccCFlags Include="$(EmccExtraCFlags)" /> + + + + <_EmccCompileRsp>$(_WasmIntermediateOutputPath)emcc-compile.rsp + + + + + + + + + + + <_WasmRuntimePackNativeLibs Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)\*.a" /> + <_WasmObjects Include="@(_WasmRuntimePackNativeLibs)" /> + <_WasmObjects Include="@(_WasmObjectsToBuild->'%(OutputPath)')" /> + + + <_EmccLDFlags Include="$(EmccLinkOptimizationFlag)" /> + <_EmccLDFlags Include="@(_EmccCommonFlags)" /> + <_EmccLDFlags Include="-s TOTAL_MEMORY=536870912" /> + <_EmccLDFlags Include="$(EmccExtraLDFlags)" /> + + <_EmccLDFlags Include="--js-library "%(_DotnetJSSrcFile.Identity)"" /> + <_EmccLDFlags Include="--js-library "%(_WasmExtraJSFile.Identity)"" Condition="'%(_WasmExtraJSFile.Kind)' == 'js-library'" /> + + <_EmccLDFlags Include="--pre-js "%(_WasmExtraJSFile.Identity)"" Condition="'%(_WasmExtraJSFile.Kind)' == 'pre-js'" /> + <_EmccLDFlags Include="--post-js "%(_WasmExtraJSFile.Identity)"" Condition="'%(_WasmExtraJSFile.Kind)' == 'post-js'" /> + + <_EmccLDFlags Include=""%(_WasmNativeFileForLinking.Identity)"" /> + <_EmccLDFlags Include=""%(_WasmObjects.Identity)"" /> + <_EmccLDFlags Include="-o "$(_WasmIntermediateOutputPath)dotnet.js"" /> + + + + <_EmccLinkRsp>$(_WasmIntermediateOutputPath)emcc-link.rsp + + + + + + + + + + + + + + + + + + + $(EmccFlags) -DDRIVER_GEN=1 + +void mono_profiler_init_aot (const char *desc)%3B +EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_profiler_init_aot (desc)%3B } + + + <_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c + + + + + + + + + + + + + + + + + + + + + + <_ReversedVersionLines Include="@(_VersionLines->Reverse())" /> + + + %(_ReversedVersionLines.Identity) + + + + + + + + + + + + + + + + + + + + <_AotInputAssemblies Include="@(_WasmAssembliesInternal)" Condition="'%(_WasmAssembliesInternal._InternalForceInterpret)' != 'true'"> + @(MonoAOTCompilerDefaultAotArguments, ';') + @(MonoAOTCompilerDefaultProcessArguments, ';') + + <_AOT_InternalForceInterpretAssemblies Include="@(_WasmAssembliesInternal->WithMetadataValue('_InternalForceInterpret', 'true'))" /> + + <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> + + <_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)" /> + <_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidDir)\lib\net6.0" /> + + + + + LLVMOnlyInterp + + + + + + + + + <_WasmDedupAssembly>$(_WasmIntermediateOutputPath)\aot-instances.dll + + + + + <_AotInputAssemblies Include="$(_WasmDedupAssembly)"> + @(MonoAOTCompilerDefaultAotArguments, ';') + @(MonoAOTCompilerDefaultProcessArguments, ';') + + + + + + + + + + + + <_WasmAssembliesInternal Include="@(_AOT_InternalForceInterpretAssemblies)" /> + + <_AOTAssemblies Include="@(_WasmAssembliesInternal)" Condition="'%(_WasmAssembliesInternal._InternalForceInterpret)' != 'true'" /> + <_BitcodeFile Include="%(_WasmAssembliesInternal.LlvmBitcodeFile)" /> + + <_WasmNativeFileForLinking Include="@(_BitcodeFile)" /> + + + + + + + + + <_WasmStrippedAssembliesPath>$([MSBuild]::NormalizeDirectory($(_WasmIntermediateOutputPath), 'stripped-assemblies')) + + + + <_WasmStrippedAssemblies + Condition="'%(_WasmAssembliesInternal._InternalForceInterpret)' != 'true'" + Include="@(_WasmAssembliesInternal->'$(_WasmStrippedAssembliesPath)%(FileName)%(Extension)')" + OriginalPath="%(_WasmAssembliesInternal.Identity)" /> + <_WasmInterpOnlyAssembly Include="@(_WasmAssembliesInternal->WithMetadataValue('_InternalForceInterpret', 'true'))" /> + + + + + + + + + <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> + <_WasmAssembliesInternal Include="@(_WasmStrippedAssemblies);@(_WasmInterpOnlyAssembly)" /> + + + + diff --git a/src/mono/wasm/build/WasmApp.props b/src/mono/wasm/build/WasmApp.props index 6f496caa81e08..3942eba7f9129 100644 --- a/src/mono/wasm/build/WasmApp.props +++ b/src/mono/wasm/build/WasmApp.props @@ -10,7 +10,7 @@ _WasmResolveReferences; _WasmAotCompileApp; _WasmStripAOTAssemblies; - _WasmBuildNative; + _WasmBuildNativeCore; _WasmGenerateAppBundle; _AfterWasmBuildApp diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index 7f1b7fa246de1..2141cce41b69b 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -1,8 +1,6 @@ - - - false false - <_ExeExt Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">.exe - true - - <_WasmNativeBuildDependsOn> - _CheckEmccIsExpectedVersion; - _PrepareForWasmBuildNative; - _GenerateDriverGenC; - _GeneratePInvokeTable; - _GenerateICallTable; - _WasmCompileNativeFiles; - _WasmLinkDotNet; - _CompleteWasmBuildNative - + false $([MSBuild]::NormalizeDirectory($(NuGetPackageRoot), 'microsoft.netcore.app.runtime.mono.browser-wasm', '$(BundledNETCoreAppPackageVersion)')) $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackDir), 'runtimes', 'browser-wasm')) $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir))) $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir), 'native')) - <_WasmRuntimePackIncludeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include')) - <_WasmRuntimePackSrcDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'src')) - <_EmccPropsPath>$(_WasmRuntimePackSrcDir)Emcc.props + <_BeforeWasmBuildAppDependsOn /> - + - - - - - - - - - - - - - <_AotInputAssemblies Include="@(_WasmAssembliesInternal)" Condition="'%(_WasmAssembliesInternal._InternalForceInterpret)' != 'true'"> - @(MonoAOTCompilerDefaultAotArguments, ';') - @(MonoAOTCompilerDefaultProcessArguments, ';') - - <_AOT_InternalForceInterpretAssemblies Include="@(_WasmAssembliesInternal->WithMetadataValue('_InternalForceInterpret', 'true'))" /> - - <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> - - <_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)" /> - <_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidDir)\lib\net6.0" /> - - - - - LLVMOnlyInterp - - - - - - - - - <_WasmDedupAssembly>$(_WasmIntermediateOutputPath)\aot-instances.dll - - - - - <_AotInputAssemblies Include="$(_WasmDedupAssembly)"> - @(MonoAOTCompilerDefaultAotArguments, ';') - @(MonoAOTCompilerDefaultProcessArguments, ';') - - - - - - - - - - - - <_WasmAssembliesInternal Include="@(_AOT_InternalForceInterpretAssemblies)" /> - - <_AOTAssemblies Include="@(_WasmAssembliesInternal)" Condition="'%(_WasmAssembliesInternal._InternalForceInterpret)' != 'true'" /> - <_BitcodeFile Include="%(_WasmAssembliesInternal.LlvmBitcodeFile)" /> - - <_WasmNativeFileForLinking Include="@(_BitcodeFile)" /> - - - - - - - - - <_WasmStrippedAssembliesPath>$([MSBuild]::NormalizeDirectory($(_WasmIntermediateOutputPath), 'stripped-assemblies')) - - - - <_WasmStrippedAssemblies - Condition="'%(_WasmAssembliesInternal._InternalForceInterpret)' != 'true'" - Include="@(_WasmAssembliesInternal->'$(_WasmStrippedAssembliesPath)%(FileName)%(Extension)')" - OriginalPath="%(_WasmAssembliesInternal.Identity)" /> - <_WasmInterpOnlyAssembly Include="@(_WasmAssembliesInternal->WithMetadataValue('_InternalForceInterpret', 'true'))" /> - - - - - - - - - <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> - <_WasmAssembliesInternal Include="@(_WasmStrippedAssemblies);@(_WasmInterpOnlyAssembly)" /> - - - - - - - - - - <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> - <_WasmAssembliesInternal Include="@(_TmpWasmAssemblies)" /> - - + - + true - true $([MSBuild]::NormalizeDirectory($(OutputPath), 'AppBundle')) $(TargetFileName) @@ -265,85 +118,6 @@ - - - <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenSdkToolsPath)' == '' or !Exists('$(EmscriptenSdkToolsPath)'))">%24(EmscriptenSdkToolsPath)=$(EmscriptenSdkToolsPath) - <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenNodeToolsPath)' == '' or !Exists('$(EmscriptenNodeToolsPath)'))">%24(EmscriptenNodeToolsPath)=$(EmscriptenNodeToolsPath) - <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenUpstreamBinPath)' == '' or !Exists('$(EmscriptenUpstreamBinPath)'))">%24(EmscriptenUpstreamBinPath)=$(EmscriptenUpstreamBinPath) - - - - <_EMSDKMissingErrorMessage Condition="'$(EMSDK_PATH)' == '' and '$(EmscriptenSdkToolsPath)' == ''">Could not find emscripten sdk. Either set %24(EMSDK_PATH), or use workloads to get the sdk. - - <_EMSDKMissingErrorMessage Condition="'$(_EMSDKMissingErrorMessage)' == '' and '$(_UsingEMSDK_PATH)' != 'true' and '$(_EMSDKMissingPaths)' != ''">Emscripten from the workload is missing some paths: $(_EMSDKMissingPaths). - <_EMSDKMissingErrorMessage Condition="'$(_EMSDKMissingErrorMessage)' == '' and '$(_UsingEMSDK_PATH)' == 'true' and !Exists($(EMSDK_PATH))">Could not find Emscripten sdk at %24(EMSDK_PATH)=$(EMSDK_PATH) . - <_EMSDKMissingErrorMessage Condition="'$(_EMSDKMissingErrorMessage)' == '' and '$(_UsingEMSDK_PATH)' == 'true' and '$(_EMSDKMissingPaths)' != ''">Specified Emscripten sdk at %24(EMSDK_PATH)=$(EMSDK_PATH) is missing some paths: $(_EMSDKMissingPaths). - - <_IsEMSDKMissing Condition="'$(_EMSDKMissingErrorMessage)' != ''">true - - - - $([MSBuild]::NormalizeDirectory($(EmscriptenSdkToolsPath))) - $([MSBuild]::NormalizeDirectory($(EmscriptenNodeToolsPath))) - $([MSBuild]::NormalizeDirectory($(EmscriptenUpstreamBinPath))) - - - - - - - - - - - <_EmscriptenPrependPATHTrimmed Include="$([MSBuild]::ValueOrDefault('%(EmscriptenPrependPATH.Identity)\', '').TrimEnd('\/'))" /> - - - - - - - <_PathSeparator Condition="'$(OS)' == 'Windows_NT'">%3B - <_PathSeparator Condition="'$(OS)' != 'Windows_NT'">: - - <_EmscriptenPrependPATHProperty>@(EmscriptenPrependPATH -> '%(Identity)', '$(_PathSeparator)') - - - - - - - - - - - - - - - - - true - false - true - false - - - - - - - false - - - - - @@ -382,161 +156,6 @@ - - - - - <_EmccDefaultFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-default.rsp')) - true - $(WasmBuildNative) - <_WasmICallTablePath>$(_WasmIntermediateOutputPath)icall-table.h - <_WasmRuntimeICallTablePath>$(_WasmIntermediateOutputPath)runtime-icall-table.h - <_WasmPInvokeTablePath>$(_WasmIntermediateOutputPath)pinvoke-table.h - - <_EmccOptimizationFlagDefault Condition="'$(_WasmDevel)' == 'true'">-O0 - <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == '' and '$(OS)' != 'Windows_NT' and '$(Configuration)' == 'Debug'">-Os - <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == '' and '$(Configuration)' != 'Debug'">-Oz - <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == ''">-Oz - - $(_EmccOptimizationFlagDefault) - $(_EmccOptimizationFlagDefault) - - - - <_EmccCommonFlags Include="$(EmccFlags)" /> - <_EmccCommonFlags Include="-s DISABLE_EXCEPTION_CATCHING=0" /> - <_EmccCommonFlags Include="-g" Condition="'$(WasmNativeStrip)' == 'false'" /> - <_EmccCommonFlags Include="-DENABLE_AOT=1" Condition="'$(RunAOTCompilation)' == 'true'" /> - <_EmccCommonFlags Include="-DDRIVER_GEN=1" Condition="'$(RunAOTCompilation)' == 'true'" /> - <_EmccCommonFlags Include="-DINVARIANT_GLOBALIZATION=1" Condition="'$(InvariantGlobalization)' == 'true'" /> - <_EmccCommonFlags Include="-DLINK_ICALLS=1" Condition="'$(WasmLinkIcalls)' == 'true'" /> - <_EmccCommonFlags Include="-v" Condition="'$(EmccVerbose)' != 'false'" /> - - - - <_WasmRuntimePackIncludeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include')) - <_WasmRuntimePackSrcDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'src')) - - - - <_WasmRuntimePackNativeLibs Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)\*.a" /> - <_WasmObjectsToBuild Include="$(_WasmRuntimePackSrcDir)\*.c" /> - <_WasmObjectsToBuild OutputPath="$(_WasmIntermediateOutputPath)%(FileName).o" /> - - <_WasmObjects Include="@(_WasmRuntimePackNativeLibs)" /> - <_WasmObjects Include="@(_WasmObjectsToBuild->'%(OutputPath)')" /> - - <_DotnetJSSrcFile Include="$(_WasmRuntimePackSrcDir)\*.js" /> - - - - - - <_WasmPInvokeModules Include="libSystem.Native" /> - <_WasmPInvokeModules Include="libSystem.IO.Compression.Native" /> - <_WasmPInvokeModules Include="libSystem.Globalization.Native" /> - - - - - - - - - - - - - - - <_EmccIncludePaths Include="$(_WasmIntermediateOutputPath.TrimEnd('\/'))" /> - <_EmccIncludePaths Include="$(_WasmRuntimePackIncludeDir)mono-2.0" /> - <_EmccIncludePaths Include="$(_WasmRuntimePackIncludeDir)wasm" /> - - - <_EmccCFlags Include="$(EmccCompileOptimizationFlag)" /> - <_EmccCFlags Include="@(_EmccCommonFlags)" /> - <_EmccCFlags Include="-DCORE_BINDINGS" /> - <_EmccCFlags Include="-DGEN_PINVOKE=1" /> - <_EmccCFlags Include=""-I%(_EmccIncludePaths.Identity)"" /> - <_EmccCFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" /> - <_EmccCFlags Include="$(EmccExtraCFlags)" /> - - - - <_EmccCompileRsp>$(_WasmIntermediateOutputPath)emcc-compile.rsp - - - - - - - - - - - <_WasmRuntimePackNativeLibs Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)\*.a" /> - <_WasmObjects Include="@(_WasmRuntimePackNativeLibs)" /> - <_WasmObjects Include="@(_WasmObjectsToBuild->'%(OutputPath)')" /> - - - <_EmccLDFlags Include="$(EmccLinkOptimizationFlag)" /> - <_EmccLDFlags Include="@(_EmccCommonFlags)" /> - <_EmccLDFlags Include="-s TOTAL_MEMORY=536870912" /> - <_EmccLDFlags Include="$(EmccExtraLDFlags)" /> - - <_EmccLDFlags Include="--js-library "%(_DotnetJSSrcFile.Identity)"" /> - <_EmccLDFlags Include=""%(_WasmNativeFileForLinking.Identity)"" /> - <_EmccLDFlags Include=""%(_WasmObjects.Identity)"" /> - - <_EmccLDFlags Include="-o "$(_WasmIntermediateOutputPath)dotnet.js"" /> - - - - <_EmccLinkRsp>$(_WasmIntermediateOutputPath)emcc-link.rsp - - - - - - - - - - - - - - - - - - - $(EmccFlags) -DDRIVER_GEN=1 - -void mono_profiler_init_aot (const char *desc)%3B -EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_profiler_init_aot (desc)%3B } - - - <_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c - - - - - - - - - - $(WasmAppDir)run-v8.sh @@ -556,27 +175,18 @@ EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_ - - - - - - - - + + + + - - <_ReversedVersionLines Include="@(_VersionLines->Reverse())" /> + <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> + <_WasmAssembliesInternal Include="@(_TmpWasmAssemblies)" /> - - %(_ReversedVersionLines.Identity) - - - From 1159f1989d2991fe067a0560460f9c12453fd384 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 19 May 2021 17:18:30 -0400 Subject: [PATCH 3/7] [wasm] fix sample makefile --- src/mono/sample/wasm/wasm.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/sample/wasm/wasm.mk b/src/mono/sample/wasm/wasm.mk index 1858ca3791182..c62b67a177711 100644 --- a/src/mono/sample/wasm/wasm.mk +++ b/src/mono/sample/wasm/wasm.mk @@ -23,7 +23,7 @@ run-browser: echo "The tool dotnet-serve could not be found. Install with: $(DOTNET) tool install --global dotnet-serve"; \ exit 1; \ else \ - $(DOTNET) serve -d bin/$(CONFIG)/AppBundle -p 8000; \ + $(DOTNET) serve -d=bin/$(CONFIG)/AppBundle -p 8000; \ fi run-console: From f7c15fafce11b6ed9b7ec9e86b28c2473bfad29d Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 20 May 2021 22:47:18 -0400 Subject: [PATCH 4/7] Add makefile prereqs for the rsp --- src/mono/wasm/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mono/wasm/Makefile b/src/mono/wasm/Makefile index 2ad9f5a7d5dd4..8a69822976bfe 100644 --- a/src/mono/wasm/Makefile +++ b/src/mono/wasm/Makefile @@ -92,22 +92,22 @@ $(NATIVE_BIN_DIR)/include/wasm: $(BUILDS_OBJ_DIR): mkdir -p $$@ -$(NATIVE_BIN_DIR)/dotnet.js: $(BUILDS_OBJ_DIR)/driver.o $(BUILDS_OBJ_DIR)/pinvoke.o $(BUILDS_OBJ_DIR)/corebindings.o runtime/library_mono.js runtime/binding_support.js runtime/dotnet_support.js $(SYSTEM_NATIVE_LIBDIR)/pal_random.js $(2) | $(NATIVE_BIN_DIR) +$(NATIVE_BIN_DIR)/dotnet.js: $(BUILDS_OBJ_DIR)/driver.o $(BUILDS_OBJ_DIR)/pinvoke.o $(BUILDS_OBJ_DIR)/corebindings.o runtime/library_mono.js runtime/binding_support.js runtime/dotnet_support.js $(SYSTEM_NATIVE_LIBDIR)/pal_random.js $(2) $(EMCC_DEFAULT_RSP) | $(NATIVE_BIN_DIR) $(EMCC) @$(EMCC_DEFAULT_RSP) $(1) --js-library runtime/library_mono.js --js-library runtime/binding_support.js --js-library runtime/dotnet_support.js --js-library $(SYSTEM_NATIVE_LIBDIR)/pal_random.js $(BUILDS_OBJ_DIR)/driver.o $(BUILDS_OBJ_DIR)/pinvoke.o $(BUILDS_OBJ_DIR)/corebindings.o $(2) -o $(NATIVE_BIN_DIR)/dotnet.js $(3) $(BUILDS_OBJ_DIR)/pinvoke-table.h: $(PINVOKE_TABLE) | $(BUILDS_OBJ_DIR) if cmp -s $(PINVOKE_TABLE) $$@ ; then : ; else cp $(PINVOKE_TABLE) $$@ ; fi -$(BUILDS_OBJ_DIR)/driver.o: runtime/driver.c | $(BUILDS_OBJ_DIR) +$(BUILDS_OBJ_DIR)/driver.o: runtime/driver.c $(EMCC_DEFAULT_RSP) | $(BUILDS_OBJ_DIR) $(EMCC) @$(EMCC_DEFAULT_RSP) $(1) -Oz -DCORE_BINDINGS -I$(BUILDS_OBJ_DIR) -I$(MONO_INCLUDE_DIR) runtime/driver.c -c -o $$@ -$(BUILDS_OBJ_DIR)/pinvoke.o: runtime/pinvoke.c runtime/pinvoke.h $(BUILDS_OBJ_DIR)/pinvoke-table.h | $(BUILDS_OBJ_DIR) +$(BUILDS_OBJ_DIR)/pinvoke.o: runtime/pinvoke.c runtime/pinvoke.h $(BUILDS_OBJ_DIR)/pinvoke-table.h $(EMCC_DEFAULT_RSP) | $(BUILDS_OBJ_DIR) $(EMCC) @$(EMCC_DEFAULT_RSP) $(1) -Oz -DGEN_PINVOKE=1 -I$(BUILDS_OBJ_DIR) runtime/pinvoke.c -c -o $$@ -$(BUILDS_OBJ_DIR)/corebindings.o: runtime/corebindings.c | $(BUILDS_OBJ_DIR) +$(BUILDS_OBJ_DIR)/corebindings.o: runtime/corebindings.c $(EMCC_DEFAULT_RSP) | $(BUILDS_OBJ_DIR) $(EMCC) @$(EMCC_DEFAULT_RSP) $(1) -Oz -I$(MONO_INCLUDE_DIR) runtime/corebindings.c -c -o $$@ -$(EMCC_DEFAULT_RSP): | $(NATIVE_BIN_DIR)/src Makefile +$(EMCC_DEFAULT_RSP): $(CURDIR)/wasm.proj | $(NATIVE_BIN_DIR)/src Makefile $(DOTNET) build $(CURDIR)/wasm.proj /p:Configuration=$(CONFIG) /t:GenerateEmccPropsAndRspFiles $(NATIVE_BIN_DIR)/src/Emcc.props: $(EMSDK_PATH)/upstream/.emsdk_version | $(NATIVE_BIN_DIR)/src From 3d4e0ac969f73f23b35d2d68901a40d404a1c454 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Fri, 21 May 2021 20:17:11 -0400 Subject: [PATCH 5/7] add missing files to wasm sdk package --- .../Microsoft.NET.Runtime.WebAssembly.Sdk.pkgproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Microsoft.NET.Runtime.WebAssembly.Sdk.pkgproj b/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Microsoft.NET.Runtime.WebAssembly.Sdk.pkgproj index 522d70fa1e4b3..874775fe7e47f 100644 --- a/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Microsoft.NET.Runtime.WebAssembly.Sdk.pkgproj +++ b/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Microsoft.NET.Runtime.WebAssembly.Sdk.pkgproj @@ -13,6 +13,8 @@ + + From 2d3a42cf5b51e8bee8dc4b9c3f44dae87183f2f3 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Mon, 24 May 2021 11:03:35 -0400 Subject: [PATCH 6/7] Address review feedback from Radek --- src/mono/sample/wasm/wasm.mk | 2 +- src/mono/wasm/wasm.proj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/sample/wasm/wasm.mk b/src/mono/sample/wasm/wasm.mk index c62b67a177711..2eb4adcfb4585 100644 --- a/src/mono/sample/wasm/wasm.mk +++ b/src/mono/sample/wasm/wasm.mk @@ -23,7 +23,7 @@ run-browser: echo "The tool dotnet-serve could not be found. Install with: $(DOTNET) tool install --global dotnet-serve"; \ exit 1; \ else \ - $(DOTNET) serve -d=bin/$(CONFIG)/AppBundle -p 8000; \ + $(DOTNET) serve -d:bin/$(CONFIG)/AppBundle -p:8000; \ fi run-console: diff --git a/src/mono/wasm/wasm.proj b/src/mono/wasm/wasm.proj index 6a7d93df1f1ec..1def6ae3c8675 100644 --- a/src/mono/wasm/wasm.proj +++ b/src/mono/wasm/wasm.proj @@ -155,7 +155,7 @@ AfterTargets="Build" DependsOnTargets="GenerateEmccPropsAndRspFiles;BuildPInvokeTable;BundleTimeZones"> - From 0ec259c699a9e38e8a865d10200376a204fd07fd Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Tue, 25 May 2021 17:50:38 -0400 Subject: [PATCH 7/7] Update src/mono/wasm/wasm.proj Co-authored-by: Larry Ewing --- src/mono/wasm/wasm.proj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mono/wasm/wasm.proj b/src/mono/wasm/wasm.proj index 1def6ae3c8675..064cb445bfac8 100644 --- a/src/mono/wasm/wasm.proj +++ b/src/mono/wasm/wasm.proj @@ -98,7 +98,6 @@ <_EmccFlags Include="-s BINARYEN=1" /> <_EmccFlags Include="-s ALIASING_FUNCTION_POINTERS=0" /> <_EmccFlags Include="-s USE_ZLIB=1" /> - <_EmccFlags Include="-DENABLE_NETCORE=1" Condition="'$(Configuration)' == 'Release'" />