-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
70 lines (64 loc) · 2.11 KB
/
CMakeLists.txt
File metadata and controls
70 lines (64 loc) · 2.11 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
cmake_minimum_required(VERSION 3.16)
project(umesh C)
set(CMAKE_C_STANDARD 99)
option(UMESH_ENABLE_POWER_MANAGEMENT "Enable power management" ON)
option(UMESH_LOW_MEMORY "Enable reduced-memory profile" OFF)
if(UMESH_ENABLE_POWER_MANAGEMENT)
set(UMESH_PM_FLAG 1)
else()
set(UMESH_PM_FLAG 0)
endif()
add_compile_definitions(UMESH_ENABLE_POWER_MANAGEMENT=${UMESH_PM_FLAG})
if(UMESH_LOW_MEMORY)
add_compile_definitions(UMESH_RAM_KB=256)
endif()
# microcrypt — optional crypto library
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microcrypt/src/mcrypt.c")
set(UMESH_USE_MICROCRYPT ON)
add_library(microcrypt STATIC
third_party/microcrypt/src/mcrypt.c)
target_include_directories(microcrypt PUBLIC
third_party/microcrypt/include)
message(STATUS "uMesh: microcrypt found and enabled")
else()
set(UMESH_USE_MICROCRYPT OFF)
message(STATUS "uMesh: microcrypt not found, using built-in AES")
endif()
set(UMESH_SOURCES
src/umesh.c
src/phy/phy.c
src/mac/mac.c
src/mac/cca.c
src/mac/frame.c
src/net/net.c
src/net/routing.c
src/net/discovery.c
src/power/power.c
src/sec/sec.c
src/sec/keys.c
src/common/crc.c
src/common/ring.c
)
add_library(umesh STATIC ${UMESH_SOURCES})
target_include_directories(umesh PUBLIC include)
target_include_directories(umesh PRIVATE src)
if(UMESH_USE_MICROCRYPT)
target_compile_definitions(umesh PRIVATE UMESH_USE_MICROCRYPT=1)
target_link_libraries(umesh PRIVATE microcrypt)
endif()
if(UMESH_PORT STREQUAL "esp32")
target_sources(umesh PRIVATE port/esp32/phy_esp32.c)
target_sources(umesh PRIVATE port/esp32/power_esp32.c)
if(DEFINED CONFIG_IDF_TARGET_ESP32C6 AND CONFIG_IDF_TARGET_ESP32C6)
target_sources(umesh PRIVATE port/esp32/twt_esp32c6.c)
endif()
else()
target_sources(umesh PRIVATE port/posix/phy_posix.c)
target_sources(umesh PRIVATE port/posix/power_posix.c)
message(STATUS "uMesh: POSIX port (testing)")
endif()
option(UMESH_BUILD_TESTS "Build tests" ON)
if(UMESH_BUILD_TESTS AND NOT UMESH_PORT STREQUAL "esp32")
enable_testing()
add_subdirectory(tests)
endif()