config-android.cmake 6.47 KB
Newer Older
Ghislain MARY's avatar
Ghislain MARY committed
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.
Ghislain MARY's avatar
Ghislain MARY committed
20 21 22
#
############################################################################

23 24 25 26
# Define options that are specific to the android config
lcb_add_dependent_option("Embedded OpenH264" "Embed the openh264 library instead of downloading it from Cisco." "${DEFAULT_VALUE_ENABLE_EMBEDDED_OPENH264}" "ENABLE_OPENH264" OFF)


Ghislain MARY's avatar
Ghislain MARY committed
27
# Define default values for the linphone builder options
28
set(DEFAULT_VALUE_ENABLE_FFMPEG OFF)
Ghislain MARY's avatar
Ghislain MARY committed
29 30 31 32
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
33
set(DEFAULT_VALUE_ENABLE_JPEG ON)
34
set(DEFAULT_VALUE_ENABLE_MBEDTLS ON)
Ghislain MARY's avatar
Ghislain MARY committed
35 36 37 38 39 40
set(DEFAULT_VALUE_ENABLE_MKV ON)
set(DEFAULT_VALUE_ENABLE_OPUS ON)
set(DEFAULT_VALUE_ENABLE_SILK ON)
set(DEFAULT_VALUE_ENABLE_SPEEX ON)
set(DEFAULT_VALUE_ENABLE_SRTP ON)
set(DEFAULT_VALUE_ENABLE_UNIT_TESTS ON)
Sylvain Berfini's avatar
Sylvain Berfini committed
41
set(DEFAULT_VALUE_ENABLE_VCARD ON)
Ghislain MARY's avatar
Ghislain MARY committed
42 43 44 45
set(DEFAULT_VALUE_ENABLE_VIDEO ON)
set(DEFAULT_VALUE_ENABLE_VPX ON)
set(DEFAULT_VALUE_ENABLE_WEBRTC_AEC ON)
set(DEFAULT_VALUE_ENABLE_ZRTP ON)
46
set(DEFAULT_VALUE_ENABLE_TOOLS OFF)
47
set(ENABLE_NLS NO CACHE BOOL "" FORCE)
Ghislain MARY's avatar
Ghislain MARY committed
48 49 50 51 52 53 54

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")
Ghislain MARY's avatar
Ghislain MARY committed
55
set(CMAKE_INSTALL_RPATH "$ORIGIN")
56 57
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi" AND ENABLE_VIDEO)
	message(STATUS "Disabling video for armv6")
58 59 60 61 62
	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)
63
endif()
Ghislain MARY's avatar
Ghislain MARY committed
64

65

66

Ghislain MARY's avatar
Ghislain MARY committed
67 68 69 70 71 72
# Include builders
include(builders/CMakeLists.txt)


# bctoolbox
set(EP_bctoolbox_LINKING_TYPE "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")
Ghislain MARY's avatar
Ghislain MARY committed
73
lcb_builder_cmake_options(bctoolbox "-DENABLE_TESTS=NO")
Ghislain MARY's avatar
Ghislain MARY committed
74 75

# belle-sip
Ghislain MARY's avatar
Ghislain MARY committed
76
lcb_builder_cmake_options(bellesip "-DENABLE_TESTS=NO")
Ghislain MARY's avatar
Ghislain MARY committed
77 78

# bzrtp
Ghislain MARY's avatar
Ghislain MARY committed
79
lcb_builder_cmake_options(bzrtp "-DENABLE_TESTS=NO")
Ghislain MARY's avatar
Ghislain MARY committed
80 81

# codec2
Ghislain MARY's avatar
Ghislain MARY committed
82
lcb_builder_extra_cflags(codec2 "-ffast-math")
Ghislain MARY's avatar
Ghislain MARY committed
83 84

# ffmpeg
Ghislain MARY's avatar
Ghislain MARY committed
85
lcb_builder_linking_type(ffmpeg "--enable-static" "--disable-shared" "--enable-pic")
Ghislain MARY's avatar
Ghislain MARY committed
86 87

# linphone
Ghislain MARY's avatar
Ghislain MARY committed
88 89 90 91
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")
92
lcb_builder_cmake_options(linphone "-DENABLE_TOOLS=DEFAULT_VALUE_ENABLE_TOOLS")
Ghislain MARY's avatar
Ghislain MARY committed
93 94 95 96 97
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")
Ghislain MARY's avatar
Ghislain MARY committed
98
lcb_builder_linking_type(linphone "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")
Ghislain MARY's avatar
Ghislain MARY committed
99

100
# mbedtls
Ghislain MARY's avatar
Ghislain MARY committed
101
lcb_builder_linking_type(mbedtls "-DUSE_STATIC_MBEDTLS_LIBRARY=YES" "-DUSE_SHARED_MBEDTLS_LIBRARY=NO")
102

Ghislain MARY's avatar
Ghislain MARY committed
103
# mediastreamer2
Ghislain MARY's avatar
Ghislain MARY committed
104 105 106 107 108 109 110 111 112
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")
113
lcb_builder_cmake_options(ms2 "-DENABLE_TOOLS=DEFAULT_VALUE_ENABLE_TOOLS")
Ghislain MARY's avatar
Ghislain MARY committed
114 115
lcb_builder_cmake_options(ms2 "-DENABLE_DOC=NO")
lcb_builder_cmake_options(ms2 "-DENABLE_UNIT_TESTS=NO")
Ghislain MARY's avatar
Ghislain MARY committed
116
lcb_builder_linking_type(ms2 "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")
Ghislain MARY's avatar
Ghislain MARY committed
117

Erwan Croze's avatar
Erwan Croze committed
118
# openh264
119 120 121
if(NOT ENABLE_EMBEDDED_OPENH264)
	lcb_builder_linking_type(openh264 "-shared")
endif()
Erwan Croze's avatar
Erwan Croze committed
122

Ghislain MARY's avatar
Ghislain MARY committed
123
# opus
Ghislain MARY's avatar
Ghislain MARY committed
124
lcb_builder_cmake_options(opus "-DENABLE_FIXED_POINT=YES")
Ghislain MARY's avatar
Ghislain MARY committed
125 126

# ortp
Ghislain MARY's avatar
Ghislain MARY committed
127
lcb_builder_cmake_options(ortp "-DENABLE_DOC=NO")
Ghislain MARY's avatar
Ghislain MARY committed
128
lcb_builder_linking_type(ortp "-DENABLE_STATIC=NO" "-DENABLE_SHARED=YES")
Ghislain MARY's avatar
Ghislain MARY committed
129 130

# polarssl
Ghislain MARY's avatar
Ghislain MARY committed
131
lcb_builder_linking_type(polarssl "-DUSE_SHARED_POLARSSL_LIBRARY=NO")
Ghislain MARY's avatar
Ghislain MARY committed
132 133

# speex
Ghislain MARY's avatar
Ghislain MARY committed
134 135
lcb_builder_cmake_options(speex "-DENABLE_FLOAT_API=NO")
lcb_builder_cmake_options(speex "-DENABLE_FIXED_POINT=YES")
136
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi-v7a")
Ghislain MARY's avatar
Ghislain MARY committed
137
	lcb_builder_cmake_options(speex "-DENABLE_ARM_NEON_INTRINSICS=YES")
138
endif()
Ghislain MARY's avatar
Ghislain MARY committed
139 140

# vpx
Ghislain MARY's avatar
Ghislain MARY committed
141
lcb_builder_linking_type(vpx "--enable-static" "--disable-shared")
Ghislain MARY's avatar
Ghislain MARY committed
142 143

# x264
Ghislain MARY's avatar
Ghislain MARY committed
144 145
lcb_builder_linking_type(x264 "--enable-static" "--enable-pic")
lcb_builder_install_target(x264 "install-lib-static")
Ghislain MARY's avatar
Ghislain MARY committed
146 147


148 149 150 151 152 153
# 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"
	DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
)


Ghislain MARY's avatar
Ghislain MARY committed
154 155 156 157 158 159 160 161 162 163 164 165 166 167
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}
	)
168 169 170 171 172 173

	# 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)
Ghislain MARY's avatar
Ghislain MARY committed
174
endif()