Conan example

oedzee
Posts: 8
Joined: Mon Oct 30, 2023 10:19 am

Conan example

Postby oedzee » Wed Mar 18, 2026 4:06 pm

Are there conan examples on how to use the conan package manager with esp-idf?

or can someone point me in the right direction to achieve this.

Our goal is to use:
  • Conan 2
  • ESP-IDF 6
I've setup a profile for the esp32 with the right compilers. which are used, but i can't get the cxx/cflags to be imported correctly.

Code: Select all

[settings]
os=baremetal
arch=xtensalx7
build_type=Debug

compiler=gcc
compiler.version=15
compiler.cppstd=gnu17
compiler.libcxx=libstdc++

[conf]
tools.build:cflags=["-mlongcalls", "-fno-exceptions","-fno-rtti"]
tools.build:cxxflags=["-mlongcalls", "-fno-exceptions", "-fno-rtti"]
tools.cmake.cmaketoolchain:generator=Ninja
tools.cmake.cmaketoolchain:system_name=Generic
tools.cmake.cmaketoolchain:user_toolchain+=<esp-idf folder>\v6.0-beta2\esp-idf\tools\cmakev2\idf.cmake

[buildenv]
IDF_TARGET=esp32s3
This is my CMakeLists.txt in esp-idf project

Code: Select all

cmake_minimum_required(VERSION 4.0.3)

include(${CMAKE_BINARY_DIR}/conan_toolchain.cmake OPTIONAL)

include($ENV{IDF_PATH}/tools/cmakev2/idf.cmake)

project(espproject C CXX ASM)

list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/build/Debug/generators")

idf_project_default()



i then do:

Code: Select all

conan install . --output-folder build --build=missing -s build_type=Debug -pr:h esp32s3
idf.py -B build -DCMAKE_BUILD_TYPE=Debug build
i eventually get errors that can be traced back to not having the cxxflags applied.

the compile command for fmt (a package that i am using to test this) is as follows:

Code: Select all

C:\\Espressif\\tools\\xtensa-esp-elf\\esp-15.2.0_20251204\\xtensa-esp-elf\\bin\\xtensa-esp32s3-elf-g++.exe -D_GLIBCXX_USE_CXX11_ABI=0 -IC:/Users/<myusername>/.conan2/p/b/fmt08ae9cd353574/b/src/include @\"C:/Users/<myusername>/.conan2/p/b/fmt08ae9cd353574/b/build/Debug/toolchain/cxxflags\" -g -std=gnu++17 -fvisibility=hidden -fvisibility-inlines-hidden -o CMakeFiles\\fmt.dir\\src\\format.cc.obj -c C:\\Users\\<myusername>\\.conan2\\p\\b\\fmt08ae9cd353574\\b\\src\\src\\format.cc",
Is my approach correct? am i missing something?

Who is online

Users browsing this forum: Baidu [Spider], GPTBot, PerplexityBot, PetalBot and 3 guests