Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wasm cross compiler to the mono build. #34935

Merged
merged 3 commits into from
Apr 14, 2020
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ usage()
{
echo "Common settings:"
echo " --subset Build a subset, print available subsets with -subset help (short: -s)"
echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS or Android"
echo " --arch Build platform: x86, x64, arm, armel or arm64"
echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android or WebAssembly"
echo " --arch Build platform: x86, x64, arm, armel, arm64 or wasm"
echo " --configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c)"
echo " --runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked (short: -rc)"
echo " --librariesConfiguration Libraries build configuration: Debug or Release (short: -lc)"
Expand Down
2 changes: 2 additions & 0 deletions eng/native/init-distro-rid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ initDistroRidGlobal()
distroRid="ios-$buildArch"
elif [ "$targetOs" = "Android" ]; then
distroRid="android-$buildArch"
elif [ "$targetOs" = "WebAssembly" ]; then
distroRid="wasm-$buildArch"
elif [ "$targetOs" = "FreeBSD" ]; then
distroRid="freebsd-$buildArch"
elif [ "$targetOs" = "SunOS" ]; then
Expand Down
40 changes: 38 additions & 2 deletions src/mono/mono.proj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<XcodeDir Condition="'$(XcodeDir)' == ''">/Applications/Xcode.app/Contents/Developer</XcodeDir>
<BuildMonoAOTCrossCompiler Condition="'$(TargetsiOS)' == 'true' and '$(TargetsiOSSimulator)' != 'true'">true</BuildMonoAOTCrossCompiler>
<BuildMonoAOTCrossCompiler Condition="'$(TargetstvOS)' == 'true' and '$(TargetstvOSSimulator)' != 'true'">true</BuildMonoAOTCrossCompiler>
<BuildMonoAOTCrossCompiler Condition="'$(TargetsWASM)' == 'true'">true</BuildMonoAOTCrossCompiler>
</PropertyGroup>

<!-- OSX/iOS/tvOS/Android/Linux Mono runtime build -->
Expand Down Expand Up @@ -642,6 +643,40 @@
<_MonoCFLAGS Include="-fexceptions" />
<_MonoCXXFLAGS Include="-fexceptions -s DISABLE_EXCEPTION_CATCHING=0" />
<_MonoAC_VARS Include="ac_cv_func_shm_open_working_with_mmap=no" />

<!-- AOT cross-compiler configuration -->
<_MonoAotCrossConfigureParams Include="--with-core=only" />
<_MonoAotCrossConfigureParams Include="--enable-maintainer-mode" />
<_MonoAotCrossConfigureParams Include="--enable-compile-warnings" />
<_MonoAotCrossConfigureParams Include="--prefix=$(MonoObjDir)cross/out" />
<_MonoAotCrossConfigureParams Include="--disable-boehm" />
<_MonoAotCrossConfigureParams Include="--disable-btls" />
<_MonoAotCrossConfigureParams Include="--disable-iconv" />
<_MonoAotCrossConfigureParams Include="--disable-libraries" />
<_MonoAotCrossConfigureParams Include="--disable-mcs-build" />
<_MonoAotCrossConfigureParams Include="--disable-nls" />
<_MonoAotCrossConfigureParams Include="--enable-dtrace=no" />
<_MonoAotCrossConfigureParams Include="--enable-icall-symbol-map" />
<_MonoAotCrossConfigureParams Include="--enable-minimal=com,remoting" />
<_MonoAotCrossConfigureParams Include="--disable-crash-reporting" />
<_MonoAotCrossConfigureParams Include="--with-cooperative-gc=no" />
<_MonoAotCrossConfigureParams Include="--enable-hybrid-suspend=no" />
<_MonoAotCrossConfigureParams Include="--target=wasm32-unknown-none" />
<_MonoAotCrossConfigureParams Include="--with-cross-offsets=$(MonoObjDir)cross/offsets-wasm32-unknown-none.h" />
<!-- FIXME: LLVM -->

<_MonoAotCrossCFLAGS Include="-O2" />
<_MonoAotCrossCFLAGS Include="-g" />
<_MonoAotCrossCFLAGS Include="-m64" />

<_MonoAotCrossOffsetsToolParams Include="--netcore" />
<_MonoAotCrossOffsetsToolParams Include="--abi=wasm32-unknown-unknown" />
<_MonoAotCrossOffsetsToolParams Include="--targetdir=&quot;$(MonoObjDir)&quot;" />
<_MonoAotCrossOffsetsToolParams Include="--monodir=&quot;$(MonoProjectRoot)&quot;" />
<_MonoAotCrossOffsetsToolParams Include="--outfile=&quot;$(MonoObjDir)cross/offsets-wasm32-unknown-none.h&quot;" />
<_MonoAotCrossOffsetsToolParams Include="--emscripten-sdk=&quot;$(EMSDK_PATH)/upstream/emscripten&quot;" />
<_MonoAotCrossOffsetsToolParams Include="--libclang=&quot;$(EMSDK_PATH)/upstream/lib/libclang.dylib&quot;" Condition="$([MSBuild]::IsOSPlatform('OSX'))" />
<_MonoAotCrossOffsetsToolParams Include="--libclang=&quot;$(EMSDK_PATH)/upstream/lib/libclang.so&quot;" Condition="!$([MSBuild]::IsOSPlatform('OSX'))" />
</ItemGroup>

<!-- Linux options -->
Expand Down Expand Up @@ -716,7 +751,7 @@
<Message Text="--- Building Mono ---" Importance="High" />
<Exec Condition="'$(TargetsWASM)' != 'true'" Command="make -j$([System.Environment]::ProcessorCount)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)" />
<Exec Condition="'$(TargetsWASM)' == 'true'" Command="bash -c 'source $(EMSDK_PATH)/emsdk_env.sh &amp;&amp; make -j$([System.Environment]::ProcessorCount)'" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)" />
<Exec Condition="'$(TargetstvOS)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetsAndroid)' == 'true'" Command="make install -j$([System.Environment]::ProcessorCount)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)" />
<Exec Condition="'$(TargetstvOS)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetsAndroid)' == 'true' or '$(TargetsWASM)' == 'true'" Command="make install -j$([System.Environment]::ProcessorCount)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)" />

<Message Condition="'$(BuildMonoAOTCrossCompiler)' == 'true'" Text="--- Building Mono AOT cross-compiler ---" Importance="High" />
<Exec Condition="'$(BuildMonoAOTCrossCompiler)' == 'true'" Command="make -j$([System.Environment]::ProcessorCount)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)cross" />
Expand Down Expand Up @@ -906,6 +941,7 @@
<_MonoAotCrossFilePath Condition="'$(TargetsiOS)' == 'true' and '$(Platform)' == 'arm64'">$(MonoObjDir)cross\out\bin\aarch64-darwin-mono-sgen</_MonoAotCrossFilePath>
<_MonoAotCrossFilePath Condition="'$(TargetsiOS)' == 'true' and '$(Platform)' == 'arm'">$(MonoObjDir)cross\out\bin\arm-darwin-mono-sgen</_MonoAotCrossFilePath>
<_MonoAotCrossFilePath Condition="'$(TargetstvOS)' == 'true' and '$(Platform)' == 'arm64'">$(MonoObjDir)cross\out\bin\aarch64-darwin-mono-sgen</_MonoAotCrossFilePath>
<_MonoAotCrossFilePath Condition="'$(TargetsWASM)' == 'true'">$(MonoObjDir)cross\out\bin\wasm32-unknown-none-mono-sgen</_MonoAotCrossFilePath>
vargaz marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

<!-- Copy Mono runtime files to artifacts directory -->
Expand All @@ -929,7 +965,7 @@
<Copy SourceFiles="@(_MonoIncludeArtifacts)"
DestinationFiles="@(_MonoIncludeArtifacts->'$(BinDir)include\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true"
Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or'$(TargetsAndroid)' == 'true' or '$(TargetsWASM)' == 'true'"/>
Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsAndroid)' == 'true' or '$(TargetsWASM)' == 'true'"/>

<Exec Condition="'$(TargetsOSX)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'" Command="install_name_tool -id @rpath/$(MonoFileName) $(BinDir)$(MonoFileName)" />
</Target>
Expand Down