[libfreerdp] prefer opus CMake file over pkg-config

This commit is contained in:
Armin Novak 2023-12-13 20:49:31 +01:00 committed by akallabeth
parent e355b64059
commit 9b7fa92521
1 changed files with 41 additions and 30 deletions

View File

@ -69,17 +69,17 @@ macro (freerdp_include_directory_add)
endmacro()
macro (freerdp_library_add_public)
foreach (_lib ${ARGN})
list (APPEND LIBFREERDP_PUB_LIBS "${_lib}")
endforeach()
set (LIBFREERDP_PUB_LIBS ${LIBFREERDP_PUB_LIBS} PARENT_SCOPE)
foreach (_lib ${ARGN})
list (APPEND LIBFREERDP_PUB_LIBS "${_lib}")
endforeach()
set (LIBFREERDP_PUB_LIBS ${LIBFREERDP_PUB_LIBS} PARENT_SCOPE)
endmacro()
macro (freerdp_library_add)
foreach (_lib ${ARGN})
list (APPEND LIBFREERDP_LIBS "${_lib}")
endforeach()
set (LIBFREERDP_LIBS ${LIBFREERDP_LIBS} PARENT_SCOPE)
foreach (_lib ${ARGN})
list (APPEND LIBFREERDP_LIBS "${_lib}")
endforeach()
set (LIBFREERDP_LIBS ${LIBFREERDP_LIBS} PARENT_SCOPE)
endmacro()
macro (freerdp_definition_add)
@ -132,8 +132,8 @@ endif ()
# codec
set(CODEC_SRCS
codec/bulk.c
codec/bulk.h
codec/bulk.c
codec/bulk.h
codec/dsp.c
codec/color.c
codec/audio.c
@ -197,8 +197,8 @@ if (WITH_DSP_FFMPEG)
${CODEC_SRCS}
codec/dsp_ffmpeg.c
codec/dsp_ffmpeg.h)
freerdp_include_directory_add(${FFMPEG_INCLUDE_DIRS})
freerdp_library_add(${FFMPEG_LIBRARIES})
freerdp_include_directory_add(${FFMPEG_INCLUDE_DIRS})
freerdp_library_add(${FFMPEG_LIBRARIES})
endif (WITH_DSP_FFMPEG)
if (WITH_SOXR)
@ -218,20 +218,31 @@ endif()
set(OPUS_DEFAULT OFF)
if (NOT WITH_DSP_FFMPEG)
find_package(PkgConfig)
if (PkgConfig_FOUND)
pkg_check_modules(OPUS opus)
set(OPUS_DEFAULT ${OPUS_FOUND})
endif()
find_package(Opus)
if (Opus_FOUND)
set(OPUS_DEFAULT ${OPUS_FOUND})
else()
find_package(PkgConfig)
if (PkgConfig_FOUND)
pkg_check_modules(OPUS opus)
set(OPUS_DEFAULT ${OPUS_FOUND})
endif()
endif()
endif()
option(WITH_OPUS "compile with opus codec support" ${OPUS_DEFAULT})
if (WITH_OPUS)
find_package(PkgConfig REQUIRED)
pkg_check_modules(OPUS REQUIRED opus)
if(OPUS_FOUND)
freerdp_library_add(${OPUS_LIBRARIES})
include_directories(${OPUS_INCLUDE_DIRS})
find_package(Opus)
if (Opus_FOUND)
freerdp_library_add(Opus::opus)
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(OPUS REQUIRED opus)
if(OPUS_FOUND)
freerdp_library_add(${OPUS_LIBRARIES})
include_directories(${OPUS_INCLUDE_DIRS})
link_directories(${OPUS_LIBRARY_DIRS})
endif()
endif()
endif()
@ -246,13 +257,13 @@ if(FAAC_FOUND)
endif()
if (WITH_AAD)
if (NOT cJSON_FOUND)
find_package(PkgConfig REQUIRED)
pkg_check_modules(CJSON REQUIRED libcjson)
endif()
include_directories(${CJSON_INCLUDE_DIRS})
if (NOT cJSON_FOUND)
find_package(PkgConfig REQUIRED)
pkg_check_modules(CJSON REQUIRED libcjson)
endif()
include_directories(${CJSON_INCLUDE_DIRS})
freerdp_library_add(${CJSON_LIBRARIES})
freerdp_library_add(${CJSON_LIBRARIES})
include_directories(${CJSON_INCLUDE_DIRS})
endif()
@ -293,8 +304,8 @@ endif()
if(ANDROID AND WITH_MEDIACODEC)
list(APPEND CODEC_SRCS codec/h264_mediacodec.c)
find_library(MEDIACODEC mediandk REQUIRED)
freerdp_library_add(${MEDIACODEC})
find_library(MEDIACODEC mediandk REQUIRED)
freerdp_library_add(${MEDIACODEC})
endif()
freerdp_module_add(${CODEC_SRCS})