Cmake with esp-mdf components

jesrix
Posts: 2
Joined: Tue Apr 02, 2019 6:09 am

Cmake with esp-mdf components

Postby jesrix » Tue Apr 02, 2019 6:12 am

Hi there,

I work at a project where we have been using the Cmake and idf.py to for building with esp-idf, now we would like to use the esp-mdf. Is this possible with CMake, I can't find any documentation on the website.

Thanks,

jesrix
Posts: 2
Joined: Tue Apr 02, 2019 6:09 am

Re: Cmake with esp-mdf components

Postby jesrix » Tue Apr 02, 2019 7:38 am

I might add that I tried to make CmakeLists.txt files in all the MDF components manually.

.../esp-mdf/components/mcommon/CMakeLists.txt example:

Code: Select all

set(COMPONENT_ADD_INCLUDEDIRS include)

set(COMPONENT_SRCS ./mdf_event_loop.c ./mdf_err_to_name.c ./mdf_info_store.c ./mdf_mem.c)

register_component()
And in the CMakeLists.txt in the project root

Code: Select all

# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

set(MDF_VER command bash -c "cd $ENV{MDF_PATH} && git describe --always --tags --dirty")
#CPPFLAGS := -D MDF_VER=\"$(MDF_VER)\"

set(EXTRA_COMPONENT_DIRS $ENV{MDF_PATH}/components $ENV{MDF_PATH}/components/third_party)
#set(EXTRA_COMPONENT_DIRS ${EXTRA_COMPONENT_DIRS} )
message(STATUS "EXTRA_COMPONENT_DIRS: ${EXTRA_COMPONENT_DIRS}")

set(CMAKE_SYSROOT $ENV{IDF_PATH}/../xtensa-esp32-elf/xtensa-esp32-elf)

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

include_directories(
    $ENV{IDF_PATH}/../xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0
    $ENV{IDF_PATH}/../xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf
    $ENV{IDF_PATH}/../xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/backward
    $ENV{IDF_PATH}/../xtensa-esp32-elf/lib/gcc/xtensa-esp32-elf/5.2.0/include
    $ENV{IDF_PATH}/../xtensa-esp32-elf/lib/gcc/xtensa-esp32-elf/5.2.0/include-fixed
    $ENV{IDF_PATH}/../xtensa-esp32-elf/xtensa-esp32-elf/include
    )

project(cpp-mesh)
idf.py build fails with:
/home/jri/work/doms-wireless/projects/cpp-mesh/components/cpp-classes/Mesh.cpp:10:19: fatal error: mwifi.h: No such file or directory

ESP_@In逍遥子
Posts: 132
Joined: Thu Nov 15, 2018 2:06 am

Re: Cmake with esp-mdf components

Postby ESP_@In逍遥子 » Tue Apr 02, 2019 8:14 am

esp-mdf will support CMake as soon as possible.

If you hava some problem about CMake,you can find solution in Build System

I think you can refer to Preset Component Variables to set COMPONENT_REQUIRES variables.

Who is online

Users browsing this forum: No registered users and 30 guests