File: CMakeLists.txt

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 (30 lines) | stat: -rw-r--r-- 1,557 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
bindgen_add_library(bindgen_regression_array SOURCES implementation.cpp)

add_executable(bindgen_regression_array_driver_fortran driver.f90)
target_link_libraries(bindgen_regression_array_driver_fortran bindgen_regression_array_fortran)
if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
    set_target_properties(bindgen_regression_array_driver_fortran PROPERTIES LINKER_LANGUAGE Fortran)
endif()

add_test(NAME bindgen_regression_array_driver_fortran
    COMMAND $<TARGET_FILE:bindgen_regression_array_driver_fortran>)

if( CUDA_AVAILABLE
    AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" # -fopenacc will be passed to the c++ linker
    AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER_EQUAL "6"
    AND "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU"
    AND "${CMAKE_Fortran_COMPILER_VERSION}" VERSION_GREATER_EQUAL "6"
    )

    bindgen_add_library(bindgen_regression_array_cu SOURCES implementation.cu)
    bindgen_enable_fortran_openacc_on_target(bindgen_regression_array_cu_fortran)

    add_executable(bindgen_regression_array_driver_cu_fortran driver_cu.f90)
    target_link_libraries(bindgen_regression_array_driver_cu_fortran bindgen_regression_array_cu_fortran)
    bindgen_enable_fortran_openacc_on_target(bindgen_regression_array_driver_cu_fortran)

    # TODO
    # we don't add this test on purpose for now, because it is likely that this test does not work
    # out of the box. The Fortran code would need to be compiled separately with a different
    # compiler than the C++ code with a compiler that has proper OpenACC support.
endif()