Skip to content

Commit

Permalink
Add more build-config variables
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
ferdnyc committed May 9, 2020
1 parent 5c688f1 commit 0e79844
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
9 changes: 7 additions & 2 deletions include/OpenShotVersion.h.in
Expand Up @@ -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>

Expand Down
25 changes: 18 additions & 7 deletions src/CMakeLists.txt
Expand Up @@ -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)
Expand All @@ -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 ###################
Expand Down Expand Up @@ -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 ####################
Expand Down Expand Up @@ -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 #################
Expand Down

0 comments on commit 0e79844

Please sign in to comment.