-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·146 lines (114 loc) · 3.42 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·146 lines (114 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
set -e
install=false
while getopts ":i" opt; do
case ${opt} in
i )
install=true
;;
\? )
echo "Invalid Option: -$OPTARG" 1>&2
exit 1
;;
esac
done
shift $((OPTIND -1))
# -----------------------------------------------------------------------------
# Pre-flight checks: verify required tools are available
# -----------------------------------------------------------------------------
check_tool() {
if ! command -v "$1" &> /dev/null; then
echo "Error: '$1' is not installed or not in PATH."
echo "Please install $1 before running this script."
exit 1
fi
}
check_tool conan
check_tool cmake
check_tool make
# -----------------------------------------------------------------------------
build_core() {
echo "Building zerr core library..."
cd core || { echo "Failed to enter 'core' directory"; exit 1; }
conan install . --output-folder=build --build=missing
cd build || { echo "Failed to enter 'core/build' directory"; exit 1; }
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build .
echo "Installing zerr_core library to local lib folder..."
make install
cd ../.. || exit 1
}
check_core_built() {
if [ -d "core/lib" ]; then
return 0
else
return 1
fi
}
# -----------------------------------------------------------------------------
build_puredata() {
echo "Building Zerr* for Pure Data..."
cd puredata || { echo "Failed to enter 'puredata' directory"; exit 1; }
conan install . --output-folder=build --build=missing
make
if [ "$install" = true ]; then
echo "Installing Pure Data build..."
make install
fi
cd .. || exit 1
}
# -----------------------------------------------------------------------------
build_maxmsp() {
echo "Building Zerr* for Max/MSP..."
cd maxmsp || { echo "Failed to enter 'maxmsp' directory"; exit 1; }
conan install . --output-folder=build --build=missing
cd build || { echo "Failed to enter 'maxmsp/build' directory"; exit 1; }
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build .
if [ "$install" = true ]; then
echo "Installing Max/MSP build..."
make install
fi
cd ../.. || exit 1
}
# -----------------------------------------------------------------------------
build_jack() {
echo "Building Zerr* for JACK..."
cd jack || { echo "Failed to enter 'jack' directory"; exit 1; }
meson setup builddir --wipe 2>/dev/null || meson setup builddir
meson compile -C builddir
if [ "$install" = true ]; then
echo "Installing JACK build..."
meson install -C builddir
fi
cd .. || exit 1
}
# -----------------------------------------------------------------------------
if [ $# -eq 0 ]; then
echo "No targets provided. Usage: $0 [-i] <puredata|maxmsp|jack>"
exit 1
fi
# Build core if needed
if check_core_built; then
echo "Core already built. Skipping core build."
else
build_core
fi
# Build the requested targets
for target in "$@"; do
case $target in
puredata)
build_puredata
;;
maxmsp)
build_maxmsp
;;
jack)
build_jack
;;
*)
echo "Invalid target: $target. Valid options are: puredata, maxmsp, jack"
exit 1
;;
esac
done