mirror of
https://github.com/SFML/SFML.git
synced 2025-03-14 01:40:05 +08:00
Update CMake integration for Opus
This commit is contained in:
parent
4008cbfe6a
commit
4fab55bf61
@ -1,15 +1,9 @@
|
|||||||
# This file was taken from Unvanquished,
|
#
|
||||||
# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
# Try to find the Opus libraries and include paths
|
||||||
# It's licensed under the terms of the 3-clause OpenBSD license.
|
# OPUS_FOUND
|
||||||
# Modifications Copyright 2014-2015 the openage authors.
|
# OPUS_INCLUDE_DIR
|
||||||
# See copying.md for further legal info.
|
# OPUS_LIBRARY
|
||||||
|
#
|
||||||
# - Find opus library
|
|
||||||
# Find the native Opus headers and libraries.
|
|
||||||
# This module defines
|
|
||||||
# OPUS_INCLUDE_DIRS - where to find opus/opus.h, opus/opusfile.h, etc
|
|
||||||
# OPUS_LIBRARIES - List of libraries when using libopus
|
|
||||||
# OPUS_FOUND - True if opus is found.
|
|
||||||
|
|
||||||
# find the opusfile header, defines our api.
|
# find the opusfile header, defines our api.
|
||||||
find_path(OPUS_INCLUDE_DIR
|
find_path(OPUS_INCLUDE_DIR
|
||||||
@ -32,12 +26,10 @@ find_library(OPUS_LIBRARY
|
|||||||
)
|
)
|
||||||
mark_as_advanced(OPUS_LIBRARY)
|
mark_as_advanced(OPUS_LIBRARY)
|
||||||
|
|
||||||
|
add_library(Opus::opus IMPORTED UNKNOWN)
|
||||||
# handle the QUIETLY and REQUIRED arguments and set OPUSFILE_FOUND to TRUE if
|
set_target_properties(Opus::opus PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${OPUS_INCLUDE_DIR})
|
||||||
# all listed variables are TRUE
|
if(OPUS_LIBRARY MATCHES "/([^/]+)\\.framework$")
|
||||||
include(FindPackageHandleStandardArgs)
|
set_target_properties(Opus::opus PROPERTIES IMPORTED_LOCATION ${OPUS_LIBRARY}/${CMAKE_MATCH_1})
|
||||||
find_package_handle_standard_args(Opus DEFAULT_MSG OPUSFILE_LIBRARY OPUS_LIBRARY OPUS_INCLUDE_DIR)
|
else()
|
||||||
|
set_target_properties(Opus::opus PROPERTIES IMPORTED_LOCATION ${OPUS_LIBRARY})
|
||||||
# export the variables
|
endif()
|
||||||
set(OPUS_LIBRARIES "${OPUSFILE_LIBRARY}" "${OPUS_LIBRARY}")
|
|
||||||
set(OPUS_INCLUDE_DIRS "${OPUS_INCLUDE_DIR}" "${OPUS_INCLUDE_DIR}/opus")
|
|
||||||
|
@ -62,6 +62,7 @@ if(SFML_STATIC_LIBRARIES)
|
|||||||
if(FIND_SFML_AUDIO_COMPONENT_INDEX GREATER -1)
|
if(FIND_SFML_AUDIO_COMPONENT_INDEX GREATER -1)
|
||||||
find_package(Vorbis)
|
find_package(Vorbis)
|
||||||
find_package(FLAC)
|
find_package(FLAC)
|
||||||
|
find_package(Opus)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FIND_SFML_DEPENDENCIES_NOTFOUND)
|
if(FIND_SFML_DEPENDENCIES_NOTFOUND)
|
||||||
|
@ -96,7 +96,7 @@ target_compile_definitions(sfml-audio PRIVATE MA_NO_MP3 MA_NO_FLAC MA_NO_ENCODIN
|
|||||||
# setup dependencies
|
# setup dependencies
|
||||||
target_link_libraries(sfml-audio
|
target_link_libraries(sfml-audio
|
||||||
PUBLIC SFML::System
|
PUBLIC SFML::System
|
||||||
PRIVATE Vorbis::vorbis FLAC::FLAC)
|
PRIVATE Vorbis::vorbis FLAC::FLAC Opus::opus)
|
||||||
if(SFML_OS_IOS)
|
if(SFML_OS_IOS)
|
||||||
target_link_libraries(sfml-audio PRIVATE "-framework Foundation" "-framework CoreFoundation" "-framework CoreAudio" "-framework AudioToolbox" "-framework AVFoundation")
|
target_link_libraries(sfml-audio PRIVATE "-framework Foundation" "-framework CoreFoundation" "-framework CoreAudio" "-framework AudioToolbox" "-framework AVFoundation")
|
||||||
else()
|
else()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user