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 c7d60a3
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ 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)
if (${packageName}_FOUND AND WITH_${variableName}_PLUGIN AND PLUGIN_LOADING_SUPPORTED_AND_ENABLED)
set(msg "found (plugin)")
elseif (${variableName}_FOUND)
elseif (${packageName}_FOUND)
set(msg "found (built-in)")
elseif (WITH_${variableName})
set(msg "not found")
Expand Down Expand Up @@ -104,8 +104,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 +116,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 +142,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 NOT WITH_AOM_ENCODER_PLUGIN))
list(APPEND REQUIRES_PRIVATE "aom")
endif()
if (DAV1D_FOUND AND NOT WITH_DAV1D_PLUGIN)
Expand All @@ -154,19 +154,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 c7d60a3

Please sign in to comment.