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 1717
1818DEFAULT_ANDROID_API = 15
1919
20+ DEFAULT_NDK_API = 21
21+
2022
2123class Context (object ):
2224 '''A build context. If anything will be built, an instance this class
@@ -352,7 +354,23 @@ def prepare_build_environment(self,
352354 'set it with `--ndk-version=...`.' )
353355 self .ndk_ver = ndk_ver
354356
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+
356374 if self .ndk_api > self .android_api :
357375 error ('Target NDK API is {}, higher than the target Android API {}.' .format (
358376 self .ndk_api , self .android_api ))
Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ def __init__(self):
259259 help = ('The version of the Android NDK. This is optional: '
260260 'we try to work it out automatically from the ndk_dir.' ))
261261 generic_parser .add_argument (
262- '--ndk-api' , type = int , default = 21 ,
262+ '--ndk-api' , type = int , default = 0 ,
263263 help = ('The Android API level to compile against. This should be your '
264264 '*minimal supported* API, not normally the same as your --android-api.' ))
265265 generic_parser .add_argument (
You can’t perform that action at this time.
0 commit comments