@@ -33,8 +33,8 @@ include(GNUInstallDirs)
3333# Set some compiler options for Windows
3434# required for libopenshot-audio headers
3535if (WIN32 )
36- add_definitions ( -DIGNORE_JUCE_HYPOT=1 )
37- set (CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -include cmath" )
36+ add_definitions ( -DIGNORE_JUCE_HYPOT=1 )
37+ set (CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -include cmath" )
3838endif ()
3939
4040if (APPLE )
@@ -52,31 +52,28 @@ endif()
5252################ IMAGE MAGICK ##################
5353# Set the Quantum Depth that ImageMagick was built with (default to 16 bits)
5454IF (MAGICKCORE_QUANTUM_DEPTH)
55- add_definitions ( -DMAGICKCORE_QUANTUM_DEPTH=${MAGICKCORE_QUANTUM_DEPTH} )
55+ add_definitions ( -DMAGICKCORE_QUANTUM_DEPTH=${MAGICKCORE_QUANTUM_DEPTH} )
5656ELSE (MAGICKCORE_QUANTUM_DEPTH)
57- add_definitions ( -DMAGICKCORE_QUANTUM_DEPTH=16 )
57+ add_definitions ( -DMAGICKCORE_QUANTUM_DEPTH=16 )
5858ENDIF (MAGICKCORE_QUANTUM_DEPTH)
5959IF (MAGICKCORE_HDRI_ENABLE)
60- add_definitions ( -DMAGICKCORE_HDRI_ENABLE=${MAGICKCORE_HDRI_ENABLE} )
60+ add_definitions ( -DMAGICKCORE_HDRI_ENABLE=${MAGICKCORE_HDRI_ENABLE} )
6161ELSE (MAGICKCORE_HDRI_ENABLE)
62- add_definitions ( -DMAGICKCORE_HDRI_ENABLE=0 )
62+ add_definitions ( -DMAGICKCORE_HDRI_ENABLE=0 )
6363ENDIF (MAGICKCORE_HDRI_ENABLE)
64- IF (OPENSHOT_IMAGEMAGICK_COMPATIBILITY)
65- add_definitions ( -DOPENSHOT_IMAGEMAGICK_COMPATIBILITY=${OPENSHOT_IMAGEMAGICK_COMPATIBILITY} )
66- ELSE (OPENSHOT_IMAGEMAGICK_COMPATIBILITY)
67- add_definitions ( -DOPENSHOT_IMAGEMAGICK_COMPATIBILITY=0 )
68- ENDIF (OPENSHOT_IMAGEMAGICK_COMPATIBILITY)
6964
7065# Find the ImageMagick++ library
7166find_package (ImageMagick COMPONENTS Magick++ MagickWand MagickCore)
7267if (ImageMagick_FOUND)
73- # Include ImageMagick++ headers (needed for compile)
74- include_directories (${ImageMagick_INCLUDE_DIRS} )
68+ # Include ImageMagick++ headers (needed for compile)
69+ include_directories (${ImageMagick_INCLUDE_DIRS} )
7570
76- # define a global var (used in the C++)
77- add_definitions ( -DUSE_IMAGEMAGICK=1 )
78- set ( CMAKE_SWIG_FLAGS "-DUSE_IMAGEMAGICK=1" )
71+ # define a global var (used in the C++)
72+ add_definitions ( -DUSE_IMAGEMAGICK=1 )
73+ list ( APPEND CMAKE_SWIG_FLAGS "-DUSE_IMAGEMAGICK=1" )
7974
75+ set (HAVE_IMAGEMAGICK TRUE CACHE BOOL "Building with ImageMagick support" FORCE)
76+ mark_as_advanced (HAVE_IMAGEMAGICK)
8077endif ()
8178
8279################# LIBOPENSHOT-AUDIO ###################
@@ -90,15 +87,15 @@ include_directories(${LIBOPENSHOT_AUDIO_INCLUDE_DIRS})
9087# Find BlackMagic DeckLinkAPI libraries
9188if (ENABLE_BLACKMAGIC)
9289
93- find_package (BlackMagic)
90+ find_package (BlackMagic)
9491
95- if (BLACKMAGIC_FOUND)
96- # Include Blackmagic headers (needed for compile)
97- include_directories (${BLACKMAGIC_INCLUDE_DIR} )
92+ if (BLACKMAGIC_FOUND)
93+ # Include Blackmagic headers (needed for compile)
94+ include_directories (${BLACKMAGIC_INCLUDE_DIR} )
9895
99- # define a global var (used in the C++)
100- add_definitions ( -DUSE_BLACKMAGIC=1 )
101- set ( CMAKE_SWIG_FLAGS "-DUSE_BLACKMAGIC=1" )
96+ # define a global var (used in the C++)
97+ add_definitions ( -DUSE_BLACKMAGIC=1 )
98+ list ( APPEND CMAKE_SWIG_FLAGS "-DUSE_BLACKMAGIC=1" )
10299 endif ()
103100
104101endif ()
@@ -153,7 +150,7 @@ set(OPENSHOT_SOURCES
153150 Fraction.cpp
154151 Frame.cpp
155152 FrameMapper.cpp
156- Json.cpp
153+ Json.cpp
157154 KeyFrame.cpp
158155 OpenShotVersion.cpp
159156 ZmqLogger.cpp
@@ -221,7 +218,7 @@ set_target_properties(openshot PROPERTIES
221218
222219# Add optional ImageMagic-dependent sources
223220if (ImageMagick_FOUND)
224- target_sources (openshot PRIVATE
221+ target_sources (openshot PRIVATE
225222 ImageReader.cpp
226223 ImageWriter.cpp
227224 TextReader.cpp)
@@ -250,7 +247,7 @@ target_include_directories(openshot
250247################### JSONCPP #####################
251248# Include jsoncpp headers (needed for JSON parsing)
252249if (USE_SYSTEM_JSONCPP)
253- message (STATUS "Looking for system jsoncpp" )
250+ message (STATUS "Looking for system jsoncpp" )
254251 # Either an installed config or our find module will
255252 # create the IMPORTED target jsoncpp_lib if successful
256253 find_package (jsoncpp)
@@ -291,14 +288,28 @@ foreach(_qt_comp IN LISTS _qt_components)
291288 endif ()
292289endforeach ()
293290
291+ # Keep track of Qt version, to embed in our version header
292+ set (QT_VERSION_STR ${Qt5Core_VERSION_STRING} CACHE STRING "Qt version linked with" FORCE)
293+ mark_as_advanced (QT_VERSION_STR)
294+
294295################### FFMPEG #####################
295296# Find FFmpeg libraries (used for video encoding / decoding)
296297find_package (FFmpeg REQUIRED COMPONENTS avcodec avdevice avformat avutil swscale)
297298
298- foreach (ff_comp avcodec avdevice avformat avfilter avutil postproc swscale swresample avresample)
299+ set (all_comps avcodec avdevice avformat avfilter avutil postproc swscale swresample avresample)
300+ set (version_comps avcodec avformat avutil)
301+
302+ foreach (ff_comp IN LISTS all_comps)
299303 if (TARGET FFmpeg::${ff_comp} )
300- target_link_libraries (openshot PUBLIC FFmpeg::${ff_comp} )
304+ target_link_libraries (openshot PUBLIC FFmpeg::${ff_comp} )
305+ # Keep track of some FFmpeg lib versions, to embed in our version header
306+ if (${ff_comp} IN_LIST version_comps)
307+ string (TOUPPER ${ff_comp} v_name)
308+ set (${v_name} _VERSION_STR ${${ff_comp} _VERSION} CACHE STRING "${ff_comp} version used" FORCE)
309+ mark_as_advanced (${v_name} _VERSION_STR)
310+ endif ()
301311 endif ()
312+
302313endforeach ()
303314
304315################### Threads ####################
@@ -332,7 +343,7 @@ find_package(cppzmq QUIET) # Creates cppzmq target
332343
333344# Link ZeroMQ library
334345if (TARGET libzmq)
335- target_link_libraries (openshot PUBLIC libzmq)
346+ target_link_libraries (openshot PUBLIC libzmq)
336347endif ()
337348# Include cppzmq headers, if not bundled into libzmq
338349if (TARGET cppzmq)
@@ -349,21 +360,25 @@ if(DEFINED ENV{RESVGDIR} AND NOT DEFINED RESVG_ROOT)
349360endif ()
350361
351362# Find resvg library (used for rendering svg files)
352- FIND_PACKAGE (RESVG)
363+ find_package (RESVG)
353364
354365# Include resvg headers (optional SVG library)
355366if (TARGET RESVG::resvg)
356367 #include_directories(${RESVG_INCLUDE_DIRS})
357368 target_link_libraries (openshot PUBLIC RESVG::resvg)
358369
359370 target_compile_definitions (openshot PUBLIC "-DUSE_RESVG=1" )
360- set (CMAKE_SWIG_FLAGS "-DUSE_RESVG=1" )
371+ list (APPEND CMAKE_SWIG_FLAGS "-DUSE_RESVG=1" )
372+
373+ set (HAVE_RESVG TRUE CACHE BOOL "Building with Resvg support" FORCE)
374+ mark_as_advanced (HAVE_RESVG)
375+
361376endif ()
362377
363378############### LINK LIBRARY #################
364379# Link remaining dependency libraries
365380target_link_libraries (openshot PUBLIC
366- ${LIBOPENSHOT_AUDIO_LIBRARIES}
381+ ${LIBOPENSHOT_AUDIO_LIBRARIES}
367382 ${PROFILER} )
368383
369384if (ImageMagick_FOUND)
@@ -375,8 +390,8 @@ if(BLACKMAGIC_FOUND)
375390endif ()
376391
377392if (WIN32 )
378- # Required for exception handling on Windows
379- target_link_libraries (openshot PUBLIC "imagehlp" "dbghelp" )
393+ # Required for exception handling on Windows
394+ target_link_libraries (openshot PUBLIC "imagehlp" "dbghelp" )
380395endif ()
381396
382397
@@ -385,9 +400,9 @@ endif()
385400add_executable (openshot-example examples/Example.cpp)
386401
387402# Define path to test input files
388- SET (TEST_MEDIA_PATH "${PROJECT_SOURCE_DIR} /src/examples/" )
403+ set (TEST_MEDIA_PATH "${PROJECT_SOURCE_DIR} /src/examples/" )
389404if (WIN32 )
390- STRING (REPLACE "/" "\\\\ " TEST_MEDIA_PATH TEST_MEDIA_PATH)
405+ string (REPLACE "/" "\\\\ " TEST_MEDIA_PATH TEST_MEDIA_PATH)
391406endif ()
392407target_compile_definitions (openshot-example PRIVATE
393408 -DTEST_MEDIA_PATH="${TEST_MEDIA_PATH} " )
@@ -407,12 +422,12 @@ target_link_libraries(openshot-player openshot)
407422
408423############### TEST BLACKMAGIC CAPTURE APP ################
409424if (BLACKMAGIC_FOUND)
410- # Create test executable
411- add_executable (openshot-blackmagic
412- examples/ExampleBlackmagic.cpp)
425+ # Create test executable
426+ add_executable (openshot-blackmagic
427+ examples/ExampleBlackmagic.cpp)
413428
414- # Link test executable to the new library
415- target_link_libraries (openshot-blackmagic openshot)
429+ # Link test executable to the new library
430+ target_link_libraries (openshot-blackmagic openshot)
416431endif ()
417432
418433############### INCLUDE SWIG BINDINGS ################
@@ -432,13 +447,13 @@ install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/
432447
433448############### CPACK PACKAGING ##############
434449if (MINGW)
435- set (CPACK_GENERATOR "NSIS" )
450+ set (CPACK_GENERATOR "NSIS" )
436451endif ()
437452if (UNIX AND NOT APPLE )
438- set (CPACK_GENERATOR "DEB" )
453+ set (CPACK_GENERATOR "DEB" )
439454endif ()
440455#if(UNIX AND APPLE)
441- # set(CPACK_GENERATOR "DragNDrop")
456+ # set(CPACK_GENERATOR "DragNDrop")
442457#endif()
443458set (CPACK_DEBIAN_PACKAGE_MAINTAINER "Jonathan Thomas" ) #required
444459
0 commit comments