From b90dcaa35249b1a061a6ed252029466672fee51c Mon Sep 17 00:00:00 2001 From: Roy Macdonald Date: Fri, 27 Apr 2018 11:30:27 -0300 Subject: [PATCH 1/2] Fix for xcode project. Correctly adding FRAMEWORK_SEARCH_PATHS --- ofxProjectGenerator/src/projects/xcodeProject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ofxProjectGenerator/src/projects/xcodeProject.cpp b/ofxProjectGenerator/src/projects/xcodeProject.cpp index 4b769aa8..9505b02b 100644 --- a/ofxProjectGenerator/src/projects/xcodeProject.cpp +++ b/ofxProjectGenerator/src/projects/xcodeProject.cpp @@ -637,8 +637,8 @@ void xcodeProject::addFramework(std::string name, std::string path, std::string } // then, we are going to add this to "FRAMEWORK_SEARCH_PATHS" -- we do this twice, once for debug once for release. - - pugi::xpath_node_set frameworkSearchPaths = doc.select_nodes("//string[contains(.,'FRAMEWORK_SEARCH_PATHS')]/.."); + + pugi::xpath_node_set frameworkSearchPaths = doc.select_nodes("//key[contains(.,'FRAMEWORK_SEARCH_PATHS')]/following-sibling::node()[1]"); if (frameworkSearchPaths.size() > 0){ for (pugi::xpath_node_set::const_iterator it = frameworkSearchPaths.begin(); it != frameworkSearchPaths.end(); ++it){ From c6d5a017fc79265f71cc89e50c0cc28d7c1de515 Mon Sep 17 00:00:00 2001 From: Roy Macdonald Date: Mon, 16 Sep 2019 02:21:53 -0400 Subject: [PATCH 2/2] Added option for addon_config.mk to add a script that runs after the project has been compiled. Only for xcode so far. --- ofxProjectGenerator/src/addons/ofAddon.cpp | 15 ++++++++++++++- ofxProjectGenerator/src/addons/ofAddon.h | 2 ++ ofxProjectGenerator/src/projects/xcodeProject.cpp | 5 ++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ofxProjectGenerator/src/addons/ofAddon.cpp b/ofxProjectGenerator/src/addons/ofAddon.cpp index 67044030..2275b785 100644 --- a/ofxProjectGenerator/src/addons/ofAddon.cpp +++ b/ofxProjectGenerator/src/addons/ofAddon.cpp @@ -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; @@ -217,7 +218,14 @@ void ofAddon::addReplaceStringVector(vector & 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){ @@ -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 & variables, vector exclusions){ @@ -678,6 +690,7 @@ void ofAddon::fromFS(string path, string platform){ void ofAddon::clear(){ + filesToFolders.clear(); srcFiles.clear(); propsFiles.clear(); diff --git a/ofxProjectGenerator/src/addons/ofAddon.h b/ofxProjectGenerator/src/addons/ofAddon.h index b7b1fe8a..25cfa876 100644 --- a/ofxProjectGenerator/src/addons/ofAddon.h +++ b/ofxProjectGenerator/src/addons/ofAddon.h @@ -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; @@ -88,6 +89,7 @@ class ofAddon { void addReplaceString(std::string & variable, std::string value, bool addToVariable); void addReplaceStringVector(std::vector & variable, std::string value, std::string prefix, bool addToVariable); void addReplaceStringVector(std::vector & 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 & variable, std::vector exclusions); void exclude(std::vector & variable, std::vector exclusions); ConfigParseState stateFromString(std::string name); diff --git a/ofxProjectGenerator/src/projects/xcodeProject.cpp b/ofxProjectGenerator/src/projects/xcodeProject.cpp index 16b4ae4b..eee3e73b 100644 --- a/ofxProjectGenerator/src/projects/xcodeProject.cpp +++ b/ofxProjectGenerator/src/projects/xcodeProject.cpp @@ -1289,5 +1289,8 @@ void xcodeProject::addAddon(ofAddon & addon){ // } - + if(addon.afterCompileScript.length()){ + ofLogVerbose() << "adding addon after compile script: " << addon.afterCompileScript; + addAfterRule(addon.afterCompileScript); + } }