-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
73 lines (60 loc) · 3.7 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
cmake_minimum_required(VERSION 3.15)
project(JayD-Library)
set(PORT /dev/ttyUSB0)
set(DEVICE cm:esp32:jayd)
set(CMAKE_CXX_STANDARD 11)
if(WIN32 OR CYGWIN)
set(Arduino15 $ENV{APPDATA}/../Local/Arduino15)
set(ArduinoLibs $ENV{USERPROFILE}/Documents/Arduino/libraries)
string(REPLACE "\\" "/" Arduino15 ${Arduino15})
string(REPLACE "\\" "/" ArduinoLibs ${ArduinoLibs})
if(${CYGWIN})
string(REGEX REPLACE "^([A-Za-z]):" "/cygdrive/\\1" Arduino15 ${Arduino15})
string(REGEX REPLACE "^([A-Za-z]):" "/cygdrive/\\1" ArduinoLibs ${ArduinoLibs})
endif()
else()
set(Arduino15 ~/.arduino15)
set(ArduinoLibs ~/Arduino/libraries)
endif()
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/libraries/Wire/src)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/libraries/FS/src)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/libraries/SD/src)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/libraries/SPI/src)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/libraries/WiFi/src)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/libraries/SPIFFS/src)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/libraries/HTTPClient/src)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/libraries/WebServer/src)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/libraries/DNSServer/src)
include_directories(${ArduinoLibs}/CircuitOS/src)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/libraries/TFT_eSPI)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/libraries/TFT_eSPI/Extensions)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/libraries/U8g2_for_TFT_eSPI/src)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/libraries/FDK-AAC/src)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/cores/esp32)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/tools/sdk)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/tools/sdk/include)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/tools/sdk/include/esp32)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/tools/sdk/include/freertos)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/tools/sdk/include/driver)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/tools/sdk/include/driver/driver)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/tools/sdk/include/spi_flash)
include_directories(${Arduino15}/packages/cm/hardware/esp32/1.7.3/libraries/LovyanGFX/src)
file(GLOB_RECURSE SOURCES "src/**.cpp" "src/**.c" "src/**.hpp" "src/**.h")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build)
add_definitions(-DDEBUG)
add_definitions(-DESP32)
add_definitions(-DCIRCUITOS_FREERTOS)
add_definitions(-DCIRCUITOS_LOVYANGFX)
add_definitions(-DLOVYAN_MANUAL)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_PROJECT_NAME}.ino PROPERTIES LANGUAGE CXX)
add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_PROJECT_NAME}.ino.elf
COMMAND arduino-cli compile --fqbn ${DEVICE} --output-dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_PROJECT_NAME}.ino
DEPENDS ${CMAKE_PROJECT_NAME}.ino ${SOURCES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
add_custom_target(CMBuild
SOURCES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_PROJECT_NAME}.ino.elf)
add_custom_target(CMUpload ALL
COMMAND arduino-cli upload --fqbn ${DEVICE} -p ${PORT} --input-dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
DEPENDS CMBuild
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
add_executable(${CMAKE_PROJECT_NAME}.bin ${CMAKE_PROJECT_NAME}.ino ${SOURCES})