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: 1 addition & 1 deletion .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
run: ./../openFrameworks/apps/projectGenerator/scripts/linux/test_cmdline.sh

- name: Build emptyExample and allAddonsExample
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/master'
shell: bash
run: ../openFrameworks/apps/projectGenerator/scripts/ci_build_examples.sh linux64

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
run: ../openFrameworks/apps/projectGenerator/scripts/osx/test_cmdline.sh

- name: Build emptyExample and allAddonsExample
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/master'
shell: bash
run: ../openFrameworks/apps/projectGenerator/scripts/ci_build_examples.sh osx

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-vs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
../openFrameworks/apps/projectGenerator/scripts/vs/test_cmdline.sh

- name: Build emptyExample and allAddonsExample
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/master'
shell: bash
run: ../openFrameworks/apps/projectGenerator/scripts/ci_build_examples.sh vs

Expand Down
2 changes: 1 addition & 1 deletion commandLine/src/defines.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define OFPROJECTGENERATOR_MAJOR_VERSION "0"
#define OFPROJECTGENERATOR_MINOR_VERSION "112"
#define OFPROJECTGENERATOR_MINOR_VERSION "113"
#define OFPROJECTGENERATOR_PATCH_VERSION "0"

#define PG_VERSION (OFPROJECTGENERATOR_MAJOR_VERSION "." OFPROJECTGENERATOR_MINOR_VERSION "." OFPROJECTGENERATOR_PATCH_VERSION)
Expand Down
275 changes: 202 additions & 73 deletions commandLine/src/projects/xcodeProject.cpp

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion commandLine/src/projects/xcodeProject.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,25 @@ class xcodeProject : public baseProject {
"E4B69B4F0A3A1720003C02F2", //macOS Release SDKROOT macosx
};

string buildConfigs[2] = {
// build configurations of every app target (both targets of the macos template)
std::vector<string> buildConfigs = {
"E4B69B610A3A1757003C02F2", //Release
"E4B69B600A3A1757003C02F2", //Debug
};

// build phases of an app target, the first one is the hard coded osx / ios one
struct appTarget {
string uuid;
string sources;
string frameworks;
string copyFrameworks;
string resources;
};
std::vector<appTarget> appTargets;
string copyFrameworksUUID { "E4C2427710CC5ABF004149E2" };
bool renameTarget = true;
void readTemplateUUIDs();

// std::unordered_map <string, string> folderUUID ;
std::map <fs::path, string> folderUUID ;
// Temporary
Expand Down
4 changes: 4 additions & 0 deletions scripts/osx/test_cmdline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ echo "Test 2: all examples - defined core openFrameworks path ../../"
./projectGenerator --recursive -posx -o../../ ../../examples/ ./projectGenerator
echo "Test 2: all examples - success"

echo "Test 3: addon defines / cflags / sources in every Xcode app target (osx, macos, ios, tvos)"
"${CURRENT_DIR}/test_xcode_addon_flags.sh" ./projectGenerator "${PG_DIR}/../.." || exit 1
echo "Test 3: addon defines / cflags / sources - success"

# echo "test out of folder -o [vs]";
# rm -rf ../../../../../pg2
# mkdir -p ../../../../../pg2
Expand Down
47 changes: 47 additions & 0 deletions scripts/osx/test_xcode_addon_flags.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
# Regression test: an addon's ADDON_DEFINES / ADDON_CFLAGS / sources end up in every app target of the
# generated Xcode projects (osx, macos with its two targets, ios, tvos), after $(inherited), once each,
# with no orphan objects (a [null] define or settings on missing UUIDs broke the build before).
# usage: test_xcode_addon_flags.sh <projectGenerator> <openFrameworks root>
set -euo pipefail
PG=$(cd "$(dirname "$1")" && pwd)/$(basename "$1")
OF=$(cd "$2" && pwd)
ADDON=ofxPGFlagsTest
ADDON_DIR="$OF/addons/$ADDON"
APPS="$OF/apps/pgFlagsTest"
command -v jq >/dev/null || { echo 'jq is required'; exit 1; }

cleanup() { rm -rf "$ADDON_DIR" "$APPS"; }
trap cleanup EXIT
cleanup
mkdir -p "$ADDON_DIR/src" "$APPS"
printf 'meta:\n\tADDON_NAME = %s\ncommon:\n\tADDON_DEFINES = FOO BAR=1\n\tADDON_CFLAGS = -DBAZ\n' "$ADDON" > "$ADDON_DIR/addon_config.mk"
printf '#pragma once\n#if !defined(FOO) || BAR != 1 || !defined(BAZ)\n#error ADDON_DEFINES / ADDON_CFLAGS not applied\n#endif\n' > "$ADDON_DIR/src/$ADDON.h"
printf '#include "%s.h"\nint %sValue() { return BAR; }\n' "$ADDON" "$ADDON" > "$ADDON_DIR/src/$ADDON.cpp"

failed=0
for platform in osx macos ios tvos; do
project="$APPS/flags_$platform"
"$PG" -o"$OF" -p"$platform" -a"$ADDON" "$project" > /dev/null
# twice, like updating an existing project: nothing may be added again
"$PG" -o"$OF" -p"$platform" -a"$ADDON" "$project" > /dev/null
pbxproj="$project/flags_$platform.xcodeproj/project.pbxproj"
errors=$(jq -r --arg src "$ADDON.cpp" '
.objects as $o
| ([$o | to_entries[] | select(.value.isa == null) | "orphan object \(.key)"]
+ [$o | to_entries[] | select(.value.isa == "PBXNativeTarget" and .value.productType == "com.apple.product-type.application") | .value as $t
| ($o[$t.buildConfigurationList].buildConfigurations[] | $o[.] as $c | $c.buildSettings as $b
| (if ($b.GCC_PREPROCESSOR_DEFINITIONS | type) != "array" or ($b.GCC_PREPROCESSOR_DEFINITIONS | map(select(type != "string")) | length) > 0 then "\($t.name) \($c.name): GCC_PREPROCESSOR_DEFINITIONS \($b.GCC_PREPROCESSOR_DEFINITIONS | tostring)" else empty end),
(["FOO", "BAR=1", "$(inherited)"][] as $d | select(($b.GCC_PREPROCESSOR_DEFINITIONS // []) | map(select(. == $d)) | length != 1) | "\($t.name) \($c.name): \($d) not once in GCC_PREPROCESSOR_DEFINITIONS \($b.GCC_PREPROCESSOR_DEFINITIONS | tostring)"),
(["OTHER_CFLAGS", "OTHER_CPLUSPLUSFLAGS"][] as $k | select(($b[$k] // []) | (type != "array") or (.[0] != "$(inherited)") or (map(select(. == "-DBAZ")) | length != 1)) | "\($t.name) \($c.name): \($k) \($b[$k] | tostring)")),
(if [$t.buildPhases[] | $o[.] | select(.isa == "PBXSourcesBuildPhase") | .files[] | $o[$o[.].fileRef].name] | index($src) then empty else "\($t.name): \($src) not in Compile Sources" end)])
| .[]' "$pbxproj")
if [[ -n $errors ]]; then
echo "FAIL [$platform]"
echo "$errors"
failed=1
else
echo "ok [$platform]"
fi
done
exit $failed
Loading