From 73c29e9d53ea91ee53af205a8db64aacbdc21ceb Mon Sep 17 00:00:00 2001 From: Tirthankar Mazumder <63574588+wermos@users.noreply.github.com> Date: Thu, 13 Oct 2022 16:40:07 +0530 Subject: [PATCH] Added Fastor (#77) * Added Fastor to `algebra-plugins` --- CMakeLists.txt | 16 ++++++++++++++++ extern/fastor/CMakeLists.txt | 30 ++++++++++++++++++++++++++++++ extern/fastor/README.md | 4 ++++ 3 files changed, 50 insertions(+) create mode 100644 extern/fastor/CMakeLists.txt create mode 100644 extern/fastor/README.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 35c8f653..bd8155d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,8 @@ option( ALGEBRA_PLUGINS_INCLUDE_SMATRIX "Include Smatrix types in Algebra Plugins" FALSE ) option( ALGEBRA_PLUGINS_INCLUDE_VC "Include Vc types in Algebra Plugins" FALSE ) +option( ALGEBRA_PLUGINS_INCLUDE_FASTOR + "Include Fastor types in Algebra Plugins" FALSE ) option( ALGEBRA_PLUGINS_INCLUDE_VECMEM "Include VecMem types in Algebra Plugins" FALSE ) option( ALGEBRA_PLUGINS_BUILD_TESTING "Build the unit tests of Algebra Plugins" @@ -139,6 +141,20 @@ if( ALGEBRA_PLUGINS_SETUP_VC ) endif() endif() +# Set up Fastor. +option( ALGEBRA_PLUGINS_SETUP_FASTOR + "Set up the Fastor target(s) explicitly" FALSE ) +option( ALGEBRA_PLUGINS_USE_SYSTEM_FASTOR + "Pick up an existing installation of Fastor from the build environment" + TRUE ) +if( ALGEBRA_PLUGINS_SETUP_FASTOR ) + if( ALGEBRA_PLUGINS_USE_SYSTEM_FASTOR ) + find_package( Fastor 0.6.3 REQUIRED ) + else() + add_subdirectory( extern/fastor ) + endif() +endif() + # Undo the developer flag suppression. if( _unsetDevWarningFlag ) unset( CMAKE_SUPPRESS_DEVELOPER_WARNINGS ) diff --git a/extern/fastor/CMakeLists.txt b/extern/fastor/CMakeLists.txt new file mode 100644 index 00000000..1e1ea00d --- /dev/null +++ b/extern/fastor/CMakeLists.txt @@ -0,0 +1,30 @@ +# Algebra plugins library, part of the ACTS project (R&D line) +# +# (c) 2022 CERN for the benefit of the ACTS project +# +# Mozilla Public License Version 2.0 + +# CMake include(s). +cmake_minimum_required( VERSION 3.11 ) +include( FetchContent ) + +# Tell the user what's happening. +message( STATUS "Building Fastor as part of the Algebra Plugins project" ) + +# Declare where to get Fastor from. +# We need to use this alternative syntax for FetchContent_Declare because the +# latest release for Fastor does not have a CMakeLists.txt file. +set( ALGEBRA_PLUGINS_FASTOR_SOURCE + "fastor;GIT_REPOSITORY;https://github.com/romeric/Fastor.git;GIT_TAG;6d7216f304d60d92b9b042566d4d6e94c65086a3" + CACHE STRING "Source for Fastor, when built as part of this project" ) +mark_as_advanced( ALGEBRA_PLUGINS_FASTOR_SOURCE ) +FetchContent_Declare( fastor ${ALGEBRA_PLUGINS_FASTOR_SOURCE} ) + +# Options used in the build of Fastor. +set(BUILD_TESTING OFF CACHE BOOL "Don't build the Fastor tests") +add_compile_definitions(FASTOR_ENABLE_RUNTIME_CHECKS=0) + +# Get it into the current directory. +FetchContent_Populate( fastor ) +add_subdirectory( "${fastor_SOURCE_DIR}" "${fastor_BINARY_DIR}" + EXCLUDE_FROM_ALL ) diff --git a/extern/fastor/README.md b/extern/fastor/README.md new file mode 100644 index 00000000..3e48a41e --- /dev/null +++ b/extern/fastor/README.md @@ -0,0 +1,4 @@ +# Build Recipe for Fastor + +This directory holds a simple build recipe for the +[Fastor](https://github.com/romeric/Fastor) project.