6
6
#else
7
7
#include < nlohmann/json.hpp> // MSYS2 : use of system-installed include
8
8
#endif
9
+ #ifdef __APPLE__
10
+ #include < cstdlib> // std::system
11
+ #endif
9
12
#include < iostream>
10
13
11
14
using nlohmann::json;
@@ -134,10 +137,26 @@ bool xcodeProject::createProjectFile(){
134
137
// originally only on IOS
135
138
// this is needed for 0.9.3 / 0.9.4 projects which have iOS media assets in bin/data/
136
139
// TODO: Test on IOS
140
+ fs::path templateBinDir { templatePath / " bin" };
137
141
fs::path templateDataDir { templatePath / " bin" / " data" };
138
142
if (fs::exists (templateDataDir) && fs::is_directory (templateDataDir)) {
139
143
baseProject::recursiveCopyContents (templateDataDir, projectDataDir);
140
144
}
145
+ if (fs::exists (templateBinDir) && fs::is_directory (templateBinDir)) {
146
+ #ifdef __APPLE__
147
+ try {
148
+ // extended attributes on macOS
149
+ std::string command = " xattr -w com.apple.xcode.CreatedByBuildSystem true " + templateBinDir.string ();
150
+ if (std::system (command.c_str ()) != 0 ) {
151
+ std::cerr << " Failed to set extended attributes on " << templateBinDir.string () << std::endl;
152
+ } else {
153
+ std::cout << " xattr set correctly for bin" << endl;
154
+ }
155
+ } catch (const std::exception & e) {
156
+ std::cout << e.what () << std::endl;
157
+ }
158
+ #endif
159
+ }
141
160
}
142
161
143
162
return true ;
@@ -418,16 +437,11 @@ void xcodeProject::addXCFramework(const fs::path & path, const fs::path & folder
418
437
419
438
addCommand (" # ----- addXCFramework path=" + ofPathToString (path) + " folder=" + ofPathToString (folder));
420
439
421
- bool isSystemFramework = false ;
422
- if (!folder.empty () && !ofIsStringInString (ofPathToString (path), " /System/Library/Frameworks" )
423
- && target != " ios" ){
424
- isSystemFramework = true ;
425
- }
426
440
427
441
fileProperties fp;
428
442
// fp.addToBuildPhase = true;
429
- fp.codeSignOnCopy = !isSystemFramework ;
430
- fp.copyFilesBuildPhase = !isSystemFramework ;
443
+ fp.codeSignOnCopy = true ;
444
+ fp.copyFilesBuildPhase = true ;
431
445
fp.frameworksBuildPhase = (target != " ios" && !folder.empty ());
432
446
433
447
string UUID {
@@ -438,7 +452,7 @@ void xcodeProject::addXCFramework(const fs::path & path, const fs::path & folder
438
452
string parent { ofPathToString (path.parent_path ()) };
439
453
440
454
for (auto & c : buildConfigs) {
441
- addCommand (" Add :objects:" + c + " :buildSettings:XFRAMEWORK_SEARCH_PATHS : string " + parent);
455
+ addCommand (" Add :objects:" + c + " :buildSettings:XCFRAMEWORK_SEARCH_PATHS : string " + parent);
442
456
}
443
457
}
444
458
@@ -611,14 +625,13 @@ void xcodeProject::addAddon(ofAddon & addon){
611
625
folder = addon.addonPath / " xcframeworks" ;
612
626
}
613
627
// MARK: Is this ok to call .framework?
614
- addXCFramework (" /System/Library/Frameworks/" + f + " .framework " , folder);
628
+ addXCFramework (" /System/Library/Frameworks/" + f + " .xcframework " , folder);
615
629
616
630
} else {
617
631
if (ofIsStringInString (f, " /System/Library" )) {
618
- addFramework (f, " addons/" + addon.name + " /frameworks" );
619
-
632
+ addXCFramework (f, " addons/" + addon.name + " /xcframeworks" );
620
633
} else {
621
- addFramework (f, addon.filesToFolders [f]);
634
+ addXCFramework (f, addon.filesToFolders [f]);
622
635
}
623
636
}
624
637
}
@@ -719,7 +732,10 @@ string xcodeProject::addFile(const fs::path & path, const fs::path & folder, con
719
732
}
720
733
721
734
if (fp.copyFilesBuildPhase ) {
722
- if (path.extension () == " .framework" ) {
735
+ // If we are going to add xcframeworks to copy files -> destination frameworks, we should include here
736
+ // if (path.extension() == ".framework" || path.extension() == ".xcframework") {
737
+ // This now includes both .framework and .xcframework
738
+ if (fileType == " wrapper.framework" || fileType == " .xcframework" ) {
723
739
// copy to frameworks
724
740
addCommand (" # ---- copyPhase Frameworks " + buildUUID);
725
741
addCommand (" Add :objects:E4C2427710CC5ABF004149E2:files: string " + buildUUID);
@@ -784,7 +800,7 @@ bool xcodeProject::saveProjectFile(){
784
800
// debugCommands = true;
785
801
786
802
addCommand (" # ---- PG VERSION " + getPGVersion ());
787
- addCommand (" Add :_openFrameworksProjectGeneratorVersion string " + getPGVersion ());
803
+ addCommand (" Add :a_OFProjectGeneratorVersion string " + getPGVersion ());
788
804
789
805
fileProperties fp;
790
806
// fp.isGroupWithoutFolder = true;
0 commit comments