Skip to content
Snippets Groups Projects
Commit 01e5c4c0 authored by Yen-Chen Chen's avatar Yen-Chen Chen
Browse files

Apply naming convention for CMake options (!69)


<!--
ICON

---------------------------------------------------------------
Copyright (C) 2004-2024, DWD, MPI-M, DKRZ, KIT, ETH, MeteoSwiss
Contact information: icon-model.org

See AUTHORS.TXT for a list of authors
See LICENSES/ for license information
SPDX-License-Identifier: CC0-1.0
---------------------------------------------------------------
-->

## What is the new feature
_Please describe your feature in a couple of words._
## How is it implemented
_Describe important implementation details of the feature._

## Mandatory steps before review
- [ ] Gitlab CI passes _(Hint: use `make format` for linting)_ 
- [x] New feature is covered by additional unit tests
- [x] Mark the merge request as ready by removing `Draft:`

## Mandatory steps before merge
- [x] Test coverage does not decrease
- [x] Reviewed by a maintainer
- [x] Incorporate review suggestions
- [ ] Remember to edit the commit message and select the proper changelog category (feature/bugfix/other)

**You are not supposed to merge this request by yourself, the maintainers of fortan-support take care of this action!**

Approved-by: default avatarPradipta Samanta <samanta@dkrz.de>
Merged-by: default avatarYen-Chen Chen <yen-chen.chen@kit.edu>
Changelog: feature
parent 2f3337f0
No related branches found
No related tags found
1 merge request!69Apply naming convention for CMake options
Pipeline #61267 passed
......@@ -92,7 +92,7 @@ OpenACC:
- module load gcc/11.2.0-gcc-11.2.0 nvhpc/22.5-gcc-11.2.0
- mkdir nvhpc
- cd nvhpc
- /sw/spack-levante/cmake-3.23.1-q5kzz6/bin/cmake .. -DBUILD_OPENACC=ON -DCMAKE_C_COMPILER=nvc -DCMAKE_Fortran_COMPILER=nvfortran -DCMAKE_CXX_COMPILER=nvc++
- /sw/spack-levante/cmake-3.23.1-q5kzz6/bin/cmake .. -DFS_ENABLE_OPENACC=ON -DCMAKE_C_COMPILER=nvc -DCMAKE_Fortran_COMPILER=nvfortran -DCMAKE_CXX_COMPILER=nvc++
- make VERBOSE=1
tags:
- levante-fake, hpc, dkrz
......@@ -152,7 +152,7 @@ Code Coverage:
script:
- mkdir build
- cd build
- cmake .. -DBACKTRACE_TEST=OFF -DCMAKE_C_COMPILER=gcc -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_FLAGS="--coverage" -DCMAKE_Fortran_FLAGS="--coverage"
- cmake .. -DFS_ENABLE_BACKTRACE_TEST=OFF -DCMAKE_C_COMPILER=gcc -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_FLAGS="--coverage" -DCMAKE_Fortran_FLAGS="--coverage"
- make
- ctest --output-on-failure
- gcovr --xml-pretty --exclude-unreachable-branches --gcov-ignore-errors=no_working_dir_found --print-summary src -o coverage.xml --root ${CI_PROJECT_DIR}
......
......@@ -17,10 +17,11 @@ find_package(OpenACC QUIET)
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(BUILD_TESTING "Build tests" ON)
option(BACKTRACE_TEST "Test backtrace function" ON)
option(BUILD_OMP "Build with OpenMP support" OFF)
option(BUILD_OPENACC "Build with OpenACC support" OFF)
option(MIXED_PRECISION "Use mixed precision" OFF)
option(FS_ENABLE_BACKTRACE_TEST "Test backtrace function" ON)
option(FS_ENABLE_OMP "Build with OpenMP support" OFF)
option(FS_ENABLE_OPENACC "Build with OpenACC support" OFF)
option(FS_ENABLE_MIXED_PRECISION "Use mixed precision" OFF)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
......
......@@ -100,7 +100,7 @@ mkdir build
cd build
cmake ..
! Or the following for GPU support with OpenACC
cmake -DBUILD_OPENACC=ON ..
cmake -DFS_ENABLE_OPENACC=ON ..
make
```
4. Format the code by `make format`.
......
......@@ -19,7 +19,7 @@ configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
if (BUILD_OPENACC)
if (FS_ENABLE_OPENACC)
message(VERBOSE "Compiler id is ${CMAKE_Fortran_COMPILER_ID}")
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
set(OpenACC_FLAGS "-hacc")
......@@ -29,7 +29,7 @@ if (BUILD_OPENACC)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenACC_FLAGS}")
endif ()
if (BUILD_OMP)
if (FS_ENABLE_OMP)
find_package(OpenMP QUIET)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}")
endif ()
......@@ -85,7 +85,7 @@ set_target_properties(fortran-support
EXPORT_NAME ${PROJECT_NAME}::fortran-support
)
if (MIXED_PRECISION)
if (FS_ENABLE_MIXED_PRECISION)
target_compile_definitions(fortran-support PRIVATE __MIXED_PRECISION)
endif ()
......
......@@ -40,7 +40,7 @@ endif()
include("${PROJECT_SOURCE_DIR}/cmake/gtest_helper.cmake")
if (BACKTRACE_TEST)
if (FS_ENABLE_BACKTRACE_TEST)
add_icon_c_test(UtilBacktraceTest ctest_util_backtrace.cpp)
endif()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment