CMakeLists.txt 9.45 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
############################################################################
# CMakeLists.txt
# Copyright (C) 2014  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.
#
############################################################################

23
if(LINPHONE_BUILDER_CHECK_LATEST)
Ghislain MARY's avatar
Ghislain MARY committed
24

25
	find_package(Git)
Ghislain MARY's avatar
Ghislain MARY committed
26

27 28 29 30 31 32 33 34 35 36 37 38
	file(GLOB _builders RELATIVE ${CMAKE_CURRENT_LIST_DIR} "${CMAKE_CURRENT_LIST_DIR}/*.cmake")
	list(SORT _builders)
	foreach(_builder ${_builders})
		include("${CMAKE_CURRENT_LIST_DIR}/${_builder}")
		get_filename_component(_builder_name ${_builder} NAME_WE)
		if(EP_${_builder_name}_GIT_TAG_LATEST)
			execute_process(COMMAND "${GIT_EXECUTABLE}" "ls-remote" "${EP_${_builder_name}_GIT_REPOSITORY}" "${EP_${_builder_name}_GIT_TAG_LATEST}"
				OUTPUT_FILE "${LINPHONE_BUILDER_WORK_DIR}/EP_${_builder_name}_git_latest")
			execute_process(COMMAND "head" "-n1" "${LINPHONE_BUILDER_WORK_DIR}/EP_${_builder_name}_git_latest"
				OUTPUT_VARIABLE _builder_latest)
			string(REPLACE "\t" ";" _builder_latest ${_builder_latest})
			list(GET _builder_latest 0 _builder_latest_git_tag)
Ghislain MARY's avatar
Ghislain MARY committed
39
			if(EP_${_builder_name}_GIT_TAG STREQUAL "${_builder_latest_git_tag}")
40 41 42 43 44 45 46 47
				message(STATUS "${_builder_name} is up-to-date")
			else()
				message(STATUS "${_builder_name} is outdated: ${EP_${_builder_name}_GIT_TAG} instead of ${_builder_latest_git_tag} [${EP_${_builder_name}_GIT_TAG_LATEST}]")
			endif()
		else()
			message(STATUS "${_builder_name} is up-to-date")
		endif()
	endforeach()
48

49
else()
Ghislain MARY's avatar
Ghislain MARY committed
50

51 52 53
	# Include builder options definitions according to the targets to be built
	include(CMakeDependentOption)
	include(FeatureSummary)
54
	include(${CMAKE_CURRENT_LIST_DIR}/../options/common.cmake)
55
	foreach(_target ${LINPHONE_BUILDER_TARGETS})
56 57
		if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../options/${_target}.cmake)
			include(${CMAKE_CURRENT_LIST_DIR}/../options/${_target}.cmake)
58 59
		endif()
	endforeach()
Ghislain MARY's avatar
Ghislain MARY committed
60

61
	add_custom_target(TARGET_linphone_builder ALL)
Ghislain MARY's avatar
Ghislain MARY committed
62

63 64 65 66 67
	# Build belle-sip and its dependencies if it is in the targets list
	list(FIND LINPHONE_BUILDER_TARGETS "belle-sip" _target_found)
	if(_target_found GREATER -1)
		add_custom_target(TARGET_bellesip ALL)
		add_dependencies(TARGET_linphone_builder TARGET_bellesip)
68 69 70
		if(LINPHONE_BUILDER_BUILD_DEPENDENCIES)
			linphone_builder_add_builder_to_target(TARGET_bellesip antlr3c)
			linphone_builder_add_builder_to_target(TARGET_bellesip polarssl)
jehan's avatar
jehan committed
71
			linphone_builder_add_builder_to_target(TARGET_bellesip bctoolbox)
72 73 74
			if(ENABLE_UNIT_TESTS)
				linphone_builder_add_builder_to_target(TARGET_bellesip cunit)
			endif()
75 76 77 78 79
		endif()
		if(ENABLE_TUNNEL)
			linphone_builder_add_builder_to_target(TARGET_bellesip tunnel)
		endif()
		linphone_builder_add_builder_to_target(TARGET_bellesip bellesip)
80
	endif()
Ghislain MARY's avatar
Ghislain MARY committed
81

82

83 84 85 86 87 88
	# Build ortp and its dependencies if it is in the targets list
	list(FIND LINPHONE_BUILDER_TARGETS "ortp" _target_found)
	if(_target_found GREATER -1)
		add_custom_target(TARGET_ortp ALL)
		add_dependencies(TARGET_linphone_builder TARGET_ortp)
		linphone_builder_add_builder_to_target(TARGET_ortp ortp)
89
	endif()
90

91

92 93 94 95 96 97
	# Build mediastreamer2 and its dependencies if it is in the targets list
	list(FIND LINPHONE_BUILDER_TARGETS "ms2" _target_found)
	if(_target_found GREATER -1)
		add_custom_target(TARGET_ms2 ALL)
		add_dependencies(TARGET_linphone_builder TARGET_ms2)
		add_dependencies(TARGET_ms2 TARGET_ortp)
98 99 100 101 102 103 104
		if(LINPHONE_BUILDER_BUILD_DEPENDENCIES)
			if(ENABLE_UNIT_TESTS)
				linphone_builder_add_builder_to_target(TARGET_ms2 cunit)
			endif()
			if(ENABLE_GSM)
				linphone_builder_add_builder_to_target(TARGET_ms2 gsm)
			endif()
105 106 107
			if(ENABLE_BV16)
				linphone_builder_add_builder_to_target(TARGET_ms2 bv16)
			endif()
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
			if(ENABLE_OPUS)
				linphone_builder_add_builder_to_target(TARGET_ms2 opus)
			endif()
			if(ENABLE_SPEEX)
				linphone_builder_add_builder_to_target(TARGET_ms2 speex)
			endif()
			if(ENABLE_FFMPEG)
				linphone_builder_add_builder_to_target(TARGET_ms2 ffmpeg)
			endif()
			if(ENABLE_VPX)
				linphone_builder_add_builder_to_target(TARGET_ms2 vpx)
			endif()
			if(ENABLE_V4L)
				linphone_builder_add_builder_to_target(TARGET_ms2 v4l)
			endif()
123 124 125
			if(ENABLE_MKV)
				linphone_builder_add_builder_to_target(TARGET_ms2 matroska2)
			endif()
126 127 128 129 130
			if(ENABLE_SRTP)
				linphone_builder_add_builder_to_target(TARGET_ms2 srtp)
			endif()
			if(ENABLE_ZRTP)
				linphone_builder_add_builder_to_target(TARGET_ms2 polarssl)
131 132 133 134
				if(NOT IOS)
					# Do not build xml2 on IOS, it is provided by the system
					linphone_builder_add_builder_to_target(TARGET_ms2 xml2)
				endif()
135
			endif()
136 137 138 139 140
		endif()
		if(ENABLE_ZRTP)
			linphone_builder_add_builder_to_target(TARGET_ms2 bzrtp)
		endif()
		linphone_builder_add_builder_to_target(TARGET_ms2 ms2)
141
	endif()
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161


	# Build mediastreamer2 plugins and its dependencies if it is in the targets list
	list(FIND LINPHONE_BUILDER_TARGETS "ms2-plugins" _target_found)
	if(_target_found GREATER -1)
		add_custom_target(TARGET_ms2plugins ALL)
		add_dependencies(TARGET_linphone_builder TARGET_ms2plugins)
		add_dependencies(TARGET_ms2plugins TARGET_ms2 TARGET_ortp)
		if(ENABLE_AMRNB OR ENABLE_AMRWB)
			linphone_builder_add_builder_to_target(TARGET_ms2plugins opencoreamr)
		endif()
		if(ENABLE_AMRWB)
			linphone_builder_add_builder_to_target(TARGET_ms2plugins voamrwbenc)
		endif()
		if(ENABLE_AMRNB OR ENABLE_AMRWB)
			linphone_builder_add_builder_to_target(TARGET_ms2plugins msamr)
		endif()
		if(ENABLE_G729)
			linphone_builder_add_builder_to_target(TARGET_ms2plugins bcg729)
		endif()
162
		if(ENABLE_ISAC OR ENABLE_ILBC OR ENABLE_WEBRTC_AEC)
163 164 165 166 167 168 169 170 171
			linphone_builder_add_builder_to_target(TARGET_ms2plugins mswebrtc)
		endif()
		if(ENABLE_SILK)
			linphone_builder_add_builder_to_target(TARGET_ms2plugins mssilk)
		endif()
		if(ENABLE_OPENH264)
			linphone_builder_add_builder_to_target(TARGET_ms2plugins openh264)
			linphone_builder_add_builder_to_target(TARGET_ms2plugins msopenh264)
		endif()
Ghislain MARY's avatar
Ghislain MARY committed
172 173 174
		if(ENABLE_WASAPI)
			linphone_builder_add_builder_to_target(TARGET_ms2plugins mswasapi)
		endif()
175 176 177 178
		if(ENABLE_X264)
			linphone_builder_add_builder_to_target(TARGET_ms2plugins x264)
			linphone_builder_add_builder_to_target(TARGET_ms2plugins msx264)
		endif()
Ghislain MARY's avatar
Ghislain MARY committed
179
		if(ENABLE_VIDEO AND (CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone"))
Ghislain MARY's avatar
Ghislain MARY committed
180 181
			linphone_builder_add_builder_to_target(TARGET_ms2plugins mswp8vid)
		endif()
182 183 184
		if(ENABLE_VIDEO AND (CMAKE_SYSTEM_NAME STREQUAL "WindowsStore"))
			linphone_builder_add_builder_to_target(TARGET_ms2plugins mswinrtvid)
		endif()
185 186 187
	endif()


188 189 190 191 192 193
	# Build linphone and its dependencies if it is in the targets list
	list(FIND LINPHONE_BUILDER_TARGETS "linphone" _target_found)
	if(_target_found GREATER -1)
		add_custom_target(TARGET_linphone ALL)
		add_dependencies(TARGET_linphone_builder TARGET_linphone)
		add_dependencies(TARGET_linphone TARGET_bellesip TARGET_ortp TARGET_ms2)
194
		if(LINPHONE_BUILDER_BUILD_DEPENDENCIES)
195 196 197 198
			if(NOT IOS)
				# Do not build sqlite3, xml2 and zlib on IOS, they are provided by the system
				linphone_builder_add_builder_to_target(TARGET_linphone sqlite3)
				linphone_builder_add_builder_to_target(TARGET_linphone xml2)
Ghislain MARY's avatar
Ghislain MARY committed
199
				if(NOT QNX)
200 201
					linphone_builder_add_builder_to_target(TARGET_linphone zlib)
				endif()
202
			endif()
203 204 205
			if(ENABLE_UNIT_TESTS)
				linphone_builder_add_builder_to_target(TARGET_linphone cunit)
			endif()
206 207 208 209
		endif()
		if(ENABLE_TUNNEL)
			linphone_builder_add_builder_to_target(TARGET_linphone tunnel)
		endif()
210 211 212 213
		if(ENABLE_VCARD)
			linphone_builder_add_builder_to_target(TARGET_linphone belr)
			linphone_builder_add_builder_to_target(TARGET_linphone belcard)
		endif()
214
		linphone_builder_add_builder_to_target(TARGET_linphone linphone)
215
	endif()
216 217 218 219 220 221

	# Build flexisip and its dependencies if it is in the targets list
	list(FIND LINPHONE_BUILDER_TARGETS "flexisip" _target_found)
	if(_target_found GREATER -1)
		add_custom_target(TARGET_flexisip ALL)
		add_dependencies(TARGET_linphone_builder TARGET_flexisip)
Ghislain MARY's avatar
Ghislain MARY committed
222
		add_dependencies(TARGET_flexisip TARGET_ortp)
jehan's avatar
jehan committed
223
		if(ENABLE_PRESENCE)
224 225 226 227 228
			if(LINPHONE_BUILDER_BUILD_DEPENDENCIES)
                        	linphone_builder_add_builder_to_target(TARGET_flexisip antlr3c)
                        	linphone_builder_add_builder_to_target(TARGET_flexisip polarssl)
                	endif()
                	linphone_builder_add_builder_to_target(TARGET_flexisip bellesip)
jehan's avatar
jehan committed
229
		endif()	
Ghislain MARY's avatar
Ghislain MARY committed
230 231 232 233 234 235 236 237 238 239 240 241
		if(ENABLE_BC_ODBC)
			linphone_builder_add_builder_to_target(TARGET_flexisip unixodbc)
			linphone_builder_add_builder_to_target(TARGET_flexisip myodbc)
		endif()
		linphone_builder_add_builder_to_target(TARGET_flexisip sofiasip)
		if(ENABLE_ODB)
			linphone_builder_add_builder_to_target(TARGET_flexisip odb)
			linphone_builder_add_builder_to_target(TARGET_flexisip libodb)
			linphone_builder_add_builder_to_target(TARGET_flexisip libodbmysql)
		endif()
		if(ENABLE_REDIS)
			linphone_builder_add_builder_to_target(TARGET_flexisip hiredis)
242
		endif()	
Ghislain MARY's avatar
Ghislain MARY committed
243
		linphone_builder_add_builder_to_target(TARGET_flexisip flexisip)
244
	endif()
245

246
endif()