| 1 |
# (C) Copyright 2024- ECMWF. |
| 2 |
# |
| 3 |
# This software is licensed under the terms of the Apache Licence Version 2.0 |
| 4 |
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
| 5 |
# In applying this licence, ECMWF does not waive the privileges and immunities |
| 6 |
# granted to it by virtue of its status as an intergovernmental organisation nor |
| 7 |
# does it submit to any jurisdiction. |
| 8 |
|
| 9 |
set(HIC_BACKEND_CUDA 0) |
| 10 |
set(HIC_BACKEND_HIP 0) |
| 11 |
set(HIC_BACKEND_DUMMY 0) |
| 12 |
if( HAVE_CUDA ) |
| 13 |
set(HIC_BACKEND_CUDA 1) |
| 14 |
elseif( HAVE_HIP ) |
| 15 |
set(HIC_BACKEND_HIP 1) |
| 16 |
else() |
| 17 |
set(HIC_BACKEND_DUMMY 1) |
| 18 |
endif() |
| 19 |
|
| 20 |
configure_file(${PROJECT_SOURCE_DIR}/src/hic/hic_config.h.in ${PROJECT_BINARY_DIR}/src/hic/hic_config.h @ONLY ) |
| 21 |
|
| 22 |
ecbuild_add_library( TARGET hic |
| 23 |
TYPE INTERFACE |
| 24 |
PUBLIC_INCLUDES |
| 25 |
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src> |
| 26 |
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/src> |
| 27 |
$<INSTALL_INTERFACE:include> |
| 28 |
) |
| 29 |
|
| 30 |
ecbuild_add_library( TARGET hicsparse |
| 31 |
TYPE INTERFACE |
| 32 |
PUBLIC_INCLUDES |
| 33 |
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src> |
| 34 |
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/src> |
| 35 |
$<INSTALL_INTERFACE:include> |
| 36 |
) |
| 37 |
|
| 38 |
install( FILES ${PROJECT_BINARY_DIR}/src/hic/hic_config.h DESTINATION include/hic ) |
| 39 |
install( FILES hic/hic.h DESTINATION include/hic ) |
| 40 |
install( FILES hic/hic_runtime.h DESTINATION include/hic ) |
| 41 |
install( FILES hic/hic_namespace_macro.h DESTINATION include/hic ) |
| 42 |
install( FILES hic/hic_library_types.h DESTINATION include/hic ) |
| 43 |
install( FILES hic/hicsparse.h DESTINATION include/hic ) |
| 44 |
install( FILES hic/hic_dummy/dummyShouldNotBeCalled.h DESTINATION include/hic/hic_dummy ) |
| 45 |
install( FILES hic/hic_dummy/hic_dummy_runtime.h DESTINATION include/hic/hic_dummy ) |
| 46 |
install( FILES hic/hic_dummy/hicsparse_dummy.h DESTINATION include/hic/hic_dummy ) |
| 47 |
|
| 48 |
if( HAVE_CUDA ) |
| 49 |
target_link_libraries( hic INTERFACE CUDA::cudart ) |
| 50 |
target_link_libraries( hicsparse INTERFACE hic CUDA::cusparse ) |
| 51 |
elseif( HAVE_HIP ) |
| 52 |
target_link_libraries( hic INTERFACE hip::host ) |
| 53 |
target_link_libraries( hicsparse INTERFACE hic roc::hipsparse ) |
| 54 |
endif() |