opencv : Make extending python optional

This commit is contained in:
mwilliammyers 2016-07-15 20:28:50 -06:00
parent c588ce9648
commit 8cf03c209f

View file

@ -55,22 +55,23 @@ class Opencv(Package):
variant('gtk', default=False, description='Activates support for GTK')
variant('vtk', default=False, description='Activates support for VTK')
variant('qt', default=False, description='Activates support for QT')
variant('python', default=False,
description='Enables the build of Python extensions')
depends_on('zlib')
depends_on('libpng')
depends_on('libjpeg-turbo')
depends_on('libtiff')
depends_on('python')
depends_on('py-numpy')
depends_on('eigen', when='+eigen')
depends_on('cuda', when='+cuda')
depends_on('gtkplus', when='+gtk')
depends_on('vtk', when='+vtk')
depends_on('qt', when='+qt')
extends('python')
depends_on('py-numpy', when='+python')
extends('python', when='+python')
def install(self, spec, prefix):
cmake_options = []
@ -97,6 +98,7 @@ def install(self, spec, prefix):
cmake_options.extend(['-DWITH_GTK:BOOL=OFF',
'-DWITH_GTK_2_X:BOOL=ON'])
if '+python' in spec:
python = spec['python']
if '^python@3:' in spec:
python_exe = join_path(python.prefix.bin, 'python3')
@ -122,6 +124,11 @@ def install(self, spec, prefix):
'-DPYTHON3_LIBRARIES=',
'-DPYTHON3_INCLUDE_DIR=',
])
else:
cmake_options.extend([
'-DBUILD_opencv_python2=OFF',
'-DBUILD_opencv_python3=OFF'
])
with working_dir('spack_build', create=True):
cmake('..', *cmake_options)