Skip to content

Commit

Permalink
Merge pull request #574 from ferdnyc/imagemagick-option
Browse files Browse the repository at this point in the history
Add ENABLE_MAGICK CMake option (default ON)
  • Loading branch information
ferdnyc authored Oct 4, 2020
2 parents 4e98fb7 + 172c3c0 commit 414a2cd
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 53 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ option(ENABLE_IWYU "Enable 'Include What You Use' scanner (CMake 3.3+)" OFF)
option(ENABLE_TESTS "Build unit tests (requires UnitTest++)" ON)
option(ENABLE_DOCS "Build API documentation (requires Doxygen)" ON)
option(APPIMAGE_BUILD "Build to install in an AppImage (Linux only)" OFF)
option(ENABLE_MAGICK "Use ImageMagick, if available" ON)

# Legacy commandline override
if (DISABLE_TESTS)
Expand Down Expand Up @@ -129,9 +130,9 @@ add_feature_info("Coverage" ENABLE_COVERAGE "analyze test coverage and generate
# -DDEBUG for debug builds. We'll do this for all OSes, even
# though only MacOS requires it.
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
# Make sure we've picked some build type, default to debug
# Make sure we've picked some build type, default to release
if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_BUILD_TYPE "Release")
endif()

############## PROCESS src/ DIRECTORIES ##############
Expand Down
48 changes: 25 additions & 23 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,31 @@ endif()

################ IMAGE MAGICK ##################
# Set the Quantum Depth that ImageMagick was built with (default to 16 bits)
IF (MAGICKCORE_QUANTUM_DEPTH)
add_definitions( -DMAGICKCORE_QUANTUM_DEPTH=${MAGICKCORE_QUANTUM_DEPTH} )
ELSE (MAGICKCORE_QUANTUM_DEPTH)
add_definitions( -DMAGICKCORE_QUANTUM_DEPTH=16 )
ENDIF (MAGICKCORE_QUANTUM_DEPTH)
IF (MAGICKCORE_HDRI_ENABLE)
add_definitions( -DMAGICKCORE_HDRI_ENABLE=${MAGICKCORE_HDRI_ENABLE} )
ELSE (MAGICKCORE_HDRI_ENABLE)
add_definitions( -DMAGICKCORE_HDRI_ENABLE=0 )
ENDIF (MAGICKCORE_HDRI_ENABLE)

# Find the ImageMagick++ library
find_package(ImageMagick COMPONENTS Magick++ MagickWand MagickCore)
if (ImageMagick_FOUND)
# Include ImageMagick++ headers (needed for compile)
include_directories(${ImageMagick_INCLUDE_DIRS})

# define a global var (used in the C++)
add_definitions( -DUSE_IMAGEMAGICK=1 )
list(APPEND CMAKE_SWIG_FLAGS "-DUSE_IMAGEMAGICK=1")

set(HAVE_IMAGEMAGICK TRUE CACHE BOOL "Building with ImageMagick support" FORCE)
mark_as_advanced(HAVE_IMAGEMAGICK)
if(ENABLE_MAGICK)
IF (MAGICKCORE_QUANTUM_DEPTH)
add_definitions( -DMAGICKCORE_QUANTUM_DEPTH=${MAGICKCORE_QUANTUM_DEPTH} )
ELSE (MAGICKCORE_QUANTUM_DEPTH)
add_definitions( -DMAGICKCORE_QUANTUM_DEPTH=16 )
ENDIF (MAGICKCORE_QUANTUM_DEPTH)
IF (MAGICKCORE_HDRI_ENABLE)
add_definitions( -DMAGICKCORE_HDRI_ENABLE=${MAGICKCORE_HDRI_ENABLE} )
ELSE (MAGICKCORE_HDRI_ENABLE)
add_definitions( -DMAGICKCORE_HDRI_ENABLE=0 )
ENDIF (MAGICKCORE_HDRI_ENABLE)

# Find the ImageMagick++ library
find_package(ImageMagick COMPONENTS Magick++ MagickWand MagickCore)
if (ImageMagick_FOUND)
# Include ImageMagick++ headers (needed for compile)
include_directories(${ImageMagick_INCLUDE_DIRS})

# define a global var (used in the C++)
add_definitions( -DUSE_IMAGEMAGICK=1 )
list(APPEND CMAKE_SWIG_FLAGS "-DUSE_IMAGEMAGICK=1")

set(HAVE_IMAGEMAGICK TRUE CACHE BOOL "Building with ImageMagick support" FORCE)
mark_as_advanced(HAVE_IMAGEMAGICK)
endif()
endif()

################# LIBOPENSHOT-AUDIO ###################
Expand Down
57 changes: 29 additions & 28 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,35 +58,36 @@ set_package_properties(UnitTest++ PROPERTIES
PURPOSE "Unit testing framework")

################ IMAGE MAGICK ##################
# Set the Quantum Depth that ImageMagick was built with (default to 16 bits)
if(MAGICKCORE_QUANTUM_DEPTH)
add_definitions( -DMAGICKCORE_QUANTUM_DEPTH=${MAGICKCORE_QUANTUM_DEPTH} )
else()
add_definitions( -DMAGICKCORE_QUANTUM_DEPTH=16 )
endif()

if(MAGICKCORE_HDRI_ENABLE)
add_definitions( -DMAGICKCORE_HDRI_ENABLE=${MAGICKCORE_HDRI_ENABLE} )
else()
add_definitions( -DMAGICKCORE_HDRI_ENABLE=0 )
if(ENABLE_MAGICK)
# Set the Quantum Depth that ImageMagick was built with (default to 16 bits)
if(MAGICKCORE_QUANTUM_DEPTH)
add_definitions( -DMAGICKCORE_QUANTUM_DEPTH=${MAGICKCORE_QUANTUM_DEPTH} )
else()
add_definitions( -DMAGICKCORE_QUANTUM_DEPTH=16 )
endif()

if(MAGICKCORE_HDRI_ENABLE)
add_definitions( -DMAGICKCORE_HDRI_ENABLE=${MAGICKCORE_HDRI_ENABLE} )
else()
add_definitions( -DMAGICKCORE_HDRI_ENABLE=0 )
endif()

if(OPENSHOT_IMAGEMAGICK_COMPATIBILITY)
add_definitions( -DOPENSHOT_IMAGEMAGICK_COMPATIBILITY=${OPENSHOT_IMAGEMAGICK_COMPATIBILITY} )
else()
add_definitions( -DOPENSHOT_IMAGEMAGICK_COMPATIBILITY=0 )
endif()

# Find the ImageMagick++ library
find_package(ImageMagick COMPONENTS Magick++ MagickWand MagickCore)
if(ImageMagick_FOUND)
# Include ImageMagick++ headers (needed for compile)
include_directories(${ImageMagick_INCLUDE_DIRS})

# define a global var (used in the C++)
add_definitions( -DUSE_IMAGEMAGICK=1 )
endif()
endif()

if(OPENSHOT_IMAGEMAGICK_COMPATIBILITY)
add_definitions( -DOPENSHOT_IMAGEMAGICK_COMPATIBILITY=${OPENSHOT_IMAGEMAGICK_COMPATIBILITY} )
else()
add_definitions( -DOPENSHOT_IMAGEMAGICK_COMPATIBILITY=0 )
endif()

# Find the ImageMagick++ library
find_package(ImageMagick COMPONENTS Magick++ MagickWand MagickCore)
if(ImageMagick_FOUND)
# Include ImageMagick++ headers (needed for compile)
include_directories(${ImageMagick_INCLUDE_DIRS})

# define a global var (used in the C++)
add_definitions( -DUSE_IMAGEMAGICK=1 )
endif()

################# LIBOPENSHOT-AUDIO ###################
# Find JUCE-based openshot Audio libraries
find_package(OpenShotAudio 0.2.0 REQUIRED)
Expand Down

0 comments on commit 414a2cd

Please sign in to comment.