Commit 0d6954c6 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Allow compilation with video enabled using cmake.

parent 9681affb
cmake_minimum_required(VERSION 2.6)
project(MEDIASTREAMER2 C)
option(MS2_ENABLE_FFMPEG "Build mediastreamer2 with ffmpeg video support (needs MS2_ENABLE_VIDEO)." ON)
option(MS2_ENABLE_GSM "Build mediastreamer2 with the GSM codec." ON)
option(MS2_ENABLE_OPUS "Build mediastreamer2 with the OPUS codec." ON)
option(MS2_ENABLE_RESAMPLE "Build mediastreamer2 with the resampling capability." ON)
option(MS2_ENABLE_SPEEX "Build mediastreamer2 with the SPEEX codec." ON)
option(MS2_ENABLE_VIDEO "Build mediastreamer2 with video support." ON)
option(MS2_ENABLE_VPX "Build mediastreamer2 with VPX codec (needs MS2_ENABLE_VIDEO)." ON)
if(NOT ORTP_ROOT_DIR)
set(ORTP_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../oRTP)
......@@ -22,17 +28,34 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}/src/
)
if(MS2_ENABLE_VIDEO)
include_directories(src/voip)
endif(MS2_ENABLE_VIDEO)
if(USE_INSTALLED_COMPONENTS)
include_directories(${CMAKE_INSTALL_PREFIX}/include)
if(MS2_ENABLE_GSM)
find_library(LIBGSM libgsm PATHS ${CMAKE_INSTALL_PREFIX}/lib)
endif(MS2_ENABLE_GSM)
if(MS2_ENABLE_OPUS)
include_directories(${CMAKE_INSTALL_PREFIX}/include/opus)
find_library(LIBOPUS libopus.lib PATHS ${CMAKE_INSTALL_PREFIX}/lib)
find_library(LIBOPUS libopus PATHS ${CMAKE_INSTALL_PREFIX}/lib)
endif(MS2_ENABLE_OPUS)
if(MS2_ENABLE_VIDEO)
if(MS2_ENABLE_FFMPEG)
find_library(LIBAVCODEC libavcodec PATHS ${CMAKE_INSTALL_PREFIX}/lib)
find_library(LIBAVUTIL libavutil PATHS ${CMAKE_INSTALL_PREFIX}/lib)
find_library(LIBSWSCALE libswscale PATHS ${CMAKE_INSTALL_PREFIX}/lib)
endif(MS2_ENABLE_FFMPEG)
if(MS2_ENABLE_VPX)
find_library(LIBVPX libvpx PATHS ${CMAKE_INSTALL_PREFIX}/lib)
endif(MS2_ENABLE_VPX)
endif(MS2_ENABLE_VIDEO)
else()
include_directories(
${ORTP_INCLUDE_DIR}
${SPEEX_INCLUDE_DIR}
)
include_directories(${ORTP_INCLUDE_DIR})
if(MS2_ENABLE_SPEEX)
include_directories(${SPEEX_INCLUDE_DIR})
endif(MS2_ENABLE_SPEEX)
if(WIN32)
include_directories(${ORTP_ROOT_DIR}/build/vsx/oRTP/oRTP/)
endif(WIN32)
......
......@@ -48,6 +48,18 @@ add_definitions(
-DMS2_FILTERS
)
if(MS2_ENABLE_VIDEO)
add_definitions(-DVIDEO_ENABLED)
if(MS2_ENABLE_FFMPEG)
add_definitions(
-DHAVE_LIBAVCODEC_AVCODEC_H
-DHAVE_LIBSWSCALE_SWSCALE_H
)
else(MS2_ENABLE_FFMPEG)
add_definitions(-DNO_FFMPEG)
endif(MS2_ENABLE_FFMPEG)
endif(MS2_ENABLE_VIDEO)
if(WIN32)
add_definitions(
-DWINDOW_NATIVE
......@@ -82,20 +94,15 @@ set(VOIP_SOURCE_FILES
audiofilters/dtmfgen.c
audiofilters/equalizer.c
#audiofilters/genericplc.c
#audiofilters/gsm.c
audiofilters/l16.c
audiofilters/msconf.c
audiofilters/msfileplayer.c
audiofilters/msfilerec.c
audiofilters/msg722.c
audiofilters/msresample.c
audiofilters/msspeex.c
audiofilters/msvolume.c
audiofilters/speexec.c
audiofilters/tonedetector.c
audiofilters/ulaw.c
audiofilters/waveheader.h
audiofilters/winsnd3.c
otherfilters/msrtp.c
audiofilters/flowcontrol.c
audiofilters/flowcontrol.h
......@@ -114,7 +121,6 @@ set(VOIP_SOURCE_FILES
voip/bitratecontrol.c
voip/bitratedriver.c
voip/ice.c
#voip/layouts.c
voip/mediastream.c
voip/msvoip.c
voip/private.h
......@@ -124,10 +130,68 @@ set(VOIP_SOURCE_FILES
voip/rfc3984.c
)
if(WIN32)
list(APPEND VOIP_SOURCE_FILES audiofilters/winsnd3.c)
endif(WIN32)
if(MS2_ENABLE_GSM)
list(APPEND VOIP_SOURCE_FILES audiofilters/gsm.c)
endif(MS2_ENABLE_GSM)
if(MS2_ENABLE_OPUS)
set(VOIP_SOURCE_FILES ${VOIP_SOURCE_FILES} audiofilters/msopus.c)
list(APPEND VOIP_SOURCE_FILES audiofilters/msopus.c)
endif(MS2_ENABLE_OPUS)
if(MS2_ENABLE_RESAMPLE)
list(APPEND VOIP_SOURCE_FILES audiofilters/msresample.c)
endif(MS2_ENABLE_RESAMPLE)
if(MS2_ENABLE_SPEEX)
list(APPEND VOIP_SOURCE_FILES
audiofilters/msspeex.c
audiofilters/speexec.c
)
endif(MS2_ENABLE_SPEEX)
if(MS2_ENABLE_VIDEO)
list(APPEND VOIP_SOURCE_FILES
videofilters/extdisplay.c
videofilters/mire.c
videofilters/pixconv.c
videofilters/sizeconv.c
voip/layouts.c
voip/layouts.h
voip/msvideo.c
voip/msvideo_neon.c
voip/msvideo_neon.h
voip/rfc2429.h
voip/rfc3984.c
voip/videostream.c
)
if(MS2_ENABLE_FFMPEG)
list(APPEND VOIP_SOURCE_FILES
utils/ffmpeg-priv.h
utils/ffmpeg-priv.c
utils/swscale.h
videofilters/h264dec.c
videofilters/jpegwriter.c
videofilters/nowebcam.c
videofilters/videodec.c
videofilters/videoenc.c
voip/nowebcam.h
)
endif(MS2_ENABLE_FFMPEG)
if(MS2_ENABLE_VPX)
list(APPEND VOIP_SOURCE_FILES videofilters/vp8.c)
endif(MS2_ENABLE_VPX)
if(WIN32)
list(APPEND VOIP_SOURCE_FILES
videofilters/msdscap-mingw.cc
videofilters/drawdib-display.c
)
endif(WIN32)
endif(MS2_ENABLE_VIDEO)
set(VOIP_GENERATED_SOURCE_FILES
${CMAKE_CURRENT_BINARY_DIR}/voipdescs.h
)
......@@ -156,10 +220,37 @@ execute_process(
if(WIN32)
set(VOIP_LIBS ws2_32 ole32 oleaut32 winmm uuid)
endif(WIN32)
set(VOIP_LIBS ${VOIP_LIBS} libortp libmediastreamer_base libspeex libspeexdsp)
list(APPEND VOIP_LIBS
libortp
libmediastreamer_base
)
if(MS2_ENABLE_GSM)
list(APPEND VOIP_LIBS ${LIBGSM})
endif(MS2_ENABLE_GSM)
if(MS2_ENABLE_OPUS)
set(VOIP_LIBS ${VOIP_LIBS} ${LIBOPUS})
list(APPEND VOIP_LIBS ${LIBOPUS})
endif(MS2_ENABLE_OPUS)
if(MS2_ENABLE_SPEEX)
list(APPEND VOIP_LIBS
libspeex
libspeexdsp
)
endif(MS2_ENABLE_SPEEX)
if(MS2_ENABLE_VIDEO)
if(MS2_ENABLE_FFMPEG)
list(APPEND VOIP_LIBS
${LIBAVCODEC}
${LIBAVUTIL}
${LIBSWSCALE}
)
if(WIN32)
list(APPEND VOIP_LIBS vfw32)
endif(WIN32)
endif(MS2_ENABLE_FFMPEG)
if(MS2_ENABLE_VPX)
list(APPEND VOIP_LIBS ${LIBVPX})
endif(MS2_ENABLE_VPX)
endif(MS2_ENABLE_VIDEO)
add_library(libmediastreamer_voip SHARED ${VOIP_SOURCE_FILES} ${VOIP_GENERATED_SOURCE_FILES})
set_target_properties(libmediastreamer_voip PROPERTIES VERSION 2.9.2 SOVERSION 3)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment