-
Notifications
You must be signed in to change notification settings - Fork 109
/
CMakeLists_Apple.cmake
222 lines (222 loc) · 12.1 KB
/
CMakeLists_Apple.cmake
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
if(APPLE_15_00_X)
# set(OSXMINVER "15.00" CACHE STRING "OSX 15.00")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.sdk")
endif()
endif()
endif()
if(APPLE_14_00_X)
# set(OSXMINVER "14.00" CACHE STRING "OSX 14.00")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk")
endif()
endif()
endif()
if(APPLE_13_00_X)
# set(OSXMINVER "13.00" CACHE STRING "OSX 13.00")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk")
endif()
endif()
endif()
if(APPLE_12_00_X)
# set(OSXMINVER "12.00" CACHE STRING "OSX 12.00")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.2.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.2.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk")
endif()
endif()
endif()
if(APPLE_11_00_X)
set(OSXMINVER "11.00" CACHE STRING "OSX 11.00")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk")
endif()
endif()
endif()
if(APPLE_10_15_X)
set(OSXMINVER "10.15" CACHE STRING "OSX 10.15")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk")
endif()
endif()
endif()
if(APPLE_10_14_X)
set(OSXMINVER "10.14" CACHE STRING "OSX 10.14")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk")
endif()
endif()
endif()
if(APPLE_10_13_X)
set(OSXMINVER "10.13" CACHE STRING "OSX 10.13")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk")
endif()
endif()
endif()
if(APPLE_10_12_X)
set(OSXMINVER "10.12" CACHE STRING "OSX 10.12")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk")
endif()
endif()
endif()
if(APPLE_10_11_X)
set(OSXMINVER "10.11" CACHE STRING "OSX 10.11")
if (WANT_OSX_SDK)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk")
endif()
endif()
if(APPLE_10_10_X)
set(OSXMINVER "10.10" CACHE STRING "OSX 10.10")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk")
endif()
endif()
endif()
if(APPLE_10_9_X)
set(OSXMINVER "10.9" CACHE STRING "OSX 10.9")
if (WANT_OSX_SDK)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk")
endif()
endif()
if(APPLE_10_8_X)
set(OSXMINVER "10.8" CACHE STRING "OSX 10.8")
if (WANT_OSX_SDK)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk")
endif()
endif()
if(APPLE_10_7_X)
set(OSXMINVER "10.7" CACHE STRING "OSX 10.7")
if (WANT_OSX_SDK)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk")
endif()
endif()
if(APPLE_10_6_X)
set(OSXMINVER "10.6" CACHE STRING "OSX 10.6")
if (WANT_OSX_SDK)
set(CMAKE_OSX_SYSROOT "/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk")
endif()
endif()
if(APPLE_10_5_X)
set(OSXMINVER "10.5" CACHE STRING "OSX 10.5")
if (WANT_OSX_SDK)
set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk")
endif()
endif()
if(APPLE_10_4_X)
set(OSXMINVER "10.4" CACHE STRING "OSX 10.4")
if (WANT_OSX_SDK)
set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk")
endif()
endif()
# gcc/mac
if(WANT_UNIVERSAL_BUNDLE)
if (WANT_PPC_I386_BUNDLE)
message(STATUS "Setting Universal (PPC/i386) Architecture for OSX Build/Bundle")
set(CMAKE_OSX_ARCHITECTURES "ppc;i386" )
set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc;i386" )
if (WANT_OSX_SDK)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.4")
endif()
else()
message(STATUS "Setting Universal (ARM/x64_64) Architecture for OSX Build/Bundle")
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" )
set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "arm64;x86_64" )
if (WANT_OSX_SDK)
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0")
endif()
endif()
else()
if(ARCH_PPC OR ARCH_PPC_64)
message(STATUS "Setting PPC Architecture for OSX Build/Bundle")
set(CMAKE_OSX_ARCHITECTURES "ppc" )
set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc" )
elseif(ARCH_ARM_64)
message(STATUS "Setting ARM64 Architecture for OSX Build/Bundle")
set(CMAKE_OSX_ARCHITECTURES "arm64" )
set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "arm64" )
if (WANT_OSX_SDK)
set(CMAKE_OSX_DEPLOYMENT_TARGET "${OSXMINVER}")
endif()
else()
if (WANT_OSX_SDK)
set(CMAKE_OSX_DEPLOYMENT_TARGET "${OSXMINVER}")
endif()
if(APPLE_OS_VERSION GREATER 9)
message(STATUS "Setting x86_64 Architecture for OSX Build/Bundle")
set(CMAKE_OSX_ARCHITECTURES "x86_64" )
set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "x86_64" )
else()
message(STATUS "Setting i386 Architecture for OSX Build/Bundle")
set(CMAKE_OSX_ARCHITECTURES "i386" )
set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "i386" )
endif()
endif()
endif()
message(STATUS "Apple Architecture: ${CMAKE_OSX_ARCHITECTURES}")
message(STATUS "Apple SDK: ${CMAKE_OSX_SYSROOT}")
set(ENV{MACOSX_DEPLOYMENT_TARGET} ${OSXMINVER} )
set(ENV{LD_PREBIND} 1 )
set(ENV{LD_PREBIND_ALLOW_OVERLAP} 1 )
if (WANT_DEBUG)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
endif()
if (WANT_RELEASEWITHDEBUG)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O2 -g -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
endif()
if (NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
endif()