Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions commandLine/commandLine.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down Expand Up @@ -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 = (
Expand Down
2 changes: 1 addition & 1 deletion commandLine/src/projects/baseProject.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#define PG_VERSION "45"
#define PG_VERSION "46"

#include "ofAddon.h"
#include "pugixml.hpp"
Expand Down
44 changes: 30 additions & 14 deletions commandLine/src/projects/xcodeProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#else
#include <nlohmann/json.hpp> // MSYS2 : use of system-installed include
#endif
#ifdef __APPLE__
#include <cstdlib> // std::system
#endif
#include <iostream>

using nlohmann::json;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -418,16 +437,11 @@ void xcodeProject::addXCFramework(const fs::path & path, const fs::path & folder

addCommand("# ----- addXCFramework path=" + ofPathToString(path) + " folder=" + ofPathToString(folder));

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 {
Expand All @@ -438,7 +452,7 @@ void xcodeProject::addXCFramework(const fs::path & path, const fs::path & folder
string parent { ofPathToString(path.parent_path()) };

for (auto & c : buildConfigs) {
addCommand("Add :objects:" + c + ":buildSettings:XFRAMEWORK_SEARCH_PATHS: string " + parent);
addCommand("Add :objects:" + c + ":buildSettings:XCFRAMEWORK_SEARCH_PATHS: string " + parent);
}
}

Expand Down Expand Up @@ -611,14 +625,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]);
}
}
}
Expand Down Expand Up @@ -719,7 +732,10 @@ 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") {
// This now includes both .framework and .xcframework
if (fileType == "wrapper.framework" || fileType == ".xcframework") {
// copy to frameworks
addCommand("# ---- copyPhase Frameworks " + buildUUID);
addCommand("Add :objects:E4C2427710CC5ABF004149E2:files: string " + buildUUID);
Expand Down Expand Up @@ -784,7 +800,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;
Expand Down
1 change: 1 addition & 0 deletions commandLine/src/projects/xcodeProject.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class xcodeProject : public baseProject {

std::map<fs::path, string> extensionToFileType {
{ ".framework" , "wrapper.framework" },
{ ".xcframework" , "wrapper.xcframework" },
{ ".dylib" , "compiled.mach-o.dylib" },

{ ".cpp" , "sourcecode.cpp.cpp" },
Expand Down
17 changes: 12 additions & 5 deletions scripts/osx/build_frontend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion scripts/osx/ci_build_pg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand Down