CMakeLists.txt 4.93 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 44 45 46 47
	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
	cast_test.c
	register_tester.h
)

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

53
string(REPLACE ";" " " LINK_FLAGS_STR "${LINK_FLAGS}")
54 55
apply_compile_flags(SOURCE_FILES_C "CPP" "C")
apply_compile_flags(SOURCE_FILES_OBJC "CPP" "OBJC")
56

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

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

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

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

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


	set(OBJECT_DESCRIBE_SOURCES describe.c)
	apply_compile_flags(OBJECT_DESCRIBE_SOURCES "CPP" "C")
114
	add_executable(belle_sip_object_describe ${USE_BUNDLE} ${OBJECT_DESCRIBE_SOURCES})
115 116 117
	if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
		set_target_properties(belle_sip_object_describe PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
	endif()
118
	target_link_libraries(belle_sip_object_describe ${BCTOOLBOX_CORE_LIBRARIES} ${PROJECT_LIBS})
119 120


121
	set(PARSE_SOURCES parse.c)
122

123
	apply_compile_flags(PARSE_SOURCES "CPP" "C")
124
	add_executable(belle_sip_parse ${USE_BUNDLE} ${PARSE_SOURCES})
125 126 127
	if(NOT "${LINK_FLAGS_STR}" STREQUAL "")
		set_target_properties(belle_sip_parse PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}")
	endif()
128
	target_link_libraries(belle_sip_parse ${BCTOOLBOX_CORE_LIBRARIES} ${PROJECT_LIBS})
129

130
endif()