Skip to content

Commit ef863d6

Browse files
authored
fix ios xcframeworks to be like normal xcframeworks - closes openframeworks/openFrameworks#8368 (#622)
1 parent f868076 commit ef863d6

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

commandLine/src/addons/ofAddon.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515

16-
void ofAddon::getFrameworksRecursively(const fs::path & path, string platform) {
16+
void ofAddon::getFrameworksRecursively(const fs::path & path, string platform, string packageTarget) {
1717
// alert ("getFrameworksRecursively for " + platform + " : " + path.string(), 34);
1818
if (!fs::exists(path) || !fs::is_directory(path)) return;
1919

@@ -33,7 +33,7 @@ void ofAddon::getFrameworksRecursively(const fs::path & path, string platform) {
3333
frameworks.emplace_back(f.string());
3434
}
3535
if (f.extension() == ".xcframework") {
36-
if( platform != "macos" && platform != "osx" ){ //we don't want to add xcFrameworks for osx and just treat them like lib folders
36+
if( packageTarget == "ios" || packageTarget == "tvos" ){ //we don't want to add xcFrameworks for osx and just treat them like lib folders
3737
xcframeworks.emplace_back(f.string());
3838
}
3939
}
@@ -793,11 +793,13 @@ void ofAddon::parseLibsPath(const fs::path & libsPath, const fs::path & parentFo
793793

794794
if (platform == "osx" || platform == "macos" || platform == "ios" || platform == "tvos"){
795795
// Horrible hack to make it work with the bad idea of renaming osx to macos
796-
getLibsRecursively(libsPath, libFiles, libs, "macos");
797-
getLibsRecursively(libsPath, libFiles, libs, "osx");
796+
// Note: we have to pass the platform through so we can do different things for osx and ios/tvos target as they both use "macos" for some reason
797+
getLibsRecursively(libsPath, libFiles, libs, "macos", "", "", platform);
798+
getLibsRecursively(libsPath, libFiles, libs, "osx", "", "", platform);
798799

799-
getFrameworksRecursively(libsPath, "macos");
800-
getFrameworksRecursively(libsPath, "osx");
800+
// Note: we have to pass the platform through so we can do different things for osx and ios/tvos target as they both use "macos" for some reason
801+
getFrameworksRecursively(libsPath, "macos", platform);
802+
getFrameworksRecursively(libsPath, "osx", platform);
801803
// getXCFrameworksRecursively(libsPath, "macos");
802804
// getXCFrameworksRecursively(libsPath, "osx");
803805

commandLine/src/addons/ofAddon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class ofAddon {
138138
ofAddon() = default;
139139
ofAddon(const ofAddon& other);
140140

141-
void getFrameworksRecursively(const fs::path & path, string platform = "");
141+
void getFrameworksRecursively(const fs::path & path, string platform, string packageTarget = "");
142142

143143
static string cleanName(const string& name);
144144

commandLine/src/utils/Utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ void getDllsRecursively(const fs::path & path, std::vector<fs::path> & dlls, str
321321
}
322322

323323

324-
void getLibsRecursively(const fs::path & path, std::vector < fs::path > & libFiles, std::vector < LibraryBinary > & libLibs, string platform, string arch, string target) {
324+
void getLibsRecursively(const fs::path & path, std::vector < fs::path > & libFiles, std::vector < LibraryBinary > & libLibs, string platform, string arch, string target, string actualTarget ) {
325325
// alert ("getLibsRecursively " + path.string(), 34);
326326
// alert ("platform " + platform, 34);
327327
// alert ("arch " + arch, 34);
@@ -341,7 +341,7 @@ void getLibsRecursively(const fs::path & path, std::vector < fs::path > & libFil
341341

342342
if (fs::is_directory(f)) {
343343
// on osx, framework is a directory, let's not parse it....
344-
if ((f.extension() == ".framework") || (f.extension() == ".xcframework" && (platform != "osx" && platform != "macos")) ) { //we want to treat .xcframeworks as regular libs for macos
344+
if ((f.extension() == ".framework") || (f.extension() == ".xcframework" && (actualTarget != "osx" && actualTarget != "macos")) ) { //we want to treat .xcframeworks as regular libs for macos
345345
it.disable_recursion_pending();
346346
continue;
347347
}

commandLine/src/utils/Utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ int countSubdirectories(const fs::path &path);
7777
void getFoldersRecursively(const fs::path & path, std::vector < fs::path > & folderNames, string platform);
7878
void getFilesRecursively(const fs::path & path, std::vector < string > & fileNames);
7979
void getFilesRecursively(const fs::path & path, std::vector < fs::path > & fileNames);
80-
void getLibsRecursively(const fs::path & path, std::vector < fs::path > & libFiles, std::vector < LibraryBinary > & libLibs, string platform = "", string arch = "", string target = "");
80+
void getLibsRecursively(const fs::path & path, std::vector < fs::path > & libFiles, std::vector < LibraryBinary > & libLibs, string platform = "", string arch = "", string target = "", string actualTarget = "");
8181

8282
void getPropsRecursively(const fs::path & path, std::vector < fs::path > & props, const string & platform);
8383
void getDllsRecursively(const fs::path & path, std::vector < fs::path > & dlls, string platform);

0 commit comments

Comments
 (0)