Components outside a project

User avatar
PaulVdBergh
Posts: 58
Joined: Fri Feb 23, 2018 4:45 pm
Location: Brasschaat, Belgium

Components outside a project

Postby PaulVdBergh » Wed Feb 13, 2019 7:36 pm

Hi All,

I'm working on a project involving different ESP32 and Linux applications. I'm using Eclipse under Debian9 in a VirtualBox running under Win10 and use the latest ESP-IDF version and toolchain.

In the Linux project I can import the common files with a link:
paulvdbergh@debian9:~/IoTT-workspace/RPi_IoTT$ file common
common: symbolic link to ../Common_IoTT/src/
paulvdbergh@debian9:~/IoTT-workspace/RPi_IoTT$
This gives the Linux application access to all the header and source files in the Common_IoTT/src directory. This works fine.
Now I need to write an ESP32-IDF application using the same sourcefiles in the Common_IoTT/src directory.
I created a /Common_IoTT/include/Common.h file with this content:

Code: Select all

/*
 * Common.h
 *
 *  Created on: Feb 13, 2019
 *      Author: paulvdbergh
 */

#ifndef MAIN_COMMOM_H_
#define MAIN_COMMON_H_

#include "../src/Accessory.h"
#include "../src/AccessoryDecoder.h"
#include "../src/DCCPriority.h"
#include "../src/Decoder.h"
#include "../src/Decoders.h"
#include "../src/LocDecoder.h"
#include "../src/MQTTConfig.h"
#include "../src/MQTTMsgHandler.h"
#include "../src/MQTTMsgQueueItem.h"
#include "../src/MQTTPublisher.h"
#include "../src/MQTTSubscription.h"
#include "../src/SystemState.h"

#endif //	MAIN_COMMON_H_
In the ESP32 application I modified the Makefile:

Code: Select all

#
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
# project subdirectory.
#

PROJECT_NAME := ESP_IoT

EXTRA_COMPONENT_DIRS += $(PROJECT_PATH)/../Common_IoTT/

include $(IDF_PATH)/make/project.mk

I'm desperately looking what could be wrong... The

Code: Select all

#include <Common.h>
gives a fatal error that there is no such file....

Maybe I'm to tired to see the obvious, so if anyone can help....

Thanks,

Paul

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Components outside a project

Postby ESP_igrr » Wed Feb 13, 2019 9:25 pm

Is there a component.mk file in the directory which you are adding to EXTRA_COMPONENT_DIRS? If no, there should be. If yes, can you try wrapping the path with realpath function to convert it to an absolute path, as in $(realpath $(PROJECT_PATH)/../Common_IoTT/) ?

User avatar
PaulVdBergh
Posts: 58
Joined: Fri Feb 23, 2018 4:45 pm
Location: Brasschaat, Belgium

Re: Components outside a project

Postby PaulVdBergh » Thu Feb 14, 2019 11:59 am

Sadly I'll never know what was wrong... This morning I deleted the ESP32 Project and started all over.
I added one line to the default Makefile (in the root of the project):

Code: Select all

#
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
# project subdirectory.
#

PROJECT_NAME := ESP_IoTT

EXTRA_COMPONENT_DIRS := $(abspath /home/paulvdbergh/IoTT-workspace/Common_IoTT/)

include $(IDF_PATH)/make/project.mk
Everything seems to work as expected.

Thanks.

Who is online

Users browsing this forum: No registered users and 105 guests