I've spent a week trying to get a simple project that works with all the code in one level (all with the main.c) but as soon as I take the display portion (u8g2) out as a component it fails to find the u8g2 library I've cloned into esp-idf/components. Its giving me :
Code: Select all
../components/display/include/u8g2_esp32_hal.h:10:10: fatal error: u8g2.h: No such file or directory
#include "u8g2.h"
Structure:
main>
-----main.c
-----CMakeLists.txt
components>
----display>
-------test_SSD1306.c //contains reference to <u8g2.h>
-------u8g2_esp32_hal.c
-------CMakeLists.txt
-------include>
----------test_SSD1306.h
----------u8g2_esp32_hal.h //contains reference to #include "u8g2.h"
Cmakelists.txt for the Project
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)
# Add RainMaker components and other common application components
#set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/esp-rainmaker/components $ENV{IDF_PATH}/esp-rainmaker/rainmaker_examples/common ${CMAKE_CURRENT_LIST_DIR}/../esp-rainmaker/components ${CMAKE_CURRENT_LIST_DIR}/../esp-rainmaker/examples/common)
set(PROJECT_VER "2.1")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(switch)
Code: Select all
idf_component_register(SRCS "main.c"
INCLUDE_DIRS ".")
Code: Select all
idf_component_register(SRCS "display.c" "test_SSD1306.c" "u8g2_esp32_hal.c"
INCLUDE_DIRS "include")
Code: Select all
{
"configurations": [
{
"name": "ESP-IDF",
"compilerPath": "${default}",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": [
"${config:idf.espIdfPath}/components/**",
"${config:idf.espIdfPathWin}/components/**",
"${workspaceFolder}/**"
],
"browse": {
"path": [
"${config:idf.espIdfPath}/components",
"${config:idf.espIdfPathWin}/components",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": false
}
}
],
"version": 4
}
As I said, the complier finds u8g2 when everything is in the same 'main' folder but falls over when its in a component. What the flip and I missing? Please, anyone. Thank you