forked from micro-ROS/micro_ros_espidf_component
-
Notifications
You must be signed in to change notification settings - Fork 0
/
esp32_toolchain.cmake.in
35 lines (26 loc) · 1.07 KB
/
esp32_toolchain.cmake.in
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
include(CMakeForceCompiler)
set(CMAKE_SYSTEM_NAME Generic)
set(idf_target "@IDF_TARGET@")
set(idf_path "@IDF_PATH@")
if("${idf_target}" STREQUAL "esp32c3")
set(CMAKE_SYSTEM_PROCESSOR riscv)
set(FLAGS "-ffunction-sections -fdata-sections" CACHE STRING "" FORCE)
else()
set(CMAKE_SYSTEM_PROCESSOR xtensa)
set(FLAGS "-mlongcalls -ffunction-sections -fdata-sections" CACHE STRING "" FORCE)
endif()
set(CMAKE_CROSSCOMPILING 1)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
set(PLATFORM_NAME "LwIP")
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_C_COMPILER @CMAKE_C_COMPILER@)
set(CMAKE_CXX_COMPILER @CMAKE_CXX_COMPILER@)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS} ${IDF_INCLUDES}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti ${FLAGS} ${IDF_INCLUDES}")
add_compile_definitions(ESP_PLATFORM LWIP_IPV4 LWIP_IPV6 PLATFORM_NAME_FREERTOS)
include_directories(
"@BUILD_CONFIG_DIR@"
${idf_path}/components/soc/${idf_target}/include
)