diff options
-rw-r--r-- | var/spack/repos/builtin/packages/hepmc/package.py | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/var/spack/repos/builtin/packages/hepmc/package.py b/var/spack/repos/builtin/packages/hepmc/package.py index 2828a179ff..d208e7ecde 100644 --- a/var/spack/repos/builtin/packages/hepmc/package.py +++ b/var/spack/repos/builtin/packages/hepmc/package.py @@ -28,24 +28,46 @@ class Hepmc(CMakePackage): variant('python', default=False, description='Enable Python bindings') variant('rootio', default=False, description='Enable ROOT I/O') + variant('interfaces', default=False, description='Install interfaces for some Monte-Carlo Event Gens') depends_on('cmake@2.8.9:', type='build') - # FIXME: Officially supports Python3, but the build system doesn't find it - depends_on('python@:2.99.99', when='+python') + depends_on('python', when='+python') depends_on('root', when='+rootio') - conflicts('+python', when='@:3.1.99') - conflicts('+rootio', when='@:2.99.99') + conflicts('+python', when='@:3.1') + conflicts('+rootio', when='@:2') + conflicts('+interfaces', when='@:2') + @when('@:2') + def cmake_args(self): + return ['-Dmomentum:STRING=GEV', '-Dlength:STRING=MM'] + + @when('@3:') def cmake_args(self): spec = self.spec - return [ + args = [ '-Dmomentum:STRING=GEV', '-Dlength:STRING=MM', '-DHEPMC3_ENABLE_PYTHON={0}'.format(spec.satisfies('+python')), - '-DHEPMC3_ENABLE_ROOTIO={0}'.format(spec.satisfies('+rootio')) + '-DHEPMC3_ENABLE_ROOTIO={0}'.format(spec.satisfies('+rootio')), + '-DHEPMC3_INSTALL_INTERFACES={0}'.format( + spec.satisfies('+interfaces')), ] + if self.spec.satisfies('+python'): + py_ver = spec['python'].version.up_to(2) + py_sitepkg = join_path(self.prefix, site_packages_dir) + args.extend([ + '-DHEPMC3_PYTHON_VERSIONS={0}'.format(py_ver), + '-DHEPMC3_Python_SITEARCH{0}={1}'.format( + py_ver.joined, py_sitepkg) + ]) + + if self.spec.satisfies('+rootio'): + args.append('-DROOT_DIR={0}'.format(self.spec['root'].prefix)) + + return args + def url_for_version(self, version): if version > Version("3.0.0"): url = "http://hepmc.web.cern.ch/hepmc/releases/HepMC3-{0}.tar.gz" |