diff --git a/var/spack/repos/builtin/packages/clhep/package.py b/var/spack/repos/builtin/packages/clhep/package.py index 8dd1dd2b50..ebfe24ec6f 100644 --- a/var/spack/repos/builtin/packages/clhep/package.py +++ b/var/spack/repos/builtin/packages/clhep/package.py @@ -35,38 +35,26 @@ class Clhep(CMakePackage): version('2.2.0.5', sha256='92e8b5d32ae96154edd27d0c641ba048ad33cb69dd4f1cfb72fc578770a34818') version('2.2.0.4', sha256='9bf7fcd9892313c8d1436bc4a4a285a016c4f8e81e1fc65bdf6783207ae57550') - variant('cxx11', default=True, description="Compile using c++11 dialect.") - variant('cxx14', default=False, description="Compile using c++14 dialect.") + variant('cxxstd', + default='11', + values=('11', '14', '17'), + multi=False, + description='Use the specified C++ standard when building.') + + conflicts('cxxstd=17', when='@:2.3.4.2') depends_on('cmake@2.8.12.2:', when='@2.2.0.4:2.3.0.0', type='build') depends_on('cmake@3.2:', when='@2.3.0.1:', type='build') + root_cmakelists_dir = 'CLHEP' # Extra directory layer. + def patch(self): filter_file('SET CMP0042 OLD', 'SET CMP0042 NEW', '%s/%s/CLHEP/CMakeLists.txt' % (self.stage.path, self.spec.version)) - root_cmakelists_dir = 'CLHEP' - def cmake_args(self): - spec = self.spec - cmake_args = [] - - if '+cxx11' in spec: - if 'CXXFLAGS' in env and env['CXXFLAGS']: - env['CXXFLAGS'] += ' ' + self.compiler.cxx11_flag - else: - env['CXXFLAGS'] = self.compiler.cxx11_flag - cmake_args.append('-DCLHEP_BUILD_CXXSTD=' + - self.compiler.cxx11_flag) - - if '+cxx14' in spec: - if 'CXXFLAGS' in env and env['CXXFLAGS']: - env['CXXFLAGS'] += ' ' + self.compiler.cxx14_flag - else: - env['CXXFLAGS'] = self.compiler.cxx14_flag - cmake_args.append('-DCLHEP_BUILD_CXXSTD=' + - self.compiler.cxx14_flag) - + cmake_args = ['-DCLHEP_BUILD_CXXSTD=-std=c++{0}'.format( + self.spec.variants['cxxstd'].value)] return cmake_args diff --git a/var/spack/repos/builtin/packages/g4abla/package.py b/var/spack/repos/builtin/packages/g4abla/package.py new file mode 100644 index 0000000000..3cca976376 --- /dev/null +++ b/var/spack/repos/builtin/packages/g4abla/package.py @@ -0,0 +1,27 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack import * +import os + + +class G4abla(Package): + """Geant4 data for nuclear shell effects in INCL/ABLA hadronic mode""" + homepage = "http://geant4.web.cern.ch" + url = "http://geant4-data.web.cern.ch/geant4-data/datasets/G4ABLA.3.0.tar.gz" + + version('3.0', sha256='99fd4dcc9b4949778f14ed8364088e45fa4ff3148b3ea36f9f3103241d277014') + version('3.1', sha256='7698b052b58bf1b9886beacdbd6af607adc1e099fc730ab6b21cf7f090c027ed') + + def install(self, spec, prefix): + mkdirp(join_path(prefix.share, 'data')) + install_path = join_path(prefix.share, 'data', + os.path.basename(self.stage.source_path)) + install_tree(self.stage.source_path, install_path) + + def url_for_version(self, version): + """Handle version string.""" + return ("http://geant4-data.web.cern.ch/geant4-data/datasets/G4ABLA.%s.tar.gz" % version) diff --git a/var/spack/repos/builtin/packages/g4emlow/package.py b/var/spack/repos/builtin/packages/g4emlow/package.py new file mode 100644 index 0000000000..d4b88c8a0f --- /dev/null +++ b/var/spack/repos/builtin/packages/g4emlow/package.py @@ -0,0 +1,27 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack import * +import os + + +class G4emlow(Package): + """Geant4 data files for low energy electromagnetic processes.""" + homepage = "http://geant4.web.cern.ch" + url = "http://geant4-data.web.cern.ch/geant4-data/datasets/G4EMLOW.6.50.tar.gz" + + version('6.50', sha256='c97be73fece5fb4f73c43e11c146b43f651c6991edd0edf8619c9452f8ab1236') + version('7.3', sha256='583aa7f34f67b09db7d566f904c54b21e95a9ac05b60e2bfb794efb569dba14e') + + def install(self, spec, prefix): + mkdirp(join_path(prefix.share, 'data')) + install_path = join_path(prefix.share, 'data', + os.path.basename(self.stage.source_path)) + install_tree(self.stage.source_path, install_path) + + def url_for_version(self, version): + """Handle version string.""" + return ("http://geant4.web.cern.ch/support/source/G4EMLOW.%s.tar.gz" % version) diff --git a/var/spack/repos/builtin/packages/g4ensdfstate/package.py b/var/spack/repos/builtin/packages/g4ensdfstate/package.py new file mode 100644 index 0000000000..ba2c370f25 --- /dev/null +++ b/var/spack/repos/builtin/packages/g4ensdfstate/package.py @@ -0,0 +1,30 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack import * +import os + + +class G4ensdfstate(Package): + """Geant4 data for nuclides properties""" + homepage = "http://geant4.web.cern.ch" + url = "http://geant4-data.web.cern.ch/geant4-data/datasets/G4ENSDFSTATE.2.1.tar.gz" + + version('2.1', '933e7f99b1c70f24694d12d517dfca36d82f4e95b084c15d86756ace2a2790d9') + version('2.2', 'dd7e27ef62070734a4a709601f5b3bada6641b111eb7069344e4f99a01d6e0a6') + + def install(self, spec, prefix): + mkdirp(join_path(prefix.share, 'data')) + install_path = join_path(prefix.share, 'data', + os.path.basename(self.stage.source_path)) + install_tree(self.stage.source_path, install_path) + + def setup_dependent_environment(self, spack_env, run_env, dependent_spec): + run_env.set('G4ENSDFSTATEDATA', join_path(prefix.share, 'data')) + + def url_for_version(self, version): + """Handle version string.""" + return "http://geant4-data.web.cern.ch/geant4-data/datasets/G4ENSDFSTATE.%s.tar.gz" % version diff --git a/var/spack/repos/builtin/packages/g4ndl/package.py b/var/spack/repos/builtin/packages/g4ndl/package.py new file mode 100644 index 0000000000..63cecd7fb7 --- /dev/null +++ b/var/spack/repos/builtin/packages/g4ndl/package.py @@ -0,0 +1,26 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack import * +import os + + +class G4ndl(Package): + """Geant4 Neutron data files with thermal cross sections """ + homepage = "http://geant4.web.cern.ch" + url = "http://geant4-data.web.cern.ch/geant4-data/datasets/G4NDL.4.5.tar.gz" + + version('4.5', 'cba928a520a788f2bc8229c7ef57f83d0934bb0c6a18c31ef05ef4865edcdf8e') + + def install(self, spec, prefix): + mkdirp(join_path(prefix.share, 'data')) + install_path = join_path(prefix.share, 'data', + os.path.basename(self.stage.source_path)) + install_tree(self.stage.source_path, install_path) + + def url_for_version(self, version): + """Handle version string.""" + return ("http://geant4-data.web.cern.ch/geant4-data/datasets/G4NDL.%s.tar.gz" % version) diff --git a/var/spack/repos/builtin/packages/g4neutronxs/package.py b/var/spack/repos/builtin/packages/g4neutronxs/package.py new file mode 100644 index 0000000000..f6b4c53193 --- /dev/null +++ b/var/spack/repos/builtin/packages/g4neutronxs/package.py @@ -0,0 +1,27 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack import * +import os + + +class G4neutronxs(Package): + """Geant4 data for evaluated neutron cross-sections on natural composition + of elements""" + homepage = "http://geant4.web.cern.ch" + url = "http://geant4-data.web.cern.ch/geant4-data/datasets/G4NEUTRONXS.1.4.tar.gz" + + version('1.4', '57b38868d7eb060ddd65b26283402d4f161db76ed2169437c266105cca73a8fd') + + def install(self, spec, prefix): + mkdirp(join_path(prefix.share, 'data')) + install_path = join_path(prefix.share, 'data', + os.path.basename(self.stage.source_path)) + install_tree(self.stage.source_path, install_path) + + def url_for_version(self, version): + """Handle version string.""" + return "http://geant4-data.web.cern.ch/geant4-data/datasets/G4NEUTRONXS.%s.tar.gz" % version diff --git a/var/spack/repos/builtin/packages/g4photonevaporation/package.py b/var/spack/repos/builtin/packages/g4photonevaporation/package.py new file mode 100644 index 0000000000..aed7c91a67 --- /dev/null +++ b/var/spack/repos/builtin/packages/g4photonevaporation/package.py @@ -0,0 +1,27 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack import * +import os + + +class G4photonevaporation(Package): + """Geant4 data for photon evaporation""" + homepage = "http://geant4.web.cern.ch" + url = "http://geant4-data.web.cern.ch/geant4-data/datasets/G4PhotonEvaporation.4.3.2.tar.gz" + + version('4.3.2', 'd4641a6fe1c645ab2a7ecee09c34e5ea584fb10d63d2838248bfc487d34207c7') + version('5.2', '83607f8d36827b2a7fca19c9c336caffbebf61a359d0ef7cee44a8bcf3fc2d1f') + + def install(self, spec, prefix): + mkdirp(join_path(prefix.share, 'data')) + install_path = join_path(prefix.share, 'data', + os.path.basename(self.stage.source_path)) + install_tree(self.stage.source_path, install_path) + + def url_for_version(self, version): + """Handle version string.""" + return ("http://geant4-data.web.cern.ch/geant4-data/datasets/G4PhotonEvaporation.%s.tar.gz" % version) diff --git a/var/spack/repos/builtin/packages/g4pii/package.py b/var/spack/repos/builtin/packages/g4pii/package.py new file mode 100644 index 0000000000..b2c5d7806c --- /dev/null +++ b/var/spack/repos/builtin/packages/g4pii/package.py @@ -0,0 +1,26 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack import * +import os + + +class G4pii(Package): + """Geant4 data for shell ionisation cross-sections""" + homepage = "http://geant4.web.cern.ch" + url = "http://geant4-data.web.cern.ch/geant4-data/datasets/G4PII.1.3.tar.gz" + + version('1.3', '6225ad902675f4381c98c6ba25fc5a06ce87549aa979634d3d03491d6616e926') + + def install(self, spec, prefix): + mkdirp(join_path(prefix.share, 'data')) + install_path = join_path(prefix.share, 'data', + os.path.basename(self.stage.source_path)) + install_tree(self.stage.source_path, install_path) + + def url_for_version(self, version): + """Handle version string.""" + return ("http://geant4-data.web.cern.ch/geant4-data/datasets/G4PII.1.3.tar.gz" % version) diff --git a/var/spack/repos/builtin/packages/g4radioactivedecay/package.py b/var/spack/repos/builtin/packages/g4radioactivedecay/package.py new file mode 100644 index 0000000000..2b86faca5a --- /dev/null +++ b/var/spack/repos/builtin/packages/g4radioactivedecay/package.py @@ -0,0 +1,27 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack import * +import os + + +class G4radioactivedecay(Package): + """Geant4 data files for radio-active decay hadronic processes""" + homepage = "http://geant4.web.cern.ch" + url = "http://geant4-data.web.cern.ch/geant4-data/datasets/G4RadioactiveDecay.5.1.1.tar.gz" + + version('5.1.1', 'f7a9a0cc998f0d946359f2cb18d30dff1eabb7f3c578891111fc3641833870ae') + version('5.2', '99c038d89d70281316be15c3c98a66c5d0ca01ef575127b6a094063003e2af5d') + + def install(self, spec, prefix): + mkdirp(join_path(prefix.share, 'data')) + install_path = join_path(prefix.share, 'data', + os.path.basename(self.stage.source_path)) + install_tree(self.stage.source_path, install_path) + + def url_for_version(self, version): + """Handle version string.""" + return ("http://geant4-data.web.cern.ch/geant4-data/datasets/G4RadioactiveDecay.%s.tar.gz" % version) diff --git a/var/spack/repos/builtin/packages/g4realsurface/package.py b/var/spack/repos/builtin/packages/g4realsurface/package.py new file mode 100644 index 0000000000..a0594e0789 --- /dev/null +++ b/var/spack/repos/builtin/packages/g4realsurface/package.py @@ -0,0 +1,28 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack import * +import os + + +class G4realsurface(Package): + """Geant4 data for measured optical surface reflectance""" + homepage = "http://geant4.web.cern.ch" + url = "http://geant4-data.web.cern.ch/geant4-data/datasets/RealSurface.1.0.tar.gz" + + version('1.0', '3e2d2506600d2780ed903f1f2681962e208039329347c58ba1916740679020b1') + version('2.1', '2a287adbda1c0292571edeae2082a65b7f7bd6cf2bf088432d1d6f889426dcf3') + version('2.1.1', '90481ff97a7c3fa792b7a2a21c9ed80a40e6be386e581a39950c844b2dd06f50') + + def install(self, spec, prefix): + mkdirp(join_path(prefix.share, 'data')) + install_path = join_path(prefix.share, 'data', + os.path.basename(self.stage.source_path)) + install_tree(self.stage.source_path, install_path) + + def url_for_version(self, version): + """Handle version string.""" + return ("http://geant4-data.web.cern.ch/geant4-data/datasets/RealSurface.1.0.tar.gz" % version) diff --git a/var/spack/repos/builtin/packages/g4saiddata/package.py b/var/spack/repos/builtin/packages/g4saiddata/package.py new file mode 100644 index 0000000000..83fd993bc8 --- /dev/null +++ b/var/spack/repos/builtin/packages/g4saiddata/package.py @@ -0,0 +1,26 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack import * +import os + + +class G4saiddata(Package): + """Geant4 data from evaluated cross-sections in SAID data-base """ + homepage = "http://geant4.web.cern.ch" + url = "http://geant4-data.web.cern.ch/geant4-data/datasets/G4SAIDDATA.1.1.tar.gz" + + version('1.1', 'a38cd9a83db62311922850fe609ecd250d36adf264a88e88c82ba82b7da0ed7f') + + def install(self, spec, prefix): + mkdirp(join_path(prefix.share, 'data')) + install_path = join_path(prefix.share, 'data', + os.path.basename(self.stage.source_path)) + install_tree(self.stage.source_path, install_path) + + def url_for_version(self, version): + """Handle version string.""" + return "http://geant4-data.web.cern.ch/geant4-data/datasets/G4SAIDDATA.%s.tar.gz" % version diff --git a/var/spack/repos/builtin/packages/g4tendl/package.py b/var/spack/repos/builtin/packages/g4tendl/package.py new file mode 100644 index 0000000000..d02cee96d2 --- /dev/null +++ b/var/spack/repos/builtin/packages/g4tendl/package.py @@ -0,0 +1,27 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack import * +import os + + +class G4tendl(Package): + """Geant4 data for incident particles [optional]""" + homepage = "http://geant4.web.cern.ch" + url = "http://geant4-data.web.cern.ch/geant4-data/datasets/G4TENDL.1.3.tar.gz" + + version('1.3', '52ad77515033a5d6f995c699809b464725a0e62099b5e55bf07c8bdd02cd3bce') + version('1.3.2', '3b2987c6e3bee74197e3bd39e25e1cc756bb866c26d21a70f647959fc7afb849') + + def install(self, spec, prefix): + mkdirp(join_path(prefix.share, 'data')) + install_path = join_path(prefix.share, 'data', + os.path.basename(self.stage.source_path)) + install_tree(self.stage.source_path, install_path) + + def url_for_version(self, version): + """Handle version string.""" + return ("http://geant4-data.web.cern.ch/geant4-data/datasets/G4TENDL.%s.tar.gz" % version) diff --git a/var/spack/repos/builtin/packages/geant4-data/package.py b/var/spack/repos/builtin/packages/geant4-data/package.py new file mode 100644 index 0000000000..d93b111434 --- /dev/null +++ b/var/spack/repos/builtin/packages/geant4-data/package.py @@ -0,0 +1,95 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * +import os +import glob + + +class Geant4Data(Package): + """An umbrella package to hold Geant4 data packages""" + + homepage = "http://geant4.cern.ch" + url = "http://geant4-data.web.cern.ch/geant4-data/ReleaseNotes/ReleaseNotes4.10.3.html" + + version('10.03.p03', '2248ad436613897d9fad93bdb99d9446', expand=False) + version('10.04', 'c49194b96e65ed4527d34d22a9860972', expand=False) + + # geant4@10.03.p03 + depends_on("g4abla@3.0", when='@10.03.p03 ') + depends_on("g4emlow@6.50", when='@10.03.p03 ') + depends_on("g4ndl@4.5", when='@10.03.p03 ') + depends_on("g4neutronxs@1.4", when='@10.03.p03 ') + depends_on("g4saiddata@1.1", when='@10.03.p03 ') + depends_on("g4ensdfstate@2.1", when='@10.03.p03 ') + depends_on("g4photonevaporation@4.3.2", when='@10.03.p03 ') + depends_on("g4pii@1.3", when='@10.03.p03 ') + depends_on("g4radioactivedecay@5.1.1", when='@10.03.p03 ') + depends_on("g4realsurface@1.0", when='@10.03.p03 ') + depends_on("g4tendl@1.3", when='@10.03.p03 ') + # geant4@10.04 + depends_on("g4abla@3.1", when='@10.04 ') + depends_on("g4emlow@7.3", when='@10.04 ') + depends_on("g4ndl@4.5", when='@10.04 ') + depends_on("g4neutronxs@1.4", when='@10.04 ') + depends_on("g4saiddata@1.1", when='@10.04 ') + depends_on("g4ensdfstate@2.2", when='@10.04 ') + depends_on("g4photonevaporation@5.2", when='@10.04 ') + depends_on("g4pii@1.3", when='@10.04 ') + depends_on("g4radioactivedecay@5.2", when='@10.04 ') + depends_on("g4realsurface@2.1", when='@10.04 ') + depends_on("g4tendl@1.3.2", when='@10.04 ') + + def install(self, spec, prefix): + spec = self.spec + version = self.version + major = version[0] + minor = version[1] + if len(version) > 2: + patch = version[-1] + else: + patch = 0 + data = 'Geant4-%s.%s.%s/data' % (major, minor, patch) + datadir = join_path(spec.prefix.share, data) + with working_dir(datadir, create=True): + for d in glob.glob('%s/share/data/*' % + spec['g4abla'].prefix): + os.symlink(d, os.path.basename(d)) + for d in glob.glob('%s/share/data/*' % + spec['g4emlow'].prefix): + os.symlink(d, os.path.basename(d)) + for d in glob.glob('%s/share/data/*' % + spec['g4ndl'].prefix): + os.symlink(d, os.path.basename(d)) + for d in glob.glob('%s/share/data/*' % + spec['g4saiddata'].prefix): + os.symlink(d, os.path.basename(d)) + for d in glob.glob('%s/share/data/*' % + spec['g4neutronxs'].prefix): + os.symlink(d, os.path.basename(d)) + for d in glob.glob('%s/share/data/*' % + spec['g4ensdfstate'].prefix): + os.symlink(d, os.path.basename(d)) + for d in glob.glob('%s/share/data/*' % + spec['g4photonevaporation'].prefix): + os.symlink(d, os.path.basename(d)) + for d in glob.glob('%s/share/data/*' % + spec['g4pii'].prefix): + os.symlink(d, os.path.basename(d)) + for d in glob.glob('%s/share/data/*' % + spec['g4radioactivedecay'].prefix): + os.symlink(d, os.path.basename(d)) + for d in glob.glob('%s/share/data/*' % + spec['g4realsurface'].prefix): + os.symlink(d, os.path.basename(d)) + for d in glob.glob('%s/share/data/*' % + spec['g4tendl'].prefix): + os.symlink(d, os.path.basename(d)) + + def url_for_version(self, version): + """Handle version string.""" + url = 'http://geant4-data.web.cern.ch/geant4-data/ReleaseNotes/' + url = url + 'ReleaseNotes4.{0}.{1}.html'.format(version[0], version[1]) + return url diff --git a/var/spack/repos/builtin/packages/geant4/cxx17.patch b/var/spack/repos/builtin/packages/geant4/cxx17.patch new file mode 100644 index 0000000000..3845e9e20b --- /dev/null +++ b/var/spack/repos/builtin/packages/geant4/cxx17.patch @@ -0,0 +1,22 @@ +diff -Naur geant4.10.03.p03/cmake/Modules/Geant4LibraryBuildOptions.cmake geant4.10.03.p03/cmake/Modules/Geant4LibraryBuildOptions.cmake +--- geant4.10.03.p03/cmake/Modules/Geant4LibraryBuildOptions.cmake 2017-10-20 06:30:46.000000000 -0500 ++++ geant4.10.03.p03/cmake/Modules/Geant4LibraryBuildOptions.cmake 2018-04-16 16:48:02.194321171 -0500 +@@ -76,7 +76,7 @@ + # Mark as advanced because most users will not need it + enum_option(GEANT4_BUILD_CXXSTD + DOC "C++ Standard to compile against" +- VALUES 11 14 c++11 c++14 ++ VALUES 11 14 17 c++11 c++14 c++17 + CASE_INSENSITIVE + ) + +@@ -106,6 +106,9 @@ + + # Add Definition to flags for temporary back compatibility + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DG4USE_STD11") ++if(GEANT4_BUILD_CXXSTD GREATER 14) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES=1") ++endif() + + # Hold any appropriate compile flag(s) in variable for later export to + # config files. Needed to support late CMake 2.8 where compile features diff --git a/var/spack/repos/builtin/packages/geant4/cxx17_geant4_10_0.patch b/var/spack/repos/builtin/packages/geant4/cxx17_geant4_10_0.patch new file mode 100644 index 0000000000..228985ebc4 --- /dev/null +++ b/var/spack/repos/builtin/packages/geant4/cxx17_geant4_10_0.patch @@ -0,0 +1,22 @@ +diff -Naur geant4/cmake/Modules/G4BuildSettings.cmake geant4/cmake/Modules/G4BuildSettings.cmake +--- geant4/cmake/Modules/G4BuildSettings.cmake 2017-10-20 06:30:46.000000000 -0500 ++++ geant4/cmake/Modules/G4BuildSettings.cmake 2018-04-16 16:48:02.194321171 -0500 +@@ -76,7 +76,7 @@ + # Mark as advanced because most users will not need it + enum_option(GEANT4_BUILD_CXXSTD + DOC "C++ Standard to compile against" +- VALUES 11 14 c++11 c++14 ++ VALUES 11 14 17 c++11 c++14 c++17 + CASE_INSENSITIVE + ) + +@@ -106,6 +106,9 @@ + + # Add Definition to flags for temporary back compatibility + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DG4USE_STD11") ++if(GEANT4_BUILD_CXXSTD GREATER 14) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES=1") ++endif() + + # Hold any appropriate compile flag(s) in variable for later export to + # config files. Needed to support late CMake 2.8 where compile features diff --git a/var/spack/repos/builtin/packages/geant4/package.py b/var/spack/repos/builtin/packages/geant4/package.py index 2f80498e3e..8846d4555d 100644 --- a/var/spack/repos/builtin/packages/geant4/package.py +++ b/var/spack/repos/builtin/packages/geant4/package.py @@ -6,6 +6,8 @@ from spack import * import platform +import os +import glob class Geant4(CMakePackage): @@ -19,49 +21,59 @@ class Geant4(CMakePackage): version('10.04', 'b84beeb756821d0c61f7c6c93a2b83de') version('10.03.p03', 'ccae9fd18e3908be78784dc207f2d73b') - version('10.02.p03', '2b887e66f0d41174016160707662a77b') - version('10.02.p02', '6aae1d0fc743b0edc358c5c8fbe48657') - version('10.02.p01', 'b81f7082a15f6a34b720b6f15c6289cfe4ddbbbdcef0dc52719f71fac95f7f1c') - version('10.01.p03', '4fb4175cc0dabcd517443fbdccd97439') variant('qt', default=False, description='Enable Qt support') variant('vecgeom', default=False, description='Enable vecgeom support') - variant('cxx11', default=True, description='Enable CXX11 support') - variant('cxx14', default=False, description='Enable CXX14 support') variant('opengl', default=False, description='Optional OpenGL support') variant('x11', default=False, description='Optional X11 support') variant('motif', default=False, description='Optional motif support') variant('threads', default=True, description='Build with multithreading') + variant('data', default=True, description='Install geant4 data') + + variant('cxxstd', + default='11', + values=('11', '14', '17'), + multi=False, + description='Use the specified C++ standard when building.') depends_on('cmake@3.5:', type='build') - conflicts('+cxx14', when='+cxx11') - conflicts('+cxx11', when='+cxx14') - # C++11 support - depends_on("clhep@2.4.0.0+cxx11~cxx14", when="@10.04+cxx11~cxx14") - depends_on("clhep@2.3.4.3+cxx11~cxx14", when="@10.03.p03+cxx11~cxx14") - depends_on("clhep@2.3.1.1+cxx11~cxx14", when="@10.02.p01+cxx11~cxx14") - depends_on("clhep@2.3.1.1+cxx11~cxx14", when="@10.02.p01+cxx11~cxx14") - depends_on("clhep@2.2.0.4+cxx11~cxx14", when="@10.01.p03+cxx11~cxx14") + depends_on("xerces-c cxxstd=11", when="cxxstd=11") + depends_on("clhep@2.4.0.0 cxxstd=11", when="@10.04 cxxstd=11") + depends_on("clhep@2.3.4.6 cxxstd=11", when="@10.03.p03 cxxstd=11") + depends_on("vecgeom cxxstd=11", when="+vecgeom cxxstd=11") # C++14 support - depends_on("clhep@2.4.0.0+cxx11~cxx14", when="@10.04~cxx11+cxx14") - depends_on("clhep@2.3.4.3+cxx11~cxx14", when="@10.03.p03~cxx11+cxx14") - depends_on("clhep@2.3.1.1~cxx11+cxx14", when="@10.02.p02~cxx11+cxx14") - depends_on("clhep@2.3.1.1~cxx11+cxx14", when="@10.02.p01~cxx11+cxx14") - depends_on("clhep@2.2.0.4~cxx11+cxx14", when="@10.01.p03~cxx11+cxx14") + depends_on("xerces-c cxxstd=14", when="cxxstd=14") + depends_on("clhep@2.4.0.0 cxxstd=14", when="@10.04 cxxstd=14") + depends_on("clhep@2.3.4.6 cxxstd=14", when="@10.03.p03 cxxstd=14") + depends_on("vecgeom cxxstd=14", when="+vecgeom cxxstd=14") + + # C++17 support + depends_on("xerces-c cxxstd=17", when="cxxstd=17") + patch('cxx17.patch', when='@:10.03.p99 cxxstd=17') + patch('cxx17_geant4_10_0.patch', level=1, when='@10.04.00: cxxstd=17') + depends_on("clhep@2.4.0.0 cxxstd=17", when="@10.04 cxxstd=17") + depends_on("clhep@2.3.4.6 cxxstd=17", when="@10.03.p03 cxxstd=17") + depends_on("vecgeom cxxstd=17", when="+vecgeom cxxstd=17") depends_on("expat") depends_on("zlib") - depends_on("xerces-c") depends_on("mesa", when='+opengl') depends_on("libx11", when='+x11') depends_on("libxmu", when='+x11') depends_on("motif", when='+motif') - depends_on("vecgeom", when="+vecgeom") depends_on("qt@4.8:4.999", when="+qt") + # if G4 data not installed with geant4 + # depend on G4 data packages + # this allows external data installations + # to avoid duplication + + depends_on('geant4-data@10.03.p03', when='@10.03.p03 ~data') + depends_on('geant4-data@10.04', when='@10.04 ~data') + def cmake_args(self): spec = self.spec @@ -77,7 +89,7 @@ def cmake_args(self): spec['xerces-c'].prefix, ] arch = platform.system().lower() - if arch is not 'darwin': + if arch != 'darwin': if "+x11" in spec and "+opengl" in spec: options.append('-DGEANT4_USE_OPENGL_X11=ON') if "+motif" in spec and "+opengl" in spec: @@ -85,10 +97,8 @@ def cmake_args(self): if "+x11" in spec: options.append('-DGEANT4_USE_RAYTRACER_X11=ON') - if '+cxx11' in spec: - options.append('-DGEANT4_BUILD_CXXSTD=c++11') - if '+cxx14' in spec: - options.append('-DGEANT4_BUILD_CXXSTD=c++14') + options.append('-DGEANT4_BUILD_CXXSTD=c++{0}'.format( + self.spec.variants['cxxstd'].value)) if '+qt' in spec: options.append('-DGEANT4_USE_QT=ON') @@ -104,8 +114,32 @@ def cmake_args(self): on_or_off = lambda opt: 'ON' if '+' + opt in spec else 'OFF' options.append('-DGEANT4_BUILD_MULTITHREADED=' + on_or_off('threads')) + # install the data with geant4 + options.append('-DGEANT4_INSTALL_DATA=' + on_or_off('data')) + return options def url_for_version(self, version): """Handle Geant4's unusual version string.""" return ("http://geant4.cern.ch/support/source/geant4.%s.tar.gz" % version) + + @run_before('cmake') + def make_data_links(self): + if '+data' in self.spec: + return + spec = self.spec + version = self.version + major = version[0] + minor = version[1] + if len(version) > 2: + patch = version[-1] + else: + patch = 0 + datadir = 'Geant4-%s.%s.%s/data' % (major, minor, patch) + with working_dir(join_path(spec.prefix.share, datadir), + create=True): + dirs = glob.glob('%s/%s/*' % + (spec['geant4-data'].prefix.share, datadir)) + for d in dirs: + target = os.readlink(d) + os.symlink(target, os.path.basename(target)) diff --git a/var/spack/repos/builtin/packages/vecgeom/package.py b/var/spack/repos/builtin/packages/vecgeom/package.py index f4a054d87b..15b4e25155 100644 --- a/var/spack/repos/builtin/packages/vecgeom/package.py +++ b/var/spack/repos/builtin/packages/vecgeom/package.py @@ -21,7 +21,7 @@ class Vecgeom(CMakePackage): variant('cxxstd', default='17', - values=('14', '17'), + values=('11', '14', '17'), multi=False, description='Use the specified C++ standard when building.') variant('vector',