CMakeLists.txt 5.22 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 47 48
	cast_test.c
	register_tester.h
)

49 50 51 52 53
set(SOURCE_FILES_OBJC )
if (IOS)
	list(APPEND SOURCE_FILES_OBJC belle_sip_tester_ios.m)
endif()

54
string(REPLACE ";" " " LINK_FLAGS_STR "${LINK_FLAGS}")
55 56
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)
57

58
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
59
	add_library(belle_sip_tester_static STATIC ${SOURCE_FILES_C})
60
	target_include_directories(belle_sip_tester_static PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
61
	target_link_libraries(belle_sip_tester_static ${BCTOOLBOX_LIBRARIES} ${PROJECT_LIBS})
62 63 64 65 66 67 68 69

	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)
70 71
	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")
72 73

	install(TARGETS belle_sip_tester_runtime
74 75 76
		RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
		LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
77 78
		PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
	)
79
	install(FILES "${CMAKE_CURRENT_BINARY_DIR}/BelledonneCommunications.BelleSip.Tester.winmd" DESTINATION ${CMAKE_INSTALL_LIBDIR})
80 81
	if(CMAKE_BUILD_TYPE STREQUAL "Debug")
		install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/BelledonneCommunications.BelleSip.Tester.pdb
82
			DESTINATION ${CMAKE_INSTALL_LIBDIR}
83 84 85
			PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
		)
	endif()
86
else()
87 88 89 90 91 92
	set(USE_BUNDLE )
	if (IOS)
		set(USE_BUNDLE MACOSX_BUNDLE)
	endif()

	add_executable(belle_sip_tester ${USE_BUNDLE} ${SOURCE_FILES_C} ${SOURCE_FILES_OBJC})
93 94 95 96

	if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
		set_target_properties(belle_sip_tester PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
	endif()
97 98 99
	if(WIN32)
		target_link_libraries(belle_sip_tester "Ws2_32")
	endif()
100
	target_include_directories(belle_sip_tester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
101
	target_link_libraries(belle_sip_tester ${BCTOOLBOX_LIBRARIES} ${PROJECT_LIBS})
102
	add_test(NAME belle_sip_tester COMMAND belle_sip_tester --verbose)
103 104 105 106 107 108 109 110
	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()
111 112 113


	set(OBJECT_DESCRIBE_SOURCES describe.c)
114
	bc_apply_compile_flags(OBJECT_DESCRIBE_SOURCES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
115
	add_executable(belle_sip_object_describe ${USE_BUNDLE} ${OBJECT_DESCRIBE_SOURCES})
116
	set_target_properties(belle_sip_object_describe PROPERTIES LINKER_LANGUAGE CXX)
117 118 119
	if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
		set_target_properties(belle_sip_object_describe PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
	endif()
120
	target_link_libraries(belle_sip_object_describe ${BCTOOLBOX_CORE_LIBRARIES} ${PROJECT_LIBS})
121 122


123
	set(PARSE_SOURCES parse.c)
124

125
	bc_apply_compile_flags(PARSE_SOURCES STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
126
	add_executable(belle_sip_parse ${USE_BUNDLE} ${PARSE_SOURCES})
127
	set_target_properties(belle_sip_parse PROPERTIES LINKER_LANGUAGE CXX)
128 129 130
	if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
		set_target_properties(belle_sip_parse PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
	endif()
131
	target_link_libraries(belle_sip_parse ${BCTOOLBOX_CORE_LIBRARIES} ${PROJECT_LIBS})
132

133
endif()