CMake: Detect Ogg+Vorbis

This commit is contained in:
Sam Edwards 2019-01-13 11:31:43 -07:00
parent 615a1d205d
commit 8a2375a5f1
4 changed files with 63 additions and 1 deletions

View File

@ -0,0 +1,20 @@
# Filename: FindOgg.cmake
# Authors: CFSworks (13 Jan, 2019)
#
# Usage:
# find_package(Ogg [REQUIRED] [QUIET])
#
# Once done this will define:
# OGG_FOUND - system has Ogg
# OGG_INCLUDE_DIR - the include directory containing ogg/
# OGG_LIBRARY - the path to the ogg library
#
find_path(OGG_INCLUDE_DIR NAMES "ogg/ogg.h")
find_library(OGG_LIBRARY NAMES "ogg")
mark_as_advanced(OGG_INCLUDE_DIR OGG_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Ogg DEFAULT_MSG OGG_INCLUDE_DIR OGG_LIBRARY)

View File

@ -0,0 +1,34 @@
# Filename: FindVorbisFile.cmake
# Authors: CFSworks (13 Jan, 2019)
#
# Usage:
# find_package(VorbisFile [REQUIRED] [QUIET])
#
# Once done this will define:
# VORBISFILE_FOUND - system has Ogg and vorbisfile
# VORBISFILE_INCLUDE_DIRS - the include directory/ies containing vorbis/ and ogg/
# VORBISFILE_LIBRARIES - the paths to the vorbis and vorbisfile libraries
#
# Find Ogg
find_package(Ogg QUIET)
# Find Vorbis
find_path(VORBIS_INCLUDE_DIR NAMES "vorbis/vorbisfile.h")
find_library(VORBIS_vorbis_LIBRARY NAMES "vorbis")
find_library(VORBIS_vorbisfile_LIBRARY NAMES "vorbisfile")
mark_as_advanced(VORBIS_INCLUDE_DIR VORBIS_vorbis_LIBRARY VORBIS_vorbisfile_LIBRARY)
# Define output variables
set(VORBISFILE_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR})
if(NOT OGG_INCLUDE_DIR STREQUAL VORBIS_INCLUDE_DIR)
list(APPEND VORBISFILE_INCLUDE_DIRS ${OGG_INCLUDE_DIR})
endif()
set(VORBISFILE_LIBRARIES ${OGG_LIBRARY} ${VORBIS_vorbis_LIBRARY} ${VORBIS_vorbisfile_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VorbisFile DEFAULT_MSG
Ogg_FOUND
VORBIS_INCLUDE_DIR VORBIS_vorbis_LIBRARY VORBIS_vorbisfile_LIBRARY)

View File

@ -241,6 +241,13 @@ else()
endif()
package_status(FFMPEG "FFmpeg" "${ffmpeg_features}")
# Vorbis
find_package(VorbisFile QUIET)
package_option(VORBIS
FOUND_AS VORBISFILE
"Enables support for decoding Vorbis-encoded .ogg audio files via libvorbisfile.")
package_status(VORBIS "Vorbis")
#
# ------------ Audio libraries ------------
#

View File

@ -45,7 +45,8 @@ set(P3MOVIES_SOURCES
composite_sources(p3movies P3MOVIES_SOURCES)
add_component_library(p3movies SYMBOL BUILDING_PANDA_MOVIES
${P3MOVIES_HEADERS} ${P3MOVIES_SOURCES})
target_link_libraries(p3movies p3pstatclient p3gobj p3pandabase pandaexpress)
target_link_libraries(p3movies p3pstatclient p3gobj p3pandabase pandaexpress
PKG::VORBIS)
target_interrogate(p3movies ALL)
if(NOT BUILD_METALIBS)