Skip to content

Commit b82cbaf

Browse files
committed
Merge pull request #70 from openframeworks/fixFrameworkLinking
fixes for framework linking
2 parents abe207c + 3662bb0 commit b82cbaf

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

ofxProjectGenerator/src/projects/xcodeProject.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ xcodeProject::xcodeProject(std::string target)
214214
resourcesUUID = "";
215215
frameworksUUID = "E7E077E715D3B6510020DFD4"; //PBXFrameworksBuildPhase
216216
afterPhaseUUID = "928F60851B6710B200E2D791";
217-
buildPhasesUUID = "E4C2427710CC5ABF004149E2";
217+
buildPhasesUUID = "E4C2427710CC5ABF004149E2";
218+
frameworksBuildPhaseUUID = "E4328149138ABC9F0047C5CB";
219+
218220
}else{
219221
srcUUID = "E4D8936A11527B74007E1F53";
220222
addonUUID = "BB16F26B0F2B646B00518274";
@@ -596,7 +598,10 @@ void xcodeProject::addFramework(string name, string path, string folder){
596598

597599
// we add the second to a final build phase for copying the framework into app. we need to make sure we *don't* do this for system frameworks
598600

599-
if (folder.size() != 0){
601+
602+
603+
if (folder.size() != 0 && !ofIsStringInString(path, "/System/Library/Frameworks")
604+
&& target != "ios"){
600605

601606
string buildUUID2 = generateUUID(name + "-build2");
602607
pbxbuildfile = string(PBXBuildFile);
@@ -605,8 +610,6 @@ void xcodeProject::addFramework(string name, string path, string folder){
605610
fileRefDoc.load_buffer(pbxbuildfile.c_str(), strlen(pbxbuildfile.c_str()));
606611
doc.select_single_node("/plist[1]/dict[1]/dict[2]").node().prepend_copy(fileRefDoc.first_child().next_sibling()); // UUID FIRST
607612
doc.select_single_node("/plist[1]/dict[1]/dict[2]").node().prepend_copy(fileRefDoc.first_child()); // DICT SECOND
608-
609-
610613

611614
pugi::xpath_node xpathResult = doc.select_node("//string[contains(.,'PBXCopyFilesBuildPhase')]/../array");
612615
pugi::xml_node node = xpathResult.node();
@@ -636,7 +639,7 @@ void xcodeProject::addFramework(string name, string path, string folder){
636639

637640
// finally, this is for making folders based on the frameworks position in the addon. so it can appear in the sidebar / file explorer
638641

639-
if (folder.size() > 0){
642+
if (folder.size() > 0 && !ofIsStringInString(folder, "/System/Library/Frameworks")){
640643

641644
vector < string > folders = ofSplitString(folder, "/", true);
642645

@@ -681,15 +684,12 @@ void xcodeProject::addFramework(string name, string path, string folder){
681684
}
682685

683686

684-
685-
//PBXCopyFilesBuildPhase
686-
687-
688-
// add it to the build phases...
689-
// pugi::xml_node arrayBuild;
690-
// findArrayForUUID(frameworksBuildPhaseUUID, arrayBuild); // this is the build array (all build refs get added here)
691-
// arrayBuild.append_child("string").append_child(pugi::node_pcdata).set_value(buildUUID.c_str());
692-
687+
if (target != "ios" && folder.size() != 0){
688+
// add it to the linking phases...
689+
pugi::xml_node arrayBuild;
690+
findArrayForUUID(frameworksBuildPhaseUUID, arrayBuild); // this is the build array (all build refs get added here)
691+
arrayBuild.append_child("string").append_child(pugi::node_pcdata).set_value(buildUUID.c_str());
692+
}
693693
}
694694

695695

ofxProjectGenerator/src/projects/xcodeProject.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ class xcodeProject : public baseProject {
4848
std::string buildPhaseResourcesUUID;
4949
std::string frameworksBuildPhaseUUID;
5050
std::string afterPhaseUUID;
51-
std::string buildPhasesUUID; // note this UUID is in an array of *all* the build steps (ie build phases)
52-
51+
std::string buildPhasesUUID; // note this UUID is in an array of *all* the build steps
5352

5453

5554

0 commit comments

Comments
 (0)