Commit f2c9a5d4 authored by Ghislain MARY's avatar Ghislain MARY

Add Android arm64 toolchain.

parent 16dd6f48
......@@ -27,11 +27,15 @@ include(GNUInstallDirs)
set(SUPPORT_SOURCES
"${ANDROID_SUPPORT}/src/musl-locale/iconv.c"
"${ANDROID_SUPPORT}/src/musl-locale/langinfo.c"
"${ANDROID_SUPPORT}/src/musl-locale/nl_langinfo_l.c"
"${ANDROID_SUPPORT}/src/musl-multibyte/wctomb.c"
)
if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
list(APPEND SUPPORT_SOURCES
"${ANDROID_SUPPORT}/src/musl-locale/iconv.c"
"${ANDROID_SUPPORT}/src/musl-locale/langinfo.c"
"${ANDROID_SUPPORT}/src/musl-locale/nl_langinfo_l.c"
)
endif()
add_library(support STATIC ${SUPPORT_SOURCES})
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
......
......@@ -52,9 +52,11 @@ else()
lcb_additional_options("OS=\"msvc\"")
elseif(ANDROID)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi-v7a")
lcb_additional_options("OS=\"android\" NDKROOT=\"${ANDROID_NDK_PATH}\" TOOLCHAINPREFIX=\"${TOOLCHAIN_PREFIX}\" TARGET=\"android-${CMAKE_ANDROID_API}\" ARCH=\"arm\"")
lcb_additional_options("OS=\"android\" NDKROOT=\"${ANDROID_NDK_PATH}\" NDKLEVEL=${CMAKE_ANDROID_API} TOOLCHAINPREFIX=\"${TOOLCHAIN_PREFIX}\" TARGET=\"android-${CMAKE_ANDROID_API}\" ARCH=\"arm\"")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
lcb_additional_options("OS=\"android\" NDKROOT=\"${ANDROID_NDK_PATH}\" NDKLEVEL=${CMAKE_ANDROID_API} TOOLCHAINPREFIX=\"${TOOLCHAIN_PREFIX}\" TARGET=\"android-${CMAKE_ANDROID_API}\" ARCH=\"arm64\"")
else()
lcb_additional_options("OS=\"android\" NDKROOT=\"${ANDROID_NDK_PATH}\" TOOLCHAINPREFIX=\"${TOOLCHAIN_PREFIX}\" TARGET=\"android-${CMAKE_ANDROID_API}\" ARCH=\"x86\"")
lcb_additional_options("OS=\"android\" NDKROOT=\"${ANDROID_NDK_PATH}\" NDKLEVEL=${CMAKE_ANDROID_API} TOOLCHAINPREFIX=\"${TOOLCHAIN_PREFIX}\" TARGET=\"android-${CMAKE_ANDROID_API}\" ARCH=\"x86\"")
endif()
elseif(APPLE)
if(IOS)
......
......@@ -29,10 +29,7 @@ lcb_groupable(YES)
lcb_dependencies("bctoolbox")
lcb_spec_file("ortp.spec")
lcb_cmake_options(
"-DENABLE_DOC=${ENABLE_DOC}"
"-DENABLE_TOOLS=${ENABLE_TOOLS}"
)
lcb_cmake_options("-DENABLE_DOC=${ENABLE_DOC}")
# TODO: Activate strict compilation options on IOS
if(IOS)
......
......@@ -117,8 +117,8 @@ else()
endif()
if(CMAKE_GENERATOR STREQUAL "Xcode")
# It appears that the build occurs in the cmake directory instead of the Build/vpx one with Xcode, so these flags are needed for include files to be found...
lcb_extra_cflags("${EP_vpx_EXTRA_CFLAGS} -I${LINPHONE_BUILDER_WORK_DIR}/Build/vpx")
lcb_extra_asflags("${EP_vpx_EXTRA_ASFLAGS} -I${LINPHONE_BUILDER_WORK_DIR}/Build/vpx")
lcb_extra_cflags("-I${LINPHONE_BUILDER_WORK_DIR}/Build/vpx")
lcb_extra_asflags("-I${LINPHONE_BUILDER_WORK_DIR}/Build/vpx")
endif()
lcb_linking_type("--enable-static" "--disable-shared" "--enable-pic")
elseif(ANDROID)
......@@ -126,6 +126,8 @@ else()
message(FATAL_ERROR "VPX cannot be built on arm.")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi-v7a")
set(VPX_TARGET "armv7-android-gcc")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(VPX_TARGET "arm64-android-gcc")
else()
set(VPX_TARGET "x86-android-gcc")
endif()
......
......@@ -95,7 +95,6 @@ lcb_builder_cmake_options(linphone "-DENABLE_TUTORIALS=NO")
lcb_builder_cmake_options(linphone "-DENABLE_UPNP=NO")
lcb_builder_cmake_options(linphone "-DENABLE_MSG_STORAGE=YES")
lcb_builder_cmake_options(linphone "-DENABLE_DOC=NO")
lcb_builder_cmake_options(linphone "-DENABLE_UNIT_TESTS=YES")
lcb_builder_linking_type(linphone "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")
# mbedtls
......@@ -112,7 +111,6 @@ lcb_builder_cmake_options(ms2 "-DENABLE_V4L=NO")
lcb_builder_cmake_options(ms2 "-DENABLE_X11=NO")
lcb_builder_cmake_options(ms2 "-DENABLE_XV=NO")
lcb_builder_cmake_options(ms2 "-DENABLE_DOC=NO")
lcb_builder_cmake_options(ms2 "-DENABLE_UNIT_TESTS=NO")
lcb_builder_linking_type(ms2 "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")
# openh264
......@@ -133,7 +131,7 @@ lcb_builder_linking_type(polarssl "-DUSE_SHARED_POLARSSL_LIBRARY=NO")
# speex
lcb_builder_cmake_options(speex "-DENABLE_FLOAT_API=NO")
lcb_builder_cmake_options(speex "-DENABLE_FIXED_POINT=YES")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi-v7a")
if(NDK_ARCHITECTURE STREQUAL "armeabi-v7a")
lcb_builder_cmake_options(speex "-DENABLE_ARM_NEON_INTRINSICS=YES")
endif()
......@@ -146,7 +144,7 @@ lcb_builder_install_target(x264 "install-lib-static")
# Copy c++ library to install prefix
file(COPY "${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/${GCC_VERSION}/libs/${CMAKE_SYSTEM_PROCESSOR}/libgnustl_shared.so"
file(COPY "${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/${GCC_VERSION}/libs/${NDK_ARCHITECTURE}/libgnustl_shared.so"
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
)
......
......@@ -20,7 +20,9 @@
#
############################################################################
set(CMAKE_ANDROID_API 14)
if(NOT CMAKE_ANDROID_API)
set(CMAKE_ANDROID_API 14)
endif()
set(CMAKE_ANDROID_STL_TYPE gnustl_shared)
set(CMAKE_CROSSCOMPILING TRUE)
......@@ -59,24 +61,24 @@ if(CLANG_EXECUTABLE)
get_filename_component(TOOLCHAIN_PATH "${CLANG_EXECUTABLE}" DIRECTORY)
set(GCC_VERSION "4.9")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi-v7a")
if(NDK_ARCHITECTURE STREQUAL "armeabi-v7a")
set(GCC_LIBRARY_ADDITIONAL_DIR "/armv7-a")
endif()
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/${NDK_ARCHITECTURE}-${GCC_VERSION}/prebuilt/linux-x86_64/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}"
"${ANDROID_NDK_PATH}/toolchains/${COMPILER_PREFIX}-${GCC_VERSION}/prebuilt/linux-x86_64/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}.x${GCC_LIBRARY_ADDITIONAL_DIR}"
"${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-${GCC_VERSION}/prebuilt/linux-x86_64/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}.x"
"${ANDROID_NDK_PATH}/toolchains/${NDK_ARCHITECTURE}-${GCC_VERSION}/prebuilt/linux-x86_64/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}.x"
"${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/${NDK_ARCHITECTURE}-${GCC_VERSION}/prebuilt/darwin-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}.x${GCC_LIBRARY_ADDITIONAL_DIR}"
"${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-${GCC_VERSION}/prebuilt/darwin-x86_64/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}.x"
"${ANDROID_NDK_PATH}/toolchains/${NDK_ARCHITECTURE}-${GCC_VERSION}/prebuilt/darwin-x86_64/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}.x"
"${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}"
"${ANDROID_NDK_PATH}/toolchains/${NDK_ARCHITECTURE}-${GCC_VERSION}/prebuilt/linux-x86/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}"
"${ANDROID_NDK_PATH}/toolchains/${COMPILER_PREFIX}-${GCC_VERSION}/prebuilt/linux-x86/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}.x${GCC_LIBRARY_ADDITIONAL_DIR}"
"${ANDROID_NDK_PATH}/toolchains/${CMAKE_SYSTEM_PROCESSOR}-${GCC_VERSION}/prebuilt/linux-x86/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}.x"
"${ANDROID_NDK_PATH}/toolchains/${NDK_ARCHITECTURE}-${GCC_VERSION}/prebuilt/linux-x86/lib/gcc/${COMPILER_PREFIX}/${GCC_VERSION}.x"
NO_DEFAULT_PATH
)
if(NOT GCC_LIBRARY)
......@@ -87,11 +89,11 @@ if(CLANG_EXECUTABLE)
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/${NDK_ARCHITECTURE}-${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/${NDK_ARCHITECTURE}-${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"
"${ANDROID_NDK_PATH}/toolchains/${NDK_ARCHITECTURE}-${GCC_VERSION}/prebuilt/linux-x86/bin"
NO_DEFAULT_PATH
)
if(NOT GCC_EXECUTABLE)
......@@ -118,11 +120,11 @@ else()
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/${NDK_ARCHITECTURE}-${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/${NDK_ARCHITECTURE}-${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"
"${ANDROID_NDK_PATH}/toolchains/${NDK_ARCHITECTURE}-${GCC_VERSION}/prebuilt/linux-x86/bin"
NO_DEFAULT_PATH
)
if(NOT GCC_EXECUTABLE)
......@@ -160,7 +162,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
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_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/${NDK_ARCHITECTURE}/include")
if(EXISTS "${ANDROID_NDK_PATH}/sources/android/cpufeatures/cpu-features.c")
set(ANDROID_CPU_FEATURES_INCLUDE_DIRS "${ANDROID_NDK_PATH}/sources/android/cpufeatures")
elseif(EXISTS "${ANDROID_NDK_PATH}/sources/cpufeatures/cpu-features.c")
......@@ -177,7 +179,7 @@ if(GCC_LIBRARY_PATH)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -L${GCC_LIBRARY_PATH}" CACHE STRING "linker flags" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -L${GCC_LIBRARY_PATH}" CACHE STRING "linker flags" FORCE)
endif()
set(GNUSTL_PATH "${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/${GCC_VERSION}/libs/${CMAKE_SYSTEM_PROCESSOR}")
set(GNUSTL_PATH "${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/${GCC_VERSION}/libs/${NDK_ARCHITECTURE}")
#link_directories("${GNUSTL_PATH}")
# link_directories has no effet for external projects so add the gnustl library path to the compiler flags
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${GNUSTL_PATH}" CACHE STRING "linker flags" FORCE)
......
############################################################################
# toolchan-android-arm.cmake
# toolchain-android-arm.cmake
# Copyright (C) 2016 Belledonne Communications, Grenoble France
#
############################################################################
......
############################################################################
# toolchain-android-arm64.cmake
# Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
############################################################################
set(CMAKE_ANDROID_API 21)
set(CMAKE_SYSTEM_PROCESSOR "aarch64")
set(ARCHITECTURE "arm64")
set(NDK_ARCHITECTURE "arm64-v8a")
set(COMPILER_PREFIX "aarch64-linux-android")
set(CLANG_TARGET "aarch64-none-linux-android")
include("${CMAKE_CURRENT_LIST_DIR}/android/toolchain-android.cmake")
link_libraries("m")
add_compile_options(
"-ffunction-sections"
"-funwind-tables"
"-fstack-protector"
"-no-canonical-prefixes"
"-fomit-frame-pointer"
"-fno-strict-aliasing"
)
if(NOT CLANG_EXECUTABLE)
add_compile_options(
"-finline-limit=300"
)
endif()
link_libraries(
"-no-canonical-prefixes"
"-Wl,--no-undefined"
"-Wl,-z,noexecstack"
"-Wl,-z,relro"
"-Wl,-z,now"
)
############################################################################
# toolchan-android-armv7.cmake
# toolchain-android-armv7.cmake
# Copyright (C) 2016 Belledonne Communications, Grenoble France
#
############################################################################
......
############################################################################
# toolchan-android-x86.cmake
# toolchain-android-x86.cmake
# Copyright (C) 2016 Belledonne Communications, Grenoble France
#
############################################################################
......
############################################################################
# toolchan-ios-i386.cmake
# toolchain-ios-i386.cmake
# Copyright (C) 2014 Belledonne Communications, Grenoble France
#
############################################################################
......
############################################################################
# toolchan-ios-x86_64.cmake
# toolchain-ios-x86_64.cmake
# Copyright (C) 2015 Belledonne Communications, Grenoble France
#
############################################################################
......
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