Skip to content

Commit 6747851

Browse files
danoli3dimitre
andauthored
iOS targets fix (#605)
* iOS targets fix * now PG can add .storyboards from src folders adding correctly to copy bundle resources (cherry picked from commit 9843883) --------- Co-authored-by: Dimitre <[email protected]>
1 parent e26fae1 commit 6747851

File tree

6 files changed

+24
-39
lines changed

6 files changed

+24
-39
lines changed

commandLine/src/addons/ofAddon.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,14 @@ void ofAddon::addToFolder(const fs::path& path, const fs::path & parentFolder){
773773
filesToFolders[path] = folder;
774774
}
775775

776+
777+
void ofAddon::prepareForWrite() {
778+
removeDuplicates(libs);
779+
removeDuplicates(libFiles);
780+
removeDuplicates(frameworks);
781+
removeDuplicates(xcframeworks);
782+
}
783+
776784
void ofAddon::parseLibsPath(const fs::path & libsPath, const fs::path & parentFolder) {
777785
if (!fs::exists(libsPath)) {
778786
// alert("file not found " + libsPath.string(), 35);
@@ -781,7 +789,7 @@ void ofAddon::parseLibsPath(const fs::path & libsPath, const fs::path & parentFo
781789
// alert ("parseLibsPath " + libsPath.string() + ", parent=" + parentFolder.string(), 35);
782790

783791

784-
if (platform == "osx" || platform == "macos"){
792+
if (platform == "osx" || platform == "macos" || platform == "ios" || platform == "tvos"){
785793
// Horrible hack to make it work with the bad idea of renaming osx to macos
786794
getLibsRecursively(libsPath, libFiles, libs, "macos");
787795
getLibsRecursively(libsPath, libFiles, libs, "osx");
@@ -802,15 +810,6 @@ void ofAddon::parseLibsPath(const fs::path & libsPath, const fs::path & parentFo
802810
getLibsRecursively(libsPath, libFiles, libs, platform);
803811
}
804812

805-
if (//platform == "osx" ||
806-
platform == "ios" ||
807-
platform == "tvos"){//} ||
808-
//platform == "macos"){
809-
810-
getFrameworksRecursively(libsPath, platform);
811-
// getXCFrameworksRecursively(libsPath, platform);
812-
}
813-
814813
if (platform == "vs" || platform == "msys2"
815814
|| platform == "vscode"
816815
|| platform == "linux"

commandLine/src/addons/ofAddon.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,32 @@ const vector<string> parseStates {
2525
"common",
2626
"linux",
2727
"linux64",
28+
"linux/64",
2829
"msys2",
2930
"vs",
3031
"linuxarmv6l",
3132
"linuxarmv7l",
3233
"linuxaarch64",
34+
"linux/armv6l",
35+
"linux/armv7l",
36+
"linux/aarch64",
37+
"linux/arm64",
3338
"android/armeabi",
3439
"android/armeabi-v7a",
3540
"android/arm64-v8a",
3641
"android/x86",
3742
"android/x86_64",
3843
"emscripten",
44+
"emscripten/32",
45+
"emscripten/64",
3946
"android",
4047
"ios",
4148
"osx",
4249
"tvos",
4350
"macos",
4451
"watchos",
4552
"visionos",
53+
"catos",
4654
};
4755

4856

@@ -136,6 +144,7 @@ class ofAddon {
136144

137145
bool load(string addonName, const fs::path& projectDir, const string& targetPlatform);
138146

147+
void prepareForWrite();
139148

140149
void clear();
141150

commandLine/src/projects/baseProject.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,8 @@ void baseProject::addAddon(ofAddon & addon){
531531
return;
532532
}
533533
}
534+
535+
addon.prepareForWrite();
534536

535537
/*
536538
@@ -561,6 +563,7 @@ void baseProject::addAddon(ofAddon & addon){
561563
}
562564
// alert("---> dependencies");
563565
addons.emplace_back(addon);
566+
564567

565568
//ofLogVerbose("baseProject") << "libs in addAddon " << addon.libs.size();
566569

@@ -583,7 +586,6 @@ void baseProject::addAddon(ofAddon & addon){
583586

584587
addAddonDefines(addon);
585588
addAddonFrameworks(addon);
586-
// addAddonXCFrameworks(addon);
587589
copyAddonData(addon);
588590
addAddonProps(addon);
589591
}

commandLine/src/projects/xcodeProject.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,10 @@ void xcodeProject::addAddonFrameworks(const ofAddon& addon){
648648
ofLogVerbose("xcodeProject::addAddonFrameworks") << addon.name;
649649

650650
std::vector <std::string> allFrameworks;
651+
651652
allFrameworks.reserve( addon.frameworks.size() + addon.xcframeworks.size() );
652653
allFrameworks.insert( allFrameworks.end(), addon.frameworks.begin(), addon.frameworks.end() );
653-
allFrameworks.insert( allFrameworks.end(), addon.xcframeworks.begin(), addon.xcframeworks.end() );
654+
// allFrameworks.insert( allFrameworks.end(), addon.xcframeworks.begin(), addon.xcframeworks.end() );
654655

655656
for (auto & f : allFrameworks) {
656657
// for (auto & f : addon.frameworks) {

commandLine/src/utils/Utils.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -638,28 +638,3 @@ bool containsSourceFiles(const fs::path& dir) {
638638
ofLogVerbose() << "No source files found in directory: [" << dir.string() << "]";
639639
return false;
640640
}
641-
642-
643-
// fs::path ofRelativeToOFPATH(const fs::path& path) {
644-
// try {
645-
// fs::path normalized_path = path;
646-
// std::string path_str = normalized_path.string();
647-
// #ifdef TARGET_WIN32
648-
// std::regex relative_pattern(R"((\.\.\\\.\.\\\.\.\\)|(\.\.\\\.\.\\\.\.))");
649-
// #else
650-
// std::regex relative_pattern(R"((\.\.\/\.\.\/\.\.\/))");
651-
// #endif
652-
// path_str = std::regex_replace(path_str, relative_pattern, "$(OF_PATH)/");
653-
// #ifdef TARGET_WIN32
654-
// fixSlashOrderPath(normalized_path);
655-
// #endif
656-
// return normalized_path;
657-
// } catch (const std::exception& ex) {
658-
// std::cout << "Canonical path for [" << path << "] threw exception:\n"
659-
// << ex.what() << '\n';
660-
// return fs::path("");
661-
// }
662-
// }
663-
664-
665-

commandLine/src/utils/Utils.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ static std::map <ofTargetPlatform, std::string> platformsToString {
3131
{ OF_TARGET_ANDROID, "android" },
3232
// { OF_TARGET_EMSCRIPTEN, "" },
3333
{ OF_TARGET_IOS, "ios" },
34+
{ OF_TARGET_IOS, "tvos" },
3435
{ OF_TARGET_MACOS, "macos" },
3536
{ OF_TARGET_LINUX, "linux" },
3637
{ OF_TARGET_LINUX64, "linux64" },
@@ -150,8 +151,6 @@ std::string normalizePath(const std::string& path);
150151
fs::path normalizePath(const fs::path& path);
151152

152153
bool containsSourceFiles(const fs::path& dir);
153-
// fs::path ofRelativeToOFPATH(const fs::path& path);
154-
155154
/*
156155
Idea: create an object to hold the origin and destination files, with renames where needed
157156
and string substitution, so we can avoid opening and writing multiple times the same file, less ssd wear.

0 commit comments

Comments
 (0)