Skip to content

Commit

Permalink
fix ambigious
Browse files Browse the repository at this point in the history
  • Loading branch information
danoli3 committed Jul 18, 2024
1 parent 8d5704e commit 3979aa1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
29 changes: 17 additions & 12 deletions commandLine/src/addons/ofAddon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ void ofAddon::addReplaceString(std::string &variable, const std::string &value,
else variable = value;
}

void ofAddon::addReplaceStringVector(std::vector<std::string> &variable, const std::string &value,const std::filesystem::path &prefix, bool addToVariable) {
addReplaceStringVector(variable, value, prefix.string(), addToVariable);
}


void ofAddon::addReplaceStringVector(std::vector<std::string> &variable, const std::string &value, const std::string &prefix, bool addToVariable) {
if (value == prefix) return;

Expand Down Expand Up @@ -299,7 +304,7 @@ void ofAddon::parseVariableValue(const string & variable, const string & value,
}

else if(variable == "ADDON_TAGS"){
addReplaceStringVector(tags,value,"",addToValue);
addReplaceStringVector(tags,value,emptyString,addToValue);
return;
}

Expand All @@ -309,7 +314,7 @@ void ofAddon::parseVariableValue(const string & variable, const string & value,
}

else if(variable == "ADDON_DEPENDENCIES"){
addReplaceStringVector(dependencies,value,"",addToValue);
addReplaceStringVector(dependencies,value,emptyString,addToValue);
}

else if(variable == "ADDON_INCLUDES"){
Expand All @@ -324,15 +329,15 @@ void ofAddon::parseVariableValue(const string & variable, const string & value,
}

else if(variable == ADDON_CFLAGS){
addReplaceStringVector(cflags,value,"",addToValue);
addReplaceStringVector(cflags,value,emptyString,addToValue);
}

else if(variable == ADDON_CPPFLAGS){
addReplaceStringVector(cppflags,value,"",addToValue);
addReplaceStringVector(cppflags,value,emptyString,addToValue);
}

else if(variable == ADDON_LDFLAGS){
addReplaceStringVector(ldflags,value,"",addToValue);
addReplaceStringVector(ldflags,value,emptyString,addToValue);
}

else if(variable == ADDON_LIBS){
Expand All @@ -344,7 +349,7 @@ void ofAddon::parseVariableValue(const string & variable, const string & value,
}

else if(variable == ADDON_PKG_CONFIG_LIBRARIES){
addReplaceStringVector(pkgConfigLibs,value,"",addToValue);
addReplaceStringVector(pkgConfigLibs,value,emptyString,addToValue);
}

else if(variable == ADDON_FRAMEWORKS){
Expand Down Expand Up @@ -376,31 +381,31 @@ void ofAddon::parseVariableValue(const string & variable, const string & value,
}

else if(variable == ADDON_DATA){
addReplaceStringVector(data,value,"",addToValue);
addReplaceStringVector(data,value,emptyString,addToValue);
}

else if(variable == ADDON_LIBS_EXCLUDE){
addReplaceStringVector(excludeLibs,value,"",addToValue);
addReplaceStringVector(excludeLibs,value,emptyString,addToValue);
}

else if(variable == ADDON_LIBS_DIR){
addReplaceStringVectorPath(libsPaths,value,addonRelPath,addToValue);
}

else if(variable == ADDON_SOURCES_EXCLUDE){
addReplaceStringVector(excludeSources,value,"",addToValue);
addReplaceStringVector(excludeSources,value,emptyString,addToValue);
}

else if(variable == ADDON_INCLUDES_EXCLUDE){
addReplaceStringVector(excludeIncludes,value,"",addToValue);
addReplaceStringVector(excludeIncludes,value,emptyString,addToValue);
}

else if (variable == ADDON_FRAMEWORKS_EXCLUDE) {
addReplaceStringVector(excludeFrameworks, value, "", addToValue);
addReplaceStringVector(excludeFrameworks, value, emptyString, addToValue);
}

else if (variable == ADDON_DEFINES) {
addReplaceStringVector(defines, value, "", addToValue);
addReplaceStringVector(defines, value, emptyString, addToValue);
}
}

Expand Down
7 changes: 6 additions & 1 deletion commandLine/src/addons/ofAddon.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ class ofAddon {

public:

ofAddon();
ofAddon() = default;
ofAddon(const ofAddon& other) = default;
ofAddon& operator=(const ofAddon& other) = default;


bool fromFS(const fs::path & path, const string & platform);
void parseLibsPath(const fs::path & path, const fs::path & parentFolder);
Expand Down Expand Up @@ -177,12 +180,14 @@ class ofAddon {
private:

string currentParseState { "" };
const string emptyString = { "" };
void preParseConfig();
void parseConfig();
void parseVariableValue(const string & variable, const string & value, bool addToValue, const string & line, int lineNum);
void parseVariableValue(const fs::path & variable, const string & value, bool addToValue, const string & line, int lineNum);
void addReplaceString(std::string &variable, const std::string &value, bool addToVariable);
void addReplaceStringVector(std::vector<std::string> &variable, const std::string &value, const std::string &prefix, bool addToVariable);
void addReplaceStringVector(std::vector<std::string> &variable, const std::string &value, const std::filesystem::path &prefix, bool addToVariable);
void addReplaceStringVectorPath(std::vector<std::filesystem::path> &variable, const std::string &value, const std::string &prefix, bool addToVariable);
void addReplaceStringVectorPath(std::vector<std::filesystem::path> &variable, const std::filesystem::path &value, const std::string &prefix, bool addToVariable);
void addReplaceStringVectorPath(std::vector<std::filesystem::path> &variable, const std::filesystem::path &value, const std::filesystem::path &prefix, bool addToVariable);
Expand Down

0 comments on commit 3979aa1

Please sign in to comment.