| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- # 1. Load all source files from lib/ and src/
- file(GLOB_RECURSE LIB_SRCS "lib/*.cpp" "lib/*.c")
- file(GLOB_RECURSE SRC_SRCS "src/*.cpp" "src/*.c")
- # 2. Search for headers from lib/, include/ and src/
- file(GLOB_RECURSE ALL_HEADERS
- "lib/*.h" "lib/*.hpp"
- "include/*.h" "include/*.hpp"
- "src/*.h" "src/*.hpp"
- )
- # 3. Add include directories
- set(ALL_INC_DIRS "")
- # Add root directories
- list(APPEND ALL_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include")
- list(APPEND ALL_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
- list(APPEND ALL_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/lib")
- foreach(header ${ALL_HEADERS})
- # Search all found headers and add their directories
- get_filename_component(header_dir ${header} DIRECTORY)
- list(APPEND ALL_INC_DIRS ${header_dir})
-
- # PlatformIO trick: add parent diewcoty for relations like "Folder/File.h"
- get_filename_component(parent_dir ${header_dir} DIRECTORY)
- list(APPEND ALL_INC_DIRS ${parent_dir})
- endforeach()
- list(REMOVE_DUPLICATES ALL_INC_DIRS)
- # 4. Register component for ESP-IDF
- idf_component_register(
- PRIV_REQUIRES
- spi_flash
- SRCS
- ${SRC_SRCS}
- ${LIB_SRCS}
- INCLUDE_DIRS
- ${ALL_INC_DIRS}
- REQUIRES
- arduino
- )
- add_compile_definitions(
- NBUS_NODE_TYPE_SLAVE
- ARDUINO_CORE_3X
- )
|