Commit b73209d6 authored by Ghislain MARY's avatar Ghislain MARY

Add support for Android NDK 11.

parent 2492823c
...@@ -117,6 +117,9 @@ else() ...@@ -117,6 +117,9 @@ else()
add_custom_target(TARGET_ms2 ALL) add_custom_target(TARGET_ms2 ALL)
add_dependencies(TARGET_linphone_builder TARGET_ms2) add_dependencies(TARGET_linphone_builder TARGET_ms2)
add_dependencies(TARGET_ms2 TARGET_ortp TARGET_bctoolbox) add_dependencies(TARGET_ms2 TARGET_ortp TARGET_bctoolbox)
if(ANDROID)
linphone_builder_add_builder_to_target(TARGET_ms2 androidcpufeatures)
endif()
if(LINPHONE_BUILDER_BUILD_DEPENDENCIES) if(LINPHONE_BUILDER_BUILD_DEPENDENCIES)
linphone_builder_add_builder_to_target(TARGET_ms2 speex) linphone_builder_add_builder_to_target(TARGET_ms2 speex)
if(ENABLE_GSM) if(ENABLE_GSM)
......
############################################################################
# androidcpufeatures.cmake
# Copyright (C) 2016 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
set(EP_androidcpufeatures_EXTERNAL_SOURCE_PATHS "externals/build/cpufeatures")
...@@ -48,6 +48,7 @@ else() ...@@ -48,6 +48,7 @@ else()
set(EP_ffmpeg_IGNORE_WARNINGS TRUE) set(EP_ffmpeg_IGNORE_WARNINGS TRUE)
set(EP_ffmpeg_BUILD_METHOD "autotools") set(EP_ffmpeg_BUILD_METHOD "autotools")
set(EP_ffmpeg_CONFIGURE_OPTIONS set(EP_ffmpeg_CONFIGURE_OPTIONS
"--disable-doc"
"--disable-zlib" "--disable-zlib"
"--disable-bzlib" "--disable-bzlib"
"--disable-ffplay" "--disable-ffplay"
...@@ -139,6 +140,10 @@ else() ...@@ -139,6 +140,10 @@ else()
else() else()
list(APPEND EP_ffmpeg_CONFIGURE_OPTIONS "--disable-mmx" "--disable-sse2" "--disable-ssse3") list(APPEND EP_ffmpeg_CONFIGURE_OPTIONS "--disable-mmx" "--disable-sse2" "--disable-ssse3")
endif() endif()
if(CMAKE_C_COMPILER_TARGET) # When building with clang
list(APPEND EP_ffmpeg_CONFIGURE_OPTIONS "--extra-cflags=--target=${CMAKE_C_COMPILER_TARGET} --gcc-toolchain=${EXTERNAL_TOOLCHAIN_PATH}/..")
list(APPEND EP_ffmpeg_CONFIGURE_OPTIONS "--extra-ldflags=--target=${CMAKE_C_COMPILER_TARGET} --gcc-toolchain=${EXTERNAL_TOOLCHAIN_PATH}/..")
endif()
else() else()
set(EP_ffmpeg_TARGET_OS "linux") set(EP_ffmpeg_TARGET_OS "linux")
list(APPEND EP_ffmpeg_CONFIGURE_OPTIONS "--enable-runtime-cpudetect") list(APPEND EP_ffmpeg_CONFIGURE_OPTIONS "--enable-runtime-cpudetect")
......
...@@ -28,6 +28,9 @@ set(EP_ms2_GROUPABLE YES) ...@@ -28,6 +28,9 @@ set(EP_ms2_GROUPABLE YES)
set(EP_ms2_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE}) set(EP_ms2_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE})
set(EP_ms2_DEPENDENCIES EP_ortp EP_bctoolbox) set(EP_ms2_DEPENDENCIES EP_ortp EP_bctoolbox)
if(ANDROID)
list(APPEND EP_ms2_DEPENDENCIES EP_androidcpufeatures)
endif()
if(MSVC) if(MSVC)
set(EP_ms2_EXTRA_LDFLAGS "/SAFESEH:NO") set(EP_ms2_EXTRA_LDFLAGS "/SAFESEH:NO")
endif() endif()
......
...@@ -68,7 +68,11 @@ if(ENABLE_ASM) ...@@ -68,7 +68,11 @@ if(ENABLE_ASM)
endif() endif()
get_directory_property(DIRECTORY_PROPERTY_COMPILE_OPTIONS "COMPILE_OPTIONS") get_directory_property(DIRECTORY_PROPERTY_COMPILE_OPTIONS "COMPILE_OPTIONS")
string(REPLACE ";" " " DIRECTORY_PROPERTY_COMPILE_OPTIONS "${DIRECTORY_PROPERTY_COMPILE_OPTIONS}") string(REPLACE ";" " " DIRECTORY_PROPERTY_COMPILE_OPTIONS "${DIRECTORY_PROPERTY_COMPILE_OPTIONS}")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> ${CMAKE_CPP_FLAGS} ${CMAKE_C_FLAGS} ${DIRECTORY_PROPERTY_COMPILE_OPTIONS} ${ARCH_OPTIONS} -o <OBJECT> -c <SOURCE>") set(CMAKE_ASM_TARGET_FLAG "")
if(CMAKE_C_COMPILER_TARGET)
set(CMAKE_ASM_TARGET_FLAG "--target=${CMAKE_C_COMPILER_TARGET}")
endif()
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> ${CMAKE_ASM_TARGET_FLAG} ${CMAKE_CPP_FLAGS} ${CMAKE_C_FLAGS} ${DIRECTORY_PROPERTY_COMPILE_OPTIONS} ${ARCH_OPTIONS} -o <OBJECT> -c <SOURCE>")
enable_language(ASM) enable_language(ASM)
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} SYSTEM_PROCESSOR) string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} SYSTEM_PROCESSOR)
#No optimization available yet for arm64 #No optimization available yet for arm64
......
...@@ -125,8 +125,12 @@ else() ...@@ -125,8 +125,12 @@ else()
set(EP_vpx_TARGET "x86-android-gcc") set(EP_vpx_TARGET "x86-android-gcc")
set(EP_vpx_EXTRA_ASFLAGS "-D__ANDROID__") set(EP_vpx_EXTRA_ASFLAGS "-D__ANDROID__")
endif() endif()
set(EP_vpx_EXTRA_CFLAGS "--sysroot=${CMAKE_SYSROOT}") if(CMAKE_C_COMPILER_TARGET) # When building with clang
set(EP_vpx_EXTRA_LDFLAGS "--sysroot=${CMAKE_SYSROOT}") set(EP_vpx_EXTRA_CFLAGS "${EP_vpx_EXTRA_CFLAGS} --target=${CMAKE_C_COMPILER_TARGET}")
set(EP_vpx_EXTRA_LDFLAGS "${EP_vpx_EXTRA_LDFLAGS} --target=${CMAKE_C_COMPILER_TARGET} -L${GCC_LIBRARY_PATH}")
endif()
set(EP_vpx_EXTRA_CFLAGS "${EP_vpx_EXTRA_CFLAGS} --sysroot=${CMAKE_SYSROOT}")
set(EP_vpx_EXTRA_LDFLAGS "${EP_vpx_EXTRA_LDFLAGS} --sysroot=${CMAKE_SYSROOT}")
list(APPEND EP_vpx_CONFIGURE_OPTIONS list(APPEND EP_vpx_CONFIGURE_OPTIONS
"--sdk-path=${ANDROID_NDK_PATH}" "--sdk-path=${ANDROID_NDK_PATH}"
"--enable-pic" "--enable-pic"
......
...@@ -23,6 +23,15 @@ ...@@ -23,6 +23,15 @@
set(CMAKE_ANDROID_API 14) set(CMAKE_ANDROID_API 14)
set(CMAKE_ANDROID_STL_TYPE gnustl_static) set(CMAKE_ANDROID_STL_TYPE gnustl_static)
include(CMakeForceCompiler)
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_POSITION_INDEPENDENT_CODE YES)
# Define name of the target system
set(CMAKE_SYSTEM_NAME "Linux")
set(ANDROID True)
find_path(ANDROID_NDK_PATH ndk-build) find_path(ANDROID_NDK_PATH ndk-build)
if(NOT ANDROID_NDK_PATH) if(NOT ANDROID_NDK_PATH)
message(FATAL_ERROR "Cannot find 'ndk-build', make sure you installed the NDK and added it to your PATH") message(FATAL_ERROR "Cannot find 'ndk-build', make sure you installed the NDK and added it to your PATH")
...@@ -38,47 +47,97 @@ if(NOT ANDROID_SDK_PLATFORM_TOOLS_PATH) ...@@ -38,47 +47,97 @@ if(NOT ANDROID_SDK_PLATFORM_TOOLS_PATH)
message(FATAL_ERROR "Cannot find 'adb', make sure you installed the SDK platform tools and added it to your PATH") message(FATAL_ERROR "Cannot find 'adb', make sure you installed the SDK platform tools and added it to your PATH")
endif() endif()
find_file(GCC_EXECUTABLE find_file(CLANG_EXECUTABLE "clang"
NAMES
"${COMPILER_PREFIX}-gcc"
PATHS PATHS
"${ANDROID_NDK_PATH}/toolchains/${COMPILER_PREFIX}-4.8/prebuilt/linux-x86_64/bin" "${ANDROID_NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/bin"
"${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-4.8/prebuilt/linux-x86_64/bin" "${ANDROID_NDK_PATH}/toolchains/llvm/prebuilt/darwin-x86_64/bin"
"${ANDROID_NDK_PATH}/toolchains/${COMPILER_PREFIX}-4.8/prebuilt/darwin-x86_64/bin" "${ANDROID_NDK_PATH}/toolchains/llvm/prebuilt/linux-x86/bin"
"${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-4.8/prebuilt/darwin-x86_64/bin" NO_DEFAULT_PATH
"${ANDROID_NDK_PATH}/toolchains/${COMPILER_PREFIX}-4.8/prebuilt/linux-x86/bin"
"${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-4.8/prebuilt/linux-x86/bin"
) )
if(NOT GCC_EXECUTABLE) if(CLANG_EXECUTABLE)
message(FATAL_ERROR "Cannot find the compiler")
endif()
get_filename_component(ANDROID_TOOLCHAIN_PATH "${GCC_EXECUTABLE}" DIRECTORY)
set(CMAKE_SYSROOT "${ANDROID_NDK_PATH}/platforms/android-${CMAKE_ANDROID_API}/arch-${ARCHITECTURE}") get_filename_component(ANDROID_TOOLCHAIN_PATH "${CLANG_EXECUTABLE}" DIRECTORY)
set(GCC_VERSION "4.9")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi-v7a")
set(GCC_LIBRARY_ADDITIONAL_DIR "/armv7-a")
endif()
message(STATUS "Using sysroot path: ${CMAKE_SYSROOT}") find_file(GCC_LIBRARY "libgcc.a"
PATHS
"${ANDROID_NDK_PATH}/toolchains/${COMPILER_PREFIX}-${GCC_VERSION}/prebuilt/linux-x86_64/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}${GCC_LIBRARY_ADDITIONAL_DIR}"
"${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-${GCC_VERSION}/prebuilt/linux-x86_64/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}"
"${ANDROID_NDK_PATH}/toolchains/${COMPILER_PREFIX}-${GCC_VERSION}/prebuilt/darwin-x86_64/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}${GCC_LIBRARY_ADDITIONAL_DIR}"
"${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-${GCC_VERSION}/prebuilt/darwin-x86_64/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}"
"${ANDROID_NDK_PATH}/toolchains/${COMPILER_PREFIX}-${GCC_VERSION}/prebuilt/linux-x86/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}${GCC_LIBRARY_ADDITIONAL_DIR}"
"${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-${GCC_VERSION}/prebuilt/linux-x86/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}"
NO_DEFAULT_PATH
)
if(NOT GCC_LIBRARY)
message(FATAL_ERROR "Cannot find libgcc.a")
endif()
get_filename_component(GCC_LIBRARY_PATH "${GCC_LIBRARY}" DIRECTORY)
set(ANDROID_TOOLCHAIN_PREFIX "${ANDROID_TOOLCHAIN_PATH}/${COMPILER_PREFIX}-") find_file(GCC_EXECUTABLE "${COMPILER_PREFIX}-gcc"
set(ANDROID_TOOLCHAIN_CC "${ANDROID_TOOLCHAIN_PREFIX}gcc") PATHS
set(ANDROID_TOOLCHAIN_CXX "${ANDROID_TOOLCHAIN_PREFIX}g++") "${ANDROID_NDK_PATH}/toolchains/${COMPILER_PREFIX}-${GCC_VERSION}/prebuilt/linux-x86_64/bin"
set(ANDROID_TOOLCHAIN_LD "${ANDROID_TOOLCHAIN_PREFIX}ld") "${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-${GCC_VERSION}/prebuilt/linux-x86_64/bin"
set(ANDROID_TOOLCHAIN_AR "${ANDROID_TOOLCHAIN_PREFIX}ar") "${ANDROID_NDK_PATH}/toolchains/${COMPILER_PREFIX}-${GCC_VERSION}/prebuilt/darwin-x86_64/bin"
set(ANDROID_TOOLCHAIN_RANLIB "${ANDROID_TOOLCHAIN_PREFIX}ranlib") "${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-${GCC_VERSION}/prebuilt/darwin-x86_64/bin"
set(ANDROID_TOOLCHAIN_STRIP "${ANDROID_TOOLCHAIN_PREFIX}strip") "${ANDROID_NDK_PATH}/toolchains/${COMPILER_PREFIX}-${GCC_VERSION}/prebuilt/linux-x86/bin"
set(ANDROID_TOOLCHAIN_NM "${ANDROID_TOOLCHAIN_PREFIX}nm") "${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-${GCC_VERSION}/prebuilt/linux-x86/bin"
NO_DEFAULT_PATH
)
if(NOT GCC_EXECUTABLE)
message(FATAL_ERROR "Cannot find gcc")
endif()
get_filename_component(EXTERNAL_TOOLCHAIN_PATH "${GCC_EXECUTABLE}" DIRECTORY)
include(CMakeForceCompiler) #Define the compiler
set(_CMAKE_TOOLCHAIN_PREFIX "${COMPILER_PREFIX}-")
set(CMAKE_C_COMPILER "${CLANG_EXECUTABLE}")
set(CMAKE_C_COMPILER_TARGET "${CLANG_TARGET}")
set(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN "${EXTERNAL_TOOLCHAIN_PATH}/..")
set(CMAKE_CXX_COMPILER "${CLANG_EXECUTABLE}++")
set(CMAKE_CXX_COMPILER_TARGET "${CLANG_TARGET}")
set(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${EXTERNAL_TOOLCHAIN_PATH}/..")
set(CMAKE_CROSSCOMPILING TRUE) else()
set(CMAKE_POSITION_INDEPENDENT_CODE YES)
# Define name of the target system set(GCC_VERSION "4.8")
set(CMAKE_SYSTEM_NAME "Linux")
set(ANDROID True) find_file(GCC_EXECUTABLE "${COMPILER_PREFIX}-gcc"
PATHS
"${ANDROID_NDK_PATH}/toolchains/${COMPILER_PREFIX}-${GCC_VERSION}/prebuilt/linux-x86_64/bin"
"${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-${GCC_VERSION}/prebuilt/linux-x86_64/bin"
"${ANDROID_NDK_PATH}/toolchains/${COMPILER_PREFIX}-${GCC_VERSION}/prebuilt/darwin-x86_64/bin"
"${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-${GCC_VERSION}/prebuilt/darwin-x86_64/bin"
"${ANDROID_NDK_PATH}/toolchains/${COMPILER_PREFIX}-${GCC_VERSION}/prebuilt/linux-x86/bin"
"${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-${GCC_VERSION}/prebuilt/linux-x86/bin"
NO_DEFAULT_PATH
)
if(NOT GCC_EXECUTABLE)
message(FATAL_ERROR "Cannot find the compiler")
endif()
get_filename_component(ANDROID_TOOLCHAIN_PATH "${GCC_EXECUTABLE}" DIRECTORY)
set(ANDROID_TOOLCHAIN_PREFIX "${ANDROID_TOOLCHAIN_PATH}/${COMPILER_PREFIX}-")
set(ANDROID_TOOLCHAIN_CC "${ANDROID_TOOLCHAIN_PREFIX}gcc")
set(ANDROID_TOOLCHAIN_CXX "${ANDROID_TOOLCHAIN_PREFIX}g++")
set(ANDROID_TOOLCHAIN_LD "${ANDROID_TOOLCHAIN_PREFIX}ld")
set(ANDROID_TOOLCHAIN_AR "${ANDROID_TOOLCHAIN_PREFIX}ar")
set(ANDROID_TOOLCHAIN_RANLIB "${ANDROID_TOOLCHAIN_PREFIX}ranlib")
set(ANDROID_TOOLCHAIN_STRIP "${ANDROID_TOOLCHAIN_PREFIX}strip")
set(ANDROID_TOOLCHAIN_NM "${ANDROID_TOOLCHAIN_PREFIX}nm")
# Define the compiler
CMAKE_FORCE_C_COMPILER("${ANDROID_TOOLCHAIN_CC}" GNU)
CMAKE_FORCE_CXX_COMPILER("${ANDROID_TOOLCHAIN_CXX}" GNU)
# Define the compiler endif()
CMAKE_FORCE_C_COMPILER("${ANDROID_TOOLCHAIN_CC}" GNU)
CMAKE_FORCE_CXX_COMPILER("${ANDROID_TOOLCHAIN_CXX}" GNU) set(CMAKE_SYSROOT "${ANDROID_NDK_PATH}/platforms/android-${CMAKE_ANDROID_API}/arch-${ARCHITECTURE}")
message(STATUS "Using sysroot path: ${CMAKE_SYSROOT}")
set(CMAKE_FIND_ROOT_PATH "${CMAKE_SYSROOT}" "${CMAKE_INSTALL_PREFIX}") set(CMAKE_FIND_ROOT_PATH "${CMAKE_SYSROOT}" "${CMAKE_INSTALL_PREFIX}")
...@@ -89,9 +148,23 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) ...@@ -89,9 +148,23 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.8/include" "${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.8/libs/${CMAKE_SYSTEM_PROCESSOR}/include") set(ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/${GCC_VERSION}/include" "${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/${GCC_VERSION}/libs/${CMAKE_SYSTEM_PROCESSOR}/include")
set(ANDROID_MACHINE_INCLUDE_DIRS "${ANDROID_NDK_PATH}/sources/cpufeatures") if(EXISTS "${ANDROID_NDK_PATH}/sources/android/cpufeatures/cpu-features.c")
include_directories(SYSTEM ${ANDROID_MACHINE_INCLUDE_DIRS} ${ANDROID_STL_INCLUDE_DIRS}) set(ANDROID_CPU_FEATURES_INCLUDE_DIRS "${ANDROID_NDK_PATH}/sources/android/cpufeatures")
link_libraries("${ANDROID_NDK_PATH}/sources/android/libportable/libs/${CMAKE_SYSTEM_PROCESSOR}/libportable.a") elseif(EXISTS "${ANDROID_NDK_PATH}/sources/cpufeatures/cpu-features.c")
link_libraries("${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.8/libs/${CMAKE_SYSTEM_PROCESSOR}/libgnustl_static.a") set(ANDROID_CPU_FEATURES_INCLUDE_DIRS "${ANDROID_NDK_PATH}/sources/cpufeatures")
else()
message(FATAL_ERROR "Cannot find cpu-features.c")
endif()
include_directories(SYSTEM ${ANDROID_CPU_FEATURES_INCLUDE_DIRS} ${ANDROID_STL_INCLUDE_DIRS})
if(GCC_LIBRARY_PATH)
#link_directories("${GCC_LIBRARY_PATH}")
# link_directories has no effet for external projects so add the GCC library path to the compiler flags
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -L${GCC_LIBRARY_PATH}")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${GCC_LIBRARY_PATH}")
set(CMAKE_EXE_LINKER_FLAGS "-L${GCC_LIBRARY_PATH}" CACHE STRING "linker flags" FORCE)
set(CMAKE_MODULE_LINKER_FLAGS "-L${GCC_LIBRARY_PATH}" CACHE STRING "linker flags" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS "-L${GCC_LIBRARY_PATH}" CACHE STRING "linker flags" FORCE)
endif()
link_libraries("${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/${GCC_VERSION}/libs/${CMAKE_SYSTEM_PROCESSOR}/libgnustl_static.a")
link_libraries("log") link_libraries("log")
...@@ -24,6 +24,7 @@ set(CMAKE_SYSTEM_PROCESSOR "armeabi") ...@@ -24,6 +24,7 @@ set(CMAKE_SYSTEM_PROCESSOR "armeabi")
set(ARCHITECTURE "arm") set(ARCHITECTURE "arm")
set(NDK_ARCHITECTURE "armeabi") set(NDK_ARCHITECTURE "armeabi")
set(COMPILER_PREFIX "arm-linux-androideabi") set(COMPILER_PREFIX "arm-linux-androideabi")
set(CLANG_TARGET "arm-none-linux-androideabi")
include("${CMAKE_CURRENT_LIST_DIR}/android/toolchain-android.cmake") include("${CMAKE_CURRENT_LIST_DIR}/android/toolchain-android.cmake")
add_compile_options( add_compile_options(
...@@ -36,9 +37,14 @@ add_compile_options( ...@@ -36,9 +37,14 @@ add_compile_options(
"-msoft-float" "-msoft-float"
"-fomit-frame-pointer" "-fomit-frame-pointer"
"-fno-strict-aliasing" "-fno-strict-aliasing"
"-finline-limit=64"
) )
if(NOT CLANG_EXECUTABLE)
add_compile_options(
"-finline-limit=64"
)
endif()
link_libraries( link_libraries(
"-no-canonical-prefixes" "-no-canonical-prefixes"
"-Wl,--no-undefined" "-Wl,--no-undefined"
......
...@@ -24,6 +24,7 @@ set(CMAKE_SYSTEM_PROCESSOR "armeabi-v7a") ...@@ -24,6 +24,7 @@ set(CMAKE_SYSTEM_PROCESSOR "armeabi-v7a")
set(ARCHITECTURE "arm") set(ARCHITECTURE "arm")
set(NDK_ARCHITECTURE "armeabi-v7a") set(NDK_ARCHITECTURE "armeabi-v7a")
set(COMPILER_PREFIX "arm-linux-androideabi") set(COMPILER_PREFIX "arm-linux-androideabi")
set(CLANG_TARGET "armv7-none-linux-androideabi")
include("${CMAKE_CURRENT_LIST_DIR}/android/toolchain-android.cmake") include("${CMAKE_CURRENT_LIST_DIR}/android/toolchain-android.cmake")
add_compile_options( add_compile_options(
...@@ -36,9 +37,14 @@ add_compile_options( ...@@ -36,9 +37,14 @@ add_compile_options(
"-mfloat-abi=softfp" "-mfloat-abi=softfp"
"-fomit-frame-pointer" "-fomit-frame-pointer"
"-fno-strict-aliasing" "-fno-strict-aliasing"
"-finline-limit=64"
) )
if(NOT CLANG_EXECUTABLE)
add_compile_options(
"-finline-limit=64"
)
endif()
link_libraries( link_libraries(
"-march=armv7-a" "-march=armv7-a"
"-Wl,--fix-cortex-a8" "-Wl,--fix-cortex-a8"
......
...@@ -24,6 +24,7 @@ set(CMAKE_SYSTEM_PROCESSOR "x86") ...@@ -24,6 +24,7 @@ set(CMAKE_SYSTEM_PROCESSOR "x86")
set(ARCHITECTURE "x86") set(ARCHITECTURE "x86")
set(NDK_ARCHITECTURE "x86") set(NDK_ARCHITECTURE "x86")
set(COMPILER_PREFIX "i686-linux-android") set(COMPILER_PREFIX "i686-linux-android")
set(CLANG_TARGET "i686-none-linux-androideabi")
include("${CMAKE_CURRENT_LIST_DIR}/android/toolchain-android.cmake") include("${CMAKE_CURRENT_LIST_DIR}/android/toolchain-android.cmake")
add_compile_options( add_compile_options(
...@@ -33,10 +34,15 @@ add_compile_options( ...@@ -33,10 +34,15 @@ add_compile_options(
"-no-canonical-prefixes" "-no-canonical-prefixes"
"-fomit-frame-pointer" "-fomit-frame-pointer"
"-fstrict-aliasing" "-fstrict-aliasing"
"-funswitch-loops"
"-finline-limit=300"
) )
if(NOT CLANG_EXECUTABLE)
add_compile_options(
"-funswitch-loops"
"-finline-limit=300"
)
endif()
link_libraries( link_libraries(
"-no-canonical-prefixes" "-no-canonical-prefixes"
"-Wl,--no-undefined" "-Wl,--no-undefined"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment