@ -301,6 +301,8 @@
# [ + ] u p d a t e d f o r N D K r 9 c
# [ + ] u p d a t e d f o r N D K r 9 c
# - J a n u a r y 2 0 1 4
# - J a n u a r y 2 0 1 4
# [ ~ ] f i x c o p y i n g o f s h a r e d S T L
# [ ~ ] f i x c o p y i n g o f s h a r e d S T L
# - O c t o b e r 2 0 1 4
# [ ~ ] f i x N A T I V E _ A P I _ L E V E L d e t e c t i o n f o r N D K r 1 0
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cmake_minimum_required ( VERSION 2.6.3 )
cmake_minimum_required ( VERSION 2.6.3 )
@ -423,12 +425,18 @@ macro( __INIT_VARIABLE var_name )
endmacro ( )
endmacro ( )
macro ( __DETECT_NATIVE_API_LEVEL _var _path )
macro ( __DETECT_NATIVE_API_LEVEL _var _path )
SET ( __ndkApiLevelRegex "^[\t ]*#define[\t ]+__ANDROID_API__[\t ]+([0-9]+)[\t ]*$" )
list ( APPEND __ndkApiLevelRegexList
FILE ( STRINGS ${ _path } __apiFileContent REGEX "${__ndkApiLevelRegex}" )
" ^ [ \ t ] * # d e f i n e [ \ t ] + _ _ A N D R O I D _ A P I _ _ [ \ t ] + ( [ 0 - 9 ] ) [ \ t ] * $ "
if ( NOT __apiFileContent )
" ^ [ \ t ] * # d e f i n e [ \ t ] + _ _ A N D R O I D _ A P I _ _ [ \ t ] + [ 0 - 9 ] + [ \ t ] + . * ( [ A - Z ] ) . * $ "
message ( SEND_ERROR "Could not get Android native API level. Probably you have specified invalid level value, or your copy of NDK/toolchain is broken." )
)
endif ( )
foreach ( __ndkApiLevelRegex IN LISTS __ndkApiLevelRegexList )
string ( REGEX REPLACE "${__ndkApiLevelRegex}" "\\1" ${ _var } "${__apiFileContent}" )
FILE ( STRINGS ${ _path } __apiFileContent REGEX "${__ndkApiLevelRegex}" )
if ( __apiFileContent )
string ( REGEX REPLACE "${__ndkApiLevelRegex}" "\\1" ${ _var } "${__apiFileContent}" )
break ( )
endif ( )
endforeach ( )
unset ( __ndkApiLevelRegexList )
unset ( __apiFileContent )
unset ( __apiFileContent )
unset ( __ndkApiLevelRegex )
unset ( __ndkApiLevelRegex )
endmacro ( )
endmacro ( )
@ -874,7 +882,7 @@ if( __levelIdx EQUAL -1 )
else ( )
else ( )
if ( BUILD_WITH_ANDROID_NDK )
if ( BUILD_WITH_ANDROID_NDK )
__DETECT_NATIVE_API_LEVEL ( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
__DETECT_NATIVE_API_LEVEL ( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
if ( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL )
if ( NOT __realApiLevel STR EQUAL ANDROID_NATIVE_API_LEVEL )
message ( SEND_ERROR "Specified Android API level (${ANDROID_NATIVE_API_LEVEL}) does not match to the level found (${__realApiLevel}). Probably your copy of NDK is broken." )
message ( SEND_ERROR "Specified Android API level (${ANDROID_NATIVE_API_LEVEL}) does not match to the level found (${__realApiLevel}). Probably your copy of NDK is broken." )
endif ( )
endif ( )
unset ( __realApiLevel )
unset ( __realApiLevel )