CMakeLists.txt 11.2 KB
Newer Older
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.
20 21 22
#
############################################################################

23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
set(OTHER_LIBS_FOR_TESTER ${BCTOOLBOX_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${BELLESIP_LIBRARIES} ${XML2_LIBRARIES})
if(INTL_FOUND)
	list(APPEND OTHER_LIBS_FOR_TESTER ${INTL_LIBRARIES})
endif()
if(SQLITE3_FOUND)
	list(APPEND OTHER_LIBS_FOR_TESTER ${SQLITE3_LIBRARIES})
endif()
if(ZLIB_FOUND)
	list(APPEND OTHER_LIBS_FOR_TESTER ${ZLIB_LIBRARIES})
endif()

set(SOUND_FILES
	sounds/ahbahouaismaisbon.wav
	sounds/hello44100.wav
	sounds/hello8000.mkv
	sounds/hello8000_mkv_ref.wav
	sounds/hello8000.wav
	sounds/oldphone.wav
	sounds/ringback.wav
	sounds/sintel_trailer_opus_h264.mkv
	sounds/sintel_trailer_opus_vp8.mkv
	sounds/sintel_trailer_pcmu_h264.mkv
	sounds/vrroom.wav
)

set(SIPP_FILES
	sipp/call_invite_200ok_without_contact_header.xml
	sipp/call_with_audio_mline_before_video_in_sdp.xml
	sipp/call_with_multiple_audio_mline_in_sdp.xml
	sipp/call_with_multiple_video_mline_in_sdp.xml
	sipp/call_with_video_mline_before_audio_in_sdp.xml
	sipp/sip_update_within_icoming_reinvite_with_no_sdp.xml
)

set(CERTIFICATE_ALT_FILES
	certificates/altname/agent.pem
	certificates/altname/cafile.pem
	certificates/altname/openssl-altname.cnf
)

set(CERTIFICATE_CN_FILES
	certificates/cn/agent.pem
	certificates/cn/cafile.pem
	certificates/cn/openssl-cn.cnf
)

69 70 71
set(CERTIFICATE_CLIENT_FILES
	certificates/client/cert.pem
	certificates/client/key.pem
72 73 74
	certificates/client/cert2.pem
	certificates/client/key2.pem
	certificates/client/cert2-signed-by-other-ca.pem
75 76 77
)

set(CERTIFICATE_FILES ${CERTIFICATE_ALT_FILES} ${CERTIFICATE_CN_FILES} ${CERTIFICATE_CLIENT_FILES})
78 79

set(RC_FILES
80
	rcfiles/account_creator_rc
Erwan Croze's avatar
Erwan Croze committed
81
	rcfiles/assistant_create.rc
82
	rcfiles/carddav_rc
83
	rcfiles/conference_focus_rc
84 85 86 87
	rcfiles/empty_rc
	rcfiles/friends_rc
	rcfiles/laure_call_logs_rc
	rcfiles/laure_rc_udp
88
	rcfiles/laure_tcp_rc
89 90
	rcfiles/marie_early_rc
	rcfiles/marie_h264_rc
91
	rcfiles/marie_nat64_rc
92 93
	rcfiles/marie_quality_reporting_rc
	rcfiles/marie_rc
94
	rcfiles/marie2_rc
95 96 97 98 99 100 101 102 103 104 105 106 107
	rcfiles/marie_rc_rtcp_xr
	rcfiles/marie_remote_404_rc
	rcfiles/marie_remote_default_values_rc
	rcfiles/marie_remote_https_rc
	rcfiles/marie_remote_invalid_rc
	rcfiles/marie_remote_invalid_uri_rc
	rcfiles/marie_remote_localfile2_rc
	rcfiles/marie_remote_localfile_android_rc
	rcfiles/marie_remote_localfile_rc
	rcfiles/marie_remote_localfile_win10_rc
	rcfiles/marie_remote_rc
	rcfiles/marie_sips_rc
	rcfiles/marie_transient_remote_rc
108
	rcfiles/marie_v4proxy_rc
109 110 111 112 113 114
	rcfiles/marie_zrtp_aes256_rc
	rcfiles/marie_zrtp_b256_rc
	rcfiles/marie_zrtp_srtpsuite_aes256_rc
	rcfiles/michelle_rc_udp
	rcfiles/multi_account_rc
	rcfiles/pauline_alt_rc
115
	rcfiles/pauline_as_friend_rc
116
	rcfiles/pauline_h264_rc
117
	rcfiles/pauline_nat64_rc
118 119 120 121
	rcfiles/pauline_rc
	rcfiles/pauline_rc_rtcp_xr
	rcfiles/pauline_sips_rc
	rcfiles/pauline_tcp_rc
122
	rcfiles/pauline_tls_client_rc
123
	rcfiles/pauline_tunnel_verify_server_certificate_rc
124
	rcfiles/pauline_v4proxy_rc
125 126 127 128 129 130 131 132 133 134
	rcfiles/pauline_wild_rc
	rcfiles/pauline_zrtp_aes256_rc
	rcfiles/pauline_zrtp_b256_rc
	rcfiles/pauline_zrtp_srtpsuite_aes256_rc
	rcfiles/remote_zero_length_params_rc
	rcfiles/stun_rc
	rcfiles/upnp_rc
	rcfiles/zero_length_params_rc
)

Ghislain MARY's avatar
Ghislain MARY committed
135 136
set(IMAGE_FILES
	images/linphone.svg
137
	images/nowebcamCIF.jpg
Ghislain MARY's avatar
Ghislain MARY committed
138 139
	images/nowebcamVGA.jpg
)
140 141 142 143 144 145

set(VCARD_FILES
	vcards/thousand_vcards.vcf
	vcards/vcards.vcf
)

146
set(OTHER_FILES
147
	tester_hosts
148
	local_tester_hosts
149
	messages.db
150 151 152 153 154 155 156 157 158 159
)

set(IOS_RESOURCES_FILES
	${OTHER_FILES}
	certificates
	images
	rcfiles
	sipp
	sounds
	vcards
160 161
)

162 163
set(SOURCE_FILES_C
	accountmanager.c
Erwan Croze's avatar
Erwan Croze committed
164
	account_creator_tester.c
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
	audio_bypass_tester.c
	call_multicast_tester.c
	call_multi_tester.c
	call_single_tester.c
	call_video_tester.c
	complex_sip_case_tester.c
	dtmf_tester.c
	eventapi_tester.c
	flexisip_tester.c
	liblinphone_tester.c
	liblinphone_tester.h
	log_collection_tester.c
	message_tester.c
	offeranswer_tester.c
	player_tester.c
	presence_server_tester.c
	presence_tester.c
	proxy_config_tester.c
	quality_reporting_tester.c
	register_tester.c
	remote_provisioning_tester.c
	setup_tester.c
	stun_tester.c
	tester.c
	tunnel_tester.c
	upnp_tester.c
	vcard_tester.c
	video_tester.c
)
194 195 196 197 198 199 200 201

set(SOURCE_FILES_OBJC )
if(APPLE)
	if (IOS)
		list(APPEND SOURCE_FILES_OBJC liblinphone_tester_ios.m)
	endif()
endif()

202 203
bc_apply_compile_flags(SOURCE_FILES_C STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
bc_apply_compile_flags(SOURCE_FILES_OBJC STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC)
204

205 206 207 208 209 210 211 212
if(MSVC)
	get_source_file_property(MESSAGE_TESTER_C_COMPILE_FLAGS message_tester.c COMPILE_FLAGS)
	set(MESSAGE_TESTER_C_COMPILE_FLAGS "${MESSAGE_TESTER_C_COMPILE_FLAGS} /wd4996") # Disable "was declared deprecated" warnings
	set_source_files_properties(message_tester.c PROPERTY COMPILE_FLAGS "${MESSAGE_TESTER_C_COMPILE_FLAGS}")
	get_source_file_property(VCARD_TESTER_C_COMPILE_FLAGS vcard_tester.c COMPILE_FLAGS)
	set(VCARD_TESTER_C_COMPILE_FLAGS "${VCARD_TESTER_C_COMPILE_FLAGS} /wd4996") # Disable "was declared deprecated" warnings
	set_source_files_properties(vcard_tester.c PROPERTY COMPILE_FLAGS "${VCARD_TESTER_C_COMPILE_FLAGS}")
endif()
213

214 215 216 217 218 219 220
if(NOT IOS OR NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
	# Executable must be available on root path, not host one
	find_program(SIPP_PROGRAM NAMES sipp sipp.exe ONLY_CMAKE_FIND_ROOT_PATH)
	if(SIPP_PROGRAM)
		add_definitions(-DHAVE_SIPP=1)
		add_definitions(-DSIPP_COMMAND="${SIPP_PROGRAM}")
	endif()
jehan's avatar
jehan committed
221 222
endif()

223
# on mobile platforms, we compile the tester as a library so that we can link with it directly from native applications
224
if(ANDROID OR IOS)
225
	add_library(linphonetester SHARED ${SOURCE_FILES_C})
226
	target_include_directories(linphonetester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
227
	target_link_libraries(linphonetester ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
228 229 230 231 232 233
	if(IOS)
		set_target_properties(linphonetester PROPERTIES
			FRAMEWORK TRUE
			MACOSX_FRAMEWORK_IDENTIFIER com.belledonne-communications.linphonetester
		)
	endif()
234
	install(TARGETS linphonetester
235 236 237
		RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
		LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
238
		FRAMEWORK DESTINATION Frameworks
239 240
		PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
		)
241
	install(FILES "liblinphone_tester.h"
242
		DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linphone
243
		PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
244
	)
245
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
246
	add_library(linphone_tester_static STATIC ${SOURCE_FILES_C})
247
	target_include_directories(linphone_tester_static PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
248
	target_link_libraries(linphone_tester_static ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
249 250 251 252 253 254 255 256 257

	set(RUNTIME_COMPONENT_SOURCES
		liblinphone_tester_windows.cpp
		liblinphone_tester_windows.h
	)
	add_library(linphone_tester_runtime MODULE ${RUNTIME_COMPONENT_SOURCES})
	target_compile_options(linphone_tester_runtime PRIVATE "/wd4996")
	target_link_libraries(linphone_tester_runtime linphone_tester_static)
	set_target_properties(linphone_tester_runtime PROPERTIES VS_WINRT_COMPONENT TRUE)
258 259
	set_target_properties(linphone_tester_runtime PROPERTIES LIBRARY_OUTPUT_NAME "BelledonneCommunications.Linphone.Tester")
	set_target_properties(linphone_tester_runtime PROPERTIES LINK_FLAGS "/WINMDFILE:BelledonneCommunications.Linphone.Tester.winmd")
260 261

	install(TARGETS linphone_tester_runtime
262 263 264
		RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
		LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
265 266
		PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
	)
267 268 269
	install(FILES "${CMAKE_CURRENT_BINARY_DIR}/BelledonneCommunications.Linphone.Tester.winmd" DESTINATION lib)
	if(CMAKE_BUILD_TYPE STREQUAL "Debug")
		install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/BelledonneCommunications.Linphone.Tester.pdb
270
			DESTINATION ${CMAKE_INSTALL_LIBDIR}
271
			PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
272
	)
273
	endif()
274 275
endif()

276
# on iOS though, we also build the exectuable so that one can compile it from Xcode and run it directly
277
if (NOT ANDROID AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
278 279 280
	if(IOS)
		set_source_files_properties(${IOS_RESOURCES_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
		add_executable(liblinphone_tester MACOSX_BUNDLE ${IOS_RESOURCES_FILES} ${SOURCE_FILES_C} ${SOURCE_FILES_OBJC})
281 282 283
	else()
		add_executable(liblinphone_tester ${SOURCE_FILES_C} ${SOURCE_FILES_OBJC})
	endif()
jehan's avatar
jehan committed
284
	set_target_properties(liblinphone_tester PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
285
	set_target_properties(liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX)
286
	target_include_directories(liblinphone_tester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
287
	target_link_libraries(liblinphone_tester ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
288 289 290
	if (GTK2_FOUND)
		target_compile_definitions(liblinphone_tester PRIVATE HAVE_GTK)
		target_include_directories(liblinphone_tester PUBLIC ${GTK2_INCLUDE_DIRS})
291
		target_link_libraries(liblinphone_tester ${GTK2_LIBRARIES})
292
		if(GTKMACINTEGRATION_FOUND)
Ghislain MARY's avatar
Ghislain MARY committed
293 294
			target_include_directories(liblinphone_tester PUBLIC ${GTKMACINTEGRATION_INCLUDE_DIRS})
			target_link_libraries(liblinphone_tester ${GTKMACINTEGRATION_LIBRARIES})
295
		endif()
296
	endif()
297 298

	if(NOT IOS)
299 300 301 302 303 304
		install(TARGETS liblinphone_tester
			RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
			LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
			ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
			PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
		)
305
		install(FILES ${OTHER_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester")
306 307 308 309
		install(FILES ${SOUND_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/sounds")
		install(FILES ${SIPP_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/sipp")
		install(FILES ${CERTIFICATE_ALT_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/certificates/altname")
		install(FILES ${CERTIFICATE_CN_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/certificates/cn")
Sylvain Berfini's avatar
Sylvain Berfini committed
310
		install(FILES ${CERTIFICATE_CLIENT_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/certificates/client")
311 312 313 314
		install(FILES ${RC_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/rcfiles")
		install(FILES ${IMAGE_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/images")
		install(FILES ${VCARD_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/vcards")
	endif()
315
endif()