From cda94bb2d29af4979a42aef348975b63d001b868 Mon Sep 17 00:00:00 2001 From: Matt Felsen Date: Sat, 14 Nov 2015 22:07:52 -0500 Subject: [PATCH 1/4] Process data from addon_config.mk ADDON_DATA field --- ofxProjectGenerator/src/addons/ofAddon.cpp | 2 +- .../src/projects/baseProject.cpp | 23 +++++++++++++++++++ .../src/projects/baseProject.h | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ofxProjectGenerator/src/addons/ofAddon.cpp b/ofxProjectGenerator/src/addons/ofAddon.cpp index 34fb3b7d..f62f8117 100644 --- a/ofxProjectGenerator/src/addons/ofAddon.cpp +++ b/ofxProjectGenerator/src/addons/ofAddon.cpp @@ -273,7 +273,7 @@ void ofAddon::parseVariableValue(string variable, string value, bool addToValue, } if(variable == "ADDON_DATA"){ - addReplaceStringVector(data,value,addonRelPath,addToValue); + addReplaceStringVector(data,value,"",addToValue); } if(variable == "ADDON_LIBS_EXCLUDE"){ diff --git a/ofxProjectGenerator/src/projects/baseProject.cpp b/ofxProjectGenerator/src/projects/baseProject.cpp index 8badec79..9f3a78cc 100644 --- a/ofxProjectGenerator/src/projects/baseProject.cpp +++ b/ofxProjectGenerator/src/projects/baseProject.cpp @@ -253,7 +253,30 @@ void baseProject::addAddon(std::string addonName){ auto standardPath = ofFilePath::join(ofFilePath::join(getOFRoot(), "addons"), addonName); addon.fromFS(standardPath, target); } + addAddon(addon); + + // Process values from ADDON_DATA + if (addon.data.size()) { + string dest = ofFilePath::join(projectDir, "bin/data/"); + + for (auto& filename : addon.data) { + ofFile src(ofFilePath::join(addon.addonPath, filename)); + + if (src.isFile()) { + src.copyTo(ofFilePath::join(dest, src.getFileName()), false, true); + } else if (src.isDirectory()) { + string folderPath = ofFilePath::join(addon.addonPath, filename); + ofDirectory dir(folderPath); + dir.listDir(); + for (auto& file : dir) { + file.copyTo(ofFilePath::join(dest, file.getFileName()), false, true); + } + } else { + ofLogWarning() << filename << " is not a file or directory, skipping"; + } + } + } } void baseProject::addAddon(ofAddon & addon){ diff --git a/ofxProjectGenerator/src/projects/baseProject.h b/ofxProjectGenerator/src/projects/baseProject.h index 23010f64..fc4eac3a 100644 --- a/ofxProjectGenerator/src/projects/baseProject.h +++ b/ofxProjectGenerator/src/projects/baseProject.h @@ -67,7 +67,7 @@ class baseProject { virtual void addAfterRule(std::string script){} virtual void addAddon(std::string addon); - virtual void addAddon(ofAddon & addon); + virtual void addAddon(ofAddon & addon); std::string getName() { return projectName;} std::string getPath() { return projectDir; } From 77b8279ae8ff67d57921a04cd8c0f84129c7e072 Mon Sep 17 00:00:00 2001 From: Matt Felsen Date: Sat, 14 Nov 2015 23:00:07 -0500 Subject: [PATCH 2/4] Add support for ADDON_DLLS_TO_COPY to Xcode projects --- ofxProjectGenerator/src/projects/xcodeProject.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ofxProjectGenerator/src/projects/xcodeProject.cpp b/ofxProjectGenerator/src/projects/xcodeProject.cpp index 6cc39bcb..8cfdf64a 100644 --- a/ofxProjectGenerator/src/projects/xcodeProject.cpp +++ b/ofxProjectGenerator/src/projects/xcodeProject.cpp @@ -1175,6 +1175,11 @@ void xcodeProject::addAddon(ofAddon & addon){ ofLogVerbose() << "adding addon libs: " << addon.libs[i].path; addLibrary(addon.libs[i]); } + for(int i=0;i<(int)addon.dllsToCopy.size();i++){ + ofLogVerbose() << "adding addon dlls to bin: " << addon.dllsToCopy[i]; + string dll = ofFilePath::join("addons/" + addon.name, addon.dllsToCopy[i]); + ofFile(ofFilePath::join(getOFRoot(),dll)).copyTo(ofFilePath::join(projectDir,"bin/"),false,true); + } for(int i=0;i<(int)addon.cflags.size();i++){ ofLogVerbose() << "adding addon cflags: " << addon.cflags[i]; addCFLAG(addon.cflags[i]); From 4cdcde88b05e824593ed8a09e6bce7a4b0b3c74e Mon Sep 17 00:00:00 2001 From: Matt Felsen Date: Sun, 15 Nov 2015 10:21:15 -0500 Subject: [PATCH 3/4] if ADDON_DATA contains a folder, copy it instead of its contents --- ofxProjectGenerator/src/projects/baseProject.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/ofxProjectGenerator/src/projects/baseProject.cpp b/ofxProjectGenerator/src/projects/baseProject.cpp index 9f3a78cc..c10a9b32 100644 --- a/ofxProjectGenerator/src/projects/baseProject.cpp +++ b/ofxProjectGenerator/src/projects/baseProject.cpp @@ -262,18 +262,11 @@ void baseProject::addAddon(std::string addonName){ for (auto& filename : addon.data) { ofFile src(ofFilePath::join(addon.addonPath, filename)); - - if (src.isFile()) { - src.copyTo(ofFilePath::join(dest, src.getFileName()), false, true); - } else if (src.isDirectory()) { - string folderPath = ofFilePath::join(addon.addonPath, filename); - ofDirectory dir(folderPath); - dir.listDir(); - for (auto& file : dir) { - file.copyTo(ofFilePath::join(dest, file.getFileName()), false, true); - } + if (!src.exists()) { + ofLogWarning() << "addon data file does not exist, skipping: " << filename; } else { - ofLogWarning() << filename << " is not a file or directory, skipping"; + ofLogVerbose() << "adding addon data files: " << filename; + src.copyTo(ofFilePath::join(dest, src.getFileName()), false, true); } } } From 0eaf8863b1e6f94fb4341e3a586801435f694a01 Mon Sep 17 00:00:00 2001 From: Matt Felsen Date: Mon, 1 Feb 2016 07:59:22 -0500 Subject: [PATCH 4/4] Remove support for ADDON_DLLS_TO_COPY to Xcode projects --- ofxProjectGenerator/src/projects/xcodeProject.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ofxProjectGenerator/src/projects/xcodeProject.cpp b/ofxProjectGenerator/src/projects/xcodeProject.cpp index 8cfdf64a..6cc39bcb 100644 --- a/ofxProjectGenerator/src/projects/xcodeProject.cpp +++ b/ofxProjectGenerator/src/projects/xcodeProject.cpp @@ -1175,11 +1175,6 @@ void xcodeProject::addAddon(ofAddon & addon){ ofLogVerbose() << "adding addon libs: " << addon.libs[i].path; addLibrary(addon.libs[i]); } - for(int i=0;i<(int)addon.dllsToCopy.size();i++){ - ofLogVerbose() << "adding addon dlls to bin: " << addon.dllsToCopy[i]; - string dll = ofFilePath::join("addons/" + addon.name, addon.dllsToCopy[i]); - ofFile(ofFilePath::join(getOFRoot(),dll)).copyTo(ofFilePath::join(projectDir,"bin/"),false,true); - } for(int i=0;i<(int)addon.cflags.size();i++){ ofLogVerbose() << "adding addon cflags: " << addon.cflags[i]; addCFLAG(addon.cflags[i]);