general: need a better way to select config files at compile time
Bug #1802885 reported by
Selene ToyKeeper
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Flashlight Firmware Repository |
Fix Released
|
Medium
|
Unassigned |
Bug Description
The code currently supports a bunch of different drivers and a bunch of different UI configurations, with one config per file. This is nice, but the way it pulls in those files requires having a few extra lines per configuration.
Basically, there are a bunch of "ifdef FOO, include foo.h" clauses. And I want to get rid of those. It's getting messy, as the number of supported build targets increases.
Changed in flashlight-firmware: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Found a way, working on it.
/*
C-preprocessor hack to include the cfg-file specified by the define "DRIVER"
Sources: /www.microchip. com/forums/ FindPost/ 845119 /stackoverflow. com/questions/ 9096201/ concatenate- string- in-c-include- filename /stackoverflow. com/questions/ 6742501/ whats-the- exact-step- of-macro- expanding/ 6742619# 6742619
https:/
https:/
https:/
*/
#ifndef DRIVER
#error You must define DRIVER to import the correct cfg_<driver>.h file
#endif
#define str(s) #s
#define xstr(s) str(s)
#define INCFILE2(a, n) a ## n
#define INCFILE(a,b) INCFILE2(a,b)
//#pragma message xstr(INCFILE(cfg_, DRIVER).h)
#include xstr(INCFILE(cfg_, DRIVER).h)