Skip to content

Commit 24e9212

Browse files
authored
Set CMAKE_OSX_DEPLOYMENT_TARGET for all Mono AOT compilers on macOS (#57507)
* Set CMAKE_OSX_DEPLOYMENT_TARGET for all Mono AOT compilers on macOS Not just if we're targetting iOS/tvOS/macOS since the AOT compiler for WASM or Android can run on macOS too. Fixes #57431 * Use RealTargetOS if it's available
1 parent 380cfc9 commit 24e9212

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/mono/mono.proj

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@
532532
<!-- Build AOT cross compiler (if available) -->
533533
<Target Name="BuildMonoCross" Condition="'$(BuildMonoAOTCrossCompiler)' == 'true'" DependsOnTargets="BuildMonoRuntime">
534534

535-
<!-- iOS specific options -->
535+
<!-- iOS/tvOS specific options -->
536536
<PropertyGroup Condition="'$(TargetstvOS)' == 'true' or '$(TargetsiOS)' == 'true'">
537537
<!-- FIXME: Disable for simulator -->
538538
<MonoUseCrossTool>true</MonoUseCrossTool>
@@ -546,24 +546,32 @@
546546
<MonoAotAbi Condition="'$(Platform)' == 'x86'">i386-apple-darwin10</MonoAotAbi>
547547
<MonoAotAbi Condition="'$(Platform)' == 'x64'">x86_64-apple-darwin10</MonoAotAbi>
548548
</PropertyGroup>
549+
550+
<!-- Catalyst specific options -->
549551
<PropertyGroup Condition="'$(TargetsMacCatalyst)' == 'true'">
550552
<MonoUseCrossTool>true</MonoUseCrossTool>
551553
<MonoAotCMakeSysroot Condition="'$(TargetsMacCatalyst)' == 'true'">$(XcodeDir)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk</MonoAotCMakeSysroot>
552554
<MonoAotOffsetsFile>$(MonoObjCrossDir)offsets-$(Platform)-darwin.h</MonoAotOffsetsFile>
553555
<MonoAotAbi Condition="'$(Platform)' == 'arm64'">aarch64-apple-maccatalyst</MonoAotAbi>
554556
<MonoAotAbi Condition="'$(Platform)' == 'x64'">x86_64-apple-maccatalyst</MonoAotAbi>
555557
</PropertyGroup>
556-
<ItemGroup Condition="'$(TargetstvOS)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetsMacCatalyst)' == 'true'">
557-
<MonoAOTCMakeArgs Include="-DCMAKE_OSX_DEPLOYMENT_TARGET=$(macOSVersionMin)" />
558-
</ItemGroup>
559558

559+
<!-- Linux specific options -->
560+
<ItemGroup Condition="'$(RealTargetOS)' == 'Linux' or $([MSBuild]::IsOSPlatform('Linux'))">
561+
<_LibClang Include="$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib64/libclang.so.*"/>
562+
</ItemGroup>
560563
<PropertyGroup Condition="'$(TargetOS)' == 'Linux' and '$(Platform)' == 'arm64'">
561564
<MonoUseCrossTool>true</MonoUseCrossTool>
562565
<MonoAotAbi>aarch64-linux-gnu</MonoAotAbi>
563566
<MonoAotOffsetsFile>$(MonoObjCrossDir)offsets-aarch-linux-gnu.h</MonoAotOffsetsFile>
564567
<MonoAotOffsetsPrefix>$(MonoCrossDir)/usr/lib/gcc/aarch64-linux-gnu/5</MonoAotOffsetsPrefix>
565568
</PropertyGroup>
566569

570+
<!-- macOS host specific options -->
571+
<ItemGroup Condition="'$(RealTargetOS)' == 'OSX' or $([MSBuild]::IsOSPlatform('OSX'))">
572+
<MonoAOTCMakeArgs Include="-DCMAKE_OSX_DEPLOYMENT_TARGET=$(macOSVersionMin)" />
573+
</ItemGroup>
574+
567575
<!-- WASM specific options -->
568576
<PropertyGroup Condition="'$(TargetsBrowser)' == 'true'">
569577
<MonoUseCrossTool>true</MonoUseCrossTool>
@@ -577,7 +585,7 @@
577585
</PropertyGroup>
578586

579587
<!-- Windows specific options -->
580-
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
588+
<ItemGroup Condition="'$(RealTargetOS)' == 'Windows' or $([MSBuild]::IsOSPlatform('Windows'))">
581589
<_MonoAOTCPPFLAGS Include="-DHOST_WIN32" />
582590
<_MonoAOTCPPFLAGS Include="-D__WIN32__" />
583591
<_MonoAOTCPPFLAGS Include="-DWIN32" />
@@ -624,10 +632,6 @@
624632
<MonoAotOffsetsFile>$(MonoObjDir)cross/offsets-$(Platform)-android.h</MonoAotOffsetsFile>
625633
</PropertyGroup>
626634

627-
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
628-
<_LibClang Include="$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib64/libclang.so.*"/>
629-
</ItemGroup>
630-
631635
<PropertyGroup>
632636
<MonoLibClang Condition="$([MSBuild]::IsOSPlatform('OSX')) and '$(MonoLibClang)' == ''">$(XcodeDir)/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib</MonoLibClang>
633637
<MonoLibClang Condition="$([MSBuild]::IsOSPlatform('Linux')) and '$(MonoLibClang)' == ''">@(_LibClang)</MonoLibClang>

0 commit comments

Comments
 (0)