diff --git a/arduino/CMakeLists.txt b/arduino/CMakeLists.txt index a2bb900..8d1dc7b 100644 --- a/arduino/CMakeLists.txt +++ b/arduino/CMakeLists.txt @@ -58,12 +58,9 @@ add_library(arduino STATIC ) target_include_directories(arduino PUBLIC - $ - $ - $ - $ - $ - $ + ${ARDUINO_ESP8266_DIR}/cores/esp8266 + ${ARDUINO_ESP8266_DIR}/tools/sdk/include + ${ARDUINO_ESP8266_DIR}/variants/generic ) install(DIRECTORY ${ARDUINO_ESP8266_DIR}/cores/esp8266/ @@ -93,5 +90,9 @@ target_compile_options(arduino PUBLIC -U__STRICT_ANSI__ ) +install(TARGETS arduino ARCHIVE DESTINATION lib) + install(DIRECTORY cmake/ DESTINATION cmake/Modules FILES_MATCHING PATTERN "Find*.cmake") install(DIRECTORY cmake/ DESTINATION cmake FILES_MATCHING PATTERN "toolchain.*.cmake") + +add_subdirectory(libraries) diff --git a/arduino/cmake/FindArduino.cmake b/arduino/cmake/FindArduino.cmake index 80a3c77..5a89dad 100644 --- a/arduino/cmake/FindArduino.cmake +++ b/arduino/cmake/FindArduino.cmake @@ -27,6 +27,12 @@ set(ARDUINO_INC_DIRS ${_IMPORT_PREFIX}/h ${_IMPORT_PREFIX}/h/variants/generic ${_IMPORT_PREFIX}/h/tools/sdk/include + ${_IMPORT_PREFIX}/h/libraries/SPI + ${_IMPORT_PREFIX}/h/libraries/Wire + ${_IMPORT_PREFIX}/h/tools/sdk/lwip/include + ${_IMPORT_PREFIX}/h/libraries/ESP8266WiFi + ${_IMPORT_PREFIX}/h/libraries/ESP8266WiFi/include + ${_IMPORT_PREFIX}/h/libraries/ESP8266Webserver ) set(ARDUINO_DEP_LIBS diff --git a/arduino/libraries/CMakeLists.txt b/arduino/libraries/CMakeLists.txt index 616be07..5c356ba 100644 --- a/arduino/libraries/CMakeLists.txt +++ b/arduino/libraries/CMakeLists.txt @@ -1,7 +1,7 @@ -add_subdirectory(ArduinoOTA) +#add_subdirectory(ArduinoOTA) add_subdirectory(ESP8266WiFi) add_subdirectory(ESP8266WebServer) -add_subdirectory(ESP8266mDNS) -add_subdirectory(GDBStub) +#add_subdirectory(ESP8266mDNS) +#add_subdirectory(GDBStub) add_subdirectory(SPI) add_subdirectory(Wire) diff --git a/arduino/libraries/ESP8266WebServer/CMakeLists.txt b/arduino/libraries/ESP8266WebServer/CMakeLists.txt index d8c1ebd..03cdbda 100644 --- a/arduino/libraries/ESP8266WebServer/CMakeLists.txt +++ b/arduino/libraries/ESP8266WebServer/CMakeLists.txt @@ -2,16 +2,16 @@ file(GLOB WEBSERVER_LIB_SRC ${ARDUINO_ESP8266_DIR}/libraries/ESP8266WebServer/src/*.cpp ) -add_library(esp8266webserver STATIC +target_sources(arduino PRIVATE ${WEBSERVER_LIB_SRC} ) -target_include_directories(esp8266webserver PUBLIC +target_include_directories(arduino PUBLIC ${ARDUINO_ESP8266_DIR}/libraries/ESP8266WebServer/src ) -target_link_libraries(esp8266webserver PUBLIC - arduino - esp8266wifi +install(DIRECTORY ${ARDUINO_ESP8266_DIR}/libraries/ESP8266WebServer/src/ + DESTINATION h/libraries/ESP8266Webserver + FILES_MATCHING PATTERN "*.h" ) diff --git a/arduino/libraries/ESP8266WiFi/CMakeLists.txt b/arduino/libraries/ESP8266WiFi/CMakeLists.txt index a420076..27335b1 100644 --- a/arduino/libraries/ESP8266WiFi/CMakeLists.txt +++ b/arduino/libraries/ESP8266WiFi/CMakeLists.txt @@ -2,18 +2,28 @@ file(GLOB WIFI_LIB_SRC ${ARDUINO_ESP8266_DIR}/libraries/ESP8266WiFi/src/*.cpp ) -add_library(esp8266wifi STATIC +target_sources(arduino PRIVATE ${WIFI_LIB_SRC} ) -target_include_directories(esp8266wifi PUBLIC +target_include_directories(arduino PUBLIC + ${ARDUINO_ESP8266_DIR}/tools/sdk/lwip/include ${ARDUINO_ESP8266_DIR}/libraries/ESP8266WiFi/src ${ARDUINO_ESP8266_DIR}/libraries/ESP8266WiFi/src/include ) -target_link_libraries(esp8266wifi PUBLIC - arduino +install(DIRECTORY ${ARDUINO_ESP8266_DIR}/tools/sdk/lwip/include/ + DESTINATION h/tools/sdk/lwip/include + FILES_MATCHING PATTERN "*.h" ) +install(DIRECTORY ${ARDUINO_ESP8266_DIR}/libraries/ESP8266WiFi/src/ + DESTINATION h/libraries/ESP8266WiFi + FILES_MATCHING PATTERN "*.h" +) +install(DIRECTORY ${ARDUINO_ESP8266_DIR}/libraries/ESP8266WiFi/src/include/ + DESTINATION h/libraries/ESP8266WiFi/include + FILES_MATCHING PATTERN "*.h" +) diff --git a/arduino/libraries/SPI/CMakeLists.txt b/arduino/libraries/SPI/CMakeLists.txt index eec86a5..4479ce4 100644 --- a/arduino/libraries/SPI/CMakeLists.txt +++ b/arduino/libraries/SPI/CMakeLists.txt @@ -2,17 +2,16 @@ file(GLOB SPI_LIB_SRC ${ARDUINO_ESP8266_DIR}/libraries/SPI/*.cpp ) -add_library(esp8266spi STATIC +target_sources(arduino PRIVATE ${SPI_LIB_SRC} ) -target_include_directories(esp8266spi PUBLIC +target_include_directories(arduino PRIVATE ${ARDUINO_ESP8266_DIR}/libraries/SPI ) -target_link_libraries(esp8266spi PUBLIC - arduino +install(DIRECTORY ${ARDUINO_ESP8266_DIR}/libraries/SPI/ + DESTINATION h/libraries/SPI + FILES_MATCHING PATTERN "*.h" ) - - diff --git a/arduino/libraries/Wire/CMakeLists.txt b/arduino/libraries/Wire/CMakeLists.txt index bfe3697..84e08af 100644 --- a/arduino/libraries/Wire/CMakeLists.txt +++ b/arduino/libraries/Wire/CMakeLists.txt @@ -2,18 +2,16 @@ file(GLOB WIRE_LIB_SRC ${ARDUINO_ESP8266_DIR}/libraries/Wire/*.cpp ) -add_library(esp8266wire STATIC +target_sources(arduino PRIVATE ${WIRE_LIB_SRC} ) -target_include_directories(esp8266wire PUBLIC +target_include_directories(arduino PRIVATE ${ARDUINO_ESP8266_DIR}/libraries/Wire ) -target_link_libraries(esp8266wire PUBLIC - arduino +install(DIRECTORY ${ARDUINO_ESP8266_DIR}/libraries/Wire/ + DESTINATION h/libraries/Wire + FILES_MATCHING PATTERN "*.h" ) - - -