config-android.cmake 7.28 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
# Define options that are specific to the android config
24
lcb_add_option("Arch suffix" "Append the android abi to shared libraries" ON)
25 26 27
lcb_add_dependent_option("Embedded OpenH264" "Embed the openh264 library instead of downloading it from Cisco." "${DEFAULT_VALUE_ENABLE_EMBEDDED_OPENH264}" "ENABLE_OPENH264" OFF)


28
# Define default values for the linphone builder options
29
set(DEFAULT_VALUE_ENABLE_FFMPEG OFF)
30 31 32 33
set(DEFAULT_VALUE_ENABLE_GPL_THIRD_PARTIES ON)
set(DEFAULT_VALUE_ENABLE_GSM ON)
set(DEFAULT_VALUE_ENABLE_ILBC ON)
set(DEFAULT_VALUE_ENABLE_ISAC ON)
Erwan Croze's avatar
Erwan Croze committed
34
set(DEFAULT_VALUE_ENABLE_JPEG ON)
35
set(DEFAULT_VALUE_ENABLE_MBEDTLS ON)
36 37
set(DEFAULT_VALUE_ENABLE_MKV ON)
set(DEFAULT_VALUE_ENABLE_OPUS ON)
Erwan Croze's avatar
Erwan Croze committed
38
set(DEFAULT_VALUE_ENABLE_SILK OFF)
39
set(DEFAULT_VALUE_ENABLE_SPEEX ON)
40
set(DEFAULT_VALUE_ENABLE_G729 ${DEFAULT_VALUE_ENABLE_GPL_THIRD_PARTIES})
41
set(DEFAULT_VALUE_ENABLE_G729B_CNG OFF)
42 43
set(DEFAULT_VALUE_ENABLE_SRTP ON)
set(DEFAULT_VALUE_ENABLE_UNIT_TESTS ON)
44
set(DEFAULT_VALUE_ENABLE_VCARD ON)
45 46
set(DEFAULT_VALUE_ENABLE_VIDEO ON)
set(DEFAULT_VALUE_ENABLE_VPX ON)
47
set(DEFAULT_VALUE_ENABLE_WEBRTC_AECM ON)
48
set(DEFAULT_VALUE_ENABLE_WEBRTC_AEC ON)
49
set(DEFAULT_VALUE_ENABLE_ZRTP ON)
Brieuc's avatar
Brieuc committed
50
set(DEFAULT_VALUE_ENABLE_LIME ON)
51
set(DEFAULT_VALUE_ENABLE_TOOLS OFF)
52
set(DEFAULT_VALUE_ENABLE_JAVA_WRAPPER ON)
53
set(ENABLE_NLS NO CACHE BOOL "" FORCE)
54 55 56 57 58 59 60

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")


# Global configuration
set(LINPHONE_BUILDER_HOST "${CMAKE_SYSTEM_PROCESSOR}-linux-android")
61
set(CMAKE_INSTALL_RPATH "$ORIGIN")
62 63 64 65 66 67 68 69 70 71
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)
72
endif()
73

74

75 76 77 78 79
# Include builders
include(builders/CMakeLists.txt)


# bctoolbox
80
lcb_builder_linking_type(bctoolbox "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")
81
lcb_builder_cmake_options(bctoolbox "-DENABLE_TESTS=NO")
82

83 84 85 86
# belcard
lcb_builder_cmake_options(belcard "-DENABLE_TOOLS=NO")
lcb_builder_cmake_options(belcard "-DENABLE_UNIT_TESTS=NO")

87
# belle-sip
88
lcb_builder_cmake_options(bellesip "-DENABLE_TESTS=NO")
89

90 91 92
# belr
lcb_builder_cmake_options(belr "-DENABLE_TESTS=NO")

93
# bzrtp
94
lcb_builder_cmake_options(bzrtp "-DENABLE_TESTS=NO")
95 96

# codec2
Ghislain MARY's avatar
Ghislain MARY committed
97
lcb_builder_extra_cflags(codec2 "-ffast-math")
98 99

# ffmpeg
Ghislain MARY's avatar
Ghislain MARY committed
100
lcb_builder_linking_type(ffmpeg "--enable-static" "--disable-shared" "--enable-pic")
101 102

# linphone
103 104 105 106 107 108 109 110
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
111
lcb_builder_linking_type(linphone "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")
112

113
# mbedtls
Ghislain MARY's avatar
Ghislain MARY committed
114
lcb_builder_linking_type(mbedtls "-DUSE_STATIC_MBEDTLS_LIBRARY=YES" "-DUSE_SHARED_MBEDTLS_LIBRARY=NO")
115

116
# mediastreamer2
117 118 119 120 121 122 123 124 125 126
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_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")
127
lcb_builder_cmake_options(ms2 "-DENABLE_UNIT_TESTS=NO")
Ghislain MARY's avatar
Ghislain MARY committed
128
lcb_builder_linking_type(ms2 "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")
129

Erwan Croze's avatar
Erwan Croze committed
130
# openh264
131 132 133
if(NOT ENABLE_EMBEDDED_OPENH264)
	lcb_builder_linking_type(openh264 "-shared")
endif()
Erwan Croze's avatar
Erwan Croze committed
134

135
# opus
136
lcb_builder_cmake_options(opus "-DENABLE_FIXED_POINT=YES")
137 138 139 140
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv5te")
	lcb_builder_cmake_options(opus "-DENABLE_ASM=NO")
	lcb_builder_cmake_options(opus "-DENABLE_INTRINSICS=NO")
endif()
141 142

# ortp
143
lcb_builder_cmake_options(ortp "-DENABLE_DOC=NO")
Ghislain MARY's avatar
Ghislain MARY committed
144
lcb_builder_linking_type(ortp "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")
145 146

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

149 150 151
# soci
lcb_builder_linking_type(soci "-DSOCI_STATIC=YES" "-DSOCI_SHARED=NO")

152
# speex
153 154
lcb_builder_cmake_options(speex "-DENABLE_FLOAT_API=NO")
lcb_builder_cmake_options(speex "-DENABLE_FIXED_POINT=YES")
155
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a")
156
	lcb_builder_cmake_options(speex "-DENABLE_ARM_NEON_INTRINSICS=YES")
157
endif()
158 159

# vpx
Ghislain MARY's avatar
Ghislain MARY committed
160
lcb_builder_linking_type(vpx "--enable-static" "--disable-shared")
161 162

# x264
Ghislain MARY's avatar
Ghislain MARY committed
163 164
lcb_builder_linking_type(x264 "--enable-static" "--enable-pic")
lcb_builder_install_target(x264 "install-lib-static")
165 166


167
# Copy c++ library to install prefix
168 169 170 171 172 173 174 175 176
if(CMAKE_ANDROID_NDK_VERSION VERSION_LESS 16)
	file(COPY "${CMAKE_ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${CMAKE_CXX_ANDROID_TOOLCHAIN_VERSION}/libs/${CMAKE_ANDROID_ARCH_ABI}/libgnustl_shared.so"
		DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
	)
else()
	file(COPY "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${CMAKE_ANDROID_ARCH_ABI}/libc++_shared.so"
		DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
	)
endif()
177 178


179 180 181 182 183 184 185 186 187 188 189 190 191 192
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}
	)
193 194 195 196 197 198

	# 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)
199
endif()