-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
include(FindPackageHandleStandardArgs) | ||
|
||
find_package(PkgConfig QUIET) | ||
pkg_check_modules(PC_OPUS QUIET opus) | ||
|
||
find_library(Opus_LIBRARY | ||
NAMES opus | ||
HINTS ${PC_OPUS_LIBDIR} | ||
) | ||
|
||
find_path(Opus_INCLUDE_PATH | ||
NAMES opus.h | ||
PATH_SUFFIXES opus | ||
HINTS ${PC_OPUS_INCLUDEDIR} | ||
) | ||
list(APPEND Opus_INCLUDE_PATH "${Opus_INCLUDE_PATH}/opus") | ||
|
||
if(PC_OPUS_FOUND) | ||
get_flags_from_pkg_config("${Opus_LIBRARY}" "PC_OPUS" "_opus") | ||
endif() | ||
|
||
set(Opus_COMPILE_OPTIONS "${_opus_compile_options}" CACHE STRING "Extra compile options of opus") | ||
|
||
set(Opus_LINK_LIBRARIES "${_opus_link_libraries}" CACHE STRING "Extra link libraries of opus") | ||
|
||
set(Opus_LINK_OPTIONS "${_opus_link_options}" CACHE STRING "Extra link flags of opus") | ||
|
||
set(Opus_LINK_DIRECTORIES "${_opus_link_directories}" CACHE PATH "Extra link directories of opus") | ||
|
||
find_package(Ogg ${required}) | ||
|
||
find_package_handle_standard_args(Opus | ||
REQUIRED_VARS Opus_LIBRARY Opus_INCLUDE_PATH Ogg_FOUND | ||
) | ||
|
||
if(Opus_FOUND) | ||
set(Opus_dirs ${Opus_INCLUDE_PATH}) | ||
if(NOT TARGET Opus::opus) | ||
add_library(Opus::opus UNKNOWN IMPORTED) | ||
set_target_properties(Opus::opus PROPERTIES | ||
IMPORTED_LOCATION "${Opus_LIBRARY}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${Opus_dirs}" | ||
INTERFACE_COMPILE_OPTIONS "${Opus_COMPILE_OPTIONS}:$<TARGET_PROPERTY:Ogg::ogg,INTERFACE_INCLUDE_DIRECTORIES>" | ||
INTERFACE_LINK_LIBRARIES "${Opus_LINK_LIBRARIES}" | ||
INTERFACE_LINK_OPTIONS "${Opus_LINK_OPTIONS}" | ||
INTERFACE_LINK_DIRECTORIES "${Opus_LINK_DIRECTORIES}" | ||
) | ||
endif() | ||
endif() | ||
|
||
set(Opus_INCLUDE_DIRS ${Opus_INCLUDE_PATH}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters