Skip to content

Commit

Permalink
Add files need for wasm executable relinking/aot to the wasm runtime …
Browse files Browse the repository at this point in the history
…pack. (#43785)

Co-authored-by: Alexander Köplinger <[email protected]>
  • Loading branch information
vargaz and akoeplinger authored Nov 9, 2020
1 parent 5a5c5cb commit b94c645
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 8 deletions.
11 changes: 11 additions & 0 deletions eng/liveBuilds.targets
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,17 @@
$(LibrariesNativeArtifactsPath)dotnet.timezones.blat;
$(LibrariesNativeArtifactsPath)*.dat;"
IsNative="true" />
<LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'"
Include="
$(LibrariesNativeArtifactsPath)src\*.c;
$(LibrariesNativeArtifactsPath)src\*.js;"
NativeSubDirectory="src"
IsNative="true" />
<LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'"
Include="
$(LibrariesNativeArtifactsPath)include\wasm\*.h;"
NativeSubDirectory="include\wasm"
IsNative="true" />
</ItemGroup>

<Error Condition="'@(LibrariesRefAssemblies)' == ''" Text="The 'libs' subset must be built before building this project." />
Expand Down
18 changes: 15 additions & 3 deletions src/mono/wasm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ICU_LIBDIR?=
SYSTEM_NATIVE_LIBDIR?=$(TOP)/src/libraries/Native/Unix/System.Native
ENABLE_ES6?=false

all: build-native icu-data
all: build-native icu-files source-files header-files

#
# EMSCRIPTEN SETUP
Expand Down Expand Up @@ -82,6 +82,12 @@ define InterpBuildTemplate
$(NATIVE_BIN_DIR):
mkdir -p $$@

$(NATIVE_BIN_DIR)/src:
mkdir -p $$@

$(NATIVE_BIN_DIR)/include/wasm:
mkdir -p $$@

$(BUILDS_OBJ_DIR):
mkdir -p $$@

Expand Down Expand Up @@ -119,8 +125,14 @@ clean:
# Helper targets
.PHONY: runtime

icu-data:
cp $(ICU_LIBDIR)/*.dat $(NATIVE_BIN_DIR)
icu-files: $(wildcard $(ICU_LIBDIR)/*.dat) $(ICU_LIBDIR)/libicuuc.a $(ICU_LIBDIR)/libicui18n.a | $(NATIVE_BIN_DIR)
cp $^ $(NATIVE_BIN_DIR)

source-files: runtime/driver.c runtime/pinvoke.c runtime/corebindings.c runtime/binding_support.js runtime/dotnet_support.js runtime/library_mono.js $(SYSTEM_NATIVE_LIBDIR)/pal_random.js | $(NATIVE_BIN_DIR)/src
cp $^ $(NATIVE_BIN_DIR)/src

header-files: runtime/pinvoke.h $(BUILDS_OBJ_DIR)/pinvoke-table.h | $(NATIVE_BIN_DIR)/include/wasm
cp $^ $(NATIVE_BIN_DIR)/include/wasm

build:
EMSDK_PATH=$(EMSDK_PATH) $(TOP)/build.sh mono+libs.pretest -os Browser -c $(CONFIG) /p:ContinueOnError=false /p:StopOnFirstFailure=true
Expand Down
28 changes: 23 additions & 5 deletions src/mono/wasm/wasm.proj
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,39 @@
AfterTargets="Build"
DependsOnTargets="BuildPInvokeTable;BundleTimeZones">

<Exec Command="make -C $(MonoProjectRoot)wasm all SHELL=/bin/bash BINDIR=$(ArtifactsBinDir) MONO_BIN_DIR=$(MonoArtifactsPath) OBJDIR=$(ArtifactsObjDir) NATIVE_BIN_DIR=$(NativeBinDir) CONFIG=$(Configuration) PINVOKE_TABLE=$(WasmPInvokeTablePath) ICU_LIBDIR=$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)/runtimes/browser-wasm/native/lib ENABLE_ES6=$(WasmEnableES6)"
<PropertyGroup>
<_IcuLibdir>$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)/runtimes/browser-wasm/native/lib</_IcuLibdir>
</PropertyGroup>

<Exec Command="make -C $(MonoProjectRoot)wasm all SHELL=/bin/bash BINDIR=$(ArtifactsBinDir) MONO_BIN_DIR=$(MonoArtifactsPath) OBJDIR=$(ArtifactsObjDir) NATIVE_BIN_DIR=$(NativeBinDir) CONFIG=$(Configuration) PINVOKE_TABLE=$(WasmPInvokeTablePath) ICU_LIBDIR=$(_IcuLibdir) ENABLE_ES6=$(WasmEnableES6)"
IgnoreStandardErrorWarningFormat="true" />

<ItemGroup>
<IcuDataFiles Include="$(NativeBinDir)*.dat" />
<WasmSrcFiles Include="$(NativeBinDir)src\*.c;
$(NativeBinDir)src\*.js;" />
<WasmHeaderFiles Include="$(NativeBinDir)include\wasm\*.h" />
</ItemGroup>

<Copy SourceFiles="$(NativeBinDir)dotnet.js;
$(NativeBinDir)dotnet.wasm;
$(NativeBinDir)dotnet.timezones.blat"
$(NativeBinDir)dotnet.timezones.blat;
$(NativeBinDir)libicuuc.a;
$(NativeBinDir)libicui18n.a"
DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)"
SkipUnchangedFiles="true" />

<ItemGroup>
<IcuDataFiles Include="$(NativeBinDir)*.dat"/>
</ItemGroup>
<Copy SourceFiles="@(IcuDataFiles)"
DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)"
SkipUnchangedFiles="true" />

<Copy SourceFiles="@(WasmSrcFiles)"
DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)src"
SkipUnchangedFiles="true" />

<Copy SourceFiles="@(WasmHeaderFiles)"
DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)include\wasm"
SkipUnchangedFiles="true" />
</Target>

</Project>

0 comments on commit b94c645

Please sign in to comment.