@@ -26,7 +26,6 @@ option(ENABLE_HIP "Enable HIP support" OFF)
26
26
if (ENABLE_HIP)
27
27
set (AMREXPR_USE_GPU 1)
28
28
set (AMREXPR_USE_HIP 1)
29
- find_package (hip REQUIRED)
30
29
enable_language (HIP)
31
30
endif ()
32
31
@@ -50,15 +49,18 @@ target_include_directories(amrexpr PUBLIC
50
49
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR} >
51
50
$<INSTALL_INTERFACE:include >)
52
51
52
+ get_target_property (amrexpr_sources amrexpr SOURCES )
53
+ list (FILTER amrexpr_sources INCLUDE REGEX "\\ .cpp$" )
54
+
53
55
if (ENABLE_CUDA)
54
- get_target_property (_sources amrexpr SOURCES )
55
- list (FILTER _sources INCLUDE REGEX "\\ .cpp$" )
56
- set_source_files_properties (${_sources} PROPERTIES LANGUAGE CUDA)
57
- if (NOT DEFINED CUDA_ARCHITECTURES)
56
+ set_source_files_properties (${amrexpr_sources} PROPERTIES LANGUAGE CUDA)
57
+ if (NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
58
58
message (STATUS "No CUDA architectures specified. Native will be used." )
59
- set_target_properties (amrexpr PROPERTIES CUDA_ARCHITECTURES native)
59
+ set (CMAKE_CUDA_ARCHITECTURES native)
60
60
endif ()
61
- set_target_properties (amrexpr PROPERTIES CUDA_SEPARABLE_COMPILATION ON )
61
+ set_target_properties (amrexpr PROPERTIES
62
+ CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES}
63
+ CUDA_SEPARABLE_COMPILATION ON )
62
64
target_compile_features (amrexpr PUBLIC cuda_std_17)
63
65
target_compile_options (amrexpr PUBLIC
64
66
$<$<COMPILE_LANGUAGE:CUDA>:-m64>
@@ -69,6 +71,12 @@ if (ENABLE_CUDA)
69
71
endif ()
70
72
71
73
if (ENABLE_HIP)
74
+ set_source_files_properties (${amrexpr_sources} PROPERTIES LANGUAGE HIP)
75
+ if (NOT DEFINED CMAKE_HIP_ARCHITECTURES)
76
+ message (STATUS "No HIP architectures specified. 'gfx90a' will be used." )
77
+ set (CMAKE_HIP_ARCHITECTURES gfx90a)
78
+ endif ()
79
+ set_target_properties (amrexpr PROPERTIES HIP_ARCHITECTURES ${CMAKE_HIP_ARCHITECTURES} )
72
80
target_compile_features (amrexpr PUBLIC hip_std_17)
73
81
endif ()
74
82
@@ -87,12 +95,6 @@ set(amrexpr_FIND_DEPENDENCIES "")
87
95
if (ENABLE_CUDA)
88
96
set (amrexpr_FIND_DEPENDENCIES "${amrexpr_FIND_DEPENDENCIES} \n find_dependency(CUDAToolkit REQUIRED)" )
89
97
endif ()
90
- if (ENABLE_HIP)
91
- set (amrexpr_FIND_DEPENDENCIES "${amrexpr_FIND_DEPENDENCIES} \n find_dependency(hip REQUIRED)" )
92
- endif ()
93
- if (ENABLE_SYCL)
94
- # Adjust SYCL dependency find commands if necessary
95
- endif ()
96
98
97
99
include (CMakePackageConfigHelpers)
98
100
0 commit comments