generic.cmake 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. # SPDX-License-Identifier: Apache-2.0
  2. set(TOOLCHAIN_HOME ${ZEPHYR_SDK_INSTALL_DIR})
  3. set(COMPILER gcc)
  4. set(LINKER ld)
  5. set(BINTOOLS gnu)
  6. # Find some toolchain that is distributed with this particular SDK
  7. file(GLOB toolchain_paths
  8. LIST_DIRECTORIES true
  9. ${TOOLCHAIN_HOME}/xtensa/*/*-zephyr-elf
  10. ${TOOLCHAIN_HOME}/*-zephyr-elf
  11. ${TOOLCHAIN_HOME}/*-zephyr-eabi
  12. )
  13. if(toolchain_paths)
  14. list(GET toolchain_paths 0 some_toolchain_path)
  15. get_filename_component(one_toolchain_root "${some_toolchain_path}" DIRECTORY)
  16. get_filename_component(one_toolchain "${some_toolchain_path}" NAME)
  17. set(CROSS_COMPILE_TARGET ${one_toolchain})
  18. set(SYSROOT_TARGET ${one_toolchain})
  19. endif()
  20. if(NOT CROSS_COMPILE_TARGET)
  21. message(FATAL_ERROR "Unable to find 'x86_64-zephyr-elf' or any other architecture in ${TOOLCHAIN_HOME}")
  22. endif()
  23. set(CROSS_COMPILE ${one_toolchain_root}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-)
  24. set(SYSROOT_DIR ${one_toolchain_root}/${SYSROOT_TARGET}/${SYSROOT_TARGET})
  25. set(TOOLCHAIN_HAS_NEWLIB ON CACHE BOOL "True if toolchain supports newlib")