1# //===----------------------------------------------------------------------===//
2# //
3# // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4# // See https://llvm.org/LICENSE.txt for details.
5# // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6# //
7# //===----------------------------------------------------------------------===//
8
9set(LLVM_LINK_COMPONENTS Support)
10
11add_clang_tool(amdgpu-arch AMDGPUArch.cpp)
12
13# If we find the HSA runtime we link with it directly.
14find_package(hsa-runtime64 QUIET 1.2.0 HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm)
15if (${hsa-runtime64_FOUND})
16  set_target_properties(amdgpu-arch PROPERTIES INSTALL_RPATH_USE_LINK_PATH ON)
17  target_link_libraries(amdgpu-arch PRIVATE hsa-runtime64::hsa-runtime64)
18else()
19  target_compile_definitions(amdgpu-arch PRIVATE "DYNAMIC_HSA")
20endif()
21