File: cpp_bindgen_fortran_helpers.cmake

package info (click to toggle)
gridtools 2.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 21,728 kB
  • sloc: cpp: 45,263; python: 9,383; javascript: 8,445; ansic: 2,564; sh: 509; f90: 370; makefile: 216
file content (19 lines) | stat: -rw-r--r-- 935 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function(bindgen_enable_fortran_openacc_on_target target)
    # TODO check if find_package(OpenACC) solves this problem
    if(CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
        target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:-h acc>)
    elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
        target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:-fopenacc>)
        set_target_properties(${target} PROPERTIES APPEND_STRING PROPERTY LINK_FLAGS -fopenacc)
    else()
        message(FATAL_ERROR "OpenACC is not configured for this compiler.")
    endif()
endfunction()

function(bindgen_enable_fortran_preprocessing_on_target target)
    if (CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
        target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:-eF>)
    else()
        target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:-cpp>)
    endif()
endfunction()