Skip to content

Commit c59fac7

Browse files
committed
oF script to route update and download commands - 0.1.0 - init update / download
1 parent 16ce9c8 commit c59fac7

File tree

2 files changed

+107
-0
lines changed

2 files changed

+107
-0
lines changed

of

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# pipe commands to core oF script
2+
_OF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3+
_OF_DIR="$(realpath "$_OF_DIR")"
4+
_OF_SCRIPT="$(realpath "$_OF_DIR/scripts/of.sh")"
5+
echo "$(date): [openFrameworks: $@]"
6+
source "$_OF_SCRIPT" $@
7+
EXIT_CODE=$?
8+
exit ${EXIT_CODE}

scripts/of.sh

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/bin/bash
2+
# pipe commands to core openFrameworks scripts
3+
OF_SCRIPT_VERSION=0.1.0
4+
# Dan Rosser 2025
5+
OF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6+
OF_DIR="$(realpath "$OF_DIR/../")"
7+
OF_CORE_SCRIPT_DIR="$(realpath "$OF_DIR/scripts")"
8+
OF_CORE_CI_SCRIPT_DIR="$(realpath "$OF_DIR/scripts/ci")"
9+
OF_PG_INSTALLED_DIR="$(realpath "$OF_DIR/projectGenerator")"
10+
echo "$(date): [openFrameworks: $@]"
11+
autoDetectOS() {
12+
if [[ -z "$PLATFORM" ]]; then
13+
export OF_OS=$(uname -s | tr '[:upper:]' '[:lower:]')
14+
case "$OF_OS" in
15+
darwin | Dawin)
16+
export OF_PLATFORM="macos"
17+
export OF_ARCH=$(uname -m)
18+
;;
19+
linux | Linux)
20+
export OF_PLATFORM="linux"
21+
export OF_ARCH=$(uname -m)
22+
;;
23+
mingw* | cygwin* | msys*)
24+
export OF_PLATFORM="vs"
25+
export OF_ARCH=${MSYSTEM,,}
26+
;;
27+
*)
28+
echo "Unsupported platform: $OF_OS"
29+
exit 1
30+
;;
31+
esac
32+
else
33+
export OF_OS=$(${OF_PLATFORM} | tr '[:upper:]' '[:lower:]')
34+
export OF_ARCH=""
35+
fi
36+
}
37+
38+
coreScriptPath() {
39+
case "$OF_PLATFORM" in
40+
linux)
41+
case "$OF_ARCH" in
42+
arm64 | jetson | armv7l | armv8l | aarch64)
43+
export OF_SCRIPT_PATH="${OF_CORE_SCRIPT_DIR}/${OF_PLATFORM}/${OF_ARCH}/"
44+
;;
45+
*)
46+
export OF_SCRIPT_PATH="${OF_CORE_SCRIPT_DIR}/${OF_PLATFORM}"
47+
;;
48+
esac
49+
;;
50+
macos | vs | emscripten | msys2 | android)
51+
export OF_SCRIPT_PATH="${OF_CORE_SCRIPT_DIR}/${OF_PLATFORM}"
52+
;;
53+
*)
54+
echo " Error: Unsupported platform: $OF_PLATFORM"
55+
exit 1
56+
;;
57+
esac
58+
}
59+
60+
autoDetectOS
61+
echo " platfrom:[$OF_PLATFORM] arch:[$OF_ARCH]"
62+
coreScriptPath
63+
echo " coreScriptPath: $OF_SCRIPT_PATH"
64+
65+
runCommand() {
66+
local CMD=$1
67+
local SCRIPT
68+
case "$CMD" in
69+
setup)
70+
echo "openFrameworks setup"
71+
SCRIPT="${OF_SCRIPT_PATH}/setup.sh"
72+
;;
73+
update)
74+
echo "openFrameworks update"
75+
SCRIPT="${OF_SCRIPT_PATH}/download_libs.sh"
76+
;;
77+
*)
78+
echo "Unknown command: $command"
79+
echo "Valid commands: setup, update"
80+
exit 1
81+
;;
82+
esac
83+
if [[ -x "$SCRIPT" ]]; then
84+
echo "Executing platform-specific script: $SCRIPT"
85+
"$SCRIPT" "${@:2}"
86+
else
87+
echo "Error: Script for '$CMD' not found at $SCRIPT"
88+
exit 1
89+
fi
90+
}
91+
if [[ $# -eq 0 ]]; then
92+
echo "Usage: $0 <command> [args...]"
93+
echo "Valid commands: setup, build, clean, etc."
94+
exit 1
95+
fi
96+
runCommand $@
97+
EXIT_CODE=$?
98+
echo "$EXIT_CODE"
99+
exit ${EXIT_CODE}

0 commit comments

Comments
 (0)