From cd9310d6f9eb61b1b61e6a8e7f16a1c32a74a586 Mon Sep 17 00:00:00 2001 From: Zara Zlatanova Date: Sun, 30 Nov 2025 21:00:13 +0100 Subject: [PATCH] feat: create package.py + feat: add options to CMakeLists.txt --- CMakeLists.txt | 31 +++++++++++++++++++------------ package.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 12 deletions(-) create mode 100644 package.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 97abfba..cd9aef0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,24 @@ cmake_minimum_required(VERSION "3.12") -project("spackexample" VERSION 0.3.0) - -find_package(Boost - 1.65.1 - REQUIRED - filesystem - ) - -find_package(yaml-cpp - 0.7.0 - REQUIRED - ) +project("spackexample" VERSION 0.3.1) + +option(BOOST "Enable boost support" ON) +option(YAML "Enable yaml support" ON) + +if(BOOST) + find_package(Boost + 1.65.1 + REQUIRED + filesystem + ) +endif() + +if(YAML) + find_package(yaml-cpp + 0.7.0 + REQUIRED + ) +endif() add_library(spackexamplelib filesystem/filesystem.cpp flatset/flatset.cpp yamlParser/yamlParser.cpp) diff --git a/package.py b/package.py new file mode 100644 index 0000000..460dbe3 --- /dev/null +++ b/package.py @@ -0,0 +1,49 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +# ---------------------------------------------------------------------------- +# If you submit this package back to Spack as a pull request, +# please first remove this boilerplate and all FIXME comments. +# +# This is a template package file for Spack. We've put "FIXME" +# next to all the things you'll want to change. Once you've handled +# them, you can save this file and test your package like this: +# +# spack install spack-exercise +# +# You can edit this file again by typing: +# +# spack edit spack-exercise +# +# See the Spack documentation for more information on packaging. +# ---------------------------------------------------------------------------- + +from spack_repo.builtin.build_systems.cmake import CMakePackage + +from spack.package import * + + +class SpackExercise(CMakePackage): + "This package serves all spack-exercise releases." + + homepage = "https://simulation-software-engineering.github.io/homepage/" + url = "https://github.com/Simulation-Software-Engineering/spack-exercise/archive/refs/tags/v0.3.0.tar.gz" + + version("main", git="https://github.com/Simulation-Software-Engineering/spack-exercise.git") + + maintainers("zezl7") + + license("MIT", checked_by="zezl7") + + version("0.3.0", sha256="c179ccc9d56b724fcb7eeff8cebbc1afe2797929b99aa6e7d9b8478a014f2d02") + version("0.2.0", sha256="010c900a3d4770116844636b89c1e42b1920f27c3da615543fb14f2ae9bb7f64") + version("0.1.0", sha256="f1c212a58376fd78e9854576627e6927d7cb93ccffe3a162b1664570c491e3a7") + + variant("boost", default=True, description="Enable boost support") + variant("yaml", default =True, description="Enable yaml support") + + depends_on("cxx", type="build") + depends_on("c", type="build") + depends_on("boost", when="@0.2.0:+boost") + depends_on("yaml-cpp", when="@0.3.0+yaml") \ No newline at end of file