<BuildMonoAOTCrossCompiler Condition="'$(TargetsOSX)' == 'true'">true</BuildMonoAOTCrossCompiler>
<BuildMonoAOTCrossCompiler Condition="'$(TargetsBrowser)' == 'true'">true</BuildMonoAOTCrossCompiler>
<BuildMonoAOTCrossCompiler Condition="'$(TargetsAndroid)' == 'true'">true</BuildMonoAOTCrossCompiler>
+ <BuildMonoAOTCrossCompiler Condition="'$(TargetsWasi)' == 'true' and !$([MSBuild]::IsOSPlatform('Windows'))">true</BuildMonoAOTCrossCompiler>
<MonoObjCrossDir>$([MSBuild]::NormalizeDirectory('$(MonoObjDir)', 'cross'))</MonoObjCrossDir>
<CrossConfigH Condition="'$(BuildMonoAOTCrossCompiler)' == 'true'">$([MSBuild]::NormalizePath('$(MonoObjCrossDir)', 'config.h'))</CrossConfigH>
<MonoBundleLLVMOptimizer Condition="'$(MonoEnableLLVM)' == 'true'">true</MonoBundleLLVMOptimizer>
</ItemGroup>
<!-- WASM specific options -->
- <PropertyGroup Condition="'$(TargetsBrowser)' == 'true'">
+ <PropertyGroup Condition="'$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true'">
<MonoUseCrossTool>true</MonoUseCrossTool>
<_MonoSkipInitCompiler>true</_MonoSkipInitCompiler>
- <MonoAotAbi>wasm32-unknown-none</MonoAotAbi>
+ <MonoAotAbi Condition="'$(TargetsBrowser)' == 'true'">wasm32-unknown-none</MonoAotAbi>
+ <MonoAotAbi Condition="'$(TargetsWasi)' == 'true'">wasm32-unknown-wasi</MonoAotAbi>
<MonoAotOffsetsFile>$(MonoObjCrossDir)offsets-wasm32-unknown-none.h</MonoAotOffsetsFile>
<MonoLibClang Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(MonoLLVMDir)/$(BuildArchitecture)/lib/libclang.dylib</MonoLibClang>
<MonoLibClang Condition="$([MSBuild]::IsOSPlatform('Linux'))">$(MonoLLVMDir)/$(BuildArchitecture)/lib/libclang.so</MonoLibClang>
<MonoLibClang Condition="$([MSBuild]::IsOSPlatform('Windows'))">$([MSBuild]::NormalizePath('$(MonoLLVMDir)', '$(BuildArchitecture)', 'bin', 'libclang.dll'))</MonoLibClang>
- <PythonCmd Condition="'$(HostOS)' == 'windows'">setlocal EnableDelayedExpansion && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.bat'))" && !EMSDK_PYTHON!</PythonCmd>
+ <PythonCmd Condition="'$(HostOS)' == 'windows'and '$(TargetsBrowser)' == 'true'">setlocal EnableDelayedExpansion && call "$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.bat'))" && !EMSDK_PYTHON!</PythonCmd>
<_ForceRelease Condition="$([MSBuild]::IsOSPlatform('Windows')) and '$(TargetArchitecture)' == 'wasm' and '$(Configuration)' == 'Debug'">true</_ForceRelease>
</PropertyGroup>
IOS_DEFINES = ["HOST_DARWIN", "TARGET_MACH", "MONO_CROSS_COMPILE", "USE_MONO_CTX", "_XOPEN_SOURCE"]
ANDROID_DEFINES = ["HOST_ANDROID", "MONO_CROSS_COMPILE", "USE_MONO_CTX", "BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD"]
LINUX_DEFINES = ["HOST_LINUX", "MONO_CROSS_COMPILE", "USE_MONO_CTX"]
+WASI_DEFINES = ["_WASI_EMULATED_PROCESS_CLOCKS", "_WASI_EMULATED_SIGNAL", "_WASI_EMULATED_MMAN"]
class Target:
def __init__(self, arch, platform, others):
parser = argparse.ArgumentParser ()
parser.add_argument ('--libclang', dest='libclang', help='path to shared library of libclang.{so,dylib}', required=True)
parser.add_argument ('--emscripten-sdk', dest='emscripten_path', help='path to emscripten sdk')
+ parser.add_argument ('--wasi-sdk', dest='wasi_path', help='path to wasi sdk')
parser.add_argument ('--outfile', dest='outfile', help='path to output file', required=True)
parser.add_argument ('--monodir', dest='mono_path', help='path to mono source tree', required=True)
parser.add_argument ('--nativedir', dest='native_path', help='path to src/native', required=True)
android_api_level = "-D__ANDROID_API=21"
if "wasm" in args.abi:
- require_emscipten_path (args)
- self.sys_includes = [args.emscripten_path + "/system/include", args.emscripten_path + "/system/include/libc", args.emscripten_path + "/system/lib/libc/musl/arch/emscripten", args.emscripten_path + "/system/lib/libc/musl/include", args.emscripten_path + "/system/lib/libc/musl/arch/generic"]
- self.target = Target ("TARGET_WASM", None, [])
- self.target_args += ["-target", args.abi]
+ if args.wasi_path != None:
+ self.sys_includes = [args.wasi_path + "/share/wasi-sysroot/include", args.wasi_path + "/lib/clang/14.0.4/include", args.mono_path + "/wasi/mono-include"]
+ self.target = Target ("TARGET_WASI", None, ["TARGET_WASM"] + WASI_DEFINES)
+ self.target_args += ["-target", args.abi]
+ else:
+ require_emscipten_path (args)
+ self.sys_includes = [args.emscripten_path + "/system/include", args.emscripten_path + "/system/include/libc", args.emscripten_path + "/system/lib/libc/musl/arch/emscripten", args.emscripten_path + "/system/lib/libc/musl/include", args.emscripten_path + "/system/lib/libc/musl/arch/generic"]
+ self.target = Target ("TARGET_WASM", None, [])
+ self.target_args += ["-target", args.abi]
# Linux
elif "arm-linux-gnueabihf" == args.abi: