From 718604885b54d93647836e795da51da59b5ffbfa Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Mon, 21 Dec 2020 11:17:21 -0500 Subject: [PATCH 1/3] FFmpeg: Reduce overlinking - We don't make use of any part of avdevice, avfilter, or postproc, so remove all of those from the package COMPONENTS list. - In addition, the deprecated avresample will only be linked/used if swresample is not present on the system. --- src/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f42b88e87..64fc66017 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -284,9 +284,14 @@ mark_as_advanced(QT_VERSION_STR) ################### FFMPEG ##################### # Find FFmpeg libraries (used for video encoding / decoding) -find_package(FFmpeg REQUIRED COMPONENTS avcodec avdevice avformat avutil swscale) +find_package(FFmpeg REQUIRED COMPONENTS avcodec avformat avutil swscale) -set(all_comps avcodec avdevice avformat avfilter avutil postproc swscale swresample avresample) +set(all_comps avcodec avformat avutil swscale) +if(TARGET FFmpeg::swresample) + list(APPEND all_comps swresample) +else() + list(APPEND all_comps avresample) +endif() set(version_comps avcodec avformat avutil) foreach(ff_comp IN LISTS all_comps) From ed4edc4c8b60e5bce9acf7340880d0664d54e674 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Mon, 21 Dec 2020 08:45:25 -0500 Subject: [PATCH 2/3] Don't link with ImageMagick MagickWand (not used) --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 64fc66017..b538f293c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -184,7 +184,7 @@ target_link_libraries(openshot PUBLIC OpenShot::Audio) ### # Find the ImageMagick++ library -find_package(ImageMagick COMPONENTS Magick++ MagickWand MagickCore) +find_package(ImageMagick COMPONENTS Magick++ MagickCore) if(ImageMagick_FOUND) if(NOT TARGET ImageMagick::Magick++ AND NOT TARGET Magick++_TARGET) From 1f05c5f1021714013ed68b8e8968ae4382e3685a Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Wed, 28 Apr 2021 22:58:41 -0400 Subject: [PATCH 3/3] CMake: Build bundled jsoncpp as an OBJECT library Avoids having to recompile it for every target. --- src/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b538f293c..4bd09e748 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -246,10 +246,12 @@ endif () if (NOT jsoncpp_FOUND AND NOT DISABLE_BUNDLED_JSONCPP) message(STATUS "Using embedded jsoncpp (not found or USE_SYSTEM_JSONCPP disabled)") if (NOT TARGET jsoncpp_lib) - add_library(jsoncpp_lib INTERFACE) - target_include_directories(jsoncpp_lib INTERFACE + add_library(jsoncpp_lib OBJECT) + set_target_properties(jsoncpp_lib PROPERTIES + POSITION_INDEPENDENT_CODE TRUE) + target_include_directories(jsoncpp_lib PUBLIC "${PROJECT_SOURCE_DIR}/thirdparty/jsoncpp") - target_sources(jsoncpp_lib INTERFACE "${PROJECT_SOURCE_DIR}/thirdparty/jsoncpp/jsoncpp.cpp") + target_sources(jsoncpp_lib PRIVATE "${PROJECT_SOURCE_DIR}/thirdparty/jsoncpp/jsoncpp.cpp") # Because this satisfies the requirement, an installed JsonCpp is optional set_package_properties(jsoncpp PROPERTIES TYPE OPTIONAL) endif ()