Commit 13ede4a7 authored by Mark Meredith's avatar Mark Meredith
Browse files

Add Spack recipe

parent 00b32b82
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
__pycache__
build
+21 −0
Original line number Diff line number Diff line
@@ -48,3 +48,24 @@ test:no_cgal:
  variables:
    ENABLE_CSG: "OFF"
  <<: *cmake_def

.test:spack: &spack_def
  stage: test
  image: $CI_REGISTRY_IMAGE:latest
  needs: ['build-img']
  when: manual
  script:
    - /usr/local/spack/bin/spack repo add .spack/repo
    - /usr/local/spack/bin/spack install csg-eb ${NO_CSG}
  tags:
    - docker

spack:cgal:
  variables:
    NO_CSG: ""
  <<: *spack_def

spack:no_cgal:
  variables:
    NO_CSG: "~cgal"
  <<: *spack_def
+37 −0
Original line number Diff line number Diff line
# 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 *

CSG_REPO = "https://mfix.netl.doe.gov/gitlab/exa/csg-eb.git"
CSG_BRANCH = "main"


class CsgEb(CMakePackage):
    """Define Embedded Boundaries (for AMReX) using CSG"""

    homepage = "https://mfix.netl.doe.gov/gitlab/exa/csg-eb"

    version("main", git=CSG_REPO, branch=CSG_BRANCH)

    variant("cgal", default=True, description="Build with CGAL Support")

    depends_on("pegtl")
    depends_on("catch2")
    depends_on("cgal", when="+cgal")

    def cmake_args(self):
        return [
            "-DCSG_CGAL_ENABLED={}".format("True" if "+cgal" in self.spec else "False")
        ]

    def setup_run_environment(self, env):
        env.prepend_path("CPATH", self.prefix.include)

    @property
    def headers(self):
        headers = find_all_headers(self.prefix.include)
        headers.directories = [self.prefix.include]
        return headers

.spack/repo/repo.yaml

0 → 100644
+2 −0
Original line number Diff line number Diff line
repo:
  namespace: 'csg-eb-ns'
+24 −1
Original line number Diff line number Diff line
@@ -28,12 +28,35 @@ endif()
add_subdirectory(src/csg)

target_include_directories(csg-eb
  PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
  PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  $<INSTALL_INTERFACE:include>
  PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
  )

target_compile_features(csg-eb PRIVATE cxx_std_17)


file(GLOB headers "include/*.hpp")
install(FILES ${headers}
  DESTINATION include
  )

install(TARGETS csg-eb
    EXPORT CsgEbConfig
    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
export(TARGETS csg-eb
    NAMESPACE CsgEb::
    FILE "${CMAKE_CURRENT_BINARY_DIR}/CsgEbConfig.cmake"
)
install(EXPORT CsgEbConfig
    DESTINATION "${CMAKE_INSTALL_PREFIX}"
    NAMESPACE CsgEb::
)


if (CSG_CGAL_ENABLED)
   target_compile_definitions(csg-eb PUBLIC USE_CGAL)
endif()
Loading