Skip to content
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
3 changes: 1 addition & 2 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@
<DefaultCoreClrSubsets>clr.native+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools+host.native</DefaultCoreClrSubsets>
<DefaultCoreClrSubsets Condition="'$(TargetRid)' == 'linux-armel'">clr.native+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools</DefaultCoreClrSubsets>
<DefaultCoreClrSubsets Condition="'$(TargetsAndroid)' == 'true'">clr.native+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools</DefaultCoreClrSubsets>
<!-- WASM-TODO: host.native -->
<DefaultCoreClrSubsets Condition="'$(TargetsBrowser)' == 'true'">mono.emsdk+clr.native+clr.corelib+clr.tools+clr.packages+clr.crossarchtools</DefaultCoreClrSubsets>
<!-- Even on platforms that do not support the CoreCLR runtime, we still want to build ilasm/ildasm. -->
<DefaultCoreClrSubsets Condition="'$(RuntimeFlavor)' != 'CoreCLR'">clr.iltools+clr.packages</DefaultCoreClrSubsets>
Expand Down Expand Up @@ -365,7 +364,7 @@
The cross tools are used as part of the build process with the downloaded build tools, so we need to build them for the host architecture and build them as unsanitized binaries.
-->
<PropertyGroup>
<_BuildAnyCrossArch Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(HostOS)' != '$(TargetOS)' or '$(EnableNativeSanitizers)' != '') and '$(TargetsWasm)' != 'true'">true</_BuildAnyCrossArch>
<_BuildAnyCrossArch Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(HostOS)' != '$(TargetOS)' or '$(EnableNativeSanitizers)' != '') and '$(TargetArchitecture)' != 'wasm'">true</_BuildAnyCrossArch>
<_BuildCrossComponents Condition="$(_subset.Contains('+clr.crossarchtools+'))">true</_BuildCrossComponents>
<_BuildCrossComponents Condition="'$(ClrRuntimeBuildSubsets)' != '' and ('$(PrimaryRuntimeFlavor)' == 'CoreCLR' or '$(TargetsMobile)' == 'true')">true</_BuildCrossComponents>
<_CrossBitwidthBuild Condition="'$(BuildArchitecture)' == 'x64' and ('$(TargetArchitecture)' == 'x86' or '$(TargetArchitecture)' == 'arm')">true</_CrossBitwidthBuild>
Expand Down
21 changes: 16 additions & 5 deletions eng/liveBuilds.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<!-- Set up artifact subpaths. -->
<PropertyGroup>
<CoreCLRSharedFrameworkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'sharedFramework'))</CoreCLRSharedFrameworkDir>
<CoreCLRCoreHostDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'corehost'))</CoreCLRCoreHostDir>
<CoreCLRILCompilerDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'ilc-published'))</CoreCLRILCompilerDir>
<CoreCLRCrossILCompilerDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', '$(BuildArchitecture)', 'ilc'))</CoreCLRCrossILCompilerDir>
<CoreCLRAotSdkDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'aotsdk'))</CoreCLRAotSdkDir>
Expand Down Expand Up @@ -214,18 +215,28 @@
$(LibrariesNativeArtifactsPath)*.dex;
$(LibrariesNativeArtifactsPath)*.jar;"
IsNative="true" />
<!-- WASM-TODO build this also as part of coreCLR host.native -->

<LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'browser' and '$(RuntimeFlavor)' == 'CoreCLR'"
Include="
$(CoreCLRCoreHostDir)package.json;
$(CoreCLRCoreHostDir)dotnet.native.js;
$(CoreCLRCoreHostDir)dotnet.native.wasm;
$(CoreCLRSharedFrameworkDir)dotnet.d.ts;
$(CoreCLRSharedFrameworkDir)dotnet.js;
$(CoreCLRSharedFrameworkDir)dotnet.js.map;
$(CoreCLRSharedFrameworkDir)dotnet.runtime.js;
$(CoreCLRSharedFrameworkDir)dotnet.runtime.js.map;
$(CoreCLRSharedFrameworkDir)*.dat;"
IsNative="true" />

<LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'browser' and '$(RuntimeFlavor)' == 'Mono'"
Include="
$(LibrariesNativeArtifactsPath)dotnet.d.ts;
$(LibrariesNativeArtifactsPath)dotnet.js;
$(LibrariesNativeArtifactsPath)dotnet.js.map;
$(LibrariesNativeArtifactsPath)dotnet.runtime.js;
$(LibrariesNativeArtifactsPath)dotnet.runtime.js.map;
$(LibrariesNativeArtifactsPath)*.dat;"
IsNative="true" />
<LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'browser' and '$(RuntimeFlavor)' == 'Mono'"
Include="
$(LibrariesNativeArtifactsPath)*.dat;
$(LibrariesNativeArtifactsPath)dotnet.diagnostics.js;
$(LibrariesNativeArtifactsPath)dotnet.native.js;
$(LibrariesNativeArtifactsPath)dotnet.native.wasm;
Expand Down
22 changes: 22 additions & 0 deletions eng/native.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project>
<ItemGroup>
<PackageReference Condition="'$(TargetsWasm)' == 'true'" Include="Microsoft.NETCore.Runtime.ICU.Transport" PrivateAssets="all" Version="$(MicrosoftNETCoreRuntimeICUTransportVersion)" GeneratePathProperty="true" />
<PackageReference Condition="'$(TargetsWasm)' == 'true'" Include="System.Runtime.TimeZoneData" PrivateAssets="all" Version="$(SystemRuntimeTimeZoneDataVersion)" GeneratePathProperty="true" />
</ItemGroup>

<PropertyGroup>
<_RuntimeVariant />
<_RuntimeVariant Condition="'$(WasmEnableThreads)' == 'true'">-threads</_RuntimeVariant>

<_IcuDir Condition="'$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)' != '' and '$(TargetsWasm)' == 'true'">$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)/runtimes/$(TargetOS)-$(TargetArchitecture)$(_RuntimeVariant)/native</_IcuDir>
<_TzdDir Condition="'$(PkgSystem_Runtime_TimeZoneData)' != '' and '$(TargetsWasm)' == 'true'">$([MSBuild]::NormalizePath('$(PkgSystem_Runtime_TimeZoneData)', 'contentFiles', 'any', 'any', 'data'))</_TzdDir>
</PropertyGroup>

<ItemGroup>
<NativeCMakeArg Condition="'$(_IcuDir)' != ''" Include="-cmakeargs &quot;-DCMAKE_ICU_DIR=$(_IcuDir)&quot;" />
<NativeCMakeArg Condition="'$(_TzdDir)' != ''" Include="-cmakeargs &quot;-DCMAKE_TZD_DIR=$(_TzdDir)&quot;" />
<NativeCMakeArg Include="-cmakeargs &quot;-DCMAKE_PRODUCT_VERSION=$(ProductVersion)&quot;" />
<NativeCMakeArg Include="-cmakeargs &quot;-DCMAKE_CONTINUOUS_INTEGRATION_BUILD=$(ContinuousIntegrationBuild)&quot;" />
</ItemGroup>

</Project>
3 changes: 2 additions & 1 deletion src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ else()
set(GEN_PINVOKE 0)
# WASM-TODO should we start using System.Native.Browser and System.Runtime.InteropServices.JavaScript.Native also for Mono ?
set(BUILD_LIBS_NATIVE_BROWSER 1)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/corehost browserhost)
set(STATIC_LIB_DESTINATION ${CMAKE_BINARY_DIR}/libs-native)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/corehost corehost)
add_dependencies(runtime browserhost)
endif()
endif()
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ endif(CLR_CMAKE_TARGET_WIN32)
# add the install targets
if(NOT CLR_CMAKE_HOST_ARCH_WASM)
install_clr(TARGETS coreclr DESTINATIONS . sharedFramework COMPONENT runtime)
else()
install_clr(TARGETS coreclr_static DESTINATIONS . sharedFramework COMPONENT runtime)
endif(NOT CLR_CMAKE_HOST_ARCH_WASM)

if(CLR_CMAKE_HOST_MACCATALYST OR CLR_CMAKE_HOST_IOS OR CLR_CMAKE_HOST_TVOS OR CLR_CMAKE_HOST_ANDROID OR CLR_CMAKE_HOST_ARCH_WASM)
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/gcinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,5 @@ endif (CLR_CMAKE_TARGET_ARCH_I386 AND CLR_CMAKE_TARGET_UNIX)

if (CLR_CMAKE_TARGET_ARCH_WASM)
create_gcinfo_lib(TARGET gcinfo_unix_wasm OS browser ARCH wasm)
install_clr(TARGETS gcinfo_unix_wasm DESTINATIONS sharedFramework COMPONENT runtime)
endif (CLR_CMAKE_TARGET_ARCH_WASM)
6 changes: 3 additions & 3 deletions src/coreclr/hosts/corerun/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ else()
target_link_libraries(corerun PRIVATE
coreclr_static
System.Native-Static
System.Native.TimeZoneData)
System.Native.TimeZoneData.Invariant)
# linker options for NodeJs, link in JavaScript helper, access to local filesystem
if (CLR_CMAKE_TARGET_BROWSER)
target_compile_options(corerun PRIVATE
Expand All @@ -63,9 +63,9 @@ else()
target_link_libraries(corerun PRIVATE
System.Native.Browser-Static)
set(JS_SYSTEM_NATIVE_BROWSER
"${CLR_ARTIFACTS_OBJ_DIR}/native/browser-${CMAKE_BUILD_TYPE}-wasm/System.Native.Browser/libSystem.Native.Browser.js")
"${STATIC_LIB_DESTINATION}/libSystem.Native.Browser.js")
set(JS_SYSTEM_BROWSER_UTILS
"${CLR_ARTIFACTS_OBJ_DIR}/native/browser-${CMAKE_BUILD_TYPE}-wasm/System.Native.Browser/libSystem.Browser.Utils.js")
"${STATIC_LIB_DESTINATION}/libSystem.Browser.Utils.js")
set(JS_CORE_RUN_PRE
"${CMAKE_CURRENT_SOURCE_DIR}/wasm/libCorerun.pre.js")
set_target_properties(corerun PROPERTIES
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/minipal/Unix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ add_library(coreclrminipal
)

target_link_libraries(coreclrminipal PRIVATE minipal)

if (CLR_CMAKE_TARGET_ARCH_WASM)
install_clr(TARGETS coreclrminipal DESTINATIONS sharedFramework COMPONENT runtime)
endif (CLR_CMAKE_TARGET_ARCH_WASM)
4 changes: 4 additions & 0 deletions src/coreclr/nativeresources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ add_library_clr(nativeresourcestring
)

install_clr (TARGETS nativeresourcestring DESTINATIONS lib)

if (CLR_CMAKE_TARGET_ARCH_WASM)
install_clr(TARGETS nativeresourcestring DESTINATIONS sharedFramework COMPONENT runtime)
endif (CLR_CMAKE_TARGET_ARCH_WASM)
4 changes: 4 additions & 0 deletions src/coreclr/pal/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,7 @@ endif(FEATURE_EVENT_TRACE)

# Install the static PAL library for VS
install_clr (TARGETS coreclrpal DESTINATIONS lib)

if (CLR_CMAKE_TARGET_ARCH_WASM)
install_clr(TARGETS coreclrpal DESTINATIONS sharedFramework COMPONENT runtime)
endif (CLR_CMAKE_TARGET_ARCH_WASM)
12 changes: 3 additions & 9 deletions src/coreclr/runtime.proj
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@
<_BuildNativeTargetOS>$(TargetOS)</_BuildNativeTargetOS>
<_BuildNativeTargetOS Condition="'$(TargetsLinuxBionic)' == 'true'">linux-bionic</_BuildNativeTargetOS>
<HasCdacBuildTool Condition="'$(ClrFullNativeBuild)' == 'true' or '$(ClrRuntimeSubset)' == 'true' or '$(ClrDebugSubset)' == 'true' or '$(ClrCrossComponentsSubset)' == 'true'">true</HasCdacBuildTool>

<_IcuDir Condition="'$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)' != '' and '$(TargetsBrowser)' == 'true'">$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)/runtimes/$(TargetOS)-$(TargetArchitecture)$(_RuntimeVariant)/native</_IcuDir>
<_TzdDir Condition="'$(PkgSystem_Runtime_TimeZoneData)' != ''">$([MSBuild]::NormalizePath('$(PkgSystem_Runtime_TimeZoneData)', 'contentFiles', 'any', 'any', 'data'))</_TzdDir>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="runtime-prereqs.proj" GlobalPropertiesToRemove="$(NativeBuildPartitionPropertiesToRemove)" />
<ProjectReference Condition="'$(HasCdacBuildTool)' == 'true'" Include="tools\cdac-build-tool\cdac-build-tool.csproj" ReferenceOutputAssembly="false" GlobalPropertiesToRemove="$(NativeBuildPartitionPropertiesToRemove)" />
<PackageReference Condition="'$(TargetsWasm)' == 'true'" Include="Microsoft.NETCore.Runtime.ICU.Transport" PrivateAssets="all" Version="$(MicrosoftNETCoreRuntimeICUTransportVersion)" GeneratePathProperty="true" />
<PackageReference Condition="'$(TargetsWasm)' == 'true'" Include="System.Runtime.TimeZoneData" PrivateAssets="all" Version="$(SystemRuntimeTimeZoneDataVersion)" GeneratePathProperty="true" />
</ItemGroup>

<Import Project="$(RepositoryEngineeringDir)native.props" />
<Import Project="$(RepositoryEngineeringDir)nativepgo.targets" />

<Target Name="BuildRuntime"
DependsOnTargets="GetPgoDataPackagePath"
BeforeTargets="Build">
Expand Down Expand Up @@ -54,8 +50,6 @@
<_CoreClrBuildArg Condition="'$(BuildSubdirectory)' != ''" Include="-subdir $(BuildSubdirectory)" />
<_CoreClrBuildArg Include="-cmakeargs &quot;-DCLR_DOTNET_HOST_PATH=$(DOTNET_HOST_PATH)&quot;" />
<_CoreClrBuildArg Condition="'$(HasCdacBuildTool)' == 'true'" Include="-cmakeargs &quot;-DCDAC_BUILD_TOOL_BINARY_PATH=$(RuntimeBinDir)cdac-build-tool\cdac-build-tool.dll&quot;" />
<_CoreClrBuildArg Condition="'$(_IcuDir)' != ''" Include="-cmakeargs &quot;-DCMAKE_ICU_DIR=$(_IcuDir)&quot;" />
<_CoreClrBuildArg Condition="'$(_TzdDir)' != ''" Include="-cmakeargs &quot;-DCMAKE_TZD_DIR=$(_TzdDir)&quot;" />
<_CoreClrBuildArg Condition="'$(FeatureXplatEventSource)' == 'false'" Include="-cmakeargs &quot;-DFEATURE_EVENTSOURCE_XPLAT=0&quot;" />
</ItemGroup>

Expand Down Expand Up @@ -112,7 +106,7 @@
<PropertyGroup>
<_CoreClrBuildScript Condition="$([MSBuild]::IsOsPlatform(Windows))">build-runtime.cmd</_CoreClrBuildScript>
<_CoreClrBuildScript Condition="!$([MSBuild]::IsOsPlatform(Windows))">build-runtime.sh</_CoreClrBuildScript>
<_CoreClrBuildCommand>&quot;$(MSBuildThisFileDirectory)$(_CoreClrBuildScript)&quot; @(_CoreClrBuildArg, ' ')</_CoreClrBuildCommand>
<_CoreClrBuildCommand>&quot;$(MSBuildThisFileDirectory)$(_CoreClrBuildScript)&quot; @(_CoreClrBuildArg, ' ') @(NativeCMakeArg, ' ')</_CoreClrBuildCommand>
</PropertyGroup>

<!-- Use IgnoreStandardErrorWarningFormat because Arcade sets WarnAsError and we want to avoid upgrading compiler warnings to errors in release branches -->
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/externals.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Version="$(MicrosoftDiaSymReaderNativeVersion)" />
</ItemGroup>

<ItemGroup>
<ItemGroup Condition="'$(TargetsWasm)' != 'true'">
<HostFxrFile Include="$(DotNetHostBinDir)$(LibPrefix)hostfxr$(LibSuffix)" />
<HostPolicyFile Include="$(DotNetHostBinDir)$(LibPrefix)hostpolicy$(LibSuffix)" />
<_HostSymbols Include="$(DotNetHostBinDir)$(LibPrefix)hostfxr$(LibSuffix)$(SymbolsSuffix)" />
Expand Down
89 changes: 57 additions & 32 deletions src/native/corehost/browserhost/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,45 @@
# The .NET Foundation licenses this file to you under the MIT license.

project(browserhost)
set(DOTNET_PROJECT_NAME "browserhost")
set(DOTNET_PROJECT_NAME "BrowserHost-Static")

# the host library

configure_file(${CLR_SRC_NATIVE_DIR}/corehost/configure.h.in ${GENERATED_INCLUDE_DIR}/corehost/configure.h)
target_include_directories(hostmisc_interface INTERFACE ${GENERATED_INCLUDE_DIR}/corehost)
include(configure.cmake)

set(SOURCES
set(BROWSERHOST_STATIC_SOURCES
./config.h
./browserhost.cpp
native.rc
../native.rc
)

add_compile_definitions(FEATURE_APPHOST)
add_definitions(-DFEATURE_APPHOST=1)
add_definitions(-DFEATURE_STATIC_HOST=1)

add_library(BrowserHost-Static
STATIC
${BROWSERHOST_STATIC_SOURCES}
)
set_target_properties(BrowserHost-Static PROPERTIES OUTPUT_NAME BrowserHost CLEAN_DIRECT_OUTPUT 1)

target_compile_options(BrowserHost-Static PRIVATE
-fwasm-exceptions
-msimd128
)
target_link_libraries(BrowserHost-Static PRIVATE
hostmisc
)

install(TARGETS BrowserHost-Static DESTINATION corehost COMPONENT runtime)
install(TARGETS BrowserHost-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs)
install(TARGETS BrowserHost-Static DESTINATION sharedFramework COMPONENT runtime)

# the executable
set(DOTNET_PROJECT_NAME "browserhost")

set(BROWSERHOST_SOURCES
empty.c
)
set(HEADERS
)
Expand All @@ -18,19 +49,13 @@ add_compile_definitions(FEATURE_APPHOST)
add_definitions(-DFEATURE_APPHOST=1)
add_definitions(-DFEATURE_STATIC_HOST=1)

add_executable(browserhost ${SOURCES})
add_executable(browserhost ${BROWSERHOST_SOURCES})
set_target_properties(browserhost PROPERTIES OUTPUT_NAME dotnet.native)
set(CMAKE_EXECUTABLE_SUFFIX ".js")
add_dependencies(browserhost System.Native.Browser-Rollup)
add_dependencies(browserhost System.Native.Browser-Static)
add_dependencies(browserhost System.Runtime.InteropServices.JavaScript.Native-Static)

install(TARGETS browserhost DESTINATION corehost COMPONENT runtime)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dotnet.native.wasm DESTINATION corehost COMPONENT runtime)

include(configure.cmake)

LIST(APPEND NATIVE_LIBS
hostmisc
clrinterpreter
coreclr_static
System.Native.Browser-Static
System.Runtime.InteropServices.JavaScript.Native-Static
Expand All @@ -44,21 +69,14 @@ LIST(APPEND NATIVE_LIBS
System.Native.TimeZoneData
)

# WASM-TODO set(RUNTIMEINFO_LIB runtimeinfo)

target_compile_options(browserhost PRIVATE
-fwasm-exceptions
-msimd128
)

set(JS_SYSTEM_NATIVE_BROWSER
"${CLR_ARTIFACTS_OBJ_DIR}/native/browser-${CMAKE_BUILD_TYPE}-wasm/System.Native.Browser/libSystem.Native.Browser.js")
"${STATIC_LIB_DESTINATION}/libSystem.Native.Browser.js")
set(JS_SYSTEM_BROWSER_UTILS
"${CLR_ARTIFACTS_OBJ_DIR}/native/browser-${CMAKE_BUILD_TYPE}-wasm/System.Native.Browser/libSystem.Browser.Utils.js")
"${STATIC_LIB_DESTINATION}/libSystem.Browser.Utils.js")
set(JS_SYSTEM_RUNTIME_INTEROPSERVICES_JAVASCRIPT_NATIVE
"${CLR_ARTIFACTS_OBJ_DIR}/native/browser-${CMAKE_BUILD_TYPE}-wasm/System.Runtime.InteropServices.JavaScript.Native/libSystem.Runtime.InteropServices.JavaScript.Native.js")
"${STATIC_LIB_DESTINATION}/libSystem.Runtime.InteropServices.JavaScript.Native.js")
set(JS_BROWSER_HOST
"${CLR_ARTIFACTS_OBJ_DIR}/coreclr/browser.wasm.${CMAKE_BUILD_TYPE}/corehost/libBrowserHost.js")
"${STATIC_LIB_DESTINATION}/libBrowserHost.js")
set(JS_SYSTEM_NATIVE_BROWSER_EXPOST
"${CMAKE_CURRENT_SOURCE_DIR}/../../libs/System.Native.Browser/libSystem.Native.Browser.extpost.js")

Expand All @@ -67,6 +85,11 @@ set_target_properties(browserhost PROPERTIES
LINK_FLAGS "--js-library ${JS_SYSTEM_NATIVE_BROWSER} --js-library ${JS_SYSTEM_BROWSER_UTILS} --js-library ${JS_SYSTEM_RUNTIME_INTEROPSERVICES_JAVASCRIPT_NATIVE} --js-library ${JS_BROWSER_HOST} --extern-post-js ${JS_SYSTEM_NATIVE_BROWSER_EXPOST}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")

target_compile_options(browserhost PRIVATE
-fwasm-exceptions
-msimd128
)

if (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG)
target_link_options(browserhost PRIVATE
# -sVERBOSE
Expand Down Expand Up @@ -97,16 +120,18 @@ target_link_options(browserhost PRIVATE
-Wno-unused-command-line-argument
-Wl,-error-limit=0)

target_link_libraries(
browserhost
PRIVATE
hostmisc
clrinterpreter
target_link_libraries(browserhost PUBLIC
BrowserHost-Static
)
target_link_libraries(browserhost PRIVATE
${NATIVE_LIBS}

${START_WHOLE_ARCHIVE}
${START_WHOLE_ARCHIVE}
${RUNTIMEINFO_LIB}
${END_WHOLE_ARCHIVE}
)

install(TARGETS browserhost DESTINATION corehost COMPONENT runtime)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dotnet.native.wasm DESTINATION corehost COMPONENT runtime)
install(FILES ${CLR_SRC_NATIVE_DIR}/package.json DESTINATION corehost COMPONENT runtime)

add_subdirectory(sample)
7 changes: 4 additions & 3 deletions src/native/corehost/browserhost/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ It's **JavaScript ES6 module**
Implements native part of the CoreCLR host and exposes it as an internal JavaScript interface to the loader.
It is **Emscripten application** statically linked from libraries.

- `host/index.ts` -> compiled -> `libBrowserHost.js` linked -> `dotnet.native.js`
- `libBrowserHost.footer.js` -> compiled -> `libBrowserHost.js` linked -> `dotnet.native.js`
- `libSystem.Native.Browser.js` linked -> `dotnet.native.js`
- `libSystem.Browser.Utils.js` linked -> `dotnet.native.js`
- `libSystem.Runtime.InteropServices.JavaScript.Native.js` linked -> `dotnet.native.js`
- `browserhost.cpp` compiled + linked -> `dotnet.native.wasm`
- `libSystem.Native.Browser.a` linked -> `dotnet.native.wasm`
- `libSystem.Runtime.InteropServices.JavaScript.Native.a` linked -> `dotnet.native.wasm`
- `host/index.ts` -> compiled -> `libBrowserHost.js` linked -> `dotnet.native.js`
- `host/libBrowserHost.footer.js` -> compiled -> `libBrowserHost.js` linked -> `dotnet.native.js`
- `host/browserhost.cpp` compiled -> `libBrowserHost.a` linked -> `dotnet.native.wasm`
- `empty.c` compiled + linked -> `dotnet.native.wasm`

## Build
TypeScript is compiled by `src/native/rollup.config.js`
Expand Down
3 changes: 0 additions & 3 deletions src/native/corehost/browserhost/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@
#ifndef __CONFIG_H__
#define __CONFIG_H__

#cmakedefine01 HAVE_GETAUXVAL
#cmakedefine01 HAVE_DIRENT_D_TYPE

#endif // __CONFIG_H__
2 changes: 0 additions & 2 deletions src/native/corehost/browserhost/configure.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
check_symbol_exists(getauxval sys/auxv.h HAVE_GETAUXVAL)
check_struct_has_member ("struct dirent" d_type dirent.h HAVE_DIRENT_D_TYPE)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#define FX_VER_FILEDESCRIPTION_STR "CoreCLR test host"

#include <fxver.h>
#include <fxver.rc>
#include "stdio.h"
Loading
Loading