mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
14e600801e
This is an experimental feature intended at the moment for ESP-IDF developers only. If IDF_TOOLCHAIN=clang environment variable or CMake variable is set, use toolchain-clang-esp32xx.cmake instead of toolchain-esp32xx.cmake. These changes aren't sufficient to actually build any IDF project with clang; subsequent commits add a few workarounds required to do this. Toolchain files are added for esp32 and esp32s2, which are the targets supported in our llvm-project fork at the moment.
17 lines
773 B
CMake
17 lines
773 B
CMake
set(CMAKE_SYSTEM_NAME Generic)
|
|
|
|
set(CMAKE_C_COMPILER clang)
|
|
set(CMAKE_CXX_COMPILER clang++)
|
|
set(CMAKE_ASM_COMPILER clang)
|
|
|
|
set(CMAKE_AR xtensa-esp32-elf-ar)
|
|
set(CMAKE_RANLIB xtensa-esp32-elf-gcc-ranlib)
|
|
set(CMAKE_OBJDUMP xtensa-esp32-elf-objdump)
|
|
|
|
# -freestanding is a hack to force Clang to use its own stdatomic.h,
|
|
# without falling back to the (incompatible) GCC stdatomic.h
|
|
# https://github.com/espressif/llvm-project/blob/d9341b81/clang/lib/Headers/stdatomic.h#L13-L18
|
|
set(CMAKE_C_FLAGS "--target=xtensa -mcpu=esp32s2 -ffreestanding" CACHE STRING "C Compiler Base Flags")
|
|
set(CMAKE_CXX_FLAGS "--target=xtensa -mcpu=esp32s2 -ffreestanding" CACHE STRING "C++ Compiler Base Flags")
|
|
set(CMAKE_ASM_FLAGS "--target=xtensa -mcpu=esp32s2" CACHE STRING "Assembler Base Flags")
|