Add more build-config variables

- HAVE_IMAGEMAGICK and HAVE_RESVG will be #defined 0 or 1
- AV{CODEC,FORMAT,UTIL}_VERSION_STR will contain the FFmpeg
  component versions detected by CMake when configuring the build
This commit is contained in:
FeRD (Frank Dana)
2020-05-09 18:33:03 -04:00
parent 5c688f1edf
commit 0e79844ed9
2 changed files with 25 additions and 9 deletions

View File

@@ -42,8 +42,13 @@
#define OPENSHOT_VERSION_SO @PROJECT_SO_VERSION@ /// Shared object version number. This increments any time the API and ABI changes (so old apps will no longer link)
// Useful dependency versioning
#define QT_VERSION_STR "@QT_VERSION_STR@"
// Useful dependency versioning / feature availability
#cmakedefine QT_VERSION_STR "@QT_VERSION_STR@"
#cmakedefine AVCODEC_VERSION_STR "@AVCODEC_VERSION_STR@"
#cmakedefine AVFORMAT_VERSION_STR "@AVFORMAT_VERSION_STR@"
#cmakedefine AVUTIL_VERSION_STR "@AVUTIL_VERSION_STR@"
#cmakedefine01 HAVE_IMAGEMAGICK
#cmakedefine01 HAVE_RESVG
#include <sstream>

View File

@@ -59,11 +59,6 @@ IF (MAGICKCORE_HDRI_ENABLE)
ELSE (MAGICKCORE_HDRI_ENABLE)
add_definitions( -DMAGICKCORE_HDRI_ENABLE=0 )
ENDIF (MAGICKCORE_HDRI_ENABLE)
IF (OPENSHOT_IMAGEMAGICK_COMPATIBILITY)
add_definitions( -DOPENSHOT_IMAGEMAGICK_COMPATIBILITY=${OPENSHOT_IMAGEMAGICK_COMPATIBILITY} )
ELSE (OPENSHOT_IMAGEMAGICK_COMPATIBILITY)
add_definitions( -DOPENSHOT_IMAGEMAGICK_COMPATIBILITY=0 )
ENDIF (OPENSHOT_IMAGEMAGICK_COMPATIBILITY)
# Find the ImageMagick++ library
find_package(ImageMagick COMPONENTS Magick++ MagickWand MagickCore)
@@ -75,6 +70,8 @@ if (ImageMagick_FOUND)
add_definitions( -DUSE_IMAGEMAGICK=1 )
set(CMAKE_SWIG_FLAGS "-DUSE_IMAGEMAGICK=1")
set(HAVE_IMAGEMAGICK TRUE CACHE BOOL "Building with ImageMagick support" FORCE)
mark_as_advanced(HAVE_IMAGEMAGICK)
endif()
################# LIBOPENSHOT-AUDIO ###################
@@ -297,10 +294,20 @@ mark_as_advanced(QT_VERSION_STR)
# Find FFmpeg libraries (used for video encoding / decoding)
find_package(FFmpeg REQUIRED COMPONENTS avcodec avdevice avformat avutil swscale)
foreach(ff_comp avcodec avdevice avformat avfilter avutil postproc swscale swresample avresample)
set(all_comps avcodec avdevice avformat avfilter avutil postproc swscale swresample avresample)
set(version_comps avcodec avformat avutil)
foreach(ff_comp IN LISTS all_comps)
if(TARGET FFmpeg::${ff_comp})
target_link_libraries(openshot PUBLIC FFmpeg::${ff_comp})
target_link_libraries(openshot PUBLIC FFmpeg::${ff_comp})
# Keep track of some FFmpeg lib versions, to embed in our version header
if(${ff_comp} IN_LIST version_comps)
string(TOUPPER ${ff_comp} v_name)
set(${v_name}_VERSION_STR ${${ff_comp}_VERSION} CACHE STRING "${ff_comp} version used" FORCE)
mark_as_advanced(${v_name}_VERSION_STR)
endif()
endif()
endforeach()
################### Threads ####################
@@ -363,6 +370,10 @@ if (TARGET RESVG::resvg)
target_compile_definitions(openshot PUBLIC "-DUSE_RESVG=1")
set(CMAKE_SWIG_FLAGS "-DUSE_RESVG=1")
set(HAVE_RESVG TRUE CACHE BOOL "Building with Resvg support" FORCE)
mark_as_advanced(HAVE_RESVG)
endif()
############### LINK LIBRARY #################