Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature post compile script xcode #217

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion ofxProjectGenerator/src/addons/ofAddon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ bool ofAddon::checkCorrectVariable(string variable, ConfigParseState state){
variable == "ADDON_DATA" ||
variable == "ADDON_LIBS_EXCLUDE" || variable == "ADDON_SOURCES_EXCLUDE" || variable == "ADDON_INCLUDES_EXCLUDE" ||
variable == "ADDON_DLLS_TO_COPY" ||
variable == "ADDON_DEFINES");
variable == "ADDON_DEFINES" ||
variable == "ADDON_AFTER_COMPILE_SCRIPT" );
case Unknown:
default:
return false;
Expand Down Expand Up @@ -217,7 +218,14 @@ void ofAddon::addReplaceStringVector(vector<LibraryBinary> & variable, string va
}
}
}
void ofAddon::appendString(std::string & variable, std::string value, std::string delimiter, bool addToVariable){
if(!addToVariable){
variable = value;
}else{
variable += delimiter + value;
}

}
void ofAddon::parseVariableValue(string variable, string value, bool addToValue, string line, int lineNum){
if(variable == "ADDON_NAME"){
if(value!=name){
Expand Down Expand Up @@ -328,6 +336,10 @@ void ofAddon::parseVariableValue(string variable, string value, bool addToValue,
if (variable == "ADDON_DEFINES") {
addReplaceStringVector(defines, value, "", addToValue);
}
if (variable == "ADDON_AFTER_COMPILE_SCRIPT") {
appendString(afterCompileScript, value, "; ", addToValue);
}

}

void ofAddon::exclude(vector<string> & variables, vector<string> exclusions){
Expand Down Expand Up @@ -678,6 +690,7 @@ void ofAddon::fromFS(string path, string platform){


void ofAddon::clear(){

filesToFolders.clear();
srcFiles.clear();
propsFiles.clear();
Expand Down
2 changes: 2 additions & 0 deletions ofxProjectGenerator/src/addons/ofAddon.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class ofAddon {
std::vector < std::string > frameworks; // osx only
std::vector < std::string > data;
std::vector < std::string > defines;
std::string afterCompileScript;

// metadata
std::string name;
Expand Down Expand Up @@ -88,6 +89,7 @@ class ofAddon {
void addReplaceString(std::string & variable, std::string value, bool addToVariable);
void addReplaceStringVector(std::vector<std::string> & variable, std::string value, std::string prefix, bool addToVariable);
void addReplaceStringVector(std::vector<LibraryBinary> & variable, std::string value, std::string prefix, bool addToVariable);
void appendString(std::string & variable, std::string value, std::string delimiter, bool addToVariable);
void exclude(std::vector<std::string> & variable, std::vector<std::string> exclusions);
void exclude(std::vector<LibraryBinary> & variable, std::vector<std::string> exclusions);
ConfigParseState stateFromString(std::string name);
Expand Down
5 changes: 4 additions & 1 deletion ofxProjectGenerator/src/projects/xcodeProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1289,5 +1289,8 @@ void xcodeProject::addAddon(ofAddon & addon){
//

}

if(addon.afterCompileScript.length()){
ofLogVerbose() << "adding addon after compile script: " << addon.afterCompileScript;
addAfterRule(addon.afterCompileScript);
}
}