Skip to content

Commit

Permalink
Xcode project updates, fix for ios, try catch on parser, local signin… (
Browse files Browse the repository at this point in the history
#537)

* Xcode project updates, fix for ios, try catch on parser, local signing for devs

* test_cmdline ios
  • Loading branch information
danoli3 authored Jul 7, 2024
1 parent 7cc1d65 commit 6181319
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 18 deletions.
5 changes: 3 additions & 2 deletions commandLine/App.xcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
OF_NO_FMOD = 1

OF_CORE_LIBS = $(LIB_GLEW) $(LIB_PUGIXML)
OF_CORE_HEADERS = $(HEADER_OF) $(HEADER_GLEW) $(HEADER_TESS2) $(HEADER_GLFW) $(HEADER_UTF8) $(HEADER_JSON) $(HEADER_GLM) $(HEADER_PUGIXML)
OF_CORE_FRAMEWORKS = -framework Accelerate -framework Cocoa -framework CoreFoundation -framework CoreServices -framework CoreVideo -framework IOKit -framework OpenGL -framework QuartzCore -framework Security -framework AVFAudio -framework Foundation -framework SystemConfiguration
OF_CORE_HEADERS = $(HEADER_OF) $(HEADER_FREETYPE) $(HEADER_FREETYPE2) $(HEADER_FMOD) $(HEADER_GLEW) $(HEADER_FREEIMAGE) $(HEADER_TESS2) $(HEADER_CAIRO) $(HEADER_RTAUDIO) $(HEADER_GLFW) $(HEADER_UTF8) $(HEADER_JSON) $(HEADER_GLM) $(HEADER_CURL) ${HEADER_SSL} $(HEADER_URIPARSER) $(HEADER_PUGIXML) ${HEADER_BROTLI}
OF_CORE_FRAMEWORKS = -framework Accelerate -framework AGL -framework AppKit -framework ApplicationServices -framework AudioToolbox -framework AVFoundation -framework Cocoa -framework CoreAudio -framework CoreFoundation -framework CoreMedia -framework CoreServices -framework CoreVideo -framework Foundation -framework IOKit -framework OpenGL -framework QuartzCore -framework Security -framework SystemConfiguration -framework Metal
10 changes: 10 additions & 0 deletions commandLine/commandLine.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,11 @@
baseConfigurationReference = E4EB6923138AFD0F00A09F29 /* Project.xcconfig */;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_DYNAMIC_NO_PIC = NO;
HEADER_SEARCH_PATHS = (
Expand All @@ -416,6 +420,7 @@
"$(OF_CORE_FRAMEWORKS)",
"$(LIB_OF_DEBUG)",
);
PROVISIONING_PROFILE_SPECIFIER = "";
};
name = Debug;
};
Expand All @@ -424,7 +429,11 @@
baseConfigurationReference = E4EB6923138AFD0F00A09F29 /* Project.xcconfig */;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = YES;
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
HEADER_SEARCH_PATHS = (
"$(OF_CORE_HEADERS)",
Expand All @@ -444,6 +453,7 @@
"$(OF_CORE_FRAMEWORKS)",
"$(LIB_OF)",
);
PROVISIONING_PROFILE_SPECIFIER = "";
baseConfigurationReference = E4EB6923138AFD0F00A09F29;
};
name = Release;
Expand Down
4 changes: 3 additions & 1 deletion commandLine/src/projects/baseProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fs::path baseProject::getPlatformTemplateDir() {
) {
folder = "vscode";
}
// if ( target == "qtcreator" ) {
// return getOFRoot()
// }
Expand Down Expand Up @@ -139,6 +139,8 @@ bool baseProject::create(const fs::path & path, string templateName){
extSrcPaths.clear();

templatePath = getPlatformTemplateDir();

ofLogNotice() << "templatePath: [" << templatePath << "]";
projectDir = path;
auto projectPath = fs::canonical(fs::current_path() / path);
projectName = projectPath.filename().string();
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 "55"
#define PG_VERSION "56"

#include "ofAddon.h"
#include "pugixml.hpp"
Expand Down
42 changes: 29 additions & 13 deletions commandLine/src/projects/xcodeProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
using nlohmann::json;
using nlohmann::json_pointer;

string xcodeProject::LOG_NAME = "xcodeProjectFile";

xcodeProject::xcodeProject(const string & target) : baseProject(target){
// TODO: remove unused variables
if( target == "osx" ){
Expand Down Expand Up @@ -384,7 +386,7 @@ void xcodeProject::addSrc(const fs::path & srcFile, const fs::path & folder, Src
fp.addToResources = true;
}
else if( target == "ios" ){
fp.addToBuildPhase = false;
fp.addToBuildPhase = true;
fp.addToResources = true;
}
}
Expand Down Expand Up @@ -835,7 +837,14 @@ bool xcodeProject::saveProjectFile(){
// JSON Block - Multiplatform

std::ifstream contents(fileName);
json j { json::parse(contents) };
json j;
try {
j = { json::parse(contents) };
} catch (json::parse_error& ex) {
ofLogError(xcodeProject::LOG_NAME) << "JSON parse error at byte" << ex.byte;
ofLogError(xcodeProject::LOG_NAME) << "fileName" << fileName;
}

contents.close();

json jversion = getPGVersion();
Expand All @@ -851,16 +860,22 @@ bool xcodeProject::saveProjectFile(){

if (thispath.substr(thispath.length() -1) != "/") {
//if (cols[0] == "Set") {
json::json_pointer p { json::json_pointer(thispath) };
if (cols[2] == "string") {
// find position after find word
auto stringStart { c.find("string ") + 7 };
j[p] = c.substr(stringStart);
// j[p] = cols[3];
}
else if (cols[2] == "array") {
j[p] = {};
}
try {
json::json_pointer p { json::json_pointer(thispath) };
if (cols[2] == "string") {
// find position after find word
auto stringStart { c.find("string ") + 7 };
j[p] = c.substr(stringStart);
// j[p] = cols[3];
}
else if (cols[2] == "array") {
j[p] = {};
}
} catch (std::exception & e) {
cout << "xcodeProject saveProjectFile() first json error " << endl;
cout << e.what() << endl;
cout << " error at this path: " << thispath << endl;
}
}
else {
thispath = thispath.substr(0, thispath.length() -1);
Expand All @@ -878,8 +893,9 @@ bool xcodeProject::saveProjectFile(){
j[p].emplace_back(cols[3]);

} catch (std::exception & e) {
cout << "json error " << endl;
cout << "xcodeProject saveProjectFile() json error " << endl;
cout << e.what() << endl;
cout << " error at this path: " << thispath << endl;
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions commandLine/src/projects/xcodeProject.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

using std::string;



class xcodeProject : public baseProject {
public:
xcodeProject(const string & target);
Expand All @@ -16,6 +18,8 @@ class xcodeProject : public baseProject {
bool saveProjectFile();
void saveMakefile();
bool debugCommands = false;

static std::string LOG_NAME;

public:

Expand Down
2 changes: 1 addition & 1 deletion commandLine/src/utils/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ unique_ptr<baseProject> getTargetProject(const string & targ) {
// cout << "getTargetProject :" << getTargetString(targ) << endl;
// typedef xcodeProject pgProject;

if (targ == "osx" || targ == "ios") {
if (targ == "osx" || targ == "ios" || targ == "macos") {
return unique_ptr<xcodeProject>(new xcodeProject(targ));
} else if (targ == "msys2") {
// return unique_ptr<QtCreatorProject>(new QtCreatorProject(targ));
Expand Down
1 change: 1 addition & 0 deletions commandLine/src/utils/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ static std::map <ofTargetPlatform, std::string> platformsToString {
{ OF_TARGET_ANDROID, "android" },
// { OF_TARGET_EMSCRIPTEN, "" },
{ OF_TARGET_IOS, "ios" },
{ OF_TARGET_MACOS, "macos" },
{ OF_TARGET_LINUX, "linux" },
{ OF_TARGET_LINUX64, "linux64" },
{ OF_TARGET_LINUXARMV6L, "linuxarmv6l" },
Expand Down
24 changes: 24 additions & 0 deletions scripts/ios/test_cmdline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SCRIPT_DIR="$( cd "$( dirname "${CURRENT_DIR}"/../../ )" && pwd )"
PG_DIR="$( cd "$( dirname "${SCRIPT_DIR}"/../../ )" && pwd )"
OF_DIR="$( cd "$( dirname "${SCRIPT_DIR}"/../../../../ )" && pwd )"
CMD_DIR="${PG_DIR}/commandLine"

echo "CURRENT_DIR: ${CURRENT_DIR}"
echo "SCRIPT_DIR: ${SCRIPT_DIR}"
echo "PG_DIR: ${PG_DIR}"
echo "CMD_DIR: ${CMD_DIR}"
echo "====== ${CMD_DIR}"
# Compile commandline tool
cd "${CMD_DIR}/bin"
echo "Testing project generation ios [${CMD_DIR}/bin] oF:[${OF_DIR}]";
chmod +x projectGenerator
# ./projectGenerator
# ./projectGenerator -o${OF_DIR} -p"osx" -l
./projectGenerator --recursive -p"ios" -o../../../../ ../../../../examples/ios
errorcode=$?
if [[ $errorcode -ne 0 ]]; then
exit $errorcode
fi

0 comments on commit 6181319

Please sign in to comment.