2017-02-28 23:51:22 +00:00
|
|
|
find_package(PkgConfig QUIET)
|
|
|
|
pkg_check_modules(PC_OPUSFILE opusfile)
|
|
|
|
set_extra_dirs(OPUSFILE opus)
|
|
|
|
|
|
|
|
find_path(OPUSFILE_INCLUDEDIR opusfile.h
|
|
|
|
PATH_SUFFIXES opus
|
|
|
|
HINTS ${PC_OPUSFILE_INCLUDEDIR} ${PC_OPUSFILE_INCLUDE_DIRS}
|
|
|
|
PATHS ${EXTRA_OPUSFILE_INCLUDEDIR}
|
|
|
|
)
|
|
|
|
find_library(OPUSFILE_LIBRARY
|
|
|
|
NAMES opusfile
|
|
|
|
HINTS ${PC_OPUSFILE_LIBDIR} ${PC_OPUSFILE_LIBRARY_DIRS}
|
|
|
|
PATHS ${EXTRA_OPUSFILE_LIBDIR}
|
|
|
|
)
|
2017-02-23 13:16:32 +00:00
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
2017-02-28 23:51:22 +00:00
|
|
|
find_package_handle_standard_args(Opusfile DEFAULT_MSG OPUSFILE_LIBRARY OPUSFILE_INCLUDEDIR)
|
|
|
|
|
|
|
|
mark_as_advanced(OPUSFILE_LIBRARY OPUSFILE_INCLUDEDIR)
|
|
|
|
|
|
|
|
set(OPUSFILE_LIBRARIES ${OPUSFILE_LIBRARY})
|
|
|
|
set(OPUSFILE_INCLUDE_DIRS ${OPUSFILE_INCLUDEDIR})
|
2017-03-07 14:24:08 +00:00
|
|
|
|
|
|
|
string(FIND "${OPUSFILE_LIBRARY}" "${PROJECT_SOURCE_DIR}" LOCAL_PATH_POS)
|
|
|
|
if(LOCAL_PATH_POS EQUAL 0 AND TARGET_OS STREQUAL "windows")
|
|
|
|
set(OPUSFILE_COPY_FILES
|
2017-07-21 21:43:01 +00:00
|
|
|
"${EXTRA_OPUSFILE_LIBDIR}/libogg.dll"
|
|
|
|
"${EXTRA_OPUSFILE_LIBDIR}/libopus.dll"
|
|
|
|
"${EXTRA_OPUSFILE_LIBDIR}/libopusfile.dll"
|
2017-03-07 14:24:08 +00:00
|
|
|
"${EXTRA_OPUSFILE_LIBDIR}/libwinpthread-1.dll"
|
|
|
|
)
|
2017-07-20 21:52:25 +00:00
|
|
|
if (TARGET_BITS EQUAL 32)
|
|
|
|
list(APPEND OPUSFILE_COPY_FILES
|
|
|
|
"${EXTRA_OPUSFILE_LIBDIR}/libgcc_s_sjlj-1.dll"
|
|
|
|
)
|
|
|
|
endif()
|
2017-03-07 14:24:08 +00:00
|
|
|
else()
|
|
|
|
set(OPUSFILE_COPY_FILES)
|
|
|
|
endif()
|