1b815c7f3Sopenharmony_ci# - Find opus 2b815c7f3Sopenharmony_ci# Find the native opus includes and libraries 3b815c7f3Sopenharmony_ci# 4b815c7f3Sopenharmony_ci# OPUS_INCLUDE_DIRS - where to find opus.h, etc. 5b815c7f3Sopenharmony_ci# OPUS_LIBRARIES - List of libraries when using opus. 6b815c7f3Sopenharmony_ci# OPUS_FOUND - True if Opus found. 7b815c7f3Sopenharmony_ci 8b815c7f3Sopenharmony_ciif (OPUS_INCLUDE_DIR) 9b815c7f3Sopenharmony_ci # Already in cache, be silent 10b815c7f3Sopenharmony_ci set(OPUS_FIND_QUIETLY TRUE) 11b815c7f3Sopenharmony_ciendif () 12b815c7f3Sopenharmony_ci 13b815c7f3Sopenharmony_cifind_package (Ogg QUIET) 14b815c7f3Sopenharmony_ci 15b815c7f3Sopenharmony_cifind_package (PkgConfig QUIET) 16b815c7f3Sopenharmony_cipkg_check_modules(PC_OPUS QUIET opus>=1.1) 17b815c7f3Sopenharmony_ci 18b815c7f3Sopenharmony_ciset (OPUS_VERSION ${PC_OPUS_VERSION}) 19b815c7f3Sopenharmony_ci 20b815c7f3Sopenharmony_cifind_path (OPUS_INCLUDE_DIR opus/opus.h 21b815c7f3Sopenharmony_ci HINTS 22b815c7f3Sopenharmony_ci ${PC_OPUS_INCLUDEDIR} 23b815c7f3Sopenharmony_ci ${PC_OPUS_INCLUDE_DIRS} 24b815c7f3Sopenharmony_ci ${OPUS_ROOT} 25b815c7f3Sopenharmony_ci ) 26b815c7f3Sopenharmony_ci 27b815c7f3Sopenharmony_ci# MSVC built opus may be named opus_static. 28b815c7f3Sopenharmony_ci# The provided project files name the library with the lib prefix. 29b815c7f3Sopenharmony_ci 30b815c7f3Sopenharmony_cifind_library (OPUS_LIBRARY 31b815c7f3Sopenharmony_ci NAMES 32b815c7f3Sopenharmony_ci opus 33b815c7f3Sopenharmony_ci opus_static 34b815c7f3Sopenharmony_ci libopus 35b815c7f3Sopenharmony_ci libopus_static 36b815c7f3Sopenharmony_ci HINTS 37b815c7f3Sopenharmony_ci ${PC_OPUS_LIBDIR} 38b815c7f3Sopenharmony_ci ${PC_OPUS_LIBRARY_DIRS} 39b815c7f3Sopenharmony_ci ${OPUS_ROOT} 40b815c7f3Sopenharmony_ci ) 41b815c7f3Sopenharmony_ci 42b815c7f3Sopenharmony_ci# Handle the QUIETLY and REQUIRED arguments and set OPUS_FOUND 43b815c7f3Sopenharmony_ci# to TRUE if all listed variables are TRUE. 44b815c7f3Sopenharmony_ciinclude(FindPackageHandleStandardArgs) 45b815c7f3Sopenharmony_cifind_package_handle_standard_args (Opus 46b815c7f3Sopenharmony_ci REQUIRED_VARS 47b815c7f3Sopenharmony_ci OPUS_LIBRARY 48b815c7f3Sopenharmony_ci OPUS_INCLUDE_DIR 49b815c7f3Sopenharmony_ci OGG_FOUND 50b815c7f3Sopenharmony_ci VERSION_VAR 51b815c7f3Sopenharmony_ci OPUS_VERSION 52b815c7f3Sopenharmony_ci ) 53b815c7f3Sopenharmony_ci 54b815c7f3Sopenharmony_ciif (OPUS_FOUND) 55b815c7f3Sopenharmony_ci set (OPUS_LIBRARIES ${OPUS_LIBRARY}) 56b815c7f3Sopenharmony_ci set (OPUS_INCLUDE_DIRS ${OPUS_INCLUDE_DIR}) 57b815c7f3Sopenharmony_ci 58b815c7f3Sopenharmony_ci if (NOT TARGET Opus::opus) 59b815c7f3Sopenharmony_ci add_library (Opus::opus UNKNOWN IMPORTED) 60b815c7f3Sopenharmony_ci set_target_properties (Opus::opus PROPERTIES 61b815c7f3Sopenharmony_ci INTERFACE_INCLUDE_DIRECTORIES "${OPUS_INCLUDE_DIRS}" 62b815c7f3Sopenharmony_ci IMPORTED_LOCATION "${OPUS_LIBRARIES}" 63b815c7f3Sopenharmony_ci ) 64b815c7f3Sopenharmony_ci endif () 65b815c7f3Sopenharmony_ciendif () 66b815c7f3Sopenharmony_ci 67b815c7f3Sopenharmony_cimark_as_advanced(OPUS_INCLUDE_DIR OPUS_LIBRARY) 68