forked from espressif/esp-serial-flasher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
46 lines (37 loc) · 1.28 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
cmake_minimum_required(VERSION 3.5)
if (DEFINED ESP_PLATFORM)
# Register component to esp-idf build system
set(COMPONENT_SRCS
src/esp_loader.c
src/esp_targets.c
src/serial_comm.c
src/md5_hash.c
port/esp32_port.c)
set(COMPONENT_ADD_INCLUDEDIRS "include port")
set(COMPONENT_PRIV_INCLUDEDIRS "private_include" )
register_component()
component_compile_options(-Wstrict-prototypes)
set(target ${COMPONENT_LIB})
else()
# Create traditional CMake target
add_library(flasher
src/esp_loader.c
src/esp_targets.c
src/serial_comm.c
src/md5_hash.c)
target_include_directories(flasher PUBLIC include port PRIVATE private_include)
if(PORT STREQUAL "STM32")
target_link_libraries(flasher PUBLIC stm_cube)
target_sources(flasher PRIVATE port/stm32_port.c)
elseif(PORT STREQUAL "RASPBERRY_PI")
find_library(pigpio_LIB pigpio)
target_link_libraries(flasher PUBLIC ${pigpio_LIB})
target_sources(flasher PRIVATE port/raspberry_port.c)
else()
message(FATAL_ERROR "Selected port is not supported")
endif()
set(target flasher)
endif()
if(DEFINED MD5_ENABLED)
target_compile_definitions(${target} PRIVATE -DMD5_ENABLED=${MD5_ENABLED})
endif()