diff --git a/eng/Subsets.props b/eng/Subsets.props index e4cc340001ee3a..5930eb19fac6e4 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -111,7 +111,7 @@ clr.native+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools clr.native+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools clr.native+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools - mono.emsdk+clr.native+clr.corelib+clr.tools+clr.packages+clr.crossarchtools + mono.emsdk+clr.native+clr.corelib+clr.tools+clr.packages+clr.crossarchtools+host.native clr.iltools+clr.packages @@ -590,22 +590,6 @@ - - - - - - - - - - - - - - - - @@ -632,6 +616,23 @@ + + + + + + + + + + + + + + + + + diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index f782005ed54140..432c673d4bd696 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -18,11 +18,14 @@ $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'mono', '$(TargetOS).$(TargetArchitecture).$(MonoConfiguration)')) $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts')) $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts')) + $([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', '$(TargetOS)-$(TargetArchitecture).$(HostConfiguration)')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'sharedFramework')) + $([MSBuild]::NormalizeDirectory('$(LibrariesNativeArtifactsPath)','sharedFramework')) + $([MSBuild]::NormalizeDirectory('$(HostArtifactsPath)','sharedFramework')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'corehost')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'ilc-published')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', '$(BuildArchitecture)', 'ilc')) @@ -88,6 +91,8 @@ value is different after CoreCLRArtifactsPath is normalized. --> $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','sharedFramework')) + $([MSBuild]::NormalizeDirectory('$(LibrariesNativeArtifactsPath)','sharedFramework')) + $([MSBuild]::NormalizeDirectory('$(HostArtifactsPath)','sharedFramework')) $([MSBuild]::NormalizeDirectory('$(CoreCLRSharedFrameworkDir)','PDB')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','$(CoreCLRCrossTargetComponentDirName)','sharedFramework')) @@ -218,15 +223,22 @@ + + + + diff --git a/eng/native/configurepaths.cmake b/eng/native/configurepaths.cmake index 7d6851d1cf0646..7f145133660dbc 100644 --- a/eng/native/configurepaths.cmake +++ b/eng/native/configurepaths.cmake @@ -2,6 +2,7 @@ get_filename_component(CLR_REPO_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../.. ABSOLUT set(CLR_ENG_NATIVE_DIR ${CMAKE_CURRENT_LIST_DIR}) get_filename_component(CLR_SRC_NATIVE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../src/native ABSOLUTE) set (CLR_ARTIFACTS_OBJ_DIR "${CLR_REPO_ROOT_DIR}/artifacts/obj") +set (CLR_ARTIFACTS_BIN_DIR "${CLR_REPO_ROOT_DIR}/artifacts/bin") set (CLR_SOURCELINK_FILE_PATH "${CLR_ARTIFACTS_OBJ_DIR}/native.sourcelink.json") set(VERSION_HEADER_PATH "${CLR_ARTIFACTS_OBJ_DIR}/_version.h") set(VERSION_FILE_PATH "${CLR_ARTIFACTS_OBJ_DIR}/_version.c") diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index 02d85086ab70f9..002f34965f950f 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -72,16 +72,6 @@ if(NOT CLR_CROSS_COMPONENTS_BUILD AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT C set(CLR_SINGLE_FILE_HOST_ONLY 1) add_subdirectory(${CLR_SRC_NATIVE_DIR}/corehost/apphost/static Corehost.Static) add_dependencies(runtime singlefilehost) -else() - if(CLR_CMAKE_TARGET_BROWSER) - # WASM-TODO set GEN_PINVOKE to 1 once we generate them. static entrypoint.c prevents C linker from trimming, when IL trimming trims PInvokes - 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) - set(STATIC_LIB_DESTINATION ${CMAKE_BINARY_DIR}/libs-native) - add_subdirectory(${CLR_SRC_NATIVE_DIR}/corehost corehost) - add_dependencies(runtime browserhost) - endif() endif() #------------------------- @@ -96,6 +86,13 @@ endif() #------------------------------- if(NOT CLR_CROSS_COMPONENTS_BUILD) set(STATIC_LIBS_ONLY 1) + if(CLR_CMAKE_TARGET_BROWSER) + # WASM-TODO set GEN_PINVOKE to 1 once we generate them. static entrypoint.c prevents C linker from trimming, when IL trimming trims PInvokes + set(GEN_PINVOKE 0) + set(BUILD_LIBS_NATIVE_BROWSER 1) + set(STATIC_LIB_DESTINATION ${CMAKE_BINARY_DIR}/libs-native) + set(CORERUN_LIBS_ONLY 1) + endif() add_subdirectory(${CLR_SRC_NATIVE_DIR}/libs libs-native) endif() diff --git a/src/native/corehost/browserhost/CMakeLists.txt b/src/native/corehost/browserhost/CMakeLists.txt index 8fc4ee3ea0fa04..5f79d7d92a8eff 100644 --- a/src/native/corehost/browserhost/CMakeLists.txt +++ b/src/native/corehost/browserhost/CMakeLists.txt @@ -32,8 +32,6 @@ 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 @@ -53,30 +51,44 @@ add_executable(browserhost ${BROWSERHOST_SOURCES}) set_target_properties(browserhost PROPERTIES OUTPUT_NAME dotnet.native) set(CMAKE_EXECUTABLE_SUFFIX ".js") + + +set(SHARED_LIB_DESTINATION + ${CLR_ARTIFACTS_BIN_DIR}/native/net${CMAKE_NET_CORE_APP_CURRENT_VERSION}-browser-${CMAKE_BUILD_LIBRARIES_CONFIGURATION}-wasm/sharedFramework) +set(SHARED_CLR_DESTINATION + ${CLR_ARTIFACTS_BIN_DIR}/coreclr/browser.wasm.${CMAKE_BUILD_RUNTIME_CONFIGURATION}/sharedFramework) + +# these dependencies assume that you built `libs.native+clr.runtime` subsets first LIST(APPEND NATIVE_LIBS - hostmisc - clrinterpreter - coreclr_static - System.Native.Browser-Static - System.Runtime.InteropServices.JavaScript.Native-Static - System.Native-Static - System.Globalization.Native-Static - System.IO.Compression.Native-Static - nativeresourcestring - gcinfo + ${SHARED_CLR_DESTINATION}/libcoreclr_static.a + ${SHARED_CLR_DESTINATION}/libclrinterpreter.a + ${SHARED_CLR_DESTINATION}/libnativeresourcestring.a + ${SHARED_CLR_DESTINATION}/libgcinfo_unix_wasm.a + ${SHARED_CLR_DESTINATION}/libcoreclrminipal.a + ${SHARED_CLR_DESTINATION}/libcoreclrpal.a + ${SHARED_CLR_DESTINATION}/libminipal.a + ${SHARED_LIB_DESTINATION}/libSystem.Native.Browser.a + ${SHARED_LIB_DESTINATION}/libSystem.Runtime.InteropServices.JavaScript.Native.a + ${SHARED_LIB_DESTINATION}/libSystem.Native.a + ${SHARED_LIB_DESTINATION}/libSystem.Globalization.Native.a + ${CMAKE_ICU_DIR}/lib/libicuuc.a + ${CMAKE_ICU_DIR}/lib/libicui18n.a + ${CMAKE_ICU_DIR}/lib/libicudata.a + ${SHARED_LIB_DESTINATION}/libSystem.IO.Compression.Native.a + ${SHARED_LIB_DESTINATION}/libz.a # WASM-TODO respect $(InvariantTimezone) - # System.Native.TimeZoneData.Invariant - System.Native.TimeZoneData + # libSystem.Native.TimeZoneData.Invariant.a + ${SHARED_LIB_DESTINATION}/libSystem.Native.TimeZoneData.a ) set(JS_SYSTEM_NATIVE_BROWSER - "${STATIC_LIB_DESTINATION}/libSystem.Native.Browser.js") + "${SHARED_LIB_DESTINATION}/libSystem.Native.Browser.js") set(JS_SYSTEM_BROWSER_UTILS - "${STATIC_LIB_DESTINATION}/libSystem.Browser.Utils.js") + "${SHARED_LIB_DESTINATION}/libSystem.Browser.Utils.js") set(JS_SYSTEM_RUNTIME_INTEROPSERVICES_JAVASCRIPT_NATIVE - "${STATIC_LIB_DESTINATION}/libSystem.Runtime.InteropServices.JavaScript.Native.js") + "${SHARED_LIB_DESTINATION}/libSystem.Runtime.InteropServices.JavaScript.Native.js") set(JS_BROWSER_HOST - "${STATIC_LIB_DESTINATION}/libBrowserHost.js") + "${SHARED_LIB_DESTINATION}/libBrowserHost.js") set(JS_SYSTEM_NATIVE_BROWSER_EXPOST "${CMAKE_CURRENT_SOURCE_DIR}/../../libs/System.Native.Browser/libSystem.Native.Browser.extpost.js") @@ -130,7 +142,8 @@ target_link_libraries(browserhost PRIVATE ) install(TARGETS browserhost DESTINATION corehost COMPONENT runtime) +install(TARGETS browserhost DESTINATION sharedFramework 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) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dotnet.native.wasm DESTINATION sharedFramework COMPONENT runtime) add_subdirectory(sample) diff --git a/src/native/corehost/browserhost/sample/CMakeLists.txt b/src/native/corehost/browserhost/sample/CMakeLists.txt index 6699740c7dcda2..f4fd154250aa62 100644 --- a/src/native/corehost/browserhost/sample/CMakeLists.txt +++ b/src/native/corehost/browserhost/sample/CMakeLists.txt @@ -8,11 +8,11 @@ set(SAMPLE_ASSETS index.html main.mjs dotnet.boot.js - ${STATIC_LIB_DESTINATION}/dotnet.js - ${STATIC_LIB_DESTINATION}/dotnet.js.map - ${STATIC_LIB_DESTINATION}/dotnet.d.ts - ${STATIC_LIB_DESTINATION}/dotnet.runtime.js - ${STATIC_LIB_DESTINATION}/dotnet.runtime.js.map + ${SHARED_LIB_DESTINATION}/dotnet.js + ${SHARED_LIB_DESTINATION}/dotnet.js.map + ${SHARED_LIB_DESTINATION}/dotnet.d.ts + ${SHARED_LIB_DESTINATION}/dotnet.runtime.js + ${SHARED_LIB_DESTINATION}/dotnet.runtime.js.map # Bring your own DLLs and update the dotnet.boot.js to match # HelloWorld.dll diff --git a/src/native/libs/CMakeLists.txt b/src/native/libs/CMakeLists.txt index 49b5607a62b58c..f048d8a777136a 100644 --- a/src/native/libs/CMakeLists.txt +++ b/src/native/libs/CMakeLists.txt @@ -113,12 +113,16 @@ else () add_subdirectory(System.Globalization.Native) endif () -add_subdirectory(System.IO.Compression.Native) +if (NOT CORERUN_LIBS_ONLY) + add_subdirectory(System.IO.Compression.Native) +endif () # Only when Browser for CoreCLR if (CLR_CMAKE_TARGET_BROWSER AND BUILD_LIBS_NATIVE_BROWSER) add_subdirectory(System.Native.Browser) - add_subdirectory(System.Runtime.InteropServices.JavaScript.Native) + if (NOT CORERUN_LIBS_ONLY) + add_subdirectory(System.Runtime.InteropServices.JavaScript.Native) + endif () endif () if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) diff --git a/src/native/libs/Common/JavaScript/CMakeLists.txt b/src/native/libs/Common/JavaScript/CMakeLists.txt index 77d4364ab06eb4..6f67600771e4ff 100644 --- a/src/native/libs/Common/JavaScript/CMakeLists.txt +++ b/src/native/libs/Common/JavaScript/CMakeLists.txt @@ -124,4 +124,5 @@ add_custom_target(System.Native.Browser-NpmInstall DEPENDS ${NPM_INSTALL_OUTPUTS} ) -install(FILES ${ROLLUP_OUTPUTS} DESTINATION sharedFramework COMPONENT runtime) \ No newline at end of file +install(FILES ${ROLLUP_OUTPUTS} DESTINATION sharedFramework COMPONENT runtime) +install(FILES "${CLR_SRC_NATIVE_DIR}/package.json" DESTINATION sharedFramework COMPONENT runtime) \ No newline at end of file diff --git a/src/native/libs/System.Native/CMakeLists.txt b/src/native/libs/System.Native/CMakeLists.txt index 9d6f97151df386..31f9c21b3f73e7 100644 --- a/src/native/libs/System.Native/CMakeLists.txt +++ b/src/native/libs/System.Native/CMakeLists.txt @@ -159,6 +159,7 @@ if (CLR_CMAKE_TARGET_ARCH_WASM AND DEFINED CMAKE_TZD_DIR) configure_file(pal_datetime_time_zone_data-config.h.in inc/pal_datetime_time_zone_data-config.h) add_library(System.Native.TimeZoneData STATIC pal_datetime_time_zone_data.c) + add_dependencies(System.Native-Static System.Native.TimeZoneData) target_compile_options(System.Native.TimeZoneData PRIVATE -Wno-overlength-strings) target_compile_definitions(System.Native.TimeZoneData PRIVATE TZ_DATA_ENABLED) target_include_directories(System.Native.TimeZoneData PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/inc") @@ -167,6 +168,7 @@ if (CLR_CMAKE_TARGET_ARCH_WASM AND DEFINED CMAKE_TZD_DIR) # Also add a stub to support InvariantTimezone. add_library(System.Native.TimeZoneData.Invariant STATIC pal_datetime_time_zone_data.c) + add_dependencies(System.Native-Static System.Native.TimeZoneData.Invariant) install(TARGETS System.Native.TimeZoneData.Invariant DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) install(TARGETS System.Native.TimeZoneData.Invariant DESTINATION sharedFramework COMPONENT runtime) endif ()