config-android.cmake 6.38 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
############################################################################
# config-android.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
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 21 22
#
############################################################################

23
include(${CMAKE_CURRENT_LIST_DIR}/options-android.cmake)
24 25


26 27 28 29 30

set(DEFAULT_VALUE_CMAKE_LINKING_TYPE "-DENABLE_STATIC=YES" "-DENABLE_SHARED=NO")
set(DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")


31 32
# Global configuration
set(LINPHONE_BUILDER_HOST "${CMAKE_SYSTEM_PROCESSOR}-linux-android")
33
set(CMAKE_INSTALL_RPATH "$ORIGIN")
34 35 36 37 38 39 40 41 42 43
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv5te")
	if(ENABLE_VIDEO)
		message(STATUS "Disabling video for armv6")
		set(ENABLE_VIDEO NO CACHE BOOL "" FORCE)
		set(ENABLE_FFMPEG NO CACHE BOOL "" FORCE)
		set(ENABLE_OPENH264 NO CACHE BOOL "" FORCE)
		set(ENABLE_VPX NO CACHE BOOL "" FORCE)
		set(ENABLE_X264 NO CACHE BOOL "" FORCE)
	endif()
	set(ENABLE_WEBRTC_AEC NO CACHE BOOL "" FORCE)
44
endif()
45

46

47 48 49 50 51
# Include builders
include(builders/CMakeLists.txt)


# bctoolbox
52
lcb_builder_linking_type(bctoolbox "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")
53
lcb_builder_cmake_options(bctoolbox "-DENABLE_TESTS=NO")
54

55 56 57 58
# belcard
lcb_builder_cmake_options(belcard "-DENABLE_TOOLS=NO")
lcb_builder_cmake_options(belcard "-DENABLE_UNIT_TESTS=NO")

59
# belle-sip
60
lcb_builder_cmake_options(bellesip "-DENABLE_TESTS=NO")
61

62 63 64
# belr
lcb_builder_cmake_options(belr "-DENABLE_TESTS=NO")

65
# bzrtp
66
lcb_builder_cmake_options(bzrtp "-DENABLE_TESTS=NO")
67 68

# codec2
Ghislain MARY's avatar
Ghislain MARY committed
69
lcb_builder_extra_cflags(codec2 "-ffast-math")
70 71

# ffmpeg
Ghislain MARY's avatar
Ghislain MARY committed
72
lcb_builder_linking_type(ffmpeg "--enable-static" "--disable-shared" "--enable-pic")
73

74 75 76
# lime
lcb_builder_cmake_options(lime "-DENABLE_UNIT_TESTS=NO")

77
# linphone
78 79 80 81 82 83 84 85
lcb_builder_cmake_options(linphone "-DENABLE_RELATIVE_PREFIX=YES")
lcb_builder_cmake_options(linphone "-DENABLE_CONSOLE_UI=NO")
lcb_builder_cmake_options(linphone "-DENABLE_DAEMON=NO")
lcb_builder_cmake_options(linphone "-DENABLE_NOTIFY=NO")
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")
Ghislain MARY's avatar
Ghislain MARY committed
86
lcb_builder_linking_type(linphone "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")
87

88
# mbedtls
Ghislain MARY's avatar
Ghislain MARY committed
89
lcb_builder_linking_type(mbedtls "-DUSE_STATIC_MBEDTLS_LIBRARY=YES" "-DUSE_SHARED_MBEDTLS_LIBRARY=NO")
90

91
# mediastreamer2
92 93 94 95 96 97 98 99 100
lcb_builder_cmake_options(ms2 "-DENABLE_RELATIVE_PREFIX=YES")
lcb_builder_cmake_options(ms2 "-DENABLE_ALSA=NO")
lcb_builder_cmake_options(ms2 "-DENABLE_ANDROIDSND=YES")
lcb_builder_cmake_options(ms2 "-DENABLE_PULSEAUDIO=NO")
lcb_builder_cmake_options(ms2 "-DENABLE_OSS=NO")
lcb_builder_cmake_options(ms2 "-DENABLE_GLX=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")
101
lcb_builder_cmake_options(ms2 "-DENABLE_UNIT_TESTS=NO")
Ghislain MARY's avatar
Ghislain MARY committed
102
lcb_builder_linking_type(ms2 "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")
103

Erwan Croze's avatar
Erwan Croze committed
104
# openh264
105 106 107
if(NOT ENABLE_EMBEDDED_OPENH264)
	lcb_builder_linking_type(openh264 "-shared")
endif()
Erwan Croze's avatar
Erwan Croze committed
108

109
# opus
110
lcb_builder_cmake_options(opus "-DENABLE_FIXED_POINT=YES")
111 112 113 114
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv5te")
	lcb_builder_cmake_options(opus "-DENABLE_ASM=NO")
	lcb_builder_cmake_options(opus "-DENABLE_INTRINSICS=NO")
endif()
115 116

# ortp
117
lcb_builder_cmake_options(ortp "-DENABLE_DOC=NO")
Ghislain MARY's avatar
Ghislain MARY committed
118
lcb_builder_linking_type(ortp "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")
119 120

# polarssl
Ghislain MARY's avatar
Ghislain MARY committed
121
lcb_builder_linking_type(polarssl "-DUSE_SHARED_POLARSSL_LIBRARY=NO")
122

123
# soci
124
lcb_builder_linking_type(soci "-DSOCI_STATIC=YES" "-DSOCI_SHARED=NO")
125

126
# speex
127 128
lcb_builder_cmake_options(speex "-DENABLE_FLOAT_API=NO")
lcb_builder_cmake_options(speex "-DENABLE_FIXED_POINT=YES")
129
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a")
130
	lcb_builder_cmake_options(speex "-DENABLE_ARM_NEON_INTRINSICS=YES")
131
endif()
132 133

# vpx
Ghislain MARY's avatar
Ghislain MARY committed
134
lcb_builder_linking_type(vpx "--enable-static" "--disable-shared")
135 136

# x264
Ghislain MARY's avatar
Ghislain MARY committed
137 138
lcb_builder_linking_type(x264 "--enable-static" "--enable-pic")
lcb_builder_install_target(x264 "install-lib-static")
139 140


141
# Copy c++ library to install prefix
142 143 144 145 146 147 148 149 150 151 152 153 154
file(COPY "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${CMAKE_ANDROID_ARCH_ABI}/libc++_shared.so"
	DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
)
if(ENABLE_SANITIZER)
	set(SANITIZER_ARCH ${CMAKE_SYSTEM_PROCESSOR})
	if(SANITIZER_ARCH MATCHES "^arm")
		set(SANITIZER_ARCH "arm")
	endif()
	file(GLOB_RECURSE _clang_rt_library "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/${ANDROID_HOST_TAG}/*/clang/*/lib/linux/libclang_rt.asan-${SANITIZER_ARCH}-android.so")
	if(_clang_rt_library)
		list(GET _clang_rt_library 0 _clang_rt_library)
		file(COPY ${_clang_rt_library} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
		configure_file("${CMAKE_CURRENT_SOURCE_DIR}/configs/android/wrap.sh.cmake" "${CMAKE_INSTALL_PREFIX}/lib/wrap.sh" @ONLY)
155
	endif()
156
endif()
157 158


159 160 161 162 163 164 165 166 167 168 169 170 171 172
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
	# GDB server setup
	linphone_builder_apply_flags()
	linphone_builder_set_ep_directories(gdbserver)
	linphone_builder_expand_external_project_vars()
	ExternalProject_Add(TARGET_gdbserver
		DEPENDS TARGET_linphone_builder
		TMP_DIR ${ep_tmp}
		BINARY_DIR ${ep_build}
		SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/android/gdbserver"
		DOWNLOAD_COMMAND ""
		CMAKE_GENERATOR ${CMAKE_GENERATOR}
		CMAKE_ARGS ${LINPHONE_BUILDER_EP_ARGS} -DANDROID_NDK_PATH=${ANDROID_NDK_PATH} -DARCHITECTURE=${ARCHITECTURE}
	)
173 174 175 176 177 178

	# Dummy stript to not strip compiled libs from the general Makefile
	file(WRITE "${LINPHONE_BUILDER_WORK_DIR}/strip.sh" "")
else()
	# Script to be able to strip compiled libs from the general Makefile
	configure_file("${CMAKE_CURRENT_LIST_DIR}/android/strip.sh.cmake" "${LINPHONE_BUILDER_WORK_DIR}/strip.sh" @ONLY)
179
endif()