File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 17
17
18
18
DEFAULT_ANDROID_API = 15
19
19
20
+ DEFAULT_NDK_API = 21
21
+
20
22
21
23
class Context (object ):
22
24
'''A build context. If anything will be built, an instance this class
@@ -352,7 +354,23 @@ def prepare_build_environment(self,
352
354
'set it with `--ndk-version=...`.' )
353
355
self .ndk_ver = ndk_ver
354
356
355
- self .ndk_api = user_ndk_api
357
+ ndk_api = None
358
+ if user_ndk_api :
359
+ ndk_api = user_ndk_api
360
+ if ndk_api is not None :
361
+ info ('Getting NDK API version (i.e. minimum supported API) from user argument' )
362
+ if ndk_api is None :
363
+ ndk_api = environ .get ('NDKAPI' , None )
364
+ if ndk_api is not None :
365
+ info ('Found Android API target in $NDKAPI' )
366
+ if ndk_api is None :
367
+ ndk_api = min (self .android_api , DEFAULT_NDK_API )
368
+ warning ('NDK API target was not set manually, using '
369
+ 'the default of {} = min(android-api={}, default ndk-api={})' .format (
370
+ ndk_api , self .android_api , DEFAULT_NDK_API ))
371
+ ndk_api = int (ndk_api )
372
+ self .ndk_api = ndk_api
373
+
356
374
if self .ndk_api > self .android_api :
357
375
error ('Target NDK API is {}, higher than the target Android API {}.' .format (
358
376
self .ndk_api , self .android_api ))
Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ def __init__(self):
259
259
help = ('The version of the Android NDK. This is optional: '
260
260
'we try to work it out automatically from the ndk_dir.' ))
261
261
generic_parser .add_argument (
262
- '--ndk-api' , type = int , default = 21 ,
262
+ '--ndk-api' , type = int , default = 0 ,
263
263
help = ('The Android API level to compile against. This should be your '
264
264
'*minimal supported* API, not normally the same as your --android-api.' ))
265
265
generic_parser .add_argument (
You can’t perform that action at this time.
0 commit comments