From e17b782dffb7bdc3f2a470dda2649c6938b07a74 Mon Sep 17 00:00:00 2001 From: Dimitre Date: Fri, 7 Jun 2024 14:27:59 -0300 Subject: [PATCH 1/8] up --- commandLine/src/projects/xcodeProject.cpp | 2 +- commandLine/src/projects/xcodeProject.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/commandLine/src/projects/xcodeProject.cpp b/commandLine/src/projects/xcodeProject.cpp index 572e393e..abc20dcf 100644 --- a/commandLine/src/projects/xcodeProject.cpp +++ b/commandLine/src/projects/xcodeProject.cpp @@ -784,7 +784,7 @@ bool xcodeProject::saveProjectFile(){ // debugCommands = true; addCommand("# ---- PG VERSION " + getPGVersion()); - addCommand("Add :_openFrameworksProjectGeneratorVersion string " + getPGVersion()); + addCommand("Add :a_OFProjectGeneratorVersion string " + getPGVersion()); fileProperties fp; // fp.isGroupWithoutFolder = true; diff --git a/commandLine/src/projects/xcodeProject.h b/commandLine/src/projects/xcodeProject.h index 38c27441..31773bb1 100644 --- a/commandLine/src/projects/xcodeProject.h +++ b/commandLine/src/projects/xcodeProject.h @@ -98,6 +98,7 @@ class xcodeProject : public baseProject { std::map extensionToFileType { { ".framework" , "wrapper.framework" }, + { ".xcframework" , "wrapper.framework" }, { ".dylib" , "compiled.mach-o.dylib" }, { ".cpp" , "sourcecode.cpp.cpp" }, From 7a81c642ce3c16bd30c7653a8eec22481514a74e Mon Sep 17 00:00:00 2001 From: Dimitre Date: Fri, 7 Jun 2024 14:30:04 -0300 Subject: [PATCH 2/8] up --- commandLine/src/projects/xcodeProject.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commandLine/src/projects/xcodeProject.cpp b/commandLine/src/projects/xcodeProject.cpp index abc20dcf..a6d0ac0f 100644 --- a/commandLine/src/projects/xcodeProject.cpp +++ b/commandLine/src/projects/xcodeProject.cpp @@ -719,7 +719,8 @@ string xcodeProject::addFile(const fs::path & path, const fs::path & folder, con } if (fp.copyFilesBuildPhase) { - if (path.extension() == ".framework") { + // If we are going to add xcframeworks to copy files -> destination frameworks, we should include here + if (path.extension() == ".framework" || path.extension() == ".xcframework") { // copy to frameworks addCommand("# ---- copyPhase Frameworks " + buildUUID); addCommand("Add :objects:E4C2427710CC5ABF004149E2:files: string " + buildUUID); From dc9c2e5a864cb20ff15c78cb50bf0d6e6b7f1a78 Mon Sep 17 00:00:00 2001 From: Dimitre Date: Fri, 7 Jun 2024 14:39:48 -0300 Subject: [PATCH 3/8] dan comments --- commandLine/src/projects/xcodeProject.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commandLine/src/projects/xcodeProject.cpp b/commandLine/src/projects/xcodeProject.cpp index a6d0ac0f..9c4d6108 100644 --- a/commandLine/src/projects/xcodeProject.cpp +++ b/commandLine/src/projects/xcodeProject.cpp @@ -418,6 +418,7 @@ void xcodeProject::addXCFramework(const fs::path & path, const fs::path & folder addCommand("# ----- addXCFramework path=" + ofPathToString(path) + " folder=" + ofPathToString(folder)); + // FIXME: Hey Dan I've noticed this has the inverted logic of isSystemFramework in the function addFramework bool isSystemFramework = false; if (!folder.empty() && !ofIsStringInString(ofPathToString(path), "/System/Library/Frameworks") && target != "ios"){ @@ -438,6 +439,7 @@ void xcodeProject::addXCFramework(const fs::path & path, const fs::path & folder string parent { ofPathToString(path.parent_path()) }; for (auto & c : buildConfigs) { + // FIXME: Dan Maybe there is a typo here in XFRAMEWORK addCommand("Add :objects:" + c + ":buildSettings:XFRAMEWORK_SEARCH_PATHS: string " + parent); } } @@ -720,7 +722,9 @@ string xcodeProject::addFile(const fs::path & path, const fs::path & folder, con if (fp.copyFilesBuildPhase) { // If we are going to add xcframeworks to copy files -> destination frameworks, we should include here - if (path.extension() == ".framework" || path.extension() == ".xcframework") { +// if (path.extension() == ".framework" || path.extension() == ".xcframework") { + // This now includes both .framework and .xcframework + if (fileType == "wrapper.framework") { // copy to frameworks addCommand("# ---- copyPhase Frameworks " + buildUUID); addCommand("Add :objects:E4C2427710CC5ABF004149E2:files: string " + buildUUID); From d3e8a52327dcb820ed283a7b043f49967a7c4d32 Mon Sep 17 00:00:00 2001 From: Dimitre Date: Fri, 7 Jun 2024 17:15:23 -0300 Subject: [PATCH 4/8] v bump --- commandLine/src/projects/baseProject.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commandLine/src/projects/baseProject.h b/commandLine/src/projects/baseProject.h index 6022ede4..97630e25 100644 --- a/commandLine/src/projects/baseProject.h +++ b/commandLine/src/projects/baseProject.h @@ -1,6 +1,6 @@ #pragma once -#define PG_VERSION "45" +#define PG_VERSION "46" #include "ofAddon.h" #include "pugixml.hpp" From 1fb85c751ef343fb88c4b1ef0349f7341fe31248 Mon Sep 17 00:00:00 2001 From: Dan Rosser Date: Sat, 8 Jun 2024 16:40:10 +1000 Subject: [PATCH 5/8] Scripts fixing copying attributes of signing when we need it Fix not copying / removing built commandLine PG into app dir if exists / clean --- scripts/osx/build_frontend.sh | 17 ++++++++++++----- scripts/osx/ci_build_pg.sh | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/osx/build_frontend.sh b/scripts/osx/build_frontend.sh index b3c4548b..535afd28 100755 --- a/scripts/osx/build_frontend.sh +++ b/scripts/osx/build_frontend.sh @@ -29,14 +29,21 @@ fi SOURCE_FILE="${PG_DIR}/commandLine/bin/projectGenerator" # Replace [destination_path] with the actual path where you want to copy the file -DESTINATION_PATH="app/" +DESTINATION_PATH="app" echo "SOURCE_FILE:$SOURCE_FILE"; + + # Check if the source file exists if [ -f "$SOURCE_FILE" ]; then - # File exists, proceed with copying - mkdir -p "$DESTINATION_PATH" # Create destination directory if it doesn't exist - cp "$SOURCE_FILE" "$DESTINATION_PATH" - echo "File copied successfully." + echo "File exists, proceed with copying" + echo "check destination:[$DESTINATION_PATH/projectGenerator]" + if [ -f "${DESTINATION_PATH}/projectGenerator" ]; then + echo "projectGenerator File exists at DESTINATION_PATH - rm old" + rm -f "${DESTINATION_PATH}/projectGenerator" + fi + mkdir -p "$DESTINATION_PATH" # Create destination directory if it doesn't exist + cp -X "$SOURCE_FILE" "$DESTINATION_PATH/" + echo "File copied successfully." else # File does not exist echo "Error: Source file does not exist." diff --git a/scripts/osx/ci_build_pg.sh b/scripts/osx/ci_build_pg.sh index 8f31e256..34b139f3 100755 --- a/scripts/osx/ci_build_pg.sh +++ b/scripts/osx/ci_build_pg.sh @@ -47,7 +47,7 @@ package_app(){ ls echo "-------------" #echo "copy cmdline PG to " - cp commandLine/bin/projectGenerator projectGenerator-$PLATFORM/projectGenerator.app/Contents/Resources/app/app/projectGenerator 2> /dev/null + cp -X commandLine/bin/projectGenerator projectGenerator-$PLATFORM/projectGenerator.app/Contents/Resources/app/app/projectGenerator 2> /dev/null cd ${PG_DIR} pwd echo "Directory contents:" From 6d3cc536e05325eee0542b5089324257ea2f9035 Mon Sep 17 00:00:00 2001 From: Dan Rosser Date: Sat, 8 Jun 2024 16:40:32 +1000 Subject: [PATCH 6/8] Set to Utility for Apple --- commandLine/commandLine.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/commandLine/commandLine.xcodeproj/project.pbxproj b/commandLine/commandLine.xcodeproj/project.pbxproj index d6cda2e6..3f356177 100644 --- a/commandLine/commandLine.xcodeproj/project.pbxproj +++ b/commandLine/commandLine.xcodeproj/project.pbxproj @@ -408,6 +408,7 @@ src/uuidxx/license, src/uuidxx/src, ); + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; LIBRARY_SEARCH_PATHS = "$(inherited)"; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( @@ -435,6 +436,7 @@ src/uuidxx/license, src/uuidxx/src, ); + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; LIBRARY_SEARCH_PATHS = "$(inherited)"; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( From ba18fa2c8efc8ba4edf59139a753d4e19be4129a Mon Sep 17 00:00:00 2001 From: Dan Rosser Date: Sat, 8 Jun 2024 16:40:47 +1000 Subject: [PATCH 7/8] XCFrameworks fixing --- commandLine/src/projects/xcodeProject.cpp | 22 +++++++--------------- commandLine/src/projects/xcodeProject.h | 2 +- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/commandLine/src/projects/xcodeProject.cpp b/commandLine/src/projects/xcodeProject.cpp index 9c4d6108..3281ba8e 100644 --- a/commandLine/src/projects/xcodeProject.cpp +++ b/commandLine/src/projects/xcodeProject.cpp @@ -418,17 +418,11 @@ void xcodeProject::addXCFramework(const fs::path & path, const fs::path & folder addCommand("# ----- addXCFramework path=" + ofPathToString(path) + " folder=" + ofPathToString(folder)); - // FIXME: Hey Dan I've noticed this has the inverted logic of isSystemFramework in the function addFramework - bool isSystemFramework = false; - if (!folder.empty() && !ofIsStringInString(ofPathToString(path), "/System/Library/Frameworks") - && target != "ios"){ - isSystemFramework = true; - } fileProperties fp; // fp.addToBuildPhase = true; - fp.codeSignOnCopy = !isSystemFramework; - fp.copyFilesBuildPhase = !isSystemFramework; + fp.codeSignOnCopy = true; + fp.copyFilesBuildPhase = true; fp.frameworksBuildPhase = (target != "ios" && !folder.empty()); string UUID { @@ -439,8 +433,7 @@ void xcodeProject::addXCFramework(const fs::path & path, const fs::path & folder string parent { ofPathToString(path.parent_path()) }; for (auto & c : buildConfigs) { - // FIXME: Dan Maybe there is a typo here in XFRAMEWORK - addCommand("Add :objects:" + c + ":buildSettings:XFRAMEWORK_SEARCH_PATHS: string " + parent); + addCommand("Add :objects:" + c + ":buildSettings:XCFRAMEWORK_SEARCH_PATHS: string " + parent); } } @@ -613,14 +606,13 @@ void xcodeProject::addAddon(ofAddon & addon){ folder = addon.addonPath / "xcframeworks"; } // MARK: Is this ok to call .framework? - addXCFramework("/System/Library/Frameworks/" + f + ".framework", folder); + addXCFramework("/System/Library/Frameworks/" + f + ".xcframework", folder); } else { if (ofIsStringInString(f, "/System/Library")) { - addFramework(f, "addons/" + addon.name + "/frameworks"); - + addXCFramework(f, "addons/" + addon.name + "/xcframeworks"); } else { - addFramework(f, addon.filesToFolders[f]); + addXCFramework(f, addon.filesToFolders[f]); } } } @@ -724,7 +716,7 @@ string xcodeProject::addFile(const fs::path & path, const fs::path & folder, con // If we are going to add xcframeworks to copy files -> destination frameworks, we should include here // if (path.extension() == ".framework" || path.extension() == ".xcframework") { // This now includes both .framework and .xcframework - if (fileType == "wrapper.framework") { + if (fileType == "wrapper.framework" || fileType == ".xcframework") { // copy to frameworks addCommand("# ---- copyPhase Frameworks " + buildUUID); addCommand("Add :objects:E4C2427710CC5ABF004149E2:files: string " + buildUUID); diff --git a/commandLine/src/projects/xcodeProject.h b/commandLine/src/projects/xcodeProject.h index 31773bb1..d56600e7 100644 --- a/commandLine/src/projects/xcodeProject.h +++ b/commandLine/src/projects/xcodeProject.h @@ -98,7 +98,7 @@ class xcodeProject : public baseProject { std::map extensionToFileType { { ".framework" , "wrapper.framework" }, - { ".xcframework" , "wrapper.framework" }, + { ".xcframework" , "wrapper.xcframework" }, { ".dylib" , "compiled.mach-o.dylib" }, { ".cpp" , "sourcecode.cpp.cpp" }, From 066139579fdf105f155977c68ec389e67320aa0e Mon Sep 17 00:00:00 2001 From: Dan Rosser Date: Sat, 8 Jun 2024 17:26:54 +1000 Subject: [PATCH 8/8] Fixes for xattrib xcode bin clean issue --- commandLine/src/projects/xcodeProject.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/commandLine/src/projects/xcodeProject.cpp b/commandLine/src/projects/xcodeProject.cpp index 3281ba8e..2ec0616f 100644 --- a/commandLine/src/projects/xcodeProject.cpp +++ b/commandLine/src/projects/xcodeProject.cpp @@ -6,6 +6,9 @@ #else #include // MSYS2 : use of system-installed include #endif +#ifdef __APPLE__ +#include // std::system +#endif #include using nlohmann::json; @@ -134,10 +137,26 @@ bool xcodeProject::createProjectFile(){ // originally only on IOS //this is needed for 0.9.3 / 0.9.4 projects which have iOS media assets in bin/data/ // TODO: Test on IOS + fs::path templateBinDir { templatePath / "bin" }; fs::path templateDataDir { templatePath / "bin" / "data" }; if (fs::exists(templateDataDir) && fs::is_directory(templateDataDir)) { baseProject::recursiveCopyContents(templateDataDir, projectDataDir); } + if (fs::exists(templateBinDir) && fs::is_directory(templateBinDir)) { +#ifdef __APPLE__ + try { + // extended attributes on macOS + std::string command = "xattr -w com.apple.xcode.CreatedByBuildSystem true " + templateBinDir.string(); + if (std::system(command.c_str()) != 0) { + std::cerr << "Failed to set extended attributes on " << templateBinDir.string() << std::endl; + } else { + std::cout << "xattr set correctly for bin" << endl; + } + } catch (const std::exception& e) { + std::cout << e.what() << std::endl; + } +#endif + } } return true;