openjpeg: add missing dependencies and optionally disable them (#27904)

* openjpeg: add missing dependencies and optionally disable them

* openjpeg: remove variant 'ownlibs'

* openjpeg: bugfix

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* openjpeg: do not build CODEC executables by default

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
This commit is contained in:
Sergey Kosukhin 2021-12-11 18:51:17 +01:00 committed by GitHub
parent 5d11bc9a77
commit ee46a1077c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,7 +31,12 @@ class Openjpeg(CMakePackage):
version('1.5.2', sha256='3734e95edd0bef6e056815591755efd822228dc3cd866894e00a2c929026b16d')
version('1.5.1', sha256='6a42fcc23cb179f69a1e94429089e5a5926aee1ffe582a0a6bd91299d297e61a')
depends_on('zlib')
variant('codec', default=False, description='Build the CODEC executables')
depends_on('zlib', when='+codec')
depends_on('libpng', when='+codec')
depends_on('libtiff', when='+codec')
depends_on('lcms', when='+codec')
# The problem with install name of the library on MacOs was fixed starting
# version 2.1.1: https://github.com/uclouvain/openjpeg/commit/b9a247b559e62e55f5561624cf4a19aee3c8afdc
@ -56,3 +61,18 @@ def url_for_version(self, version):
def libs(self):
return find_libraries('libopenjp{0}'.format(self.version.up_to(1)),
root=self.prefix, recursive=True)
def cmake_args(self):
args = [
self.define_from_variant('BUILD_CODEC', 'codec'),
# MJ2 executables are disabled by default and we just make it
# explicit. Note that the executables require additional libraries
# as in the case '+codec', therefore, we will need to update the
# 'depends_on' directives when/if we introduce a variant that
# enables them.
self.define('BUILD_MJ2', False),
# Note that if the list of dependencies is incomplete, there is
# still a chance that the bundled third-party libraries get built.
self.define('BUILD_THIRDPARTY', False)
]
return args