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 project for LLVM backend (supports Wasm) #247

Merged
merged 7 commits into from
Nov 29, 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# .NET Runtime - Native AOT

This branch contains experimental fork of CoreCLR [.NET runtime](http://github.com/dotnet/runtime) optimized for the [Native AOT Form factor](https://github.com/dotnet/designs/blob/main/accepted/2020/form-factors.md#native-aot-form-factors). The ahead-of-time (AOT) toolchain can compile .NET application into a native (architecture specific) single-file executable. It can also produce standalone dynamic or static libraries that can be consumed by applications written in other programming languages.
This branch contains experimental fork of CoreCLR [.NET runtime](http://github.com/dotnet/runtime) optimized for the [Native AOT Form factor](https://github.com/dotnet/designs/blob/main/accepted/2020/form-factors.md#native-aot-form-factors). The ahead-of-time (AOT) toolchain can compile .NET application into a native (architecture specific) single-file executable. It can also produce standalone dynamic or static libraries that can be consumed by applications written in other programming languages. This branch contains the experimental feature of compiling to LLVM to target Web Assembly at present and other LLVM targets in the future.

## Samples

Expand Down
6 changes: 6 additions & 0 deletions docs/workflow/building/coreclr/nativeaot.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ The Native AOT toolchain can be currently built for Linux, macOS and Windows x64
- Add the package directory to your `nuget.config` file. For example, replace `dotnet-experimental` line in `samples\HelloWorld\nuget.config` with `<add key="local" value="C:\runtimelab\artifacts\packages\Debug\Shipping" />`
- Run `dotnet publish --packages pkg -r [win-x64|linux-x64|osx-64] -c [Debug|Release]` to publish your project. `--packages pkg` option restores the package into a local directory that is easy to cleanup once you are done. It avoids polluting the global nuget cache with your locally built dev package.

## Building for Web Assembly
- Currently only tested on Windows
- Run `build nativeaot+libs+nativeaot.packages -rc [Debug|Release] -lc [Debug|Release] -a wasm -os Browser -runtimeFlavor CoreCLR`
- Add the package directory to your `nuget.config` as above.
- Run `dotnet publish -r browser-wasm -c [Debug|Release] /p:Platform=wasm` to publish.

## Visual Studio Solutions

The repository has a number of Visual Studio Solutions files (`*.sln`) that are useful for editing parts of the repository. Build the repo from command line first before building using the solution files. Remember to select the appropriate configuration that you built. By default, `build.cmd` builds Debug x64 and so `Debug` and `x64` must be selected in the solution build configuration drop downs.
Expand Down
6 changes: 3 additions & 3 deletions eng/Configurations.props
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@
<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'linux-musl' and $(TargetArchitecture.StartsWith('arm')) and !$(_hostArch.StartsWith('arm'))">linux-x64</_toolRuntimeRID>

<!-- There are no WebAssembly tools, so use the default ones -->
<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser' and '$(TargetOS)' == 'windows'">win-x64</_toolRuntimeRID>
<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser' and '$(TargetOS)' != 'windows' and $(_buildingInOSX)">osx-x64</_toolRuntimeRID>
<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser' and '$(TargetOS)' != 'windows' and !$(_buildingInOSX)">linux-x64</_toolRuntimeRID>
<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser'">linux-x64</_toolRuntimeRID>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it works, it would be nice to submit this to dotnet/runtime. Also, the Android block below should get the same fix.

<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser' and $([MSBuild]::IsOSPlatform('WINDOWS'))">win-x64</_toolRuntimeRID>
<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser' and $([MSBuild]::IsOSPlatform('OSX'))">osx-x64</_toolRuntimeRID>

<!-- There are no Android tools, so use the default ones -->
<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'android' and '$(TargetOS)' == 'windows'">win-x64</_toolRuntimeRID>
Expand Down
2 changes: 1 addition & 1 deletion eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
</ItemGroup>

<!-- Mono sets -->
<ItemGroup Condition="$(_subset.Contains('+mono.llvm+')) or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'Browser'">
<ItemGroup Condition="$(_subset.Contains('+mono.llvm+')) or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS' or ('$(TargetOS)' == 'Browser' and '$(RuntimeFlavor)' != 'CoreCLR')">
<ProjectToBuild Include="$(MonoProjectRoot)llvm\llvm-init.proj" Category="mono" />
</ItemGroup>

Expand Down
6 changes: 5 additions & 1 deletion eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,11 @@ foreach ($config in $configuration) {
$argumentsWithConfig = $arguments + " -configuration $((Get-Culture).TextInfo.ToTitleCase($config))";
foreach ($singleArch in $arch) {
$argumentsWithArch = "/p:TargetArchitecture=$singleArch " + $argumentsWithConfig
$env:__DistroRid="win-$singleArch"
if ($singleArch -eq "wasm") {
$env:__DistroRid="browser-wasm"
} else {
$env:__DistroRid="win-$singleArch"
}
Invoke-Expression "& `"$PSScriptRoot/common/build.ps1`" $argumentsWithArch"
if ($lastExitCode -ne 0) {
$failedBuilds += "Configuration: $config, Architecture: $singleArch"
Expand Down
6 changes: 3 additions & 3 deletions eng/liveBuilds.targets
Original file line number Diff line number Diff line change
Expand Up @@ -159,22 +159,22 @@
$(LibrariesNativeArtifactsPath)*.pdb"
IsNative="true"
Exclude="@(ExcludeNativeLibrariesRuntimeFiles)" />
<LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'"
<LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser' and '$(RuntimeFlavor)' == 'Mono'"
Include="
$(LibrariesNativeArtifactsPath)dotnet.js;
$(LibrariesNativeArtifactsPath)dotnet.wasm;
$(LibrariesNativeArtifactsPath)dotnet.timezones.blat;
$(LibrariesNativeArtifactsPath)*.dat;"
IsNative="true" />
<LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'"
<LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser' and '$(RuntimeFlavor)' == 'Mono'"
Include="
$(LibrariesNativeArtifactsPath)src\*.c;
$(LibrariesNativeArtifactsPath)src\*.js;
$(LibrariesNativeArtifactsPath)src\emcc-flags.txt;
$(LibrariesNativeArtifactsPath)src\emcc-version.txt;"
NativeSubDirectory="src"
IsNative="true" />
<LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser'"
<LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'Browser' and '$(RuntimeFlavor)' == 'Mono'"
Include="
$(LibrariesNativeArtifactsPath)include\wasm\*.h;"
NativeSubDirectory="include\wasm"
Expand Down
38 changes: 25 additions & 13 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ elseif (CLR_CMAKE_HOST_ARCH_ARM64)
set(ARCH_HOST_NAME arm64)
add_definitions(-DHOST_ARM64)
add_definitions(-DHOST_64BIT)
elseif (CLR_CMAKE_TARGET_ARCH_WASM)
set(ARCH_HOST_NAME wasm)
add_definitions(-DHOST_WASM=1)
add_definitions(-DFEATURE_64BIT_ALIGNMENT=1)
else ()
clr_unknown_arch()
endif ()
Expand Down Expand Up @@ -287,22 +291,37 @@ elseif (CLR_CMAKE_TARGET_ARCH_I386)
set(ARCH_TARGET_NAME x86)
set(ARCH_SOURCES_DIR i386)
add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_X86>)
elseif (CLR_CMAKE_TARGET_ARCH_WASM)
set(ARCH_TARGET_NAME wasm)
set(ARCH_SOURCES_DIR wasm)
add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_WASM>)
else ()
clr_unknown_arch()
endif ()

#--------------------------------------
# Compile Options
#--------------------------------------
if (CLR_CMAKE_HOST_UNIX)
# Disable frame pointer optimizations so profilers can get better call stacks
add_compile_options(-fno-omit-frame-pointer)

if (NOT(MSVC))
# The -fms-extensions enable the stuff like __if_exists, __declspec(uuid()), etc.
add_compile_options(-fms-extensions)
#-fms-compatibility Enable full Microsoft Visual C++ compatibility
#-fms-extensions Accept some non-standard constructs supported by the Microsoft compiler

# Disabled common warnings
add_compile_options(-Wno-unused-variable)
add_compile_options(-Wno-unused-value)
add_compile_options(-Wno-unused-function)
add_compile_options(-Wno-tautological-compare)

#These seem to indicate real issues
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-invalid-offsetof>)
endif (NOT(MSVC))

if (CLR_CMAKE_HOST_UNIX)
# Disable frame pointer optimizations so profilers can get better call stacks
add_compile_options(-fno-omit-frame-pointer)

# Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around
# using twos-complement representation (this is normally undefined according to the C++ spec).
add_compile_options(-fwrapv)
Expand All @@ -322,20 +341,11 @@ if (CLR_CMAKE_HOST_UNIX)
add_compile_options(-Werror)
endif(PRERELEASE)

# Disabled common warnings
add_compile_options(-Wno-unused-variable)
add_compile_options(-Wno-unused-value)
add_compile_options(-Wno-unused-function)
add_compile_options(-Wno-tautological-compare)

check_cxx_compiler_flag(-Wimplicit-fallthrough COMPILER_SUPPORTS_W_IMPLICIT_FALLTHROUGH)
if (COMPILER_SUPPORTS_W_IMPLICIT_FALLTHROUGH)
add_compile_options(-Wimplicit-fallthrough)
endif()

#These seem to indicate real issues
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-invalid-offsetof>)

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# The -ferror-limit is helpful during the porting, it makes sure the compiler doesn't stop
# after hitting just about 20 errors.
Expand Down Expand Up @@ -639,6 +649,8 @@ if (CLR_CMAKE_HOST_WIN32)
message(FATAL_ERROR "MC not found")
endif()

elseif(CLR_CMAKE_TARGET_ARCH_WASM)
# No other tools required, emcmake is already running this script
else (CLR_CMAKE_HOST_WIN32)
enable_language(ASM)

Expand Down
9 changes: 6 additions & 3 deletions eng/native/configureplatform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ if(CLR_CMAKE_HOST_OS STREQUAL Windows)
endif(CLR_CMAKE_HOST_OS STREQUAL Windows)

if(CLR_CMAKE_HOST_OS STREQUAL Emscripten)
#set(CLR_CMAKE_HOST_UNIX 1) # TODO: this should be reenabled but it activates a bunch of additional compiler flags in configurecompiler.cmake
set(CLR_CMAKE_HOST_WIN32 0)
set(CLR_CMAKE_HOST_UNIX 0)
set(CLR_CMAKE_HOST_UNIX_WASM 1)
set(CLR_CMAKE_HOST_BROWSER 1)
endif(CLR_CMAKE_HOST_OS STREQUAL Emscripten)
Expand Down Expand Up @@ -337,8 +338,10 @@ endif(CLR_CMAKE_TARGET_OS STREQUAL SunOS)

if(CLR_CMAKE_TARGET_OS STREQUAL Emscripten)
set(CLR_CMAKE_TARGET_UNIX 1)
set(CLR_CMAKE_TARGET_LINUX 1)
set(CLR_CMAKE_TARGET_BROWSER 1)
if(NOT(RUNTIME_FLAVOR STREQUAL CoreClr))
set(CLR_CMAKE_TARGET_LINUX 1)
endif(NOT(RUNTIME_FLAVOR STREQUAL CoreClr))
endif(CLR_CMAKE_TARGET_OS STREQUAL Emscripten)

if(CLR_CMAKE_TARGET_UNIX)
Expand All @@ -364,7 +367,7 @@ endif(CLR_CMAKE_TARGET_UNIX)
# check if host & target os/arch combination are valid
if (CLR_CMAKE_TARGET_OS STREQUAL CLR_CMAKE_HOST_OS)
if(NOT(CLR_CMAKE_TARGET_ARCH STREQUAL CLR_CMAKE_HOST_ARCH))
if(NOT((CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM64) OR (CLR_CMAKE_HOST_ARCH_I386 AND CLR_CMAKE_TARGET_ARCH_ARM) OR (CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM) OR (CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_I386)))
if(NOT((CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM64) OR (CLR_CMAKE_HOST_ARCH_I386 AND CLR_CMAKE_TARGET_ARCH_ARM) OR (CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM) OR (CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_I386) OR (CLR_CMAKE_TARGET_UNIX_WASM AND CLR_CMAKE_HOST_ARCH STREQUAL Windows_NT)))
message(FATAL_ERROR "Invalid platform and target arch combination TARGET_ARCH=${CLR_CMAKE_TARGET_ARCH} HOST_ARCH=${CLR_CMAKE_HOST_ARCH}")
endif()
endif()
Expand Down
14 changes: 7 additions & 7 deletions eng/native/gen-buildsys.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if /i "%__Ninja%" == "1" (
if /i NOT "%__Arch%" == "wasm" (
if /i "%__VSVersion%" == "vs2019" (set __CmakeGenerator=%__CmakeGenerator% 16 2019)
if /i "%__VSVersion%" == "vs2017" (set __CmakeGenerator=%__CmakeGenerator% 15 2017)

if /i "%__Arch%" == "x64" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A x64)
if /i "%__Arch%" == "arm" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM)
if /i "%__Arch%" == "arm64" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM64)
Expand All @@ -38,17 +38,17 @@ if /i "%__Ninja%" == "1" (
set __CmakeGenerator=NMake Makefiles
)
)

echo gen-buildsys %__Arch%
if /i "%__Arch%" == "wasm" (
if "%EMSDK_PATH%" == "" (
echo Error: Should set EMSDK_PATH environment variable pointing to emsdk root.
if "%EMSDK%" == "" (
echo Error: Should set EMSDK environment variable pointing to emsdk root.
exit /B 1
)

if "%EMSCRIPTEN_ROOT%" == "" (
set EMSCRIPTEN_ROOT="%EMSDK_PATH/upstream/emscripten%"
if /i "%CMAKE_BUILD_TYPE%" == "debug" (
set __ExtraCmakeParams=%__ExtraCmakeParams% -g -O0
)
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DEMSCRIPTEN_GENERATE_BITCODE_STATIC_LIBRARIES=1" "-DCMAKE_TOOLCHAIN_FILE=%EMSCRIPTEN%/cmake/Modules/Platform/Emscripten.cmake"
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%" "-DCMAKE_TOOLCHAIN_FILE=%EMSDK%/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" -DCLR_CMAKE_TARGET_ARCH=wasm -DCLR_CMAKE_TARGET_ARCH_WASM=1 -DCLR_CMAKE_HOST_ARCH=Windows_NT -DCLR_CMAKE_HOST_OS=Emscripten -DRUNTIME_FLAVOR=CoreClr -DCLR_CMAKE_HOST_UNIX_WASM=1 "-DCLR_ENG_NATIVE_DIR=%__repoRoot%\eng\native" "-DCMAKE_REPO_ROOT=%__repoRoot%" -DCLR_CMAKE_KEEP_NATIVE_SYMBOLS=1
set __UseEmcmake=1
) else (
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_SYSTEM_VERSION=10.0"
Expand Down
2 changes: 1 addition & 1 deletion samples/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="6.0.0-*" />
<PackageReference Include="Microsoft.DotNet.ILCompiler.LLVM" Version="6.0.0-*" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion samples/HelloWorld/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This will add a nuget.config file to your application. Open the file and in the
Once you've added the package source, add a reference to the compiler by running the following command:

```bash
> dotnet add package Microsoft.DotNet.ILCompiler -v 6.0.0-*
> dotnet add package Microsoft.DotNet.ILCompiler.LLVM -v 6.0.0-*
```

## Restore and Publish your app
Expand Down
2 changes: 1 addition & 1 deletion samples/HelloWorld/nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="dotnet-experimental" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json" />
<add key="local" value="e:\github\runtimelab\artifacts\packages\Debug\Shipping" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
2 changes: 1 addition & 1 deletion samples/NativeLibrary/NativeLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="6.0.0-*" />
<PackageReference Include="Microsoft.DotNet.ILCompiler.LLVM" Version="6.0.0-*" />
</ItemGroup>

</Project>
10 changes: 6 additions & 4 deletions src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,23 @@ if(CLR_CMAKE_HOST_UNIX)
add_subdirectory(src/pal)
add_subdirectory(src/hosts)
else(CLR_CMAKE_HOST_UNIX)
if(CLR_CMAKE_TARGET_UNIX)
if(CLR_CMAKE_TARGET_UNIX AND NOT CLR_CMAKE_HOST_UNIX_WASM)
add_subdirectory(src/pal/src/libunwind)
endif(CLR_CMAKE_TARGET_UNIX)
endif(CLR_CMAKE_TARGET_UNIX AND NOT CLR_CMAKE_HOST_UNIX_WASM)
endif(CLR_CMAKE_HOST_UNIX)

# Add this subdir. We install the headers for the jit.
add_subdirectory(src/pal/prebuilt/inc)

add_subdirectory(src/debug/debug-pal)
if(NOT CLR_CMAKE_HOST_UNIX_WASM)
add_subdirectory(src/debug/debug-pal)
add_subdirectory(src/tools/aot/jitinterface)
endif(NOT CLR_CMAKE_HOST_UNIX_WASM)

if(CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_BUILD_SUBSET_RUNTIME)
add_subdirectory(src/gc/sample)
endif()

add_subdirectory(src/tools/aot/jitinterface)

if(NOT CLR_CROSS_COMPONENTS_BUILD)
add_subdirectory(src/nativeaot)
Expand Down
16 changes: 15 additions & 1 deletion src/coreclr/build-runtime.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ set __BuildArchX64=0
set __BuildArchX86=0
set __BuildArchArm=0
set __BuildArchArm64=0
set __BuildArchWasm=0

set __BuildTypeDebug=0
set __BuildTypeChecked=0
Expand Down Expand Up @@ -117,6 +118,7 @@ if /i "%1" == "-x64" (set __BuildArchX64=1&set processedArgs=!pr
if /i "%1" == "-x86" (set __BuildArchX86=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-arm" (set __BuildArchArm=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-arm64" (set __BuildArchArm64=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-wasm" (set __BuildArchWasm=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)

if /i "%1" == "-debug" (set __BuildTypeDebug=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-checked" (set __BuildTypeChecked=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
Expand Down Expand Up @@ -233,6 +235,11 @@ if %__BuildArchArm64%==1 (
set __BuildArch=arm64
set __CrossArch=x64
)
if %__BuildArchWasm%==1 (
set __TargetOS=browser
set __BuildArch=wasm
set __BuildJit=0
)

set /A __TotalSpecifiedBuildType=__BuildTypeDebug + __BuildTypeChecked + __BuildTypeRelease
if %__TotalSpecifiedBuildType% GTR 1 (
Expand Down Expand Up @@ -622,6 +629,9 @@ if %__BuildNative% EQU 1 (
if %__Ninja% EQU 1 (
set __ExtraCmakeArgs="-DCMAKE_BUILD_TYPE=!__BuildType!"
)
if "%__BuildArch%" == "wasm" (
set __ExtraCmakeArgs="-DCMAKE_BUILD_TYPE=!__BuildType!"
)

set __ExtraCmakeArgs=!__ExtraCmakeArgs! !___CrossBuildDefine! %__CMakeClrBuildSubsetArgs% "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs%
call "%__RepoRootDir%\eng\native\gen-buildsys.cmd" "%__ProjectDir%" "%__IntermediatesDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs!
Expand Down Expand Up @@ -656,7 +666,10 @@ if %__BuildNative% EQU 1 (
set __CmakeBuildToolArgs=
) else (
REM We pass the /m flag directly to MSBuild so that we can get both MSBuild and CL parallelism, which is fastest for our builds.
set __CmakeBuildToolArgs=/nologo /m !__Logging!
REM wasm uses nmake which does not support /m
if not "%__BuildArch%" == "wasm" (
set __CmakeBuildToolArgs=/nologo /m !__Logging!
)
)

"%CMakePath%" --build %__IntermediatesDir% --target install --config %__BuildType% -- !__CmakeBuildToolArgs!
Expand All @@ -671,6 +684,7 @@ if %__BuildNative% EQU 1 (
)

if /i "%__BuildArch%" == "arm64" goto SkipCopyUcrt
if /i "%__BuildArch%" == "wasm" goto SkipCopyUcrt

if not defined UCRTVersion (
echo %__ErrMsgPrefix%%__MsgPrefix%Error: Please install Windows 10 SDK.
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/clrfeatures.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ if(CLR_CMAKE_TARGET_TIZEN_LINUX)
set(FEATURE_GDBJIT_LANGID_CS 1)
endif()

if(CLR_CMAKE_TARGET_UNIX_WASM)
set(FEATURE_EVENT_TRACE 0)
endif()

if(NOT DEFINED FEATURE_EVENT_TRACE)
set(FEATURE_EVENT_TRACE 1)
endif(NOT DEFINED FEATURE_EVENT_TRACE)
Expand Down
Loading