dotnet / runtimelab

This repo is for experimentation and exploring new ideas that may or may not make it into the main dotnet/runtime repo.
MIT License
1.36k stars 188 forks source link

[NativeAOT-LLVM] Support using emscripten from Mono workload #2602

Closed maraf closed 3 weeks ago

maraf commented 4 weeks ago

Soon version of emscripten that uses NativeAOT-LLVM and mono will align. These changes allows to use emscripten from mono workload. For the moment it unblocks smoke tests on runtime repo.

Preview of upstream integration bits

<Target Name="SetupEmscriptenEnvVars" BeforeTargets="CompileSingleWasmObject;LinkNativeLlvm">
  <!-- Environment variables required for running emsdk commands like `emcc` -->
  <ItemGroup Condition="'$(EMSDK)' == '$(EmscriptenUpstreamEmscriptenPath)'">
    <EmscriptenEnvVars Include="EMSDK_PYTHON=$(EmscriptenPythonToolsPath)python.exe" Condition="'$(OS)' == 'Windows_NT'" />
    <EmscriptenEnvVars Include="PYTHONPATH=$(EmscriptenPythonToolsPath)" Condition="'$(OS)' == 'Windows_NT'" />
    <EmscriptenEnvVars Include="PYTHONHOME=" Condition="'$(OS)' == 'Windows_NT'" />
    <EmscriptenEnvVars Include="DOTNET_EMSCRIPTEN_LLVM_ROOT=$(EmscriptenSdkToolsPath)bin" />
    <EmscriptenEnvVars Include="DOTNET_EMSCRIPTEN_BINARYEN_ROOT=$(EmscriptenSdkToolsPath)" />
    <EmscriptenEnvVars Include="DOTNET_EMSCRIPTEN_NODE_JS=$([MSBuild]::NormalizePath($(EmscriptenNodeToolsPath), 'bin', 'node$(_ExeExt)'))" />
    <EmscriptenEnvVars Include="EM_CACHE=$(WasmCachePath)" Condition="'$(WasmCachePath)' != ''" />
    <EmscriptenEnvVars Include="EM_FROZEN_CACHE=True" Condition="'$(WasmCachePath)' == '$(EmscriptenCacheSdkCacheDir)'" />
  </ItemGroup>
</Target>
maraf commented 4 weeks ago

cc @dotnet/nativeaot-llvm

SingleAccretion commented 4 weeks ago

Soon version of emscripten that uses NativeAOT-LLVM and mono will align

Which version will move, considering https://github.com/dotnet/runtimelab/pull/2595? I believe the current upstream emsdk is a bit older than 3.1.54.

maraf commented 4 weeks ago

Which version will move, considering https://github.com/dotnet/runtimelab/pull/2595? I believe the current upstream emsdk is a bit older than 3.1.54.

Upstream is moving to 3.1.56