Add DESKTOP_APP_USE_PACKAGED_FFMPEG_STATIC option
Since static linking of packaged ffmpeg can be the easier option for libraries bundling
This commit is contained in:
parent
e4f4dad321
commit
85759739eb
4 changed files with 51 additions and 9 deletions
36
external/ffmpeg/CMakeLists.txt
vendored
36
external/ffmpeg/CMakeLists.txt
vendored
|
|
@ -16,14 +16,34 @@ if (DESKTOP_APP_USE_PACKAGED)
|
||||||
pkg_check_modules(SWSCALE REQUIRED IMPORTED_TARGET libswscale)
|
pkg_check_modules(SWSCALE REQUIRED IMPORTED_TARGET libswscale)
|
||||||
pkg_check_modules(SWRESAMPLE REQUIRED IMPORTED_TARGET libswresample)
|
pkg_check_modules(SWRESAMPLE REQUIRED IMPORTED_TARGET libswresample)
|
||||||
|
|
||||||
target_link_libraries(external_ffmpeg
|
if (DESKTOP_APP_USE_PACKAGED_FFMPEG_STATIC)
|
||||||
INTERFACE
|
target_include_directories(external_ffmpeg
|
||||||
PkgConfig::AVCODEC
|
INTERFACE
|
||||||
PkgConfig::AVFORMAT
|
${AVCODEC_STATIC_INCLUDE_DIRS}
|
||||||
PkgConfig::AVUTIL
|
${AVFORMAT_STATIC_INCLUDE_DIRS}
|
||||||
PkgConfig::SWSCALE
|
${AVUTIL_STATIC_INCLUDE_DIRS}
|
||||||
PkgConfig::SWRESAMPLE
|
${SWSCALE_STATIC_INCLUDE_DIRS}
|
||||||
)
|
${SWRESAMPLE_STATIC_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_static_libraries(external_ffmpeg IGNORE_NONEXISTING
|
||||||
|
INTERFACE
|
||||||
|
${AVCODEC_STATIC_LIBRARIES}
|
||||||
|
${AVFORMAT_STATIC_LIBRARIES}
|
||||||
|
${AVUTIL_STATIC_LIBRARIES}
|
||||||
|
${SWSCALE_STATIC_LIBRARIES}
|
||||||
|
${SWRESAMPLE_STATIC_LIBRARIES}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
target_link_libraries(external_ffmpeg
|
||||||
|
INTERFACE
|
||||||
|
PkgConfig::AVCODEC
|
||||||
|
PkgConfig::AVFORMAT
|
||||||
|
PkgConfig::AVUTIL
|
||||||
|
PkgConfig::SWSCALE
|
||||||
|
PkgConfig::SWRESAMPLE
|
||||||
|
)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
target_include_directories(external_ffmpeg SYSTEM
|
target_include_directories(external_ffmpeg SYSTEM
|
||||||
INTERFACE
|
INTERFACE
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ INTERFACE
|
||||||
VideoDecodeAcceleration
|
VideoDecodeAcceleration
|
||||||
AVFoundation
|
AVFoundation
|
||||||
CoreAudio
|
CoreAudio
|
||||||
|
CoreVideo
|
||||||
QuartzCore
|
QuartzCore
|
||||||
AppKit
|
AppKit
|
||||||
CoreWLAN
|
CoreWLAN
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,34 @@ function(target_link_static_libraries target_name)
|
||||||
set(private_libs "")
|
set(private_libs "")
|
||||||
set(public_libs "")
|
set(public_libs "")
|
||||||
set(interface_libs "")
|
set(interface_libs "")
|
||||||
|
set(ignore_nonexisting 0)
|
||||||
|
set(ignored_libs "")
|
||||||
foreach (entry ${list})
|
foreach (entry ${list})
|
||||||
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
|
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
|
||||||
set(writing_now ${entry})
|
set(writing_now ${entry})
|
||||||
|
elseif (${entry} STREQUAL "IGNORE_NONEXISTING")
|
||||||
|
set(ignore_nonexisting 1)
|
||||||
else()
|
else()
|
||||||
find_library(static_lib_${entry} lib${entry}.a)
|
find_library(static_lib_${entry} lib${entry}.a)
|
||||||
set(full_path "${static_lib_${entry}}")
|
set(full_path "${static_lib_${entry}}")
|
||||||
if (${full_path} STREQUAL static_lib_${entry}-NOTFOUND)
|
if (${full_path} STREQUAL static_lib_${entry}-NOTFOUND)
|
||||||
message(FATAL_ERROR "Could not find static library lib${entry}.a")
|
if (ignore_nonexisting)
|
||||||
|
if (NOT entry IN_LIST ignored_libs)
|
||||||
|
message(VERBOSE "Could not find static library lib${entry}.a, using shared one...")
|
||||||
|
list(APPEND ignored_libs ${entry})
|
||||||
|
endif()
|
||||||
|
if (APPLE)
|
||||||
|
find_library(shared_lib_${entry} lib${entry}.dylib)
|
||||||
|
set(full_path "${shared_lib_${entry}}")
|
||||||
|
if (${full_path} STREQUAL shared_lib_${entry}-NOTFOUND)
|
||||||
|
message(FATAL_ERROR "Could not find shared library lib${entry}.dylib")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(full_path ${entry})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Could not find static library lib${entry}.a")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if ("${writing_now}" STREQUAL "PRIVATE")
|
if ("${writing_now}" STREQUAL "PRIVATE")
|
||||||
list(APPEND private_libs ${full_path})
|
list(APPEND private_libs ${full_path})
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ option(DESKTOP_APP_USE_PACKAGED_EXPECTED "Find expected using CMake instead of b
|
||||||
option(DESKTOP_APP_USE_PACKAGED_VARIANT "Find mapbox-variant using CMake instead of bundled one." ${DESKTOP_APP_USE_PACKAGED})
|
option(DESKTOP_APP_USE_PACKAGED_VARIANT "Find mapbox-variant using CMake instead of bundled one." ${DESKTOP_APP_USE_PACKAGED})
|
||||||
option(DESKTOP_APP_USE_PACKAGED_GSL "Find GSL using CMake instead of bundled one." ${DESKTOP_APP_USE_PACKAGED})
|
option(DESKTOP_APP_USE_PACKAGED_GSL "Find GSL using CMake instead of bundled one." ${DESKTOP_APP_USE_PACKAGED})
|
||||||
option(DESKTOP_APP_USE_PACKAGED_QRCODE "Find qr-code-generator library using CMake instead of bundled one." OFF)
|
option(DESKTOP_APP_USE_PACKAGED_QRCODE "Find qr-code-generator library using CMake instead of bundled one." OFF)
|
||||||
|
option(DESKTOP_APP_USE_PACKAGED_FFMPEG_STATIC "Link found ffmpeg statically." OFF)
|
||||||
option(DESKTOP_APP_USE_PACKAGED_FONTS "Use preinstalled fonts instead of bundled one." ${DESKTOP_APP_USE_PACKAGED})
|
option(DESKTOP_APP_USE_PACKAGED_FONTS "Use preinstalled fonts instead of bundled one." ${DESKTOP_APP_USE_PACKAGED})
|
||||||
option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF)
|
option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF)
|
||||||
option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell. (Linux only)" OFF)
|
option(DESKTOP_APP_USE_ENCHANT "Use Enchant instead of bundled Hunspell. (Linux only)" OFF)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue