CMakeLists.txt 17.3 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
cmake_minimum_required(VERSION 3.0)
24 25 26 27
project(MEDIASTREAMER2 C CXX)


set(MEDIASTREAMER_MAJOR_VERSION "2")
28
set(MEDIASTREAMER_MINOR_VERSION "12")
29
set(MEDIASTREAMER_MICRO_VERSION "1")
30
set(MEDIASTREAMER_VERSION "${MEDIASTREAMER_MAJOR_VERSION}.${MEDIASTREAMER_MINOR_VERSION}.${MEDIASTREAMER_MICRO_VERSION}")
31
set(MEDIASTREAMER_SO_VERSION "6")
32

33
string(REGEX MATCH "^(arm*|aarch64)" FIXED_POINT_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}")
34 35 36 37 38 39
if(FIXED_POINT_PROCESSOR)
	set(ENABLE_FIXED_POINT_DEFAULT_VALUE YES)
else()
	set(ENABLE_FIXED_POINT_DEFAULT_VALUE NO)
endif()
if(IOS)
40
	set(ENABLE_MACSND_DEFAULT_VALUE NO)
41 42
	set(ENABLE_MACAQSND_DEFAULT_VALUE YES)
else()
43
	set(ENABLE_MACSND_DEFAULT_VALUE YES)
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
	set(ENABLE_MACAQSND_DEFAULT_VALUE NO)
endif()
set(ENABLE_GLX_DEFAULT_VALUE NO)
set(ENABLE_X11_DEFAULT_VALUE NO)
if(UNIX)
	if(NOT APPLE)
		set(ENABLE_GLX_DEFAULT_VALUE YES)
		set(ENABLE_X11_DEFAULT_VALUE YES)
	endif()
endif()
if(UNIX AND NOT APPLE)
	set(LINUX_OR_BSD 1)
endif()

include(CMakeDependentOption)

option(ENABLE_STATIC "Build static library (default is shared library)." NO)
option(ENABLE_DEBUG_LOGS "Enable the display of traces showing the execution of the library." NO)
62
option(ENABLE_DOC "Enable documentation generation with Doxygen." YES)
63
option(ENABLE_FIXED_POINT "Turn on fixed point computations." ${ENABLE_FIXED_POINT_DEFAULT_VALUE})
64
option(ENABLE_NON_FREE_CODECS "Allow inclusion of non-free codecs in the build." NO)
65
option(ENABLE_PCAP "Enable PCAP support." NO)
66
option(ENABLE_STRICT "Build with strict compile options." YES)
67
option(ENABLE_RELATIVE_PREFIX "Find resources relatively to the installation directory." NO)
68
option(ENABLE_TOOLS "Turn on or off compilation of tools." YES)
69 70
option(ENABLE_UNIT_TESTS "Enable compilation of unit tests." YES)

71
cmake_dependent_option(ENABLE_DTLS "Build with DTLS support." YES "ENABLE_SRTP" NO)
72
option(ENABLE_SRTP "Build with the SRTP transport support." YES)
73
cmake_dependent_option(ENABLE_ZRTP "Build with ZRTP support." YES "ENABLE_SRTP" NO)
74 75 76 77

option(ENABLE_SOUND "Can be used to turn off all possible sound backends." YES)
cmake_dependent_option(ENABLE_ALSA "Enable ALSA support." YES "ENABLE_SOUND;LINUX_OR_BSD" NO)
cmake_dependent_option(ENABLE_ARTSC "Enable artsc (KDE<4) sound input/output." NO "ENABLE_SOUND;LINUX_OR_BSD" NO)
78
cmake_dependent_option(ENABLE_MACSND "Enable MAC OS X Audio Units sound support." ${ENABLE_MACSND_DEFAULT_VALUE} "ENABLE_SOUND;APPLE" NO)
79 80 81 82 83 84 85
cmake_dependent_option(ENABLE_MACAQSND "Enable native MAC OS X Audio Queue sound support." ${ENABLE_MACAQSND_DEFAULT_VALUE} "ENABLE_SOUND;APPLE" NO)
cmake_dependent_option(ENABLE_QSA "Enable QSA (QNX Sound Architecture) support." NO "ENABLE_SOUND" NO)
cmake_dependent_option(ENABLE_OSS "Enable OSS support." YES "ENABLE_SOUND;LINUX_OR_BSD" NO)
cmake_dependent_option(ENABLE_PORTAUDIO "Enable portaudio native support." NO "ENABLE_SOUND" NO)
cmake_dependent_option(ENABLE_PULSEAUDIO "Enable pulseaudio support." YES "ENABLE_SOUND" NO)
option(ENABLE_GSM "Build mediastreamer2 with the GSM codec." YES)
option(ENABLE_OPUS "Build mediastreamer2 with the OPUS codec." YES)
86
cmake_dependent_option(ENABLE_RESAMPLE "Build mediastreamer2 with the resampling capability." YES "ENABLE_SPEEX" NO)
87 88 89 90 91 92
option(ENABLE_SPEEX "Build mediastreamer2 with the SPEEX codec." YES)

option(ENABLE_VIDEO "Build mediastreamer2 with video support." YES)
cmake_dependent_option(ENABLE_FFMPEG "Build mediastreamer2 with ffmpeg video support." YES "ENABLE_VIDEO" NO)
cmake_dependent_option(ENABLE_GLX "Enable X11+OpenGL rendering support (requires glx and glew)." ${ENABLE_GLX_DEFAULT_VALUE} "ENABLE_VIDEO;UNIX" NO)
cmake_dependent_option(ENABLE_SDL "Enable SDL support." NO "ENABLE_FFMPEG" NO)
93
cmake_dependent_option(ENABLE_V4L "Enable Video4Linux support." YES "ENABLE_VIDEO;LINUX_OR_BSD" NO)
94 95 96 97
cmake_dependent_option(ENABLE_X11 "Enable X11 support." ${ENABLE_X11_DEFAULT_VALUE} "ENABLE_FFMPEG;UNIX" NO)
cmake_dependent_option(ENABLE_XV "Enable XV support." ${ENABLE_X11_DEFAULT_VALUE} "ENABLE_FFMPEG;UNIX" NO)
cmake_dependent_option(ENABLE_THEORA "Enable theora video codec support." YES "ENABLE_VIDEO" NO)
cmake_dependent_option(ENABLE_VPX "Build mediastreamer2 with VPX codec." YES "ENABLE_VIDEO" NO)
98
option(ENABLE_MKV "Enable support of MKV files reading and writing." YES)
99
cmake_dependent_option(ENABLE_QNX "Build medistreamer2 with BB10 filters." NO "ENABLE_VIDEO" NO)
100

101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117

macro(apply_compile_flags SOURCE_FILES)
	if(${SOURCE_FILES})
		set(options "")
		foreach(a ${ARGV})
			if(STRICT_OPTIONS_${a})
				string(REPLACE ";" " " options_${a} "${STRICT_OPTIONS_${a}}")
				set(options "${options} ${options_${a}}")
			endif()
		endforeach()
		if(options)
			set_source_files_properties(${${SOURCE_FILES}} PROPERTIES COMPILE_FLAGS "${options}")
		endif()
	endif()
endmacro()


118
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
119 120 121

include(CheckIncludeFile)
include(CheckLibraryExists)
122
include(CMakePushCheckState)
123

124
set(MSVC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/MSVC")
125
if(MSVC)
126
	list(APPEND CMAKE_REQUIRED_INCLUDES "${MSVC_INCLUDE_DIR}")
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
endif()

find_package(Threads)

check_include_file(sys/shm.h HAVE_SYS_SHM_H)
check_include_file(alloca.h HAVE_ALLOCA_H)
if(ENABLE_OSS)
	check_include_file(soundcard.h HAVE_SOUNDCARD_H)
	check_include_file(sys/soundcard.h HAVE_SYS_SOUNDCARD_H)
	check_include_file(machine/soundcard.h HAVE_MACHINE_SOUNDCARD_H)
	check_include_file(sys/audio.h HAVE_SYS_AUDIO_H)
	if(NOT (HAVE_SOUNDCARD_H OR HAVE_SYS_SOUNDCARD_H OR HAVE_MACHINE_SOUNDCARD_H OR HAVE_SYS_AUDIO_H))
		set(ENABLE_OSS OFF CACHE BOOL "Enable OSS support." FORCE)
	endif()
endif()

check_library_exists("dl" "dlopen" "" HAVE_DLOPEN)

include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)

148 149 150 151 152
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
	include("${EP_ortp_CONFIG_DIR}/ORTPConfig.cmake")
else()
	find_package(ORTP REQUIRED)
endif()
153
find_package(PolarSSL)
154 155 156
if(ENABLE_PCAP)
	find_package(PCAP QUIET)
endif()
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172

if(ENABLE_UNIT_TESTS)
	find_package(CUnit)
	if(CUNIT_FOUND)
		cmake_push_check_state(RESET)
		list(APPEND CMAKE_REQUIRED_INCLUDES ${CUNIT_INCLUDE_DIRS})
		list(APPEND CMAKE_REQUIRED_LIBRARIES ${CUNIT_LIBRARIES})
		check_symbol_exists("CU_get_suite" "CUnit/CUnit.h" HAVE_CU_GET_SUITE)
		check_symbol_exists("CU_curses_run_tests" "CUnit/CUnit.h" HAVE_CU_CURSES)
		cmake_pop_check_state()
	else()
		message(WARNING "Could not find the cunit library!")
		set(ENABLE_UNIT_TESTS OFF CACHE BOOL "Enable compilation of unit tests." FORCE)
	endif()
endif()

173 174 175 176 177
if(ENABLE_SRTP)
	find_package(SRTP)
	if(NOT SRTP_FOUND)
		message(WARNING "Could not find SRTP library, Mediastreamer2 will be compiled without SRTP support.")
		set(ENABLE_SRTP OFF CACHE BOOL "Build with the SRTP transport support." FORCE)
jehan's avatar
jehan committed
178
		set(ENABLE_DTLS OFF CACHE BOOL "Build mediastreamer2 with DTLS support." FORCE)
179 180
	endif()
endif()
181
if(ENABLE_ZRTP)
182 183 184 185 186
	if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
		include("${EP_bzrtp_CONFIG_DIR}/BZRTPConfig.cmake")
	else()
		find_package(BZRTP)
	endif()
187 188 189 190 191
	if(NOT BZRTP_FOUND)
		message(WARNING "Could not find bzrtp library, mediastreamer2 will be compiled without ZRTP support.")
		set(ENABLE_ZRTP OFF CACHE BOOL "Build mediastreamer2 with ZRTP support." FORCE)
	endif()
endif()
192
if(ENABLE_DTLS AND ENABLE_SRTP) # DTLS requires SRTP
193 194
	if(NOT POLARSSL_FOUND OR NOT HAVE_SSL_GET_DTLS_SRTP_PROTECTION_PROFILE)
		message(WARNING "Could not find polarssl library with DTLS support, mediastreamer2 will be compiled without DTLS support.")
195 196 197
		set(ENABLE_DTLS OFF CACHE BOOL "Build mediastreamer2 with DTLS support." FORCE)
	endif()
endif()
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
if(ENABLE_GSM)
	find_package(GSM)
	if(NOT GSM_FOUND)
		message(WARNING "Could not find GSM library, mediastreamer2 will be compiled without the GSM codec.")
		set(ENABLE_GSM OFF CACHE BOOL "Build mediastreamer2 with the GSM codec." FORCE)
	endif()
endif()
if(ENABLE_OPUS)
	find_package(Opus)
	if(NOT OPUS_FOUND)
		message(WARNING "Could not find opus library, mediastreamer2 will be compiled without the OPUS codec.")
		set(ENABLE_OPUS OFF CACHE BOOL "Build mediastreamer2 with the OPUS codec." FORCE)
	endif()
endif()
if(ENABLE_SPEEX)
	find_package(Speex)
	if(NOT SPEEX_FOUND)
		message(WARNING "Could not find speex library, mediastreamer2 will be compiled without the SPEEX codec.")
		set(ENABLE_SPEEX OFF CACHE BOOL "Build mediastreamer2 with the SPEEX codec." FORCE)
	endif()
endif()
if(ENABLE_ALSA)
	find_package(ALSA)
	if(NOT ALSA_FOUND)
		set(ENABLE_ALSA OFF CACHE BOOL "Enable ALSA support." FORCE)
	endif()
endif()
if(ENABLE_ARTSC)
	find_package(Arts REQUIRED)
endif()
if(ENABLE_PORTAUDIO)
	find_package(PortAudio REQUIRED)
endif()
if(ENABLE_PULSEAUDIO)
	find_package(PulseAudio)
	if(NOT PULSEAUDIO_FOUND)
		set(ENABLE_PULSEAUDIO OFF CACHE BOOL "Enable pulseaudio support." FORCE)
	endif()
endif()
if(ENABLE_QSA)
	find_package(QSA REQUIRED)
239
	find_package(QnxAudioManager REQUIRED)
240 241 242 243 244 245 246 247 248
endif()
if(ENABLE_VIDEO)
	add_definitions(-DVIDEO_ENABLED)
endif()
if(ENABLE_FFMPEG)
	find_package(FFMpeg REQUIRED)
else()
	add_definitions(-DNO_FFMPEG)
endif()
249 250 251 252 253 254
if(ENABLE_V4L)
	find_package(V4L)
	if(NOT V4L_FOUND)
		message(FATAL_ERROR "Missing V4L. It is highly recommended to build with libv4l2 headers and library. Many camera will won't work or will crash your application if libv4l2 is not installed. If you know what you are doing, you can use -DENABLE_V4L=0 to disable this check.")
	endif()
endif()
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
if(ENABLE_X11)
	find_package(X11)
	if(NOT X11_FOUND)
		set(ENABLE_X11 OFF CACHE BOOL "Enable X11 support." FORCE)
	endif()
endif()
if(ENABLE_XV)
	find_package(Xv)
	if(XV_FOUND)
		set(HAVE_XV 1)
	else()
		set(ENABLE_XV OFF CACHE BOOL "Enable XV support." FORCE)
	endif()
endif()
if(ENABLE_GLX)
	find_package(GLX)
	if(GLX_FOUND)
		set(HAVE_GL 1)
	else()
		set(ENABLE_GLX OFF CACHE BOOL "Enable X11+OpenGL rendering support (requires glx and glew)." FORCE)
	endif()
endif()
# TODO: Handle SDL option
# TODO: Handle Theora option
if(ENABLE_VPX)
	find_package(VPX)
	if(NOT VPX_FOUND)
		set(ENABLE_VPX OFF CACHE BOOL "Build mediastreamer2 with VPX codec." FORCE)
	endif()
endif()
285
if(ENABLE_MKV)
286
	find_package(Matroska2 QUIET)
287
	if(NOT MATROSKA2_FOUND)
288
		message(WARNING "Could not find Matroska2 library, mediastreamer2 will be compiled without MKV support.")
289 290 291
		set(ENABLE_MKV OFF CACHE BOOL "Enable support of MKV files reading and writing." FORCE)
	endif()
endif()
292

293
if(ENABLE_QNX)
294 295 296 297 298 299 300 301 302
	find_package(Screen)
	if(NOT SCREEN_FOUND)
		message(FATAL_ERROR "SCREEN NOT FOUND")
	endif()
	find_package(CamApi)
	if(NOT CAMAPI_FOUND)
		message(FATAL_ERROR "CAMAPI NOT FOUND")
	endif()
endif()
303 304 305 306

if(ENABLE_SOUND AND NOT(WIN32 OR ENABLE_ALSA OR ENABLE_ARTSC OR ENABLE_MACSND OR ENABLE_MACAQSND OR ENABLE_OSS OR ENABLE_PORTAUDIO OR ENABLE_PULSEAUDIO OR ENABLE_QSA))
	message(FATAL_ERROR "Could not find a support sound driver API. Use -DENABLE_SOUND=NO if you don't care about having sound.")
endif()
307

308

309
include_directories(
Ghislain MARY's avatar
Ghislain MARY committed
310 311 312 313
	include
	src/audiofilters
	src/utils
	src/voip
314
	${CMAKE_CURRENT_BINARY_DIR}
Ghislain MARY's avatar
Ghislain MARY committed
315
	${CMAKE_CURRENT_BINARY_DIR}/src
316
	${ORTP_INCLUDE_DIRS}
317 318
)

319 320
if(BZRTP_FOUND)
	include_directories(${BZRTP_INCLUDE_DIRS})
321
endif()
322 323 324
if(SRTP_FOUND)
	include_directories(${SRTP_INCLUDE_DIRS})
endif()
325 326 327
if(POLARSSL_FOUND)
	include_directories(${POLARSSL_INCLUDE_DIRS})
endif()
328 329 330 331 332 333 334 335 336
if(GSM_FOUND)
	include_directories(${GSM_INCLUDE_DIRS})
endif()
if(OPUS_FOUND)
	include_directories(${OPUS_INCLUDE_DIRS})
endif()
if(SPEEX_FOUND)
	include_directories(${SPEEX_INCLUDE_DIRS})
endif()
337 338 339 340 341 342 343 344 345 346 347 348
if(FFMPEG_FOUND)
	include_directories(${FFMPEG_INCLUDE_DIRS})
endif()
if(VPX_FOUND)
	include_directories(${VPX_INCLUDE_DIRS})
endif()
if(MATROSKA2_FOUND)
	include_directories(${MATROSKA2_INCLUDE_DIRS})
endif()
if(V4L_FOUND)
	include_directories(${V4L_INCLUDE_DIRS})
endif()
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
if(ALSA_FOUND)
	include_directories(${ALSA_INCLUDE_DIRS})
endif()
if(ARTS_FOUND)
	include_directories(${ARTS_INCLUDE_DIRS})
endif()
if(PORTAUDIO_FOUND)
	include_directories(${PORTAUDIO_INCLUDE_DIRS})
endif()
if(PULSEAUDIO_FOUND)
	include_directories(${PULSEAUDIO_INCLUDE_DIRS})
endif()
if(QSA_FOUND)
	include_directories(${QSA_INCLUDE_DIRS})
endif()
364 365 366
if(QNXAUDIOMANAGER_FOUND)
	include_directories(${QNXAUDIOMANAGER_INCLUDE_DIRS})
endif()
367 368 369 370 371 372 373 374 375
if(X11_FOUND)
	include_directories(${X11_INCLUDE_DIRS})
endif()
if(XV_FOUND)
	include_directories(${XV_INCLUDE_DIRS})
endif()
if(GLX_FOUND)
	include_directories(${GLX_INCLUDE_DIRS})
endif()
376 377
if(SCREEN_FOUND)
	include_directories(${SCREEN_INCLUDE_DIRS})
378
endif()
379 380 381 382 383
if(CAMAPI_FOUND)
	include_directories(${CAMAPI_INCLUDE_DIRS})
endif()
if(PCAP_FOUND)
	include_directories(${PCAP_INCLUDE_DIRS})
384
endif()
385
if(MSVC)
386
	include_directories(${MSVC_INCLUDE_DIR})
387
endif()
388

389 390 391 392 393 394
if(ENABLE_DEBUG_LOGS)
	add_definitions(-DDEBUG)
endif()
if(ENABLE_FIXED_POINT)
	set(MS_FIXED_POINT 1)
endif()
395 396
if(ENABLE_NON_FREE_CODECS)
	set(HAVE_NON_FREE_CODECS 1)
397 398
else()
	set(HAVE_NON_FREE_CODECS 0)
399
endif()
400 401 402
if(PCAP_FOUND)
	set(HAVE_PCAP 1)
endif()
403 404 405
if(SRTP_FOUND)
	set(HAVE_SRTP 1)
endif()
406 407 408
if(BZRTP_FOUND)
	set(HAVE_ZRTP 1)
endif()
409 410 411
if(ENABLE_DTLS)
	set(HAVE_DTLS 1)
endif()
412 413 414 415 416
if(ENABLE_ALSA)
	set(__ALSA_ENABLED__ 1)
endif()
if(ENABLE_ARTSC)
	set(__ARTS_ENABLED__ 1)
417
endif()
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432
if(ENABLE_MACSND)
	set(__MACSND_ENABLED__ 1)
endif()
if(ENABLE_MACAQSND)
	set(__MAC_AQ_ENABLED__ 1)
endif()
if(ENABLE_PORTAUDIO)
	set(__PORTAUDIO_ENABLED__ 1)
endif()
if(ENABLE_PULSEAUDIO)
	set(__PULSEAUDIO_ENABLED__ 1)
endif()
if(ENABLE_QSA)
	set(__QSA_ENABLED__ 1)
endif()
433 434 435
if(ENABLE_QNX)
	set(__QNX__ 1)
endif()
436 437 438
if(SPEEX_FOUND)
	set(HAVE_SPEEXDSP 1)
endif()
439 440 441
if(MATROSKA2_FOUND)
	set(HAVE_MATROSKA 1)
endif()
442 443 444 445 446 447 448
if(ENABLE_RELATIVE_PREFIX)
	set(PACKAGE_PLUGINS_DIR "./lib/mediastreamer/plugins")
	set(PACKAGE_DATA_DIR "./share")
else()
	set(PACKAGE_PLUGINS_DIR "${CMAKE_INSTALL_PREFIX}/lib/mediastreamer/plugins")
	set(PACKAGE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share")
endif()
449
set(LINK_FLAGS )
450
if(APPLE)
451 452 453 454 455 456 457 458 459
	list(APPEND LINK_FLAGS "-framework CoreFoundation" "-framework AudioToolbox" "-framework CoreAudio")
	if(IOS)
		list(APPEND LINK_FLAGS "-framework Foundation" "-framework QuartzCore" "-framework OpenGLES" "-framework UIKit" "-framework AVFoundation")
	else()
		list(APPEND LINK_FLAGS "-framework AppKit")
		if(ENABLE_MACSND)
			list(APPEND LINK_FLAGS "-framework Carbon" "-framework AudioUnit")
		endif()
	endif()
460
	if(ENABLE_VIDEO)
461
		list(APPEND LINK_FLAGS "-framework Cocoa" "-framework OpenGL" "-framework QuartzCore" "-framework QTKit")
462
	endif()
463
	set(PLUGINS_EXT ".dylib")
464
	add_definitions("-DTARGET_OS_MAC=1")
465
endif()
466 467
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mediastreamer-config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/mediastreamer-config.h)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/mediastreamer-config.h PROPERTIES GENERATED ON)
468
add_definitions("-DHAVE_CONFIG_H")
469 470
add_definitions(${ORTP_CPPFLAGS})

471 472
set(STRICT_OPTIONS_CPP )
set(STRICT_OPTIONS_C )
473
set(STRICT_OPTIONS_OBJC "-Wno-error")
474 475
if(NOT MSVC)
	list(APPEND STRICT_OPTIONS_CPP "-Wall" "-Wuninitialized")
476
	list(APPEND STRICT_OPTIONS_C "-Wdeclaration-after-statement" "-Wstrict-prototypes" "-Wno-error=strict-prototypes")
477 478 479 480
	if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
		list(APPEND STRICT_OPTIONS_CPP "-Qunused-arguments" "-Wno-unused-function" "-Wno-array-bounds")
	endif()
	if(APPLE)
481
		list(APPEND STRICT_OPTIONS_CPP "-Wno-error=unknown-warning-option" "-Qunused-arguments" "-Wno-tautological-compare" "-Wno-unused-function" "-Wno-array-bounds")
482 483 484 485 486
	endif()
	if(ENABLE_STRICT)
		list(APPEND STRICT_OPTIONS_CPP "-Werror" "-fno-strict-aliasing")
	endif()
endif()
487 488 489 490 491 492 493 494 495
if(STRICT_OPTIONS_CPP)
	list(REMOVE_DUPLICATES STRICT_OPTIONS_CPP)
endif()
if(STRICT_OPTIONS_C)
	list(REMOVE_DUPLICATES STRICT_OPTIONS_C)
endif()
if(STRICT_OPTIONS_OBJC)
	list(REMOVE_DUPLICATES STRICT_OPTIONS_OBJC)
endif()
496

497

498 499 500 501 502 503 504
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
	set(EXPORT_TARGETS_NAME "LinphoneBuilder")
else()
	set(EXPORT_TARGETS_NAME "Mediastreamer2")
endif()


505 506 507
if(ENABLE_DOC)
	add_subdirectory(help)
endif()
508 509
add_subdirectory(include)
add_subdirectory(src)
510 511 512
if(ENABLE_UNIT_TESTS)
	add_subdirectory(tester)
endif()
513 514 515
if(ENABLE_TOOLS)
	add_subdirectory(tools)
endif()
516 517 518 519 520 521 522 523


include(CMakePackageConfigHelpers)
write_basic_package_version_file(
	"${CMAKE_CURRENT_BINARY_DIR}/Mediastreamer2ConfigVersion.cmake"
	VERSION ${MEDIASTREAMER_VERSION}
	COMPATIBILITY AnyNewerVersion
)
524
export(EXPORT ${EXPORT_TARGETS_NAME}Targets
525 526 527 528 529 530 531 532
	FILE "${CMAKE_CURRENT_BINARY_DIR}/Mediastreamer2Targets.cmake"
)
configure_file(cmake/Mediastreamer2Config.cmake.in
	"${CMAKE_CURRENT_BINARY_DIR}/Mediastreamer2Config.cmake"
	@ONLY
)

set(ConfigPackageLocation lib/cmake/Mediastreamer2)
533
install(EXPORT ${EXPORT_TARGETS_NAME}Targets
534 535 536 537 538 539 540 541
	FILE Mediastreamer2Targets.cmake
	DESTINATION ${ConfigPackageLocation}
)
install(FILES
	"${CMAKE_CURRENT_BINARY_DIR}/Mediastreamer2Config.cmake"
	"${CMAKE_CURRENT_BINARY_DIR}/Mediastreamer2ConfigVersion.cmake"
	DESTINATION ${ConfigPackageLocation}
)