diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index 01a0c6aac679ae..fb05c25a395a16 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -109,6 +109,8 @@ true + + diff --git a/eng/pipelines/common/global-build-job.yml b/eng/pipelines/common/global-build-job.yml index 96c116eb872722..84f1786bd2171d 100644 --- a/eng/pipelines/common/global-build-job.yml +++ b/eng/pipelines/common/global-build-job.yml @@ -83,6 +83,12 @@ jobs: ${{ if ne(parameters.isOfficialBuild, true) }}: value: '' + - name: _buildDarwinFrameworksParameter + ${{ if in(parameters.osGroup, 'iOS', 'tvOS', 'MacCatalyst')}}: + value: /p:BuildDarwinFrameworks=true + ${{ if notin(parameters.osGroup, 'iOS', 'tvOS', 'MacCatalyst')}}: + value: '' + - name: _richCodeNavigationParam ${{ if eq(parameters.enableRichCodeNavigation, true) }}: value: /p:EnableRichCodeNavigation=true @@ -134,7 +140,7 @@ jobs: displayName: Install native dependencies # Build - - script: $(_sclEnableCommand) $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci -arch ${{ parameters.archType }} $(_osParameter) ${{ parameters.buildArgs }} $(_officialBuildParameter) $(_crossBuildPropertyArg) $(_cxx11Parameter) $(_richCodeNavigationParam) + - script: $(_sclEnableCommand) $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci -arch ${{ parameters.archType }} $(_osParameter) ${{ parameters.buildArgs }} $(_officialBuildParameter) $(_crossBuildPropertyArg) $(_cxx11Parameter) $(_richCodeNavigationParam) $(_buildDarwinFrameworksParameter) displayName: Build product ${{ if eq(parameters.useContinueOnErrorDuringBuild, true) }}: continueOnError: ${{ parameters.shouldContinueOnError }} diff --git a/eng/pipelines/mono/templates/build-job.yml b/eng/pipelines/mono/templates/build-job.yml index ef9af237168b70..bdb15a09a665e5 100644 --- a/eng/pipelines/mono/templates/build-job.yml +++ b/eng/pipelines/mono/templates/build-job.yml @@ -63,6 +63,8 @@ jobs: value: '' - name: msCorDbi value: '+mono.mscordbi' + - name: darwinFrameworks + value: '' - ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}: - name: officialBuildIdArg value: '/p:officialBuildId=$(Build.BuildNumber)' @@ -76,15 +78,23 @@ jobs: - ${{ if eq(parameters.osGroup, 'tvOS') }}: - name: osOverride value: -os tvOS + - name: darwinFrameworks + value: /p:BuildDarwinFrameworks=true - ${{ if eq(parameters.osGroup, 'tvOSSimulator') }}: - name: osOverride value: -os tvOSSimulator + - name: darwinFrameworks + value: /p:BuildDarwinFrameworks=true - ${{ if eq(parameters.osGroup, 'iOS') }}: - name: osOverride value: -os iOS + - name: darwinFrameworks + value: /p:BuildDarwinFrameworks=true - ${{ if eq(parameters.osGroup, 'iOSSimulator') }}: - name: osOverride value: -os iOSSimulator + - name: darwinFrameworks + value: /p:BuildDarwinFrameworks=true - ${{ if eq(parameters.osGroup, 'Android') }}: - name: osOverride value: -os Android @@ -136,7 +146,7 @@ jobs: # Build - ${{ if ne(parameters.osGroup, 'windows') }}: - - script: ./build$(scriptExt) -subset mono$(msCorDbi) -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(aotCrossParameter) $(llvmParameter) + - script: ./build$(scriptExt) -subset mono$(msCorDbi) -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(aotCrossParameter) $(llvmParameter) $(darwinFrameworks) displayName: Build product - ${{ if eq(parameters.osGroup, 'windows') }}: - script: build$(scriptExt) -subset mono$(msCorDbi) -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(aotCrossParameter) $(llvmParameter) diff --git a/eng/pipelines/runtime-staging.yml b/eng/pipelines/runtime-staging.yml index 666641354bf5a6..f58caca2899de2 100644 --- a/eng/pipelines/runtime-staging.yml +++ b/eng/pipelines/runtime-staging.yml @@ -119,7 +119,7 @@ jobs: jobParameters: testGroup: innerloop nameSuffix: AllSubsets_Mono - buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunAOTCompilation=true /p:MonoForceInterpreter=true + buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunAOTCompilation=true /p:MonoForceInterpreter=true /p:BuildDarwinFrameworks=true timeoutInMinutes: 180 condition: >- or( diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props index 4eea2cf850fa0a..28ac4374be2ae2 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props @@ -70,6 +70,18 @@ runtimes/$(RuntimeIdentifier)/native/include/%(RecursiveDir) + + runtimes/$(RuntimeIdentifier)/native/Mono.release.framework/%(RecursiveDir) + + + + runtimes/$(RuntimeIdentifier)/native/Mono.debug.framework/%(RecursiveDir) + + diff --git a/src/mono/mono.proj b/src/mono/mono.proj index c26eb9f4e2e545..cc9fc41b546290 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -198,6 +198,7 @@ <_MonoCMakeArgs Include="-DCMAKE_BUILD_TYPE=$(Configuration)"/> <_MonoCMakeArgs Condition="'$(CMakeArgs)' != ''" Include="$(CMakeArgs)"/> <_MonoCMakeArgs Condition="'$(MonoEnableLLVM)' == 'true'" Include="-DLLVM_PREFIX=$(MonoLLVMDir.TrimEnd('\/'))" /> + <_MonoCMakeArgs Condition="'$(BuildDarwinFrameworks)' == 'true'" Include="-DBUILD_DARWIN_FRAMEWORKS=1" /> <_MonoCMakeArgs Include="-DGC_SUSPEND=$(MonoThreadSuspend)" /> <_MonoCMakeArgs Include="-DMONO_LIB_NAME=$(MonoLibName)" /> <_MonoCMakeArgs Include="-DMONO_SHARED_LIB_NAME=$(MonoSharedLibName)" /> @@ -508,6 +509,7 @@ + @@ -773,6 +775,42 @@ $(RuntimeBinDir)cross\$(PackageRID)\opt$(ExeExt) <_MonoIncludeArtifacts Include="$(MonoObjDir)out\include\**" /> + <_MonoRuntimeArtifacts Condition="'$(MonoComponentsStatic)' != 'true' and Exists('$(MonoObjDir)out\lib\Mono.release.framework')" Include="@(_MonoRuntimeComponentsSharedFilePath)"> + $(RuntimeBinDir)\Mono.release.framework\%(_MonoRuntimeComponentsSharedFilePath.Filename)%(_MonoRuntimeComponentsSharedFilePath.Extension) + + <_MonoRuntimeArtifacts Condition="Exists('$(MonoObjDir)out\lib\Mono.release.framework') and !Exists('$(MonoObjDir)out\lib\Mono.release.framework\Versions')" Include="$(MonoObjDir)out\lib\Mono.release.framework\Mono.release"> + $(RuntimeBinDir)\Mono.release.framework\Mono + + <_MonoRuntimeArtifacts Condition="Exists('$(MonoObjDir)out\lib\Mono.release.framework') and Exists('$(MonoObjDir)out\lib\Mono.release.framework\Versions')" Include="$(MonoObjDir)out\lib\Mono.release.framework\Versions\Current\Mono.release"> + $(RuntimeBinDir)\Mono.release.framework\Mono + + <_MonoRuntimeArtifacts Condition="Exists('$(MonoObjDir)out\lib\Mono.release.framework')" Include="$(MonoObjDir)out\lib\Mono.release.framework\Mono.release.dwarf"> + $(RuntimeBinDir)\Mono.release.framework\Mono.dwarf + + <_MonoRuntimeArtifacts Condition="'$(MonoComponentsStatic)' != 'true' and Exists('$(MonoObjDir)out\lib\Mono.debug.framework')" Include="@(_MonoRuntimeComponentsSharedFilePath)"> + $(RuntimeBinDir)\Mono.debug.framework\%(_MonoRuntimeComponentsSharedFilePath.Filename)%(_MonoRuntimeComponentsSharedFilePath.Extension) + + <_MonoRuntimeArtifacts Condition="Exists('$(MonoObjDir)out\lib\Mono.debug.framework') and !Exists('$(MonoObjDir)out\lib\Mono.debug.framework\Versions')" Include="$(MonoObjDir)out\lib\Mono.debug.framework\Mono.debug"> + $(RuntimeBinDir)\Mono.debug.framework\Mono + + <_MonoRuntimeArtifacts Condition="Exists('$(MonoObjDir)out\lib\Mono.debug.framework') and Exists('$(MonoObjDir)out\lib\Mono.debug.framework\Versions')" Include="$(MonoObjDir)out\lib\Mono.debug.framework\Versions\Current\Mono.debug"> + $(RuntimeBinDir)\Mono.debug.framework\Mono + + <_MonoRuntimeArtifacts Condition="Exists('$(MonoObjDir)out\lib\Mono.debug.framework')" Include="$(MonoObjDir)out\lib\Mono.debug.framework\Mono.debug.dwarf"> + $(RuntimeBinDir)\Mono.debug.framework\Mono.dwarf + + <_MonoRuntimeArtifacts Condition="Exists('$(MonoObjDir)out\lib\Mono.release.framework') and !Exists('$(MonoObjDir)out\lib\Mono.release.framework\Versions')" Include="$(MonoObjDir)out\lib\Mono.release.framework\Info.plist"> + $(RuntimeBinDir)\Mono.release.framework\Info.plist + + <_MonoRuntimeArtifacts Condition="Exists('$(MonoObjDir)out\lib\Mono.release.framework') and Exists('$(MonoObjDir)out\lib\Mono.release.framework\Versions')" Include="$(MonoObjDir)out\lib\Mono.release.framework\Versions\Current\Resources\Info.plist"> + $(RuntimeBinDir)\Mono.release.framework\Info.plist + + <_MonoRuntimeArtifacts Condition="Exists('$(MonoObjDir)out\lib\Mono.debug.framework') and !Exists('$(MonoObjDir)out\lib\Mono.debug.framework\Versions')" Include="$(MonoObjDir)out\lib\Mono.debug.framework\Info.plist"> + $(RuntimeBinDir)\Mono.debug.framework\Info.plist + + <_MonoRuntimeArtifacts Condition="Exists('$(MonoObjDir)out\lib\Mono.debug.framework') and Exists('$(MonoObjDir)out\lib\Mono.debug.framework\Versions')" Include="$(MonoObjDir)out\lib\Mono.debug.framework\Versions\Current\Resources\Info.plist"> + $(RuntimeBinDir)\Mono.debug.framework\Info.plist + <_MonoRuntimeBuildArtifacts Include="$(MonoObjDir)\build\**" /> <_MonoRuntimeArtifacts Condition="'$(_MonoIncludeInterpStaticFiles)' == 'true'" Include="$(MonoObjDir)out\lib\libmono-ee-interp.a"> $(RuntimeBinDir)libmono-ee-interp.a diff --git a/src/mono/mono/mini/CMakeLists.txt b/src/mono/mono/mini/CMakeLists.txt index c66362a55f395f..841bff5f566cf9 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -381,6 +381,47 @@ if(NOT DISABLE_SHARED_LIBS) add_library(monosgen-shared-dac SHARED "mini-windows-dlldac.c") set_target_properties(monosgen-shared-dac PROPERTIES OUTPUT_NAME ${MONO_SHARED_LIB_NAME}-dac) endif() + + if(BUILD_DARWIN_FRAMEWORKS) + if(TARGET_DARWIN) + # In cmake, you cannot have list entries which contain a space or semicolon - those are considered + # record separators (i.e. a list of list(APPEND foo "a" "b;c" "d e") is a five entry list of values + # a, b, c, d and e. + # So, in order to treat the components lists as single list entries, swap out the ; character + # for a temporary replacement character, allowing the full lists to be treated as single entries + string(REPLACE ";" "*" mono-components-objects-nowhitespace "${mono-components-objects}") + string(REPLACE ";" "*" mono-components-stub-objects-nowhitespace "${mono-components-stub-objects}") + list(APPEND FrameworkConfig Mono.debug Mono.release) + list(APPEND ComponentsObjects "${mono-components-objects-nowhitespace}" "${mono-components-stub-objects-nowhitespace}") + foreach(frameworkconfig componentsobjects IN ZIP_LISTS FrameworkConfig ComponentsObjects) + if("${componentsobjects}" STREQUAL "") + #components list is empty, use stubs instead + set(componentsobjects "${mono-components-stub-objects-nowhitespace}") + endif() + add_library(${frameworkconfig} SHARED $) + target_compile_definitions(${frameworkconfig} PRIVATE -DMONO_DLL_EXPORT) + target_sources(${frameworkconfig} PRIVATE $) + target_link_libraries(${frameworkconfig} PRIVATE ${OS_LIBS} ${ICONV_LIB} ${LLVM_LIBS} ${ICU_LIBS}) + if(ICU_LDFLAGS) + set_property(TARGET ${frameworkconfig} APPEND_STRING PROPERTY LINK_FLAGS " ${ICU_LDFLAGS}") + endif() + if(STATIC_ICU) + set_property(TARGET ${frameworkconfig} APPEND_STRING PROPERTY LINKER_LANGUAGE CXX) + endif () + set_property(TARGET ${frameworkconfig} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-compatibility_version -Wl,2.0 -Wl,-current_version -Wl,2.0") + string(REPLACE "*" ";" componentsobjects-whitespace "${componentsobjects}") + target_sources(${frameworkconfig} PRIVATE "${componentsobjects-whitespace}") + set_target_properties(${frameworkconfig} PROPERTIES + FRAMEWORK TRUE + FRAMEWORK_VERSION C + MACOSX_FRAMEWORK_IDENTIFIER net.dot.mono-framework + ) + install(TARGETS ${frameworkconfig} + FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + endforeach() + endif() + endif() endif() find_package(Python3 COMPONENTS Interpreter)