From c7d60a38202cf0557319a650b98e91c448819c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Komar=C4=8Devi=C4=87?= Date: Thu, 17 Aug 2023 10:26:03 +0200 Subject: [PATCH] CMake misc fixes --- CMakeLists.txt | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 672659bb385..311067bfd66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") @@ -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) @@ -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") @@ -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) @@ -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)