| 1 |
if(NOT USE_CODEC_OPUS) |
| 2 |
return() |
| 3 |
endif() |
| 4 |
|
| 5 |
if(NOT BUILD_CLIENT) |
| 6 |
return() |
| 7 |
endif() |
| 8 |
|
| 9 |
include(utils/disable_warnings) |
| 10 |
include(utils/find_include_dirs) |
| 11 |
|
| 12 |
set(INTERNAL_OPUS_DIR ${SOURCE_DIR}/thirdparty/opus-1.5.2) |
| 13 |
set(INTERNAL_OPUSFILE_DIR ${SOURCE_DIR}/thirdparty/opusfile-0.12) |
| 14 |
|
| 15 |
if(USE_INTERNAL_OPUS) |
| 16 |
file(GLOB_RECURSE OPUS_SOURCES ${INTERNAL_OPUS_DIR}/*.c) |
| 17 |
file(GLOB_RECURSE OPUSFILE_SOURCES ${INTERNAL_OPUSFILE_DIR}/*.c) |
| 18 |
disable_warnings(${OPUS_SOURCES} ${OPUSFILE_SOURCES}) |
| 19 |
find_include_dirs(OPUS_INCLUDE_DIRS ${INTERNAL_OPUS_DIR}) |
| 20 |
find_include_dirs(OPUSFILE_INCLUDE_DIRS ${INTERNAL_OPUSFILE_DIR}) |
| 21 |
set(OPUS_DEFINITIONS OPUS_BUILD HAVE_LRINTF FLOATING_POINT FLOAT_APPROX USE_ALLOCA) |
| 22 |
list(APPEND CLIENT_LIBRARY_SOURCES ${OPUS_SOURCES} ${OPUSFILE_SOURCES}) |
| 23 |
else() |
| 24 |
find_package(PkgConfig REQUIRED) |
| 25 |
pkg_check_modules(OPUS REQUIRED opus) |
| 26 |
pkg_check_modules(OPUSFILE REQUIRED opusfile) |
| 27 |
endif() |
| 28 |
|
| 29 |
list(APPEND CLIENT_LIBRARIES ${OPUS_LIBRARIES} ${OPUSFILE_LIBRARIES}) |
| 30 |
list(APPEND CLIENT_INCLUDE_DIRS ${OPUS_INCLUDE_DIRS} ${OPUSFILE_INCLUDE_DIRS}) |
| 31 |
list(APPEND CLIENT_DEFINITIONS USE_CODEC_OPUS ${OPUS_DEFINITIONS} ${OPUSFILE_DEFINITIONS}) |