-
Notifications
You must be signed in to change notification settings - Fork 9
/
riscv-llvm.cmake
37 lines (29 loc) · 1.35 KB
/
riscv-llvm.cmake
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
31
32
33
34
35
36
#################################
# RISCV Toolchain
#################################
option(RISCV "Build for RISC-V" ON)
option(USE_LLVM "Use LLVM toolchain" ON)
set(CMAKE_SYSTEM_NAME "Generic" CACHE STRING "")
set(CMAKE_SYSTEM_PROCESSOR "riscv" CACHE STRING "")
set(TOOLCHAIN_PREFIX "riscv64-unknown-elf-")
set(MYRISCV "/scratch/iansseijelly/riscv-toolchain-build")
set(CMAKE_AR "llvm-ar")
set(CMAKE_ASM_COMPILER "${MYRISCV}/bin/clang")
set(CMAKE_C_COMPILER "${MYRISCV}/bin/clang")
set(CMAKE_CXX_COMPILER "${MYRISCV}/bin/clang++")
set(CMAKE_LINKER "lld")
set(CMAKE_OBJCOPY "llvm-objcopy")
set(CMAKE_OBJDUMP "llvm-objdump")
set(CMAKE_SIZE "llvm-size")
set(CMAKE_FIND_ROOT_PATH "${MYRISCV}/")
set(CMAKE_INCLUDE_PATH "${MYRISCV}/include/")
set(CMAKE_LIBRARY_PATH "${MYRISCV}/lib/")
set(CMAKE_PROGRAM_PATH "${MYRISCV}/bin/")
# tell me the cc compiler cmake found
message(STATUS "CC: ${CMAKE_C_COMPILER}")
set(CMAKE_CROSSCOMPILING TRUE)
# prevent the toolchain from searching for programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)