21
21
logger = logging .getLogger (__name__ if __name__ != '__main__' else 'ymake_conf.py' )
22
22
23
23
24
+ class WindowsVersion (object ):
25
+ """
26
+ Predefined values for _WIN32_WINNT macro.
27
+ This macro specifies minimal Windows version required by the binary being build.
28
+
29
+ A complete list of the values supported by the Windows SDK can be found at
30
+ https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt
31
+ """
32
+ Windows07 = '0x0601'
33
+ Windows08 = '0x0602'
34
+ Windows10 = '0x0A00'
35
+
36
+
37
+ # This is default Android API level unless `-DANDROID_API` is specified in cmdline
38
+ # Android api level can be resolved to Android version using
39
+ # https://android.googlesource.com/platform/bionic/+/master/docs/status.md
40
+ ANDROID_API_DEFAULT = 21
41
+
42
+ # This is default Linux SDK unless `-DOS_SDK` is specified in cmdline
43
+ LINUX_SDK_DEFAULT = "ubuntu-14"
44
+
45
+ MACOS_VERSION_MIN = "11.0"
46
+ IOS_VERSION_MIN = "13.0"
47
+ WINDOWS_VERSION_MIN = WindowsVersion .Windows07
48
+
49
+
24
50
def init_logger (verbose ):
25
51
logging .basicConfig (level = logging .DEBUG if verbose else logging .INFO )
26
52
@@ -129,9 +155,7 @@ def __init__(self, name, os, arch):
129
155
130
156
self .is_android = self .os == 'android'
131
157
if self .is_android :
132
- # This is default Android API level unless `-DANDROID_API` is specified in cmdline
133
- default_android_api = 21
134
- self .android_api = int (preset ('ANDROID_API' , default_android_api ))
158
+ self .android_api = int (preset ('ANDROID_API' , ANDROID_API_DEFAULT ))
135
159
136
160
self .is_cygwin = self .os == 'cygwin'
137
161
self .is_yocto = self .os == 'yocto'
@@ -1073,7 +1097,7 @@ def _default_os_sdk(self):
1073
1097
return 'ubuntu-18'
1074
1098
1075
1099
# Default OS SDK for Linux builds
1076
- return 'ubuntu-14'
1100
+ return LINUX_SDK_DEFAULT
1077
1101
1078
1102
1079
1103
class Toolchain (object ):
@@ -1155,13 +1179,10 @@ def get_os_sdk(target):
1155
1179
for lib_path in build .host .library_path_variables :
1156
1180
self .env .setdefault (lib_path , []).append ('{}/lib' .format (self .tc .name_marker ))
1157
1181
1158
- macos_version_min = '11.0'
1159
- ios_version_min = '13.0'
1160
-
1161
1182
swift_target = select (default = None , selectors = [
1162
- (target .is_iossim and target .is_x86_64 , 'x86_64-apple-ios{}-simulator' .format (ios_version_min )),
1163
- (target .is_iossim and target .is_x86 , 'i386-apple-ios{}-simulator' .format (ios_version_min )),
1164
- (target .is_iossim and target .is_armv8 , 'arm64-apple-ios{}-simulator' .format (ios_version_min )),
1183
+ (target .is_iossim and target .is_x86_64 , 'x86_64-apple-ios{}-simulator' .format (IOS_VERSION_MIN )),
1184
+ (target .is_iossim and target .is_x86 , 'i386-apple-ios{}-simulator' .format (IOS_VERSION_MIN )),
1185
+ (target .is_iossim and target .is_armv8 , 'arm64-apple-ios{}-simulator' .format (IOS_VERSION_MIN )),
1165
1186
(not target .is_iossim and target .is_ios and target .is_armv8 , 'arm64-apple-ios9' ),
1166
1187
(not target .is_iossim and target .is_ios and target .is_armv7 , 'armv7-apple-ios9' ),
1167
1188
])
@@ -1184,11 +1205,11 @@ def get_os_sdk(target):
1184
1205
(target .is_linux and target .is_armv7 and target .armv7_float_abi == 'softfp' , 'armv7-linux-gnueabi' ),
1185
1206
(target .is_linux and target .is_powerpc , 'powerpc64le-linux-gnu' ),
1186
1207
1187
- (target .is_iossim and target .is_x86_64 , 'x86_64-apple-ios{}-simulator' .format (ios_version_min )),
1188
- (target .is_iossim and target .is_x86 , 'i386-apple-ios{}-simulator' .format (ios_version_min )),
1189
- (target .is_iossim and target .is_armv8 , 'arm64-apple-ios{}-simulator' .format (ios_version_min )),
1190
- (not target .is_iossim and target .is_ios and target .is_armv8 , 'arm64-apple-ios{}' .format (ios_version_min )),
1191
- (not target .is_iossim and target .is_ios and target .is_armv7 , 'armv7-apple-ios{}' .format (ios_version_min )),
1208
+ (target .is_iossim and target .is_x86_64 , 'x86_64-apple-ios{}-simulator' .format (IOS_VERSION_MIN )),
1209
+ (target .is_iossim and target .is_x86 , 'i386-apple-ios{}-simulator' .format (IOS_VERSION_MIN )),
1210
+ (target .is_iossim and target .is_armv8 , 'arm64-apple-ios{}-simulator' .format (IOS_VERSION_MIN )),
1211
+ (not target .is_iossim and target .is_ios and target .is_armv8 , 'arm64-apple-ios{}' .format (IOS_VERSION_MIN )),
1212
+ (not target .is_iossim and target .is_ios and target .is_armv7 , 'armv7-apple-ios{}' .format (IOS_VERSION_MIN )),
1192
1213
1193
1214
(target .is_apple and target .is_x86 , 'i386-apple-darwin14' ),
1194
1215
(target .is_apple and target .is_x86_64 , 'x86_64-apple-darwin14' ),
@@ -1266,9 +1287,9 @@ def get_os_sdk(target):
1266
1287
(target .is_linux and target .is_power8le , ['-mcpu=power8' , '-mtune=power8' , '-maltivec' ]),
1267
1288
(target .is_linux and target .is_power9le , ['-mcpu=power9' , '-mtune=power9' , '-maltivec' ]),
1268
1289
(target .is_linux and target .is_armv8 , ['-march=armv8a' ]),
1269
- (target .is_macos , ['-mmacosx-version-min={}' .format (macos_version_min )]),
1270
- (target .is_ios and not target .is_iossim , ['-mios-version-min={}' .format (ios_version_min )]),
1271
- (target .is_iossim , ['-mios-simulator-version-min={}' .format (ios_version_min )]),
1290
+ (target .is_macos , ['-mmacosx-version-min={}' .format (MACOS_VERSION_MIN )]),
1291
+ (target .is_ios and not target .is_iossim , ['-mios-version-min={}' .format (IOS_VERSION_MIN )]),
1292
+ (target .is_iossim , ['-mios-simulator-version-min={}' .format (IOS_VERSION_MIN )]),
1272
1293
(target .is_android and target .is_armv7 , ['-march=armv7-a' , '-mfloat-abi=softfp' ]),
1273
1294
(target .is_android and target .is_armv8 , ['-march=armv8-a' ]),
1274
1295
(target .is_yocto and target .is_armv7 , ['-march=armv7-a' , '-mfpu=neon' , '-mfloat-abi=hard' , '-mcpu=cortex-a9' , '-O1' ])
@@ -1847,19 +1868,6 @@ def prefix(_type, _path):
1847
1868
1848
1869
1849
1870
class MSVC (object ):
1850
- # noinspection PyPep8Naming
1851
- class WindowsVersion (object ):
1852
- """
1853
- Predefined values for _WIN32_WINNT macro.
1854
- This macro specifies minimal Windows version required by the binary being build.
1855
-
1856
- A complete list of the values supported by the Windows SDK can be found at
1857
- https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt
1858
- """
1859
- Windows07 = '0x0601'
1860
- Windows08 = '0x0602'
1861
- Windows10 = '0x0A00'
1862
-
1863
1871
def __init__ (self , tc , build ):
1864
1872
"""
1865
1873
:type tc: MSVCToolchainOptions
@@ -2062,8 +2070,7 @@ def print_compiler(self):
2062
2070
'-Wno-unused-command-line-argument' ,
2063
2071
]
2064
2072
2065
- win_version_min = self .WindowsVersion .Windows07
2066
- defines .append ('/D_WIN32_WINNT={0}' .format (win_version_min ))
2073
+ defines .append ('/D_WIN32_WINNT={0}' .format (WINDOWS_VERSION_MIN ))
2067
2074
2068
2075
if winapi_unicode :
2069
2076
defines += ['/DUNICODE' , '/D_UNICODE' ]
0 commit comments