Skip to content

Commit 1b9a8e0

Browse files
committed
put back the libs hack
1 parent c1e5531 commit 1b9a8e0

File tree

1 file changed

+38
-32
lines changed

1 file changed

+38
-32
lines changed

commandLine/src/addons/ofAddon.cpp

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void ofAddon::getFrameworksRecursively(const fs::path & path, string platform) {
2222
if (f.extension() == ".framework" || f.extension() == ".xcframework") {
2323
// alert ("found XCF " + f.string(), 31);
2424
bool platformFound = false;
25-
25+
2626
// if (ofIsStringInString(platform), f.string()) {
2727
if (!platform.empty() && f.string().find(platform) != std::string::npos) {
2828
platformFound = true;
@@ -87,7 +87,7 @@ vector<string> splitStringOnceByLeft(const string &source, const string &delimit
8787
// = std::unordered_map<fs::path, fs::path>();
8888
//}
8989

90-
ofAddon::ofAddon(const ofAddon& other):
90+
ofAddon::ofAddon(const ofAddon& other):
9191
additionalLibsFolder(other.additionalLibsFolder),
9292
libFiles(other.libFiles),
9393
filesToFolders(other.filesToFolders),
@@ -770,7 +770,7 @@ void ofAddon::addToFolder(const fs::path& path, const fs::path & parentFolder){
770770
} else {
771771
folder = fs::relative(path.parent_path(), getOFRoot());
772772
}
773-
773+
774774
filesToFolders[path] = folder;
775775
}
776776

@@ -781,33 +781,39 @@ void ofAddon::parseLibsPath(const fs::path & libsPath, const fs::path & parentFo
781781
}
782782
// alert ("parseLibsPath " + libsPath.string() + ", parent=" + parentFolder.string(), 35);
783783

784+
// FIXME: Remove This
785+
#define MERGE_MAC_LIBS_HACK
786+
#ifdef MERGE_MAC_LIBS_HACK
787+
788+
if (platform == "osx" || platform == "macos"){
789+
// Horrible hack to make it work with the bad idea of renaming osx to macos
790+
getLibsRecursively(libsPath, libFiles, libs, "macos");
791+
getLibsRecursively(libsPath, libFiles, libs, "osx");
792+
793+
getFrameworksRecursively(libsPath, "macos");
794+
getFrameworksRecursively(libsPath, "osx");
795+
/ getXCFrameworksRecursively(libsPath, "macos");
796+
/ getXCFrameworksRecursively(libsPath, "osx");
797+
798+
// FIXME: This is not needed when we get libraries right.
799+
// if it was needed the best was change to std::set.
800+
removeDuplicates(libs);
801+
removeDuplicates(libFiles);
802+
removeDuplicates(frameworks);
803+
removeDuplicates(xcframeworks);
804+
805+
} else {
806+
getLibsRecursively(libsPath, libFiles, libs, platform);
807+
}
808+
809+
#else
784810

785-
// if (platform == "osx" || platform == "macos"){
786-
// // Horrible hack to make it work with the bad idea of renaming osx to macos
787-
// getLibsRecursively(libsPath, libFiles, libs, "macos");
788-
// getLibsRecursively(libsPath, libFiles, libs, "osx");
789-
//
790-
// getFrameworksRecursively(libsPath, "macos");
791-
// getFrameworksRecursively(libsPath, "osx");
792-
//// getXCFrameworksRecursively(libsPath, "macos");
793-
//// getXCFrameworksRecursively(libsPath, "osx");
794-
//
795-
// // FIXME: This is not needed when we get libraries right.
796-
// // if it was needed the best was change to std::set.
797-
// removeDuplicates(libs);
798-
// removeDuplicates(libFiles);
799-
// removeDuplicates(frameworks);
800-
// removeDuplicates(xcframeworks);
801-
//
802-
// } else {
803-
// getLibsRecursively(libsPath, libFiles, libs, platform);
804-
// }
805-
806811
getLibsRecursively(libsPath, libFiles, libs, platform);
807812
if (platform == "osx" || platform == "macos"){
808813
getFrameworksRecursively(libsPath, platform);
809814
}
810-
815+
816+
#endif
811817

812818
if (//platform == "osx" ||
813819
platform == "ios" ||
@@ -881,7 +887,7 @@ string ofAddon::cleanName(const string& name){
881887
// FIXME: change this. second parameter is not needed, projectDir is always CWD
882888
bool ofAddon::load(string addonName, const fs::path& projectDir, const string& targetPlatform){
883889
// alert ("ofAddon::load " + addonName + " :projectDir:" + projectDir.string(), 36);
884-
890+
885891
// we want to set addonMakeName before cleaning the addon name, so it is preserved in the exact same way as it was passed, and the addons.make file can be (re)constructed properly
886892
this->addonMakeName = addonName;
887893

@@ -894,15 +900,15 @@ bool ofAddon::load(string addonName, const fs::path& projectDir, const string& t
894900

895901
// a local addon can be added but it should have at least one parent folder, like
896902
// addons/ofxMidi if there is no separator on path PG will search in $ofw/addons path
897-
903+
898904
fs::path addonNamePath { addonName };
899905
// alert ("addonNamePath " + addonNamePath.string(), 32);
900906
// alert("CWD: " + fs::current_path().string(), 34);
901907
// alert("addonNamePath: has_parent_path " , 33);
902908
// cout << addonNamePath.has_parent_path() << endl;
903909
// alert("fs::exists " + addonNamePath.string(), 33);
904910
// cout << fs::exists(addonNamePath) << endl;
905-
911+
906912
if (addonNamePath.has_parent_path() && fs::exists(fs::current_path() / addonNamePath)) {
907913
// if (addonNamePath.is_absolute()) {
908914
// alert ("IS ABS ! " + addonNamePath.string(), 32);
@@ -914,7 +920,7 @@ bool ofAddon::load(string addonName, const fs::path& projectDir, const string& t
914920
// addon.pathToProject = makeRelative(getOFRoot(), projectDir);
915921
// projectDir;
916922
}
917-
923+
918924
else {
919925
this->addonPath = fs::path { getOFRoot() / "addons" / addonName };
920926
// alert ("NOT LOCAL ! " + this->addonPath.string(), 34);
@@ -929,7 +935,7 @@ bool ofAddon::load(string addonName, const fs::path& projectDir, const string& t
929935
ofLogVerbose("ofAddon::load") << "addon does not exist!" << addonPath;
930936
return false;
931937
}
932-
938+
933939
this->pathToProject = projectDir;
934940

935941
this->platform = targetPlatform;
@@ -1072,7 +1078,7 @@ fs::path ofAddon::fixPath(const fs::path & path) {
10721078
if (path.is_absolute()) {
10731079
return path;
10741080
}
1075-
1081+
10761082
return path;
10771083

10781084
// alert ("ow::pathToProject " + pathToProject.string(), 31);
@@ -1083,6 +1089,6 @@ fs::path ofAddon::fixPath(const fs::path & path) {
10831089
// return (( pathToProject / fs::relative(path, pathToProject) ).parent_path() / path.filename());
10841090
// }else{
10851091
// return (( pathToOF / fs::relative(path, getOFRoot()) ).parent_path() / path.filename());
1086-
//
1092+
//
10871093
// }
10881094
}

0 commit comments

Comments
 (0)