CMakeLists.txt 11.8 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
set(OTHER_LIBS_FOR_TESTER ${BCTOOLBOX_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${BELLESIP_LIBRARIES} ${XML2_LIBRARIES} ${XSD_LIBRARIES})
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
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

Ronan's avatar
Ronan committed
79 80 81 82 83
set(DB_FILES
	db/linphone.db
	db/messages.db
)

84
set(RC_FILES
85
	rcfiles/account_creator_rc
Erwan Croze's avatar
Erwan Croze committed
86
	rcfiles/assistant_create.rc
87
	rcfiles/carddav_rc
88
	rcfiles/conference_focus_rc
89 90 91 92
	rcfiles/empty_rc
	rcfiles/friends_rc
	rcfiles/laure_call_logs_rc
	rcfiles/laure_rc_udp
93
	rcfiles/laure_tcp_rc
94 95
	rcfiles/marie_early_rc
	rcfiles/marie_h264_rc
96
	rcfiles/marie_nat64_rc
97 98
	rcfiles/marie_quality_reporting_rc
	rcfiles/marie_rc
99
	rcfiles/marie2_rc
100 101 102 103 104 105 106 107 108 109 110 111 112
	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
113
	rcfiles/marie_v4proxy_rc
114 115 116 117 118 119
	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
120
	rcfiles/pauline_as_friend_rc
121
	rcfiles/pauline_h264_rc
122
	rcfiles/pauline_nat64_rc
123 124 125 126
	rcfiles/pauline_rc
	rcfiles/pauline_rc_rtcp_xr
	rcfiles/pauline_sips_rc
	rcfiles/pauline_tcp_rc
127
	rcfiles/pauline_tls_client_rc
128
	rcfiles/pauline_tunnel_verify_server_certificate_rc
129
	rcfiles/pauline_v4proxy_rc
130 131 132 133 134 135 136 137 138
	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/zero_length_params_rc
)

Ghislain MARY's avatar
Ghislain MARY committed
139 140
set(IMAGE_FILES
	images/linphone.svg
141
	images/nowebcamCIF.jpg
Ghislain MARY's avatar
Ghislain MARY committed
142 143
	images/nowebcamVGA.jpg
)
144 145 146 147 148 149

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

150
set(OTHER_FILES
151
	tester_hosts
152
	local_tester_hosts
153 154 155 156
)

set(IOS_RESOURCES_FILES
	${OTHER_FILES}
Ronan's avatar
Ronan committed
157
	${DB_FILES}
158 159 160 161 162 163
	certificates
	images
	rcfiles
	sipp
	sounds
	vcards
164 165
)

166 167
set(SOURCE_FILES_C
	accountmanager.c
Erwan Croze's avatar
Erwan Croze committed
168
	account_creator_tester.c
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 194 195 196
	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
	vcard_tester.c
	video_tester.c
)
197

Ronan's avatar
Ronan committed
198
set(SOURCE_FILES_CXX
199
	clonable-object-tester.cpp
200
#	conference-event-tester.cpp
Benjamin REIS's avatar
Benjamin REIS committed
201
	conference-tester.cpp
Ronan's avatar
Ronan committed
202
	cpim-tester.cpp
Ronan's avatar
Ronan committed
203
	events-db-tester.cpp
204
	property-container-tester.cpp
Ronan's avatar
Ronan committed
205 206
)

207 208 209 210 211 212 213
set(SOURCE_FILES_OBJC )
if(APPLE)
	if (IOS)
		list(APPEND SOURCE_FILES_OBJC liblinphone_tester_ios.m)
	endif()
endif()

Ronan's avatar
Ronan committed
214
# TODO: Remove me later!
Benjamin REIS's avatar
Benjamin REIS committed
215
list(REMOVE_ITEM STRICT_OPTIONS_CPP "-Wconversion" "-Werror=conversion" "-Wcast-align" "-Werror=cast-align")
Ronan's avatar
Ronan committed
216

217
bc_apply_compile_flags(SOURCE_FILES_C STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
218
bc_apply_compile_flags(SOURCE_FILES_CXX STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
219
bc_apply_compile_flags(SOURCE_FILES_OBJC STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC)
220

221 222
add_definitions("-DLINPHONE_TESTER")

223 224 225 226 227 228 229 230
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()
231

232 233 234 235 236 237 238
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
239 240
endif()

241
# on mobile platforms, we compile the tester as a library so that we can link with it directly from native applications
242
if(ANDROID OR IOS)
Ronan's avatar
Ronan committed
243
	add_library(linphonetester SHARED ${SOURCE_FILES_C} ${SOURCE_FILES_CXX})
244
	target_include_directories(linphonetester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
245
	target_link_libraries(linphonetester ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
246 247 248 249 250 251
	if(IOS)
		set_target_properties(linphonetester PROPERTIES
			FRAMEWORK TRUE
			MACOSX_FRAMEWORK_IDENTIFIER com.belledonne-communications.linphonetester
		)
	endif()
252
	install(TARGETS linphonetester
253 254 255
		RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
		LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
256
		FRAMEWORK DESTINATION Frameworks
257 258
		PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
		)
259
	install(FILES "liblinphone_tester.h"
260
		DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linphone
261
		PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
262
	)
263
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
Ronan's avatar
Ronan committed
264
	add_library(linphone_tester_static STATIC ${SOURCE_FILES_C} ${SOURCE_FILES_CXX})
265
	target_include_directories(linphone_tester_static PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
266
	target_link_libraries(linphone_tester_static ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
267 268 269 270 271 272 273 274 275

	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)
276 277
	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")
278 279

	install(TARGETS linphone_tester_runtime
280 281 282
		RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
		LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
283 284
		PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
	)
285 286 287
	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
288
			DESTINATION ${CMAKE_INSTALL_LIBDIR}
289
			PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
290
	)
291
	endif()
292 293
endif()

294
# on iOS though, we also build the exectuable so that one can compile it from Xcode and run it directly
295
if (NOT ANDROID AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
296 297
	if(IOS)
		set_source_files_properties(${IOS_RESOURCES_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
Ronan's avatar
Ronan committed
298
		add_executable(liblinphone_tester MACOSX_BUNDLE ${IOS_RESOURCES_FILES} ${SOURCE_FILES_C} ${SOURCE_FILES_CXX} ${SOURCE_FILES_OBJC})
299
	else()
Ronan's avatar
Ronan committed
300
		add_executable(liblinphone_tester ${SOURCE_FILES_C} ${SOURCE_FILES_CXX} ${SOURCE_FILES_OBJC})
301
	endif()
jehan's avatar
jehan committed
302
	set_target_properties(liblinphone_tester PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
303
	set_target_properties(liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX)
304
	target_include_directories(liblinphone_tester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
305
	target_link_libraries(liblinphone_tester ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
306 307 308
	if (GTK2_FOUND)
		target_compile_definitions(liblinphone_tester PRIVATE HAVE_GTK)
		target_include_directories(liblinphone_tester PUBLIC ${GTK2_INCLUDE_DIRS})
309
		target_link_libraries(liblinphone_tester ${GTK2_LIBRARIES})
310
		if(GTKMACINTEGRATION_FOUND)
Ghislain MARY's avatar
Ghislain MARY committed
311 312
			target_include_directories(liblinphone_tester PUBLIC ${GTKMACINTEGRATION_INCLUDE_DIRS})
			target_link_libraries(liblinphone_tester ${GTKMACINTEGRATION_LIBRARIES})
313
		endif()
314
	endif()
315 316

	if(NOT IOS)
317 318 319 320 321 322
		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
		)
323
		install(FILES ${CERTIFICATE_ALT_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/certificates/altname")
Sylvain Berfini's avatar
Sylvain Berfini committed
324
		install(FILES ${CERTIFICATE_CLIENT_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/certificates/client")
Ronan's avatar
Ronan committed
325 326
		install(FILES ${CERTIFICATE_CN_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/certificates/cn")
		install(FILES ${DB_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/db")
327
		install(FILES ${IMAGE_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/images")
Ronan's avatar
Ronan committed
328 329 330 331
		install(FILES ${OTHER_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester")
		install(FILES ${RC_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/rcfiles")
		install(FILES ${SIPP_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/sipp")
		install(FILES ${SOUND_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/sounds")
332 333
		install(FILES ${VCARD_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/vcards")
	endif()
334
endif()