FindMS2.cmake.in 5.27 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
############################################################################
# FindMS2.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
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
############################################################################
#
# - Find the mediastreamer2 include file and library
#
#  MS2_FOUND - system has mediastreamer2
#  MS2_INCLUDE_DIRS - the mediastreamer2 include directory
#  MS2_LIBRARIES - The libraries needed to use mediastreamer2
28
#  MS2_CPPFLAGS - The compilation flags needed to use mediastreamer2
29
#  MS2_LDFLAGS - The linking flags needed to use mediastreamer2
30 31

find_package(ORTP REQUIRED)
32 33 34 35 36 37 38 39 40
if(@ENABLE_GSM@)
	find_package(GSM)
endif()
if(@ENABLE_OPUS@)
	find_package(Opus)
endif()
if(@ENABLE_SPEEX@)
	find_package(Speex)
endif()
41
if(@ENABLE_SOUND@)
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 69 70 71 72 73 74 75 76 77
	if(UNIX AND NOT APPLE)
		if(@ENABLE_ALSA@)
			find_package(ALSA)
		endif()
		if(@ENABLE_ARTSC@)
			find_package(Arts)
		endif()
	endif()
	if(@ENABLE_PORTAUDIO@)
		find_package(PortAudio)
	endif()
	if(@ENABLE_PULSEAUDIO@)
		find_package(PulseAudio)
	endif()
	if(@ENABLE_QSA@)
		find_package(QSA)
	endif()
endif()
if(@ENABLE_VIDEO@)
	if(@ENABLE_FFMPEG@)
		find_package(FFMpeg)
	endif()
	if(UNIX)
		if(@ENABLE_GLX@)
			find_package(GLX)
		endif()
		if(@ENABLE_X11@)
			find_package(X11)
		endif()
		if(@ENABLE_XV@)
			find_package(Xv)
		endif()
	endif()
	if(@ENABLE_VPX@)
		find_package(VPX)
	endif()
78 79
endif()

80 81 82 83 84 85
if(@ENABLE_SRTP@)
	find_package(SRTP)
endif()
if(@ENABLE_ZRTP@)
	find_package(BZRTP)
endif()
86 87 88
if(@ENABLE_DTLS@ AND SRTP_FOUND)
	find_package(PolarSSL)
endif()
89 90


91
set(_MS2_ROOT_PATHS
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
	${WITH_MS2}
	${CMAKE_INSTALL_PREFIX}
)

find_path(MS2_INCLUDE_DIRS
	NAMES mediastreamer2/mscommon.h
	HINTS _MS2_ROOT_PATHS
	PATH_SUFFIXES include
)

if(MS2_INCLUDE_DIRS)
	set(HAVE_MEDIASTREAMER2_MSCOMMON_H 1)
endif()

find_library(MS2_BASE_LIBRARY
	NAMES mediastreamer_base
	HINTS ${_MS2_ROOT_PATHS}
	PATH_SUFFIXES bin lib
)
find_library(MS2_VOIP_LIBRARY
	NAMES mediastreamer_voip
	HINTS ${_MS2_ROOT_PATHS}
	PATH_SUFFIXES bin lib
)
set(MS2_LIBRARIES ${MS2_BASE_LIBRARY} ${MS2_VOIP_LIBRARY} ${ORTP_LIBRARIES})
list(APPEND MS2_INCLUDE_DIRS ${ORTP_INCLUDE_DIRS})

if(GSM_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${GSM_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${GSM_LIBRARIES})
endif()
if(OPUS_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${OPUS_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${OPUS_LIBRARIES})
endif()
if(SPEEX_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${SPEEX_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${SPEEX_LIBRARIES})
endif()
if(ALSA_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${ALSA_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${ALSA_LIBRARIES})
endif()
if(ARTS_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${ARTS_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${ARTS_LIBRARIES})
endif()
if(PORTAUDIO_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${PORTAUDIO_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${PORTAUDIO_LIBRARIES})
endif()
if(PULSEAUDIO_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${PULSEAUDIO_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${PULSEAUDIO_LIBRARIES})
endif()
if(QSA_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${QSA_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${QSA_LIBRARIES})
endif()
if(FFMPEG_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${FFMPEG_LIBRARIES})
endif()
if(X11_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${X11_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${X11_LIBRARIES})
endif()
if(XV_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${XV_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${XV_LIBRARIES})
endif()
if(GLX_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${GLX_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${GLX_LIBRARIES})
endif()
if(VPX_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${VPX_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${VPX_LIBRARIES})
endif()
171 172 173 174 175 176 177 178
if(SRTP_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${SRTP_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${SRTP_LIBRARIES})
endif()
if(BZRTP_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${BZRTP_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${BZRTP_LIBRARIES})
endif()
179 180 181 182
if(POLARSSL_FOUND)
	list(APPEND MS2_INCLUDE_DIRS ${POLARSSL_INCLUDE_DIRS})
	list(APPEND MS2_LIBRARIES ${POLARSSL_LIBRARIES})
endif()
183 184 185 186 187
if(WIN32)
	list(APPEND MS2_LIBRARIES ole32 oleaut32 uuid gdi32 user32 vfw32)
endif(WIN32)
list(REMOVE_DUPLICATES MS2_INCLUDE_DIRS)
list(REMOVE_DUPLICATES MS2_LIBRARIES)
188 189 190
set(MS2_CPPFLAGS "${ORTP_CPPFLAGS}")
set(MS2_LDFLAGS "@APPLE_SPECIFIC_LINK_FLAGS@")

191 192 193 194

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MS2
	DEFAULT_MSG
195
	MS2_INCLUDE_DIRS MS2_LIBRARIES MS2_BASE_LIBRARY MS2_VOIP_LIBRARY
196 197
)

198
mark_as_advanced(MS2_INCLUDE_DIRS MS2_LIBRARIES MS2_BASE_LIBRARY MS2_VOIP_LIBRARY MS2_CPPFLAGS MS2_LDFLAGS)