From 09d11e24583d6c21366fccfbd63bc6d66521eacb Mon Sep 17 00:00:00 2001 From: Dirk Farin Date: Mon, 16 Oct 2023 15:13:51 +0200 Subject: [PATCH] cmake: handle case where two plugins depend on the same library but only one can be compiled (#989) --- libheif/plugins/CMakeLists.txt | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/libheif/plugins/CMakeLists.txt b/libheif/plugins/CMakeLists.txt index dd57cf1758..fb1f2d93ac 100644 --- a/libheif/plugins/CMakeLists.txt +++ b/libheif/plugins/CMakeLists.txt @@ -1,6 +1,6 @@ -macro(plugin_compilation name varName optionName defineName) - if (${varName}_FOUND AND WITH_${optionName}) +macro(plugin_compilation name varName foundName optionName defineName) + if (${foundName} AND WITH_${optionName}) if (PLUGIN_LOADING_SUPPORTED_AND_ENABLED AND WITH_${optionName}_PLUGIN) message("Compiling '" ${name} "' as dynamic plugin") add_library(heif-${name} @@ -41,55 +41,55 @@ endmacro() set(X265_sources encoder_x265.h encoder_x265.cc) set(X265_extra_plugin_sources) -plugin_compilation(x265 X265 X265 X265) +plugin_compilation(x265 X265 X265_FOUND X265 X265) set(LIBDE265_sources decoder_libde265.cc decoder_libde265.h) set(LIBDE265_extra_plugin_sources ../error.cc) -plugin_compilation(libde265 LIBDE265 LIBDE265 LIBDE265) +plugin_compilation(libde265 LIBDE265 LIBDE265_FOUND LIBDE265 LIBDE265) set(DAV1D_sources decoder_dav1d.cc decoder_dav1d.h) set(DAV1D_extra_plugin_sources ../common_utils.cc ../common_utils.h) -plugin_compilation(dav1d DAV1D DAV1D DAV1D) +plugin_compilation(dav1d DAV1D DAV1D_FOUND DAV1D DAV1D) set(AOM_DECODER_sources decoder_aom.cc decoder_aom.h) set(AOM_DECODER_extra_plugin_sources) -plugin_compilation(aomdec AOM_DECODER AOM_DECODER AOM_DECODER) +plugin_compilation(aomdec AOM AOM_DECODER_FOUND AOM_DECODER AOM_DECODER) set(AOM_ENCODER_sources encoder_aom.cc encoder_aom.h) set(AOM_ENCODER_extra_plugin_sources ../error.cc ../common_utils.cc ../common_utils.h) -plugin_compilation(aomenc AOM_ENCODER AOM_ENCODER AOM_ENCODER) +plugin_compilation(aomenc AOM AOM_ENCODER_FOUND AOM_ENCODER AOM_ENCODER) set(SvtEnc_sources encoder_svt.cc encoder_svt.h) set(SvtEnc_extra_plugin_sources) -plugin_compilation(svtenc SvtEnc SvtEnc SvtEnc) +plugin_compilation(svtenc SvtEnc AvtEnc_FOUND SvtEnc SvtEnc) set(RAV1E_sources encoder_rav1e.cc encoder_rav1e.h) set(RAV1E_extra_plugin_sources ../error.cc) -plugin_compilation(rav1e RAV1E RAV1E RAV1E) +plugin_compilation(rav1e RAV1E RAV1E_FOUND RAV1E RAV1E) set(JPEG_DECODER_sources decoder_jpeg.cc decoder_jpeg.h) set(JPEG_DECODER_extra_plugin_sources) -plugin_compilation(jpegdec JPEG JPEG_DECODER JPEG_DECODER) +plugin_compilation(jpegdec JPEG JPEG_FOUND JPEG_DECODER JPEG_DECODER) set(JPEG_ENCODER_sources encoder_jpeg.cc encoder_jpeg.h) set(JPEG_ENCODER_extra_plugin_sources) -plugin_compilation(jpegenc JPEG JPEG_ENCODER JPEG_ENCODER) +plugin_compilation(jpegenc JPEG JPEG_FOUND JPEG_ENCODER JPEG_ENCODER) set(OpenJPEG_DECODER_sources decoder_openjpeg.cc decoder_openjpeg.h) set(OpenJPEG_DECODER_extra_plugin_sources ) -plugin_compilation(j2kdec OPENJPEG OpenJPEG_DECODER OPENJPEG_DECODER) +plugin_compilation(j2kdec OPENJPEG OPENJPEG_FOUND OpenJPEG_DECODER OPENJPEG_DECODER) set(OpenJPEG_ENCODER_sources encoder_openjpeg.cc encoder_openjpeg.h) set(OpenJPEG_ENCODER_extra_plugin_sources) -plugin_compilation(j2kenc OPENJPEG OpenJPEG_ENCODER OPENJPEG_ENCODER) +plugin_compilation(j2kenc OPENJPEG OPENJPEG_FOUND OpenJPEG_ENCODER OPENJPEG_ENCODER) set(KVAZAAR_sources encoder_kvazaar.cc encoder_kvazaar.h) set(KVAZAAR_extra_plugin_sources) -plugin_compilation(kvazaar KVAZAAR KVAZAAR KVAZAAR) +plugin_compilation(kvazaar KVAZAAR KVAZAAR_FOUND KVAZAAR KVAZAAR) set(FFMPEG_DECODER_sources decoder_ffmpeg.cc decoder_ffmpeg.h) set(FFMPEG_DECODER_extra_plugin_sources ../error.cc) -plugin_compilation(ffmpegdec FFMPEG FFMPEG_DECODER FFMPEG_DECODER) +plugin_compilation(ffmpegdec FFMPEG FFMPEG_FOUND FFMPEG_DECODER FFMPEG_DECODER) target_sources(heif PRIVATE encoder_mask.h