# !!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE
# https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
#
# If you need to override existing CMake configuration or add extra,
# please create `CMakeListsUser.txt` in the root of project.
# The `CMakeListsUser.txt` will not be overwritten by PlatformIO.



set(CMAKE_CONFIGURATION_TYPES "esp_wroom_02" CACHE STRING "Build Types reflect PlatformIO Environments" FORCE)

# Convert "Home Directory" that may contain unescaped backslashes on Windows
file(TO_CMAKE_PATH $ENV{HOMEDRIVE}$ENV{HOMEPATH} ENV_HOME_PATH)


SET(CMAKE_C_COMPILER "${ENV_HOME_PATH}/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-gcc.exe")
SET(CMAKE_CXX_COMPILER "${ENV_HOME_PATH}/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-g++.exe")
SET(CMAKE_CXX_FLAGS "-fno-rtti -std=gnu++17 -fno-exceptions -Os -mlongcalls -mtext-section-literals -falign-functions=4 -U__STRICT_ANSI__ -D_GNU_SOURCE -ffunction-sections -fdata-sections -Wall -Werror=return-type -free -fipa-pta")
SET(CMAKE_C_FLAGS "-std=gnu17 -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -Os -mlongcalls -mtext-section-literals -falign-functions=4 -U__STRICT_ANSI__ -D_GNU_SOURCE -ffunction-sections -fdata-sections -Wall -Werror=return-type -free -fipa-pta")

SET(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD 17)

if (CMAKE_BUILD_TYPE MATCHES "esp_wroom_02")
    add_definitions(-DPLATFORMIO=50205)
    add_definitions(-DESP8266)
    add_definitions(-DARDUINO_ARCH_ESP8266)
    add_definitions(-DARDUINO_ESP8266_ESP_WROOM_02)
    add_definitions(-DF_CPU=80000000L)
    add_definitions(-D__ets__)
    add_definitions(-DICACHE_FLASH)
    add_definitions(-DARDUINO=10805)
    add_definitions(-DARDUINO_BOARD=\"PLATFORMIO_ESP_WROOM_02\")
    add_definitions(-DFLASHMODE_QIO)
    add_definitions(-DLWIP_OPEN_SRC)
    add_definitions(-DNONOSDK22x_190703=1)
    add_definitions(-DTCP_MSS=536)
    add_definitions(-DLWIP_FEATURES=1)
    add_definitions(-DLWIP_IPV6=0)
    add_definitions(-DVTABLES_IN_FLASH)
    add_definitions(-DMMU_IRAM_SIZE=0x8000)
    add_definitions(-DMMU_ICACHE_SIZE=0x8000)

    include_directories("${CMAKE_CURRENT_LIST_DIR}/include")
    include_directories("${CMAKE_CURRENT_LIST_DIR}/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/SoftwareSerial/src")
    include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/esp_wroom_02/Adafruit MLX90614 Library")
    include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/esp_wroom_02/Adafruit BusIO")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/SPI")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/Wire")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/cores/esp8266")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/toolchain-xtensa/include")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip2/include")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/ArduinoOTA")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/DNSServer/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/EEPROM")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266AVRISP/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPClient/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPUpdateServer/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266LLMNR")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266NetBIOS")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266SSDP")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266SdFat/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WebServer/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFiMesh/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266httpUpdate/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266mDNS/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/Ethernet/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/GDBStub/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/Hash/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/I2S/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/LittleFS/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/Netdump/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/SD/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/SDFS/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/SPISlave/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/Servo/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/TFT_Touch_Shield_V2")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/Ticker/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/esp8266/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/lwIP_PPP/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/lwIP_enc28j60/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/lwIP_w5100/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/framework-arduinoespressif8266/libraries/lwIP_w5500/src")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/10.3.0/xtensa-lx106-elf")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/toolchain-xtensa/lib/gcc/xtensa-lx106-elf/10.3.0/include")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/toolchain-xtensa/lib/gcc/xtensa-lx106-elf/10.3.0/include-fixed")
    include_directories("${ENV_HOME_PATH}/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include")

    FILE(GLOB_RECURSE EXTRA_LIB_SOURCES
        ${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/esp_wroom_02/*.*
    )
endif()


FILE(GLOB_RECURSE SRC_LIST
    ${CMAKE_CURRENT_LIST_DIR}/src/*.*
    ${CMAKE_CURRENT_LIST_DIR}/lib/*.*
    ${CMAKE_CURRENT_LIST_DIR}/test/*.*
)

list(APPEND SRC_LIST ${EXTRA_LIB_SOURCES})
