1# SPDX-License-Identifier: Apache-2.0
2
3if(DEFINED TOOLCHAIN_HOME)
4  set(find_program_clang_args PATHS ${TOOLCHAIN_HOME} ${ONEAPI_LLVM_BIN_PATH} NO_DEFAULT_PATH)
5  set(find_program_binutils_args PATHS ${TOOLCHAIN_HOME} )
6endif()
7
8find_package(oneApi 2023.0.0 REQUIRED)
9
10find_program(CMAKE_AR      llvm-ar      ${find_program_clang_args}   )
11if(ONEAPI_VERSION VERSION_LESS_EQUAL "2023.0.0")
12  find_program(CMAKE_NM      nm           ${find_program_binutils_args}   )
13else()
14  find_program(CMAKE_NM      llvm-nm      ${find_program_clang_args}   )
15endif()
16# In OneApi installation directory on Windows, there is no llvm-objdump
17# binary, so would better use objdump from system environment both
18# on Linux and Windows.
19find_program(CMAKE_OBJDUMP objdump      ${find_program_binutils_args})
20find_program(CMAKE_RANLIB  llvm-ranlib  ${find_program_clang_args}   )
21find_program(CMAKE_OBJCOPY llvm-objcopy ${find_program_binutils_args})
22find_program(CMAKE_READELF readelf      ${find_program_binutils_args})
23find_program(CMAKE_STRIP   llvm-strip   ${find_program_binutils_args})
24
25find_program(CMAKE_GDB     gdb-oneapi)
26
27# Use the gnu binutil abstraction
28include(${ZEPHYR_BASE}/cmake/bintools/llvm/target_bintools.cmake)
29
30