Force platformIO to use cmake to build in espidf framework

Hi everyone, currently I’m trying to build this library: ChargeLab/OpenOCPP: Multi-platform OCPP 1.6/2.0.1 embedded software for charging stations in platformio with espidf framework. It has this part in cmake file in the main folder:


list(APPEND SOURCES "main.cpp")
list(APPEND SOURCES "../include/openocpp/implementation/logging_esp.cc")

idf_component_register(
        SRCS ${SOURCES}
        INCLUDE_DIRS "."
        REQUIRES app_update esp_websocket_client esp_wifi nvs_flash spiffs driver esp_eth esp_https_server esp_http_client
        EMBED_TXTFILES "certs/servercert.pem" "certs/prvtkey.pem" "certs/manufacturer.pem"
        EMBED_FILES
            "web/web_favicon.ico.gz"
            "web/web_index.html.gz"
            "web/web_setup.html.gz"
            "web/web_config.html.gz"
            "web/web_control.html.gz"
)

I copy it into the cmake file under the src folder in platformio. I also copy the whole web and cert folder and put it under src folder. When I click run in platformio, it doesn’t run the cmake file to convert cert and gzipped html file into the assembly file under the build folder. How can I fix this?

See documentation

and existing examples

Hi @maxgerhardt. Thank you for your solution. Btw, I wonder that whether platformIo using the cmake file to build in the espidf environment? Because I also add some messages line in the cmake file but I don’t see those messages during my build process?

Platformio does not use cmake for the build process. It uses cmake ninja for generating the needed “things” in precompile step and “feed” this to SCons. SCons does the heavy lifting.