[cmake,codec] fix WITH_OPUS

detect Opus in libfreerdp directly.
The target definition is there and if we run detection in a subdirectory
the required symbols are not visible
This commit is contained in:
akallabeth
2024-06-25 11:29:47 +02:00
parent 9b65c1109f
commit 7abf5eb3a7
2 changed files with 30 additions and 32 deletions

View File

@@ -96,6 +96,36 @@ macro (freerdp_compile_options_add)
set (LIBFREERDP_COMPILE_OPTIONS ${LIBFREERDP_COMPILE_OPTIONS} PARENT_SCOPE)
endmacro()
set(OPUS_DEFAULT OFF)
if (NOT WITH_DSP_FFMPEG)
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()
message("Using OPUS: ${OPUS_DEFAULT}")
endif()
option(WITH_OPUS "compile with opus codec support" ${OPUS_DEFAULT})
if (WITH_OPUS)
find_package(Opus)
if (Opus_FOUND)
freerdp_library_add(${OPUS_LIBRARIES})
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(OPUS REQUIRED opus)
freerdp_library_add(${OPUS_LIBRARIES})
freerdp_include_directory_add(${OPUS_INCLUDE_DIRS})
link_directories(${OPUS_LIBRARY_DIRS})
endif()
endif()
if (WITH_SWSCALE)
find_package(SWScale REQUIRED)
endif(WITH_SWSCALE)

View File

@@ -107,38 +107,6 @@ if(LAME_FOUND)
include_directories(${LAME_INCLUDE_DIRS})
endif()
set(OPUS_DEFAULT OFF)
if (NOT WITH_DSP_FFMPEG)
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()
message("Using OPUS: ${OPUS_DEFAULT}")
endif()
option(WITH_OPUS "compile with opus codec support" ${OPUS_DEFAULT})
if (WITH_OPUS)
find_package(Opus)
if (Opus_FOUND)
list(APPEND CODEC_LIBS ${OPUS_LIBRARIES})
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(OPUS REQUIRED opus)
if(OPUS_FOUND)
list(APPEND CODEC_LIBS ${OPUS_LIBRARIES})
include_directories(${OPUS_INCLUDE_DIRS})
link_directories(${OPUS_LIBRARY_DIRS})
endif()
endif()
endif()
if(FAAD2_FOUND)
list(APPEND CODEC_LIBS ${FAAD2_LIBRARIES})
include_directories(${FAAD2_INCLUDE_DIRS})