CMakeLists.txt 6.73 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
if(ENABLE_STATIC)
	set(PROJECT_LIBS bellesip-static)
else()
	set(PROJECT_LIBS bellesip)
endif()

set(SOURCE_FILES_C
30 31 32 33 34 35 36 37 38 39 40 41 42 43
	auth_helper_tester.c
	belle_generic_uri_tester.c
	belle_http_tester.c
	belle_sdp_tester.c
	belle_sip_core_tester.c
	belle_sip_dialog_tester.c
	belle_sip_headers_tester.c
	belle_sip_message_tester.c
	belle_sip_refresher_tester.c
	belle_sip_register_tester.c
	belle_sip_resolver_tester.c
	belle_sip_tester.c
	belle_sip_tester.h
	belle_sip_uri_tester.c
jehan's avatar
jehan committed
44
	belle_sip_fast_uri_tester.c
45 46
	cast_test.c
	register_tester.h
Simon Morlat's avatar
Simon Morlat committed
47
	object_tester.cc
48 49
)

50 51 52 53
set(OTHER_FILES
	tester_hosts
)

Simon Morlat's avatar
Simon Morlat committed
54 55 56 57
add_definitions(
	-DBCTBX_LOG_DOMAIN="belle-sip"
)

58 59 60 61 62
set(SOURCE_FILES_OBJC )
if (IOS)
	list(APPEND SOURCE_FILES_OBJC belle_sip_tester_ios.m)
endif()

63
string(REPLACE ";" " " LINK_FLAGS_STR "${LINK_FLAGS}")
64 65
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)
66

67
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
68
	add_library(belle_sip_tester_static STATIC ${SOURCE_FILES_C})
69
	target_include_directories(belle_sip_tester_static PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
70
	target_link_libraries(belle_sip_tester_static ${BCTOOLBOX_LIBRARIES} ${PROJECT_LIBS})
71 72 73 74 75 76 77 78

	set(RUNTIME_COMPONENT_SOURCES
		belle_sip_tester_windows.cpp
		belle_sip_tester_windows.h
	)
	add_library(belle_sip_tester_runtime MODULE ${RUNTIME_COMPONENT_SOURCES})
	target_link_libraries(belle_sip_tester_runtime belle_sip_tester_static)
	set_target_properties(belle_sip_tester_runtime PROPERTIES VS_WINRT_COMPONENT TRUE)
79 80
	set_target_properties(belle_sip_tester_runtime PROPERTIES LIBRARY_OUTPUT_NAME "BelledonneCommunications.BelleSip.Tester")
	set_target_properties(belle_sip_tester_runtime PROPERTIES LINK_FLAGS "/WINMDFILE:BelledonneCommunications.BelleSip.Tester.winmd")
Simon Morlat's avatar
Simon Morlat committed
81
	set_target_properties(belle_sip_tester_runtime PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
82 83
	set_target_properties(belle_sip_tester_runtime PROPERTIES C_STANDARD 99)

84 85

	install(TARGETS belle_sip_tester_runtime
86 87 88
		RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
		LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
89 90
		PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
	)
91
	install(FILES "${CMAKE_CURRENT_BINARY_DIR}/BelledonneCommunications.BelleSip.Tester.winmd" DESTINATION ${CMAKE_INSTALL_LIBDIR})
92 93
	if(CMAKE_BUILD_TYPE STREQUAL "Debug")
		install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/BelledonneCommunications.BelleSip.Tester.pdb
94
			DESTINATION ${CMAKE_INSTALL_LIBDIR}
95 96 97
			PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
		)
	endif()
98
else()
99 100 101 102 103 104
	set(USE_BUNDLE )
	if (IOS)
		set(USE_BUNDLE MACOSX_BUNDLE)
	endif()

	add_executable(belle_sip_tester ${USE_BUNDLE} ${SOURCE_FILES_C} ${SOURCE_FILES_OBJC})
105
	set_target_properties(belle_sip_tester PROPERTIES LINKER_LANGUAGE CXX)
Simon Morlat's avatar
Simon Morlat committed
106
	set_target_properties(belle_sip_tester PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
107
	set_target_properties(belle_sip_tester PROPERTIES C_STANDARD 99)
108 109 110 111

	if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
		set_target_properties(belle_sip_tester PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
	endif()
112 113 114
	if(WIN32)
		target_link_libraries(belle_sip_tester "Ws2_32")
	endif()
115
	target_include_directories(belle_sip_tester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
116
	target_link_libraries(belle_sip_tester ${BCTOOLBOX_LIBRARIES} ${PROJECT_LIBS})
117
	add_test(NAME belle_sip_tester COMMAND belle_sip_tester --verbose)
118 119 120 121 122 123 124 125
	if(NOT IOS)
		install(TARGETS belle_sip_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
		)
	endif()
126 127 128


	set(OBJECT_DESCRIBE_SOURCES describe.c)
129
	bc_apply_compile_flags(OBJECT_DESCRIBE_SOURCES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
130
	add_executable(belle_sip_object_describe ${USE_BUNDLE} ${OBJECT_DESCRIBE_SOURCES})
131
	set_target_properties(belle_sip_object_describe PROPERTIES LINKER_LANGUAGE CXX)
132 133 134
	if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
		set_target_properties(belle_sip_object_describe PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
	endif()
135
	target_link_libraries(belle_sip_object_describe ${BCTOOLBOX_CORE_LIBRARIES} ${PROJECT_LIBS})
136

137 138 139 140 141 142 143 144
	set(OBJECT_RESOLVE_SOURCES resolve.c)
	bc_apply_compile_flags(OBJECT_DESCRIBE_SOURCES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
	add_executable(belle_sip_resolve ${USE_BUNDLE} ${OBJECT_RESOLVE_SOURCES})
	set_target_properties(belle_sip_resolve PROPERTIES LINKER_LANGUAGE CXX)
	if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
		set_target_properties(belle_sip_resolve PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
	endif()
	target_link_libraries(belle_sip_resolve ${BCTOOLBOX_CORE_LIBRARIES} ${PROJECT_LIBS})
145 146


147
	set(PARSE_SOURCES parse.c)
148

149
	bc_apply_compile_flags(PARSE_SOURCES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
150
	add_executable(belle_sip_parse ${USE_BUNDLE} ${PARSE_SOURCES})
151
	set_target_properties(belle_sip_parse PROPERTIES LINKER_LANGUAGE CXX)
152 153 154
	if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
		set_target_properties(belle_sip_parse PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
	endif()
155
	target_link_libraries(belle_sip_parse ${BCTOOLBOX_CORE_LIBRARIES} ${PROJECT_LIBS})
156 157 158 159 160 161 162 163 164 165
	
	set(GET_SOURCES get.c)

	bc_apply_compile_flags(GET_SOURCES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
	add_executable(belle_sip_http_get ${USE_BUNDLE} ${GET_SOURCES})
	set_target_properties(belle_sip_http_get PROPERTIES LINKER_LANGUAGE CXX)
	if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
		set_target_properties(belle_sip_http_get PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
	endif()
	target_link_libraries(belle_sip_http_get ${BCTOOLBOX_CORE_LIBRARIES} ${PROJECT_LIBS})
166

167
endif()
168 169

install(FILES ${OTHER_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/belle_sip_tester")