Skip to content

Commit

Permalink
CMake misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kmilos committed Aug 22, 2023
1 parent 0e52a02 commit fd311d4
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,19 @@ endif()

macro(plugin_option variableName packageName displayName displayType defaultEnabled defaultPlugin)
option(WITH_${variableName} "Build ${displayName} ${displayType}" ${defaultEnabled})
option(WITH_${variableName}_PLUGIN "Build ${displayName} as a plugin" ${defaultPlugin})
option(WITH_${variableName}_PLUGIN "Build ${displayName} ${displayType} as a plugin" ${defaultPlugin})
if (WITH_${variableName})
find_package(${packageName})
endif ()

if (${variableName}_FOUND AND WITH_${variableName}_PLUGIN AND PLUGIN_LOADING_SUPPORTED_AND_ENABLED)
set(msg "found (plugin)")
elseif (${variableName}_FOUND)
set(msg "found (built-in)")
elseif (WITH_${variableName})
set(msg "not found")
if (${packageName}_FOUND)
if (WITH_${variableName}_PLUGIN AND PLUGIN_LOADING_SUPPORTED_AND_ENABLED)
set(msg "found (plugin)")
else()
set(msg "found (built-in)")
endif()
else()
set(msg "not found")
endif()
else()
set(msg "disabled")
endif ()
Expand All @@ -90,7 +92,7 @@ endmacro()

plugin_option(LIBDE265 LIBDE265 "libde265" "HEIC decoder" ON OFF)
plugin_option(X265 X265 "x265" "HEIC encoder" ON OFF)
plugin_option(KVAZAAR kvazaar "kvazaar" "kvazaar HEVC encoder" OFF OFF)
plugin_option(KVAZAAR kvazaar "kvazaar" "HEVC encoder" OFF OFF)
if (HAVE_KVAZAAR_ENABLE_LOGGING)
add_definitions(-DHAVE_KVAZAAR_ENABLE_LOGGING=1)
else()
Expand All @@ -104,8 +106,8 @@ plugin_option(SvtEnc SvtEnc "Svt-av1" "AVIF encoder" OFF ON)
plugin_option(RAV1E RAV1E "Rav1e" "AVIF encoder" OFF ON)
plugin_option(JPEG_DECODER JPEG "Jpeg" "JPEG decoder" OFF OFF)
plugin_option(JPEG_ENCODER JPEG "Jpeg" "JPEG encoder" OFF OFF)
plugin_option(OpenJPEG_ENCODER OpenJPEG "OpenJPEG_Encoder" "JPEG2000 encoder" OFF ON)
plugin_option(OpenJPEG_DECODER OpenJPEG "OpenJPEG_Decoder" "JPEG2000 decoder" OFF ON)
plugin_option(OpenJPEG_ENCODER OpenJPEG "OpenJPEG" "JPEG2000 encoder" OFF ON)
plugin_option(OpenJPEG_DECODER OpenJPEG "OpenJPEG" "JPEG2000 decoder" OFF ON)

option(WITH_UNCOMPRESSED_CODEC "Support internal ISO/IEC 23001-17 uncompressed codec (experimental)" OFF)

Expand All @@ -116,7 +118,7 @@ if (WITH_LIBSHARPYUV)
endif ()
if (LIBSHARPYUV_FOUND)
message("libsharpyuv: found")
elseif (WITH_${variableName})
elseif (WITH_LIBSHARPYUV)
message("libsharpyuv: not found")
else()
message("libsharpyuv: disabled")
Expand All @@ -142,7 +144,7 @@ endif()
if (X265_FOUND AND NOT WITH_X265_PLUGIN)
list(APPEND REQUIRES_PRIVATE "x265")
endif()
if ((AOM_DECODER_FOUND AND NOT WITH_AOM_DECODER_PLUGIN) OR (AOM_ENCODER_FOUND AND NOT WITH_AOM_ENCODER_PLUGIN))
if (AOM_FOUND AND NOT (WITH_AOM_DECODER_PLUGIN AND WITH_AOM_ENCODER_PLUGIN))
list(APPEND REQUIRES_PRIVATE "aom")
endif()
if (DAV1D_FOUND AND NOT WITH_DAV1D_PLUGIN)
Expand All @@ -154,19 +156,15 @@ endif()
if (SvtEnc_FOUND AND NOT WITH_SvtEnc_PLUGIN)
list(APPEND REQUIRES_PRIVATE "SvtAv1Enc")
endif()
if ((JPEG_DECODER_FOUND AND NOT WITH_JPEG_DECODER_PLUGIN) OR (JPEG_ENCODER_FOUND AND NOT WITH_JPEG_ENCODER_PLUGIN))
if ((JPEG_FOUND AND NOT (WITH_JPEG_DECODER_PLUGIN AND WITH_JPEG_ENCODER_PLUGIN))
list(APPEND REQUIRES_PRIVATE "libjpeg")
endif()
# TODO: JPEG
if (OpenJPEG_FOUND AND NOT WITH_OpenJPEG_PLUGIN)
if ((OpenJPEG_FOUND AND NOT (WITH_OpenJPEG_DECODER_PLUGIN AND WITH_OpenJPEG_ENCODER_PLUGIN))
list(APPEND REQUIRES_PRIVATE "libopenjp2")
endif()
if (LIBSHARPYUV_FOUND)
list(APPEND REQUIRES_PRIVATE "libsharpyuv")
endif()
if (OpenJPEG_FOUND AND NOT WITH_OpenJPEG_PLUGIN)
list(APPEND REQUIRES_PRIVATE "OpenJPEG")
endif()
list(JOIN REQUIRES_PRIVATE " " REQUIRES_PRIVATE)

configure_file(libheif.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libheif.pc @ONLY)
Expand Down

0 comments on commit fd311d4

Please sign in to comment.