17
17
def get_recommended_ndk ():
18
18
pass
19
19
20
+
20
21
def check_ndk_version (ndk_dir ):
21
22
# Check the NDK version against what is currently recommended
22
23
version = read_ndk_version (ndk_dir )
23
24
24
25
if version is None :
25
- return # it doesn 't matter
26
-
26
+ return # if we failed to read the version, just don 't worry about it
27
+
27
28
major_version = version .version [0 ]
28
29
29
30
info ('Found NDK revision {}' .format (version ))
@@ -37,14 +38,15 @@ def check_ndk_version(ndk_dir):
37
38
RECOMMENDED_NDK_VERSION ))
38
39
warning (NEW_NDK_MESSAGE )
39
40
41
+
40
42
def read_ndk_version (ndk_dir ):
41
43
"""Read the NDK version from the NDK dir, if possible"""
42
44
try :
43
45
with open (join (ndk_dir , 'source.properties' )) as fileh :
44
46
ndk_data = fileh .read ()
45
47
except IOError :
46
48
info ('Could not determine NDK version, no source.properties '
47
- 'in the NDK dir' )
49
+ 'in the NDK dir' )
48
50
return
49
51
50
52
for line in ndk_data .split ('\n ' ):
@@ -53,12 +55,13 @@ def read_ndk_version(ndk_dir):
53
55
else :
54
56
info ('Could not parse $NDK_DIR/source.properties, not checking '
55
57
'NDK version' )
58
+ return
56
59
57
60
# Line should have the form "Pkg.Revision = ..."
58
61
ndk_version = LooseVersion (line .split ('=' )[- 1 ].strip ())
59
62
60
63
return ndk_version
61
-
64
+
62
65
63
66
MIN_TARGET_API = 26
64
67
RECOMMENDED_TARGET_API = 27 # highest version tested to work fine with SDL2
@@ -69,6 +72,7 @@ def read_ndk_version(ndk_dir):
69
72
'and are not recommended. Note that the Target API can be higher than '
70
73
'your device Android version, and should usually be as high as possible.' )
71
74
75
+
72
76
def check_target_api (api , arch ):
73
77
"""Warn if the user's target API is less than the current minimum
74
78
recommendation
@@ -78,7 +82,7 @@ def check_target_api(api, arch):
78
82
raise BuildInterruptingException (
79
83
'Asked to build for armeabi architecture with API '
80
84
'{}, but API {} or greater does not support armeabi' .format (
81
- self . android_api , ARMEABI_MAX_TARGET_API ),
85
+ api , ARMEABI_MAX_TARGET_API ),
82
86
instructions = 'You probably want to build with --arch=armeabi-v7a instead' )
83
87
84
88
if api < MIN_TARGET_API :
@@ -90,14 +94,15 @@ def check_target_api(api, arch):
90
94
RECOMMENDED_NDK_API = 21
91
95
OLD_NDK_API_MESSAGE = ('NDK API less than {} is not supported' .format (MIN_NDK_API ))
92
96
97
+
93
98
def check_ndk_api (ndk_api , android_api ):
94
99
"""Warn if the user's NDK is too high or low."""
95
100
if ndk_api > android_api :
96
101
raise BuildInterruptingException (
97
102
'Target NDK API is {}, higher than the target Android API {}.' .format (
98
103
ndk_api , android_api ),
99
104
instructions = ('The NDK API is a minimum supported API number and must be lower '
100
- 'than the target Android API' ))
105
+ 'than the target Android API' ))
101
106
102
107
if ndk_api < MIN_NDK_API :
103
108
warning (OLD_NDK_API_MESSAGE )
0 commit comments