-
Notifications
You must be signed in to change notification settings - Fork 1
/
GSECommon.props
120 lines (120 loc) · 7.04 KB
/
GSECommon.props
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<Project>
<PropertyGroup>
<!-- We want to use .NET 9 in general due to added platform supported (x86 on Windows, ARM on Linux/Android) -->
<!-- However, we still use .NET 8 on macOS, due to the effective minimum version being bumped from 10.15 to 12 -->
<!-- However, to do this, we need to define .NET 8 as the default, so restore on macOS doesn't try to use .NET 9 -->
<!-- Since restore will not end up hitting the GSE_OSX condition, it will just use the TargetFramework specified here -->
<TargetFramework>net8.0</TargetFramework>
<!-- Don't use C# 13, as we're still using .NET 8.0 on macOS -->
<LangVersion>12.0</LangVersion>
<Platforms>x64;ARM64;x86;ARM</Platforms>
<!-- linux-bionic-arm is not present to avoid some kind of compilation bug with local builds -->
<RuntimeIdentifiers Condition="'$(RuntimeIdentifier)' == ''">win-x64;win-arm64;win-x86;osx-x64;osx-arm64;linux-x64;linux-arm64;linux-arm;linux-bionic-x64;linux-bionic-arm64</RuntimeIdentifiers>
<AnalysisLevel>8</AnalysisLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<Features>strict</Features>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>disable</Nullable>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>full</TrimMode>
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
<ILLinkTreatWarningsAsErrors>true</ILLinkTreatWarningsAsErrors>
<InvariantGlobalization>true</InvariantGlobalization>
<IsAotCompatible>true</IsAotCompatible>
<PublishAot>true</PublishAot>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup>
<GSE_PUBLISH Condition="'$(_IsPublishing)' == 'true'">true</GSE_PUBLISH>
<IsWindowsHost>$([MSBuild]::IsOSPlatform('Windows'))</IsWindowsHost>
<IsOSXHost>$([MSBuild]::IsOSPlatform('OSX'))</IsOSXHost>
<IsLinuxHost>$([MSBuild]::IsOSPlatform('Linux'))</IsLinuxHost>
</PropertyGroup>
<PropertyGroup Condition="'$(GSE_PUBLISH)' == 'true'">
<!-- Use RID to compute the OS if we're publishing -->
<GSE_WINDOWS>$(RuntimeIdentifier.ToLowerInvariant().StartsWith('win-'))</GSE_WINDOWS>
<GSE_OSX>$(RuntimeIdentifier.ToLowerInvariant().StartsWith('osx-'))</GSE_OSX>
<!-- .NET NativeAOT on Android uses linux-bionic-* rather than android-* RIDs -->
<GSE_ANDROID>$(RuntimeIdentifier.ToLowerInvariant().StartsWith('linux-bionic-'))</GSE_ANDROID>
<GSE_LINUX Condition="'$(GSE_ANDROID)' != 'true'">$(RuntimeIdentifier.ToLowerInvariant().StartsWith('linux-'))</GSE_LINUX>
</PropertyGroup>
<PropertyGroup Condition="'$(GSE_PUBLISH)' != 'true'">
<!-- Make sure we compute the correct platform if we're not publishing (i.e. local build) -->
<GSE_WINDOWS>$(IsWindowsHost)</GSE_WINDOWS>
<GSE_OSX>$(IsOSXHost)</GSE_OSX>
<GSE_LINUX>$(IsLinuxHost)</GSE_LINUX>
</PropertyGroup>
<PropertyGroup>
<!-- Try to use RID to identify the target architecture -->
<GSE_X64>$(RuntimeIdentifier.ToLowerInvariant().EndsWith('-x64'))</GSE_X64>
<GSE_ARM64>$(RuntimeIdentifier.ToLowerInvariant().EndsWith('-arm64'))</GSE_ARM64>
<GSE_X86>$(RuntimeIdentifier.ToLowerInvariant().EndsWith('-x86'))</GSE_X86>
<GSE_ARM>$(RuntimeIdentifier.ToLowerInvariant().EndsWith('-arm'))</GSE_ARM>
<!-- Use the selected platform otherwise -->
<GSE_X64 Condition="'$(RuntimeIdentifier)' == '' And '$(Platform)' == 'x64'">true</GSE_X64>
<GSE_ARM64 Condition="'$(RuntimeIdentifier)' == '' And '$(Platform)' == 'ARM64'">true</GSE_ARM64>
<GSE_X86 Condition="'$(RuntimeIdentifier)' == '' And '$(Platform)' == 'x86'">true</GSE_X86>
<GSE_ARM Condition="'$(RuntimeIdentifier)' == '' And '$(Platform)' == 'ARM'">true</GSE_ARM>
</PropertyGroup>
<PropertyGroup Condition="'$(GSE_X64)' == 'true' Or '$(GSE_ARM64)' == 'true'">
<PlatformTarget Condition="'$(GSE_X64)' == 'true'">x64</PlatformTarget>
<PlatformTarget Condition="'$(GSE_ARM64)' == 'true'">ARM64</PlatformTarget>
<DefineConstants>$(DefineConstants);GSE_64BIT</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(GSE_X86)' == 'true' Or '$(GSE_ARM)' == 'true'">
<PlatformTarget Condition="'$(GSE_X86)' == 'true'">x86</PlatformTarget>
<PlatformTarget Condition="'$(GSE_ARM)' == 'true'">ARM</PlatformTarget>
<DefineConstants>$(DefineConstants);GSE_32BIT</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(GSE_PUBLISH)' == 'true'">
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<DefineConstants>$(DefineConstants);GSE_PUBLISH</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(GSE_WINDOWS)' == 'true'">
<GSE_LIB_PREFIX></GSE_LIB_PREFIX>
<GSE_LIB_EXT Condition="'$(GSE_PUBLISH)' == 'true'">.lib</GSE_LIB_EXT>
<GSE_LIB_EXT Condition="'$(GSE_PUBLISH)' != 'true'">.dll</GSE_LIB_EXT>
<GSE_RID Condition="'$(GSE_X64)' == 'true'">win-x64</GSE_RID>
<GSE_RID Condition="'$(GSE_ARM64)' == 'true'">win-arm64</GSE_RID>
<GSE_RID Condition="'$(GSE_X86)' == 'true'">win-x86</GSE_RID>
<!-- We support as far back as Windows 7 SP1 -->
<TargetFramework>net9.0-windows</TargetFramework>
<SupportedOSPlatformVersion>6.1.7601</SupportedOSPlatformVersion>
<DefineConstants>$(DefineConstants);GSE_WINDOWS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(GSE_OSX)' == 'true'">
<GSE_LIB_PREFIX>lib</GSE_LIB_PREFIX>
<GSE_LIB_EXT Condition="'$(GSE_PUBLISH)' == 'true'">.a</GSE_LIB_EXT>
<GSE_LIB_EXT Condition="'$(GSE_PUBLISH)' != 'true'">.dylib</GSE_LIB_EXT>
<GSE_RID Condition="'$(GSE_X64)' == 'true'">osx-x64</GSE_RID>
<GSE_RID Condition="'$(GSE_ARM64)' == 'true'">osx-arm64</GSE_RID>
<!-- We hold back on .NET 9 for macOS, as it bumps the minimum macOS version from 10.15 to 12 -->
<TargetFramework>net8.0</TargetFramework>
<DefineConstants>$(DefineConstants);GSE_OSX</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(GSE_LINUX)' == 'true'">
<GSE_LIB_PREFIX>lib</GSE_LIB_PREFIX>
<GSE_LIB_EXT Condition="'$(GSE_PUBLISH)' == 'true'">.a</GSE_LIB_EXT>
<GSE_LIB_EXT Condition="'$(GSE_PUBLISH)' != 'true'">.so</GSE_LIB_EXT>
<GSE_RID Condition="'$(GSE_X64)' == 'true'">linux-x64</GSE_RID>
<GSE_RID Condition="'$(GSE_ARM64)' == 'true'">linux-arm64</GSE_RID>
<GSE_RID Condition="'$(GSE_ARM)' == 'true'">linux-arm</GSE_RID>
<TargetFramework>net9.0</TargetFramework>
<DefineConstants>$(DefineConstants);GSE_LINUX</DefineConstants>
</PropertyGroup>
<!-- We must be publishing for Android -->
<PropertyGroup Condition="'$(GSE_ANDROID)' == 'true' And '$(GSE_PUBLISH)' == 'true'">
<GSE_LIB_PREFIX>lib</GSE_LIB_PREFIX>
<GSE_LIB_EXT>.so</GSE_LIB_EXT>
<GSE_RID Condition="'$(GSE_X64)' == 'true'">linux-bionic-x64</GSE_RID>
<GSE_RID Condition="'$(GSE_ARM64)' == 'true'">linux-bionic-arm64</GSE_RID>
<GSE_RID Condition="'$(GSE_ARM)' == 'true'">linux-bionic-arm</GSE_RID>
<TargetFramework>net9.0</TargetFramework>
<DefineConstants>$(DefineConstants);GSE_ANDROID</DefineConstants>
</PropertyGroup>
<!-- https://github.com/dotnet/runtime/issues/92272 -->
<ItemGroup Condition="'$(GSE_ANDROID)' == 'true'">
<LinkerArg Include="-Wl,--undefined-version" />
</ItemGroup>
</Project>