CMakeLists.txt 15.7 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
############################################################################
# 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
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
Ghislain MARY's avatar
Ghislain MARY committed
20 21 22 23
#
############################################################################

cmake_minimum_required(VERSION 3.0)
Ronan's avatar
Ronan committed
24
project(mswebrtc VERSION 1.1.1 LANGUAGES C CXX)
Ghislain MARY's avatar
Ghislain MARY committed
25 26


27 28 29
set(PACKAGE "${PROJECT_NAME}")
set(PACKAGE_NAME "${PROJECT_NAME}")
set(PACKAGE_VERSION "${PROJECT_VERSION}")
Ghislain MARY's avatar
Ghislain MARY committed
30 31 32 33 34 35 36
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "support@belledonne-communications.com")
set(PACKAGE_TARNAME "mswebrtc")
set(PACKAGE_URL "")
set(VERSION "${PACKAGE_VERSION}")


37 38
option(ENABLE_SHARED "Build shared library." YES)
option(ENABLE_STATIC "Build static library." YES)
Ghislain MARY's avatar
Ghislain MARY committed
39
option(ENABLE_AEC "Enable the WebRTC echo canceller support." YES)
Ghislain MARY's avatar
Ghislain MARY committed
40 41
option(ENABLE_AECM "Enable the WebRTC echo canceller for mobile support." YES)
option(ENABLE_ISAC "Enable the ISAC audio codec support." YES)
42
option(ENABLE_ILBC "Build iLBC codec filter" YES)
Ghislain MARY's avatar
Ghislain MARY committed
43 44 45 46
set(ISAC_FLAVOUR "fix" CACHE STRING "ISAC audio codec flavour.")
set_property(CACHE ISAC_FLAVOUR PROPERTY STRINGS "fix" "main")


Ghislain MARY's avatar
Ghislain MARY committed
47
if(NOT ENABLE_AEC AND NOT ENABLE_AECM AND NOT ENABLE_ISAC AND NOT ENABLE_ILBC)
Ghislain MARY's avatar
Ghislain MARY committed
48 49 50 51
	message(FATAL_ERROR "You need to enable at least one feature of WebRTC.")
endif()


52 53 54 55 56 57 58
include(GNUInstallDirs)

if(NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX)
	set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
	message(STATUS "Setting install rpath to ${CMAKE_INSTALL_RPATH}")
endif()

59 60
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
	include("${EP_ms2_CONFIG_DIR}/Mediastreamer2Config.cmake")
Ghislain MARY's avatar
Ghislain MARY committed
61
	include("${EP_ortp_CONFIG_DIR}/ORTPConfig.cmake")
62
	#set(BcToolbox_FIND_COMPONENTS tester)
63
	include("${EP_bctoolbox_CONFIG_DIR}/BcToolboxConfig.cmake")
64 65
else()
	find_package(Mediastreamer2 REQUIRED)
Ghislain MARY's avatar
Ghislain MARY committed
66
	find_package(ORTP REQUIRED)
67
	find_package(BcToolbox REQUIRED)
68
endif()
Ghislain MARY's avatar
Ghislain MARY committed
69

Erwan Croze's avatar
Erwan Croze committed
70
find_library(LIBM NAMES m)
Ghislain MARY's avatar
Ghislain MARY committed
71

Ghislain MARY's avatar
Ghislain MARY committed
72
if(ENABLE_AEC)
73 74
	set(BUILD_AEC 1)
endif()
Ghislain MARY's avatar
Ghislain MARY committed
75 76 77
if(ENABLE_AECM)
	set(BUILD_AECM 1)
endif()
78 79 80
if(ENABLE_ISAC)
	set(BUILD_ISAC 1)
endif()
81 82 83
if(ENABLE_ILBC)
	set(BUILD_ILBC 1)
endif()
Ghislain MARY's avatar
Ghislain MARY committed
84 85
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)

86 87
set(WEBRTC_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/webrtc")
set(WEBRTC_SRC_DIR "${WEBRTC_ROOT_DIR}/webrtc")
Ghislain MARY's avatar
Ghislain MARY committed
88 89 90
include_directories(
	${MEDIASTREAMER2_INCLUDE_DIRS}
	${CMAKE_CURRENT_BINARY_DIR}
91 92
	${WEBRTC_ROOT_DIR}
	${WEBRTC_SRC_DIR}/common_audio/signal_processing/include
Ghislain MARY's avatar
Ghislain MARY committed
93 94 95 96 97 98
)

add_definitions(-DHAVE_CONFIG_H)
if(WIN32)
	add_definitions(-DWEBRTC_WIN)
endif()
99 100 101 102
if(ANDROID)
	add_definitions("-DANDROID")
endif()

103 104 105 106 107 108
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND CMAKE_GENERATOR_PLATFORM STREQUAL "ARM")
	add_definitions(
		-D__ARMEL__
		-DWEBRTC_ARCH_ARM
	)
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND CMAKE_GENERATOR MATCHES "^.* ARM$")
109 110 111 112 113
	add_definitions(
		-D__ARMEL__
		-DWEBRTC_ARCH_ARM
	)
endif()
Ghislain MARY's avatar
Ghislain MARY committed
114
if(UNIX)
115
	add_definitions(-DWEBRTC_POSIX)
Ghislain MARY's avatar
Ghislain MARY committed
116 117 118 119 120
	if(APPLE)
		add_definitions(-DWEBRTC_MAC -DWEBRTC_THREAD_RR -DWEBRTC_CLOCK_TYPE_REALTIME)
	else()
		add_definitions(-DWEBRTC_LINUX -DWEBRTC_THREAD_RR)
	endif()
Ghislain MARY's avatar
Ghislain MARY committed
121
endif()
Ghislain MARY's avatar
Ghislain MARY committed
122

123 124
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSTEM_PROCESSOR)
string(REGEX MATCH "^(arm*|aarch64)" FIXED_POINT_PROCESSOR "${SYSTEM_PROCESSOR}")
125 126 127
if(FIXED_POINT_PROCESSOR)
	add_definitions(-D__ARMEL__)
endif()
Ghislain MARY's avatar
Ghislain MARY committed
128

129 130
set(AEC_CXX11_FLAGS "-std=c++11")

131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
set(WEBRTC_SIGNAL_PROCESSING_DIR ${WEBRTC_SRC_DIR}/common_audio/signal_processing)
set(WEBRTC_SIGNAL_PROCESSING_SRCS
	${WEBRTC_SIGNAL_PROCESSING_DIR}/spl_sqrt.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/real_fft.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/filter_ar_fast_q12.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/complex_bit_reverse.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/spl_init.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/splitting_filter.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/spl_sqrt_floor.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/levinson_durbin.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/filter_ar.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/get_scaling_square.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/resample_fractional.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/resample.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/downsample_fast.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/filter_ma_fast_q12.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/auto_corr_to_refl_coef.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/auto_correlation.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/refl_coef_to_lpc.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/dot_product_with_scale.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/copy_set_operations.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/cross_correlation.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/sqrt_of_one_minus_x_squared.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/ilbc_specific_functions.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/resample_by_2.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/complex_fft.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/resample_48khz.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/energy.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/get_hanning_window.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/randomization_functions.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/vector_scaling_operations.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/resample_by_2_internal.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/lpc_to_refl_coef.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/min_max_operations.c
	${WEBRTC_SIGNAL_PROCESSING_DIR}/division_operations.c
)
set(WEBRTC_COMMON_DIR "${WEBRTC_SRC_DIR}/common_audio")
Ghislain MARY's avatar
Ghislain MARY committed
168
set(WEBRTC_COMMON_SRCS
169 170
	${WEBRTC_COMMON_DIR}/fft4g.c
	${WEBRTC_COMMON_DIR}/ring_buffer.c
Ghislain MARY's avatar
Ghislain MARY committed
171 172
)
include_directories(${WEBRTC_COMMOND_DIR}/include)
Ghislain MARY's avatar
Ghislain MARY committed
173 174 175 176
if(ENABLE_AEC)
	set(AEC_SRC_DIR "${WEBRTC_SRC_DIR}/modules/audio_processing/aec")
	set(AEC_SRCS
		aec.c
177
		aec_splitting_filter.cc
Ghislain MARY's avatar
Ghislain MARY committed
178 179 180 181
		${AEC_SRC_DIR}/aec_core.c
		${AEC_SRC_DIR}/aec_rdft.c
		${AEC_SRC_DIR}/aec_resampler.c
		${AEC_SRC_DIR}/echo_cancellation.c
182 183 184
		${WEBRTC_SRC_DIR}/base/checks.cc
		${WEBRTC_SRC_DIR}/common_audio/audio_util.cc
		${WEBRTC_SRC_DIR}/common_audio/sparse_fir_filter.cc
Ghislain MARY's avatar
Ghislain MARY committed
185
		${WEBRTC_SRC_DIR}/system_wrappers/source/cpu_features.cc
186
		${WEBRTC_SRC_DIR}/modules/audio_processing/three_band_filter_bank.cc
Ghislain MARY's avatar
Ghislain MARY committed
187 188 189
		${WEBRTC_SRC_DIR}/modules/audio_processing/utility/delay_estimator.c
		${WEBRTC_SRC_DIR}/modules/audio_processing/utility/delay_estimator_wrapper.c
	)
190 191 192 193 194 195 196
	set(AEC_CXX11_SRCS
		aec_splitting_filter.cc
		${WEBRTC_SRC_DIR}/common_audio/audio_util.cc
		${WEBRTC_SRC_DIR}/common_audio/sparse_fir_filter.cc
		${WEBRTC_SRC_DIR}/modules/audio_processing/three_band_filter_bank.cc
	)
	bc_apply_compile_flags(AEC_CXX11_SRCS AEC_CXX11_FLAGS)
197 198 199 200 201 202
	if(SYSTEM_PROCESSOR MATCHES "^aarch64.*")
		add_definitions(
			-DWEBRTC_ARCH_ARM64=1
		)
	endif()
	
Ghislain MARY's avatar
Ghislain MARY committed
203 204 205 206 207
	if(SYSTEM_PROCESSOR MATCHES "^arm.*" OR SYSTEM_PROCESSOR MATCHES "^aarch64.*")
		list(APPEND AEC_SRCS
			${AEC_SRC_DIR}/aec_core_neon.c
			${AEC_SRC_DIR}/aec_rdft_neon.c
		)
208
	elseif(SYSTEM_PROCESSOR MATCHES "^i.?86.*" OR SYSTEM_PROCESSOR MATCHES "^x86.*" OR SYSTEM_PROCESSOR MATCHES "^x86_64.*" OR SYSTEM_PROCESSOR MATCHES "^amd64.*" OR SYSTEM_PROCESSOR MATCHES "^x64.*")
Ghislain MARY's avatar
Ghislain MARY committed
209 210 211 212 213 214 215
		list(APPEND AEC_SRCS
			${AEC_SRC_DIR}/aec_core_sse2.c
			${AEC_SRC_DIR}/aec_rdft_sse2.c
		)
	endif()
	include_directories(
		${AEC_SRC_DIR}/include
216 217
		${WEBRTC_SRC_DIR}/common_audio/include
		${WEBRTC_SRC_DIR}/modules/audio_processing
Ghislain MARY's avatar
Ghislain MARY committed
218 219
	)
endif()
Ghislain MARY's avatar
Ghislain MARY committed
220
if(ENABLE_AECM)
221
	set(AECM_SRC_DIR "${WEBRTC_SRC_DIR}/modules/audio_processing/aecm")
Ghislain MARY's avatar
Ghislain MARY committed
222 223 224 225
	set(AECM_SRCS
		aec.c
		${AECM_SRC_DIR}/echo_control_mobile.c
		${AECM_SRC_DIR}/aecm_core.c
226 227
		${AECM_SRC_DIR}/aecm_core_c.c
		${AECM_SRC_DIR}/../utility/
Ghislain MARY's avatar
Ghislain MARY committed
228 229 230 231
		${AECM_SRC_DIR}/../utility/delay_estimator.c
		${AECM_SRC_DIR}/../utility/delay_estimator_wrapper.c
	)
	include_directories(
232
		${AECM_SRC_DIR}/include
233 234
		${WEBRTC_SRC_DIR}/modules/audio_processing/utility
		${WEBRTC_SRC_DIR}/system_wrappers/interface
Ghislain MARY's avatar
Ghislain MARY committed
235 236 237
	)
endif()
if(ENABLE_ISAC)
238
	set(ISAC_SRC_DIR "${WEBRTC_SRC_DIR}/modules/audio_coding/codecs/isac/${ISAC_FLAVOUR}")
Ghislain MARY's avatar
Ghislain MARY committed
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
	set(ISAC_SRCS
		isac_dec.c
		isac_enc.c
		${ISAC_SRC_DIR}/source/fft.c
		${ISAC_SRC_DIR}/source/arith_routines.c
		${ISAC_SRC_DIR}/source/arith_routines_hist.c
		${ISAC_SRC_DIR}/source/arith_routines_logist.c
		${ISAC_SRC_DIR}/source/bandwidth_estimator.c
		${ISAC_SRC_DIR}/source/decode.c
		${ISAC_SRC_DIR}/source/decode_bwe.c
		${ISAC_SRC_DIR}/source/encode.c
		${ISAC_SRC_DIR}/source/entropy_coding.c
		${ISAC_SRC_DIR}/source/filterbank_tables.c
		${ISAC_SRC_DIR}/source/filterbanks.c
		${ISAC_SRC_DIR}/source/lattice.c
		${ISAC_SRC_DIR}/source/lpc_tables.c
		${ISAC_SRC_DIR}/source/pitch_estimator.c
256
		${ISAC_SRC_DIR}/source/pitch_estimator_c.c
Ghislain MARY's avatar
Ghislain MARY committed
257 258 259 260 261
		${ISAC_SRC_DIR}/source/pitch_filter.c
		${ISAC_SRC_DIR}/source/pitch_gain_tables.c
		${ISAC_SRC_DIR}/source/pitch_lag_tables.c
		${ISAC_SRC_DIR}/source/spectrum_ar_model_tables.c
		${ISAC_SRC_DIR}/source/transform.c
262
		${ISAC_SRC_DIR}/source/transform_tables.c
Ghislain MARY's avatar
Ghislain MARY committed
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
	)
	if("${ISAC_FLAVOUR}" STREQUAL "fix")
		list(APPEND ISAC_SRCS
			${ISAC_SRC_DIR}/source/decode_plc.c
			${ISAC_SRC_DIR}/source/filters.c
			${ISAC_SRC_DIR}/source/initialize.c
			${ISAC_SRC_DIR}/source/isacfix.c
			${ISAC_SRC_DIR}/source/lattice_c.c
			${ISAC_SRC_DIR}/source/pitch_filter_c.c
			${ISAC_SRC_DIR}/source/lpc_masking_model.c
		)
	else()
		list(APPEND ISAC_SRCS
			${ISAC_SRC_DIR}/source/initialize.c
			${ISAC_SRC_DIR}/source/crc.c
			${ISAC_SRC_DIR}/source/encode_lpc_swb.c
			${ISAC_SRC_DIR}/source/filter_functions.c
			${ISAC_SRC_DIR}/source/isac.c
			${ISAC_SRC_DIR}/source/lpc_analysis.c
			${ISAC_SRC_DIR}/source/lpc_gain_swb_tables.c
			${ISAC_SRC_DIR}/source/lpc_shape_swb12_tables.c
			${ISAC_SRC_DIR}/source/lpc_shape_swb16_tables.c
			${ISAC_SRC_DIR}/util/utility.c
		)
	endif()
	include_directories(
		${ISAC_SRC_DIR}/source
		${ISAC_SRC_DIR}/util
291
		${ISAC_SRC_DIR}/include
Ghislain MARY's avatar
Ghislain MARY committed
292 293
	)
endif()
294
if(ENABLE_ILBC)
295
	set(ILBC_SRC_DIR ${WEBRTC_SRC_DIR}/modules/audio_coding/codecs/ilbc)
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
	set(ILBC_SRCS
		ilbc.c
		${ILBC_SRC_DIR}/abs_quant.c
		${ILBC_SRC_DIR}/abs_quant_loop.c
		${ILBC_SRC_DIR}/augmented_cb_corr.c
		${ILBC_SRC_DIR}/bw_expand.c
		${ILBC_SRC_DIR}/cb_construct.c
		${ILBC_SRC_DIR}/cb_mem_energy_augmentation.c
		${ILBC_SRC_DIR}/cb_mem_energy.c
		${ILBC_SRC_DIR}/cb_mem_energy_calc.c
		${ILBC_SRC_DIR}/cb_search.c
		${ILBC_SRC_DIR}/cb_search_core.c
		${ILBC_SRC_DIR}/cb_update_best_index.c
		${ILBC_SRC_DIR}/chebyshev.c
		${ILBC_SRC_DIR}/comp_corr.c
		${ILBC_SRC_DIR}/constants.c
		${ILBC_SRC_DIR}/create_augmented_vec.c
		${ILBC_SRC_DIR}/decode.c
		${ILBC_SRC_DIR}/decode_residual.c
		${ILBC_SRC_DIR}/decoder_interpolate_lsf.c
		${ILBC_SRC_DIR}/do_plc.c
		${ILBC_SRC_DIR}/encode.c
		${ILBC_SRC_DIR}/energy_inverse.c
		${ILBC_SRC_DIR}/enhancer.c
		${ILBC_SRC_DIR}/enhancer_interface.c
		${ILBC_SRC_DIR}/enh_upsample.c
		${ILBC_SRC_DIR}/filtered_cb_vecs.c
		${ILBC_SRC_DIR}/frame_classify.c
		${ILBC_SRC_DIR}/gain_dequant.c
		${ILBC_SRC_DIR}/gain_quant.c
		${ILBC_SRC_DIR}/get_cd_vec.c
		${ILBC_SRC_DIR}/get_lsp_poly.c
		${ILBC_SRC_DIR}/get_sync_seq.c
		${ILBC_SRC_DIR}/hp_input.c
		${ILBC_SRC_DIR}/hp_output.c
		${ILBC_SRC_DIR}/ilbc.c
		${ILBC_SRC_DIR}/index_conv_dec.c
		${ILBC_SRC_DIR}/index_conv_enc.c
		${ILBC_SRC_DIR}/init_decode.c
		${ILBC_SRC_DIR}/init_encode.c
		${ILBC_SRC_DIR}/interpolate.c
		${ILBC_SRC_DIR}/interpolate_samples.c
		${ILBC_SRC_DIR}/lpc_encode.c
		${ILBC_SRC_DIR}/lsf_check.c
		${ILBC_SRC_DIR}/lsf_interpolate_to_poly_dec.c
		${ILBC_SRC_DIR}/lsf_interpolate_to_poly_enc.c
		${ILBC_SRC_DIR}/lsf_to_lsp.c
		${ILBC_SRC_DIR}/lsf_to_poly.c
		${ILBC_SRC_DIR}/lsp_to_lsf.c
		${ILBC_SRC_DIR}/my_corr.c
		${ILBC_SRC_DIR}/nearest_neighbor.c
		${ILBC_SRC_DIR}/pack_bits.c
		${ILBC_SRC_DIR}/poly_to_lsf.c
		${ILBC_SRC_DIR}/poly_to_lsp.c
		${ILBC_SRC_DIR}/refiner.c
		${ILBC_SRC_DIR}/simple_interpolate_lsf.c
		${ILBC_SRC_DIR}/simple_lpc_analysis.c
		${ILBC_SRC_DIR}/simple_lsf_dequant.c
		${ILBC_SRC_DIR}/simple_lsf_quant.c
		${ILBC_SRC_DIR}/smooth.c
		${ILBC_SRC_DIR}/smooth_out_data.c
		${ILBC_SRC_DIR}/sort_sq.c
		${ILBC_SRC_DIR}/split_vq.c
		${ILBC_SRC_DIR}/state_construct.c
		${ILBC_SRC_DIR}/state_search.c
		${ILBC_SRC_DIR}/swap_bytes.c
		${ILBC_SRC_DIR}/unpack_bits.c
		${ILBC_SRC_DIR}/vq3.c
		${ILBC_SRC_DIR}/vq4.c
		${ILBC_SRC_DIR}/window32_w32.c
		${ILBC_SRC_DIR}/xcorr_coef.c
	)
368
	include_directories(${ILBC_SRC_DIR}/include)
369
endif()
Ghislain MARY's avatar
Ghislain MARY committed
370 371 372 373

set(SOURCE_FILES
	mswebrtc.c
	${WEBRTC_COMMON_SRCS}
374
	${WEBRTC_SIGNAL_PROCESSING_SRCS}
Ghislain MARY's avatar
Ghislain MARY committed
375
)
Ghislain MARY's avatar
Ghislain MARY committed
376 377 378
if(ENABLE_AEC)
	list(APPEND SOURCE_FILES ${AEC_SRCS})
endif()
Ghislain MARY's avatar
Ghislain MARY committed
379 380 381 382 383 384
if(ENABLE_AECM)
	list(APPEND SOURCE_FILES ${AECM_SRCS})
endif()
if(ENABLE_ISAC)
	list(APPEND SOURCE_FILES ${ISAC_SRCS})
endif()
385 386 387
if(ENABLE_ILBC)
	list(APPEND SOURCE_FILES ${ILBC_SRCS})
endif()
Ghislain MARY's avatar
Ghislain MARY committed
388

389
set(LIBS ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES})
Ghislain MARY's avatar
Ghislain MARY committed
390

Erwan Croze's avatar
Erwan Croze committed
391 392 393 394
if(LIBM)
    list(APPEND LIBS ${LIBM})
endif()

Ghislain MARY's avatar
Ghislain MARY committed
395
if(ENABLE_STATIC)
396
	add_library(mswebrtc-static STATIC ${SOURCE_FILES})
397
	set_target_properties(mswebrtc-static PROPERTIES OUTPUT_NAME mswebrtc)
398
	set_target_properties(mswebrtc-static PROPERTIES LINKER_LANGUAGE CXX)
399 400
	target_link_libraries(mswebrtc-static ${LIBS})
	install(TARGETS mswebrtc-static
401
		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/mediastreamer/plugins
402 403 404 405
		PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
	)
endif()
if(ENABLE_SHARED)
406 407 408 409 410
	if(NOT IOS)
		add_library(mswebrtc MODULE ${SOURCE_FILES})
	else()
		add_library(mswebrtc SHARED ${SOURCE_FILES})
	endif()
411
	target_link_libraries(mswebrtc ${LIBS})
412
	set_target_properties(mswebrtc PROPERTIES LINKER_LANGUAGE CXX)
413
	if(IOS)
414 415
		set(MIN_OS ${LINPHONE_IOS_DEPLOYMENT_TARGET})
		set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/build/osx/")
416 417
		set_target_properties(mswebrtc PROPERTIES
			FRAMEWORK TRUE
418 419
			MACOSX_FRAMEWORK_IDENTIFIER org.linphone.mswebrtc
  			MACOSX_FRAMEWORK_INFO_PLIST Info.plist.in
420 421
		) 
	endif()
Ghislain MARY's avatar
Ghislain MARY committed
422
	if(MSVC)
423 424
		if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
			install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/libmswebrtc.pdb
425
				DESTINATION ${CMAKE_INSTALL_BINDIR}
Ghislain MARY's avatar
Ghislain MARY committed
426 427 428
				PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
			)
		endif()
429 430 431
		if(NOT IOS)
			set_target_properties(mswebrtc PROPERTIES PREFIX "lib")
		endif()
Ghislain MARY's avatar
Ghislain MARY committed
432
	endif()
433 434 435 436
	install(TARGETS mswebrtc
		RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/mediastreamer/plugins
		LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mediastreamer/plugins
		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/mediastreamer/plugins
437
		FRAMEWORK DESTINATION Frameworks
438 439
		PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
	)
Ghislain MARY's avatar
Ghislain MARY committed
440
endif()
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482


# CPack settings
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
set(CPACK_SOURCE_IGNORE_FILES
	"^${CMAKE_BINARY_DIR}"
	"/\\\\..+"
	"webrtc/build"
	"webrtc/build_overrides"
	"webrtc/chromium"
	"webrtc/data"
	"webrtc/infra"
	"webrtc/resources"
	"webrtc/talk"
	"webrtc/third_party"
	"webrtc/tools"
	"webrtc/webrtc/audio"
	"webrtc/webrtc/build"
	"webrtc/webrtc/call"
	"webrtc/webrtc/common_video"
	"webrtc/webrtc/examples"
	"webrtc/webrtc/libjingle"
	"webrtc/webrtc/modules/audio_conference_mixer"
	"webrtc/webrtc/modules/audio_device"
	"webrtc/webrtc/modules/bitrate_controller"
	"webrtc/webrtc/modules/desktop_capture"
	"webrtc/webrtc/modules/media_file"
	"webrtc/webrtc/modules/pacing"
	"webrtc/webrtc/modules/remote_bitrate_estimator"
	"webrtc/webrtc/modules/rtp_rtcp"
	"webrtc/webrtc/modules/utility"
	"webrtc/webrtc/modules/video*"
	"webrtc/webrtc/p2p"
	"webrtc/webrtc/sound"
	"webrtc/webrtc/test"
	"webrtc/webrtc/tools"
	"webrtc/webrtc/video*"
	"webrtc/webrtc/voice_engine"
)

include(CPack)