idf_component_register(SRCS  "main.cpp"
                            # Needed as we use minimal build
                            PRIV_REQUIRES esp_http_server esp_eth
                             esp_wifi nvs_flash esp_netif vfs
                             json app_update esp_timer esp_psram mdns driver
        INCLUDE_DIRS ".")

if(CONFIG_CALENDINK_DEPLOY_WEB_PAGES)
    set(WEB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../frontend")
    if(EXISTS ${WEB_SRC_DIR}/dist)
        littlefs_create_partition_image(www_0 ${WEB_SRC_DIR}/dist FLASH_IN_PROJECT)
    else()
        message(FATAL_ERROR "'${WEB_SRC_DIR}/dist' doesn't exist. Run 'npm run build' in frontend/ first.")
    endif()
endif()
