diff options
Diffstat (limited to 'Modules/Platform/Android-Common.cmake')
-rw-r--r-- | Modules/Platform/Android-Common.cmake | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake index 0ef9512..e77d2d8 100644 --- a/Modules/Platform/Android-Common.cmake +++ b/Modules/Platform/Android-Common.cmake @@ -17,5 +17,36 @@ if(__ANDROID_COMPILER_COMMON) endif() set(__ANDROID_COMPILER_COMMON 1) +# The NDK toolchain configuration files at: +# +# <ndk>/[build/core/]toolchains/*/setup.mk +# +# contain logic to set TARGET_CFLAGS and TARGET_LDFLAGS (and debug/release +# variants) to tell their build system what flags to pass for each ABI. +# We need to produce the same flags here to produce compatible binaries. +# We initialize these variables here and set them in the compiler-specific +# modules that include this one. Then we use them in the macro below when +# it is called. +set(_ANDROID_ABI_INIT_CFLAGS "") +set(_ANDROID_ABI_INIT_CFLAGS_DEBUG "") +set(_ANDROID_ABI_INIT_CFLAGS_RELEASE "") +set(_ANDROID_ABI_INIT_LDFLAGS "") + macro(__android_compiler_common lang) + if(_ANDROID_ABI_INIT_CFLAGS) + string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_ANDROID_ABI_INIT_CFLAGS}") + endif() + if(_ANDROID_ABI_INIT_CFLAGS_DEBUG) + string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " ${_ANDROID_ABI_INIT_CFLAGS_DEBUG}") + endif() + if(_ANDROID_ABI_INIT_CFLAGS_RELEASE) + string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " ${_ANDROID_ABI_INIT_CFLAGS_RELEASE}") + string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " ${_ANDROID_ABI_INIT_CFLAGS_RELEASE}") + string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " ${_ANDROID_ABI_INIT_CFLAGS_RELEASE}") + endif() + if(_ANDROID_ABI_INIT_LDFLAGS) + foreach(t EXE SHARED MODULE) + string(APPEND CMAKE_${t}_LINKER_FLAGS_INIT " ${_ANDROID_ABI_INIT_LDFLAGS}") + endforeach() + endif() endmacro() |