Permalink
Browse files

Re-add codecs support to the build system

  • Loading branch information...
olesalscheider committed Sep 3, 2017
1 parent 8e0415d commit 77d52eb507474ae5a2c1b2f540e3c67945eaea37
Showing with 142 additions and 0 deletions.
  1. +2 −0 CMakeLists.txt
  2. +25 −0 cmake/modules/FindOpus.cmake
  3. +25 −0 cmake/modules/FindSpeex.cmake
  4. +33 −0 cmake/modules/FindTheora.cmake
  5. +25 −0 cmake/modules/FindVPX.cmake
  6. +32 −0 src/CMakeLists.txt
View
@@ -9,6 +9,8 @@ set(SO_VERSION 0)
set(VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
mark_as_advanced(VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_STRING)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules")
find_package(Qt5 REQUIRED COMPONENTS Core Network Xml)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
@@ -0,0 +1,25 @@
# Try to find Opus
# Once done this will define
# Opus_FOUND - System has Opus
# Opus_INCLUDE_DIRS - The Opus include directories
# Opus_LIBRARIES - The libraries needed to use Opus
find_package(PkgConfig)
pkg_check_modules(PC_Opus QUIET libopus)
find_path(Opus_INCLUDE_DIR opus/opus.h
HINTS ${PC_Opus_INCLUDEDIR} ${PC_Opus_INCLUDE_DIRS}
)
find_library(Opus_LIBRARY NAMES opus
HINTS ${PC_Opus_LIBDIR} ${PC_Opus_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Opus DEFAULT_MSG Opus_LIBRARY Opus_INCLUDE_DIR)
mark_as_advanced(Opus_INCLUDE_DIR Opus_LIBRARY)
set(Opus_LIBRARIES ${Opus_LIBRARY})
set(Opus_INCLUDE_DIRS ${Opus_INCLUDE_DIR})
@@ -0,0 +1,25 @@
# Try to find Speex
# Once done this will define
# Speex_FOUND - System has Speex
# Speex_INCLUDE_DIRS - The Speex include directories
# Speex_LIBRARIES - The libraries needed to use Speex
find_package(PkgConfig)
pkg_check_modules(PC_Speex QUIET libspeex)
find_path(Speex_INCLUDE_DIR speex/speex.h
HINTS ${PC_Speex_INCLUDEDIR} ${PC_Speex_INCLUDE_DIRS}
)
find_library(Speex_LIBRARY NAMES speex
HINTS ${PC_Speex_LIBDIR} ${PC_Speex_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Speex DEFAULT_MSG Speex_LIBRARY Speex_INCLUDE_DIR)
mark_as_advanced(Speex_INCLUDE_DIR Speex_LIBRARY)
set(Speex_LIBRARIES ${Speex_LIBRARY})
set(Speex_INCLUDE_DIRS ${Speex_INCLUDE_DIR})
@@ -0,0 +1,33 @@
# Try to find Theora
# Once done this will define
# Theora_FOUND - System has Theora
# Theora_INCLUDE_DIRS - The Theora include directories
# Theora_LIBRARIES - The libraries needed to use Theora
find_package(PkgConfig)
pkg_check_modules(PC_Theora QUIET libtheora)
find_path(Theora_INCLUDE_DIR theora/theora.h
HINTS ${PC_Theora_INCLUDEDIR} ${PC_Theora_INCLUDE_DIRS}
)
find_library(Theora_LIBRARY NAMES theora
HINTS ${PC_Theora_LIBDIR} ${PC_Theora_LIBRARY_DIRS}
)
find_library(Theora_enc_LIBRARY NAMES theoraenc
HINTS ${PC_Theora_LIBDIR} ${PC_Theora_LIBRARY_DIRS}
)
find_library(Theora_dec_LIBRARY NAMES theoradec
HINTS ${PC_Theora_LIBDIR} ${PC_Theora_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Theora DEFAULT_MSG Theora_LIBRARY Theora_enc_LIBRARY Theora_dec_LIBRARY Theora_INCLUDE_DIR)
mark_as_advanced(Theora_INCLUDE_DIR Theora_LIBRARY Theora_enc_LIBRARY Theora_dec_LIBRARY)
set(Theora_LIBRARIES ${Theora_LIBRARY} ${Theora_enc_LIBRARY} ${Theora_dec_LIBRARY})
set(Theora_INCLUDE_DIRS ${Theora_INCLUDE_DIR})
@@ -0,0 +1,25 @@
# Try to find VPX
# Once done this will define
# VPX_FOUND - System has VPX
# VPX_INCLUDE_DIRS - The VPX include directories
# VPX_LIBRARIES - The libraries needed to use VPX
find_package(PkgConfig)
pkg_check_modules(PC_VPX QUIET libvpx)
find_path(VPX_INCLUDE_DIR vpx/vp8.h
HINTS ${PC_VPX_INCLUDEDIR} ${PC_VPX_INCLUDE_DIRS}
)
find_library(VPX_LIBRARY NAMES vpx
HINTS ${PC_VPX_LIBDIR} ${PC_VPX_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VPX DEFAULT_MSG VPX_LIBRARY VPX_INCLUDE_DIR)
mark_as_advanced(VPX_INCLUDE_DIR VPX_LIBRARY)
set(VPX_LIBRARIES ${VPX_LIBRARY})
set(VPX_INCLUDE_DIRS ${VPX_INCLUDE_DIR})
View
@@ -157,6 +157,36 @@ set(SOURCE_FILES
server/QXmppServerPlugin.cpp
)
option(WITH_SPEEX "Support the Speex codec" OFF)
option(WITH_OPUS "Support the Opus codec" OFF)
option(WITH_THEORA "Support the Theora codec" OFF)
option(WITH_VPX "Support the VPX codec" OFF)
if(WITH_SPEEX)
find_package(Speex REQUIRED)
include_directories(${Speex_INCLUDE_DIRS})
set(MULTIMEDIA_LIBS ${MULTIMEDIA_LIBS} ${Speex_LIBRARIES})
add_definitions(-DQXMPP_USE_SPEEX)
endif()
if(WITH_OPUS)
find_package(Opus REQUIRED)
include_directories(${Opus_INCLUDE_DIRS})
set(MULTIMEDIA_LIBS ${MULTIMEDIA_LIBS} ${Opus_LIBRARIES})
add_definitions(-DQXMPP_USE_OPUS)
endif()
if(WITH_THEORA)
find_package(Theora REQUIRED)
include_directories(${Theora_INCLUDE_DIRS})
set(MULTIMEDIA_LIBS ${MULTIMEDIA_LIBS} ${Theora_LIBRARIES})
add_definitions(-DQXMPP_USE_THEORA)
endif()
if(WITH_VPX)
find_package(VPX REQUIRED)
include_directories(${VPX_INCLUDE_DIRS})
set(MULTIMEDIA_LIBS ${MULTIMEDIA_LIBS} ${VPX_LIBRARIES})
add_definitions(-DQXMPP_USE_VPX)
endif()
add_library(qxmpp SHARED ${SOURCE_FILES})
set_target_properties(qxmpp PROPERTIES
@@ -171,6 +201,8 @@ target_link_libraries(qxmpp
Qt5::Core
Qt5::Network
Qt5::Xml
PRIVATE
${MULTIMEDIA_LIBS}
)
install(

0 comments on commit 77d52eb

Please sign in to comment.