Add rosco package (#43822)

* Add rosco package

* format

* remove unused

* Add in other versions

* start adding some patches

* finish adding the patches
This commit is contained in:
Marc T. Henry de Frahan 2024-05-03 01:58:35 -06:00 committed by GitHub
parent 14561fafff
commit 7008bb6335
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 89 additions and 0 deletions

View file

@ -0,0 +1,13 @@
diff --git a/rosco/controller/CMakeLists.txt b/rosco/controller/CMakeLists.txt
index 0d29085..46705c2 100644
--- a/rosco/controller/CMakeLists.txt
+++ b/rosco/controller/CMakeLists.txt
@@ -11,7 +11,7 @@ endif()
message(STATUS "CMAKE_Fortran_COMPILER_ID = ${CMAKE_Fortran_COMPILER_ID}")
if(APPLE OR UNIX)
# Enable .dll export
-if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
+if (CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DIMPLICIT_DLLEXPORT -r8 -double-size 64 -cpp -no-wrap-margin")
else()
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DIMPLICIT_DLLEXPORT -ffree-line-length-0 -fdefault-real-8 -fdefault-double-8 -cpp")

View file

@ -0,0 +1,13 @@
diff --git a/ROSCO/CMakeLists.txt b/ROSCO/CMakeLists.txt
index b450a30..9506267 100644
--- a/ROSCO/CMakeLists.txt
+++ b/ROSCO/CMakeLists.txt
@@ -11,7 +11,7 @@ endif()
message(STATUS "CMAKE_Fortran_COMPILER_ID = ${CMAKE_Fortran_COMPILER_ID}")
if(APPLE OR UNIX)
# Enable .dll export
-if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
+if (CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DIMPLICIT_DLLEXPORT -r8 -double-size 64 -cpp -no-wrap-margin")
else()
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DIMPLICIT_DLLEXPORT -ffree-line-length-0 -fdefault-real-8 -fdefault-double-8 -cpp")

View file

@ -0,0 +1,63 @@
# Copyright 2013-2024 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.package import *
class Rosco(CMakePackage):
"""
ROSCO controls package for OpenFAST from NREL
Note: this only builds ROSCO controls library for inclusion with OpenFAST
If the toolbox or tuning scripts are needed, please build manually
"""
homepage = "https://rosco.readthedocs.io/en/latest/"
url = "https://github.com/NREL/ROSCO/archive/refs/tags/v2.9.0.tar.gz"
git = "https://github.com/NREL/ROSCO.git"
maintainers("dzalkind", "ndevelder")
version("develop", branch="develop")
version("main", branch="main")
version("2.9.0", sha256="eb7f6220207b8a07c9570fb64bab591906b0c19d73ac4c24bb8dca252722ca79")
version("2.8.0", sha256="7a2e3a7bebdf6ee73884a9e3502f904cc3a3f1aa1bf672c223ecbaa041bfc48f")
version("2.7.0", sha256="b6a2cda92680cf6a460d194901a2f16c2635710a82788576a6383a3bb189fc83")
version("2.6.0", sha256="ca1c1a6ac53e8220b107accccfb8b5299772c38b7c77cd8d2ba383e9825daeaa")
version("2.5.1", sha256="55fe7bba612321baa6e089ee1156ef4db2e3bccf1b69534829b06f3367fff05d")
variant("shared", default=False, description="Build shared libraries")
variant("pic", default=False, description="Position independent code")
patch("intel-oneapi-2x.patch", when="@2.5:2.8%oneapi")
patch("intel-oneapi-29.patch", when="@2.9.0:2.9.1%oneapi")
@property
def root_cmakelists_dir(self):
if self.spec.version >= Version("2.9.0"):
return "rosco/controller"
else:
return "ROSCO"
def cmake_args(self):
options = []
options.extend(
[
self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"),
]
)
return options
def setup_run_environment(self, env):
env.set("ROSCO_DISCON", self.prefix.lib + "/libdiscon.so")
env.set("ROSCO_DISCON_DIR", self.prefix.lib)
def flag_handler(self, name, flags):
if name == "fflags" and self.compiler.fc.endswith("gfortran"):
flags.extend(["-ffree-line-length-0"])
return (None, None, flags)