# Copyright 2013-2021 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 *


class Openmc(CMakePackage):
    """The OpenMC project aims to provide a fully-featured Monte Carlo particle
       transport code based on modern methods. It is a constructive solid
       geometry, continuous-energy transport code that uses ACE format cross
       sections. The project started under the Computational Reactor Physics
       Group at MIT."""

    homepage = "http://openmc.readthedocs.io/"
    url = "https://github.com/openmc-dev/openmc/tarball/v0.10.0"
    git = "https://github.com/openmc-dev/openmc.git"

    version('0.10.0', sha256='47650cb45e2c326ae439208d6f137d75ad3e5c657055912d989592c6e216178f')
    version('develop')

    depends_on("hdf5+hl")

    def cmake_args(self):
        options = ['-DHDF5_ROOT:PATH=%s' % self.spec['hdf5'].prefix]

        return options

@@ -741,16 +741,281 @@
 c.git%22%0A%0A
+    version('develop', branch='develop', submodules=True)%0A    version('master', branch='master', submodules=True)%0A    version('0.12.0', tag='v0.12.0', submodules=True)%0A    version('0.11.0', sha256='19a9d8e9c3b581e9060fbd96d30f1098312d217cb5c925eb6372a5786d9175af')%0A
     vers
@@ -1107,153 +1107,1122 @@
 f')%0A
+%0A
     v
-ersion('develop')%0A%0A    depends_on(%22hdf5+hl%22)%0A%0A    def cmake_args(self):%0A        options = %5B'-DHDF5_ROOT:PATH=%25s' %25 self.spec%5B'hdf5'%5D.prefix%5D
+ariant('mpi', default=False, description='Enable MPI support')%0A    variant('openmp', default=True, description='Enable OpenMP support')%0A    variant('optimize', default=False, description='Enable optimization flags')%0A    variant('debug', default=False, description='Enable debug flags')%0A%0A    depends_on('git', type='build')%0A    depends_on('hdf5+hl~mpi', when='~mpi')%0A    depends_on('mpi', when='+mpi')%0A    depends_on('hdf5+hl+mpi', when='+mpi')%0A%0A    def cmake_args(self):%0A        options = %5B'-DCMAKE_INSTALL_LIBDIR=lib'%5D  # forcing bc sometimes goes to lib64%0A%0A        if '+mpi' in self.spec:%0A            options += %5B'-DCMAKE_C_COMPILER=%25s' %25 self.spec%5B'mpi'%5D.mpicc,%0A                        '-DCMAKE_CXX_COMPILER=%25s' %25 self.spec%5B'mpi'%5D.mpicxx%5D%0A%0A        options += %5Bself.define_from_variant('openmp')%5D%0A        options += %5Bself.define_from_variant('optimize')%5D%0A        options += %5Bself.define_from_variant('debug')%5D%0A%0A        if '+optimize' in self.spec:%0A            self.spec.variants%5B'build_type'%5D.value = 'Release'%0A%0A        if '+debug' in self.spec:%0A            self.spec.variants%5B'build_type'%5D.value = 'Debug'
 %0A%0A  

add v0.11.0, v0.12.0 (#21349)