-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
46 lines (39 loc) · 1.27 KB
/
CMakeLists.txt
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
37
38
39
40
41
42
43
44
45
46
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20.0)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif()
if (DEFINED ESP_PLATFORM)
if (DEFINED IDF_TARGET)
set(BOARD ${IDF_TARGET})
else()
set(BOARD esp32s3)
endif()
set(CMAKE_TOOLCHAIN_FILE $ENV{IDF_PATH}/tools/cmake/toolchain-${BOARD}.cmake)
elseif (DEFINED WEST_PYTHON)
set(OVERLAY_CONFIG ports/zephyr/fpl.conf)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
endif()
project(${BOARD})
include(${CMAKE_SOURCE_DIR}/projects/version.cmake)
include(${CMAKE_SOURCE_DIR}/projects/sources.cmake)
if (DEFINED ESP_PLATFORM)
set(TARGET_PLATFORM esp32)
set(PLATFORM_SPECIFIC_CMAKE ports/esp-idf/esp32.cmake)
elseif (DEFINED ZEPHYR_BASE)
set(TARGET_PLATFORM zephyr)
set(PLATFORM_SPECIFIC_CMAKE ports/zephyr/zephyr.cmake)
elseif (DEFINED BOARD)
enable_language(C CXX ASM)
include(projects/boards/${BOARD}.cmake)
include(${CMAKE_SOURCE_DIR}/projects/app.cmake)
else()
message(FATAL_ERROR "Either of unknown platform or undefined board")
endif()
include(${CMAKE_SOURCE_DIR}/projects/external.cmake)
if (DEFINED PLATFORM_SPECIFIC_CMAKE)
include(${PLATFORM_SPECIFIC_CMAKE})
endif()
if (DEFINED PLATFORM_SPECIFIC_DIR)
add_subdirectory(${PLATFORM_SPECIFIC_DIR})
endif()