Create define for build question

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Create define for build question

Postby fly135 » Thu Apr 11, 2019 5:42 pm

I want to be able to dynamically create a define for builds. I'm planning to have a build script that will write...

CXXFLAGS=-Dmydefine to a component.mk file. If i write it in my root project directory it seems to do nothing. If I write to my main project subdirectory it works, but doesn't work in a parallel folder components subdirectory. For example....

MyRootFolder
<tab>mainFolder
<tab>components/sensorsFolder
<tab>components/audioFolder

So the component.mk in mainFolder works for those files. But it appears I would have to modify component.mk in all the component subfolders. I'm looking for a simpler method that would cover the entire project.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Create define for build question

Postby ESP_Angus » Fri Apr 12, 2019 4:36 am

To make project-wide changes, add a Makefile.projbuild file to one of your components (alongside component.mk), that sets "CPPFLAGS += -Dxyz"

(Note that these are a blunt instrument as they will also change all IDF source file compiler flags. Sparing use is recommended.)

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Create define for build question

Postby fly135 » Fri Apr 12, 2019 6:32 pm

ESP_Angus wrote:
Fri Apr 12, 2019 4:36 am
To make project-wide changes, add a Makefile.projbuild file to one of your components (alongside component.mk), that sets "CPPFLAGS += -Dxyz"

(Note that these are a blunt instrument as they will also change all IDF source file compiler flags. Sparing use is recommended.)
The guy who's going to automate the builds wants to export an environment variable to define which H/W version of the device he's building the firmware for. I was able to do that with Makefile.projbuild. Thanks!!!

John A

Who is online

Users browsing this forum: Bing [Bot] and 99 guests