riscv64-gcc.toolchain.cmake 852 B

1234567891011121314151617181920
  1. set(CMAKE_SYSTEM_NAME Linux)
  2. set(CMAKE_SYSTEM_PROCESSOR riscv64)
  3. set(RISCV_GCC_INSTALL_ROOT /opt/RISCV CACHE PATH "Path to GCC for RISC-V cross compiler installation directory")
  4. set(CMAKE_SYSROOT ${RISCV_GCC_INSTALL_ROOT}/sysroot CACHE PATH "RISC-V sysroot")
  5. set(CMAKE_C_COMPILER ${RISCV_GCC_INSTALL_ROOT}/bin/riscv64-unknown-linux-gnu-gcc)
  6. set(CMAKE_CXX_COMPILER ${RISCV_GCC_INSTALL_ROOT}/bin/riscv64-unknown-linux-gnu-g++)
  7. # Don't run the linker on compiler check
  8. set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
  9. set(CMAKE_C_FLAGS "-march=rv64gcv_zfh ${CMAKE_C_FLAGS}")
  10. set(CMAKE_CXX_FLAGS "-march=rv64gcv_zfh ${CXX_FLAGS}")
  11. set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
  12. set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  13. set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  14. set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  15. set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)