Skip to content

Commit

Permalink
cmake: handle case where two plugins depend on the same library but o…
Browse files Browse the repository at this point in the history
…nly one can be compiled (#989)
  • Loading branch information
farindk committed Oct 16, 2023
1 parent 5b8c948 commit 09d11e2
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions libheif/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 09d11e2

Please sign in to comment.