Skip to content

Commit 73c4f14

Browse files
authored
ofxPoco / ofxAssimp fix (#464)
1 parent c739083 commit 73c4f14

3 files changed

Lines changed: 74 additions & 7 deletions

File tree

commandLine/src/addons/ofAddon.cpp

Lines changed: 72 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,75 @@ void ofAddon::exclude(vector<LibraryBinary> & variables, vector<string> exclusio
315315
}
316316
}
317317

318+
319+
void ofAddon::preParseConfig(){
320+
// alert ("ofAddon::parseConfig " + addonPath.string(), 33);
321+
fs::path fileName = isLocalAddon ?
322+
(pathToProject / addonPath / "addon_config.mk") :
323+
(addonPath / "addon_config.mk")
324+
;
325+
326+
if (!fs::exists(fileName)) {
327+
// ofLogError() << "ofAddon::parseConfig() " << fileName << " not found " << ofPathToString(fileName);
328+
return;
329+
}
330+
331+
for (auto & line : fileToStrings(fileName)) {
332+
line = ofTrim(line);
333+
334+
if (line[0]=='#' || line == "") {
335+
continue;
336+
} // discard comments
337+
338+
339+
// found section?
340+
if (line.back() == ':'){
341+
ofStringReplace(line, ":", "");
342+
currentParseState = line;
343+
344+
if (std::find(parseStates.begin(), parseStates.end(), currentParseState) == parseStates.end()) {
345+
ofLogError() << "Error parsing " << name << " addon_config.mk" << "\n\t\t"
346+
// << "line " << lineNum << ": " << originalLine << "\n\t\t"
347+
<< "sectionName " << currentParseState << " not recognized";
348+
}
349+
continue;
350+
}
351+
352+
// found Variable
353+
if (line.find("=") != string::npos){
354+
bool addToValue = false;
355+
string variable, value;
356+
vector<string> varValue;
357+
if (line.find("+=") != string::npos) {
358+
addToValue = true;
359+
varValue = ofSplitString(line, "+=");
360+
} else {
361+
varValue = ofSplitString(line, "=");
362+
}
363+
variable = ofTrim(varValue[0]);
364+
value = ofTrim(varValue[1]);
365+
366+
// FIXME: This seems to be meaningless
367+
if(!checkCorrectPlatform(currentParseState)){
368+
continue;
369+
}
370+
371+
if(!checkCorrectVariable(variable, currentParseState)){
372+
ofLogError() << "Error parsing " << name << " addon_config.mk" << "\n\t\t"
373+
// << "line " << lineNum << ": " << originalLine << "\n\t\t"
374+
<< "variable " << variable << " not recognized for section " << currentParseState;
375+
continue;
376+
}
377+
378+
if (variable == "ADDON_ADDITIONAL_LIBS") {
379+
additionalLibsFolder.emplace_back(value);
380+
// return;
381+
}
382+
// parseVariableValue(variable, value, addToValue, originalLine, lineNum);
383+
}
384+
}
385+
}
386+
318387
void ofAddon::parseConfig(){
319388
// alert ("ofAddon::parseConfig " + addonPath.string(), 33);
320389
fs::path fileName = isLocalAddon ?
@@ -541,7 +610,8 @@ bool ofAddon::fromFS(const fs::path & path, const string & platform){
541610
}
542611

543612

544-
parseConfig();
613+
// FIXME: MARK: - HACK:
614+
preParseConfig();
545615

546616
parseLibsPath(libsPath, parentFolder);
547617

@@ -550,17 +620,13 @@ bool ofAddon::fromFS(const fs::path & path, const string & platform){
550620
parseLibsPath((path / a), parentFolder);
551621
}
552622

553-
554623
paths.sort();
555624

556625
for (auto & p : paths) {
557626
includePaths.emplace_back(p.string());
558627
}
559628

560-
561-
//
562-
// FIXME: MARK: - HACK:
563-
// parseConfig();
629+
parseConfig();
564630

565631
exclude(includePaths, excludeIncludes);
566632
exclude(srcFiles, excludeSources);

commandLine/src/addons/ofAddon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ class ofAddon {
168168

169169
string currentParseState { "" };
170170

171+
void preParseConfig();
171172
void parseConfig();
172173
void parseVariableValue(const string & variable, const string & value, bool addToValue, const string & line, int lineNum);
173174
void addReplaceString(string & variable, string value, bool addToVariable);

commandLine/src/projects/baseProject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#define PG_VERSION "31"
3+
#define PG_VERSION "32"
44

55
#include "ofAddon.h"
66
#include "ofFileUtils.h"

0 commit comments

Comments
 (0)