Massive conversion from Package to CMakePackage (#4975)

This commit is contained in:
Adam J. Stewart
2017-08-05 10:15:18 -05:00
committed by GitHub
parent 17cdb73be7
commit c7df12f698
57 changed files with 410 additions and 677 deletions

View File

@@ -25,7 +25,7 @@
from spack import *
class GribApi(Package):
class GribApi(CMakePackage):
"""The ECMWF GRIB API is an application program interface accessible from
C, FORTRAN and Python programs developed for encoding and decoding WMO
FM-92 GRIB edition 1 and edition 2 messages."""
@@ -40,42 +40,41 @@ class GribApi(Package):
variant('netcdf', default=False, description='Enable netcdf encoding/decoding using netcdf library')
variant('jpeg', default=True, description='Enable jpeg 2000 for grib 2 decoding/encoding')
variant('png', default=False, description='Enable png for decoding/encoding')
variant('build_type', default='RelWithDebInfo',
description='The build type to build',
values=('Debug', 'Release', 'RelWithDebInfo', 'Production'))
depends_on('cmake', type='build')
depends_on('libpng', when='+png')
depends_on('netcdf', when='+netcdf')
depends_on('jasper', when='+jpeg')
depends_on('cmake@2.8.11:', type='build')
def install(self, spec, prefix):
options = []
options.extend(std_cmake_args)
options.append('-DBUILD_SHARED_LIBS=BOTH')
def cmake_args(self):
spec = self.spec
args = ['-DBUILD_SHARED_LIBS=BOTH']
# We will add python support later.
options.append('-DENABLE_PYTHON=OFF')
args.append('-DENABLE_PYTHON=OFF')
# Disable FORTRAN interface if we don't have it.
if (self.compiler.f77 is None) or (self.compiler.fc is None):
options.append('-DENABLE_FORTRAN=OFF')
args.append('-DENABLE_FORTRAN=OFF')
if '+netcdf' in spec:
options.append('-DENABLE_NETCDF=ON')
options.append('-DNETCDF_PATH=%s' % spec['netcdf'].prefix)
args.append('-DENABLE_NETCDF=ON')
args.append('-DNETCDF_PATH=%s' % spec['netcdf'].prefix)
else:
options.append('-DENABLE_NETCDF=OFF')
args.append('-DENABLE_NETCDF=OFF')
if '+jpeg' in spec:
options.append('-DENABLE_JPG=ON')
options.append('-DJASPER_PATH=%s' % spec['jasper'].prefix)
args.append('-DENABLE_JPG=ON')
args.append('-DJASPER_PATH=%s' % spec['jasper'].prefix)
else:
options.append('-DENABLE_JPG=OFF')
args.append('-DENABLE_JPG=OFF')
if '+png' in spec:
options.append('-DENABLE_PNG=ON')
args.append('-DENABLE_PNG=ON')
else:
options.append('-DENABLE_PNG=OFF')
args.append('-DENABLE_PNG=OFF')
with working_dir('spack-build', create=True):
cmake('..', *options)
make()
make('install')
return args