opencv : Fix python extensions issues

This commit is contained in:
mwilliammyers 2016-07-12 20:27:21 -06:00
parent 9e1d26e973
commit cf0f5756f5

View file

@ -58,6 +58,8 @@ class Opencv(Package):
depends_on('eigen', when='+eigen') depends_on('eigen', when='+eigen')
depends_on('cuda', when='+cuda') depends_on('cuda', when='+cuda')
extends('python')
# FIXME : GUI extensions missing # FIXME : GUI extensions missing
def install(self, spec, prefix): def install(self, spec, prefix):
@ -70,6 +72,19 @@ def install(self, spec, prefix):
'-DWITH_IPP:BOOL=%s' % ('ON' if '+ipp' in spec else 'OFF'), '-DWITH_IPP:BOOL=%s' % ('ON' if '+ipp' in spec else 'OFF'),
'-DWITH_CUDA:BOOL=%s' % ('ON' if '+cuda' in spec else 'OFF')]) '-DWITH_CUDA:BOOL=%s' % ('ON' if '+cuda' in spec else 'OFF')])
python_prefix = spec['python'].prefix
python_lib = python_prefix.lib
if spec.satisfies('^python@3:'):
python = join_path(python_prefix.bin, 'python3')
cmake_options.extend(['-DBUILD_opencv_python3=ON',
'-DPYTHON_EXECUTABLE={0}'.format(python),
'-DPYTHON_LIBRARIES={0}'.format(python_lib)])
elif spec.satisfies('^python@2:3'):
python = join_path(python_prefix.bin, 'python2')
cmake_options.extend(['-DBUILD_opencv_python2=ON',
'-DPYTHON_EXECUTABLE={0}'.format(python),
'-DPYTHON_LIBRARIES={0}'.format(python_lib)])
with working_dir('spack_build', create=True): with working_dir('spack_build', create=True):
cmake('..', *cmake_options) cmake('..', *cmake_options)
make('VERBOSE=1') make('VERBOSE=1')