-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·90 lines (71 loc) · 2.42 KB
/
build.sh
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
#!/usr/bin/env bash
clear
# get current working directory
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
BASEDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
echo "Flushing build caches and output folders"
rm -rf build
echo "Creating build folders"
mkdir build
cd build
echo "Building project"
echo "----------------"
# env variable for VST3_SDK_ROOT set ? pass it to CMake configuration
if [ -n "${VST3_SDK_ROOT}" ]; then
DVST3_SDK_ROOT=${VST3_SDK_ROOT}
else
DVST3_SDK_ROOT="${BASEDIR}/vst3sdk"
fi
echo "Building using VST3 SDK located at ${DVST3_SDK_ROOT}"
type="vst3"
# Parse arguments
while [[ "$#" -gt 0 ]]; do
case $1 in
--type) type="$2"; shift ;;
--team_id) team_id="$2"; shift ;;
--identity) identity="$2"; shift ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done
# flag to build as VST2 supplied ? pass it to CMake configuration
if [ "$type" == "vst2" ]; then
FLAGS="-DSMTG_CREATE_VST2_VERSION=ON"
elif [ "$type" == "au" ]; then
FLAGS="-GXcode -DSMTG_CREATE_AU_VERSION=ON"
fi
if [ -z "$identity" ]; then
cmake "-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64" -DVST3_SDK_ROOT=${DVST3_SDK_ROOT} ${FLAGS} ..
else
echo "Plugin will be signed using ${identity}"
cmake "-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64" -DVST3_SDK_ROOT=${DVST3_SDK_ROOT} ${FLAGS} -DSMTG_IOS_DEVELOPMENT_TEAM=${team_id} "-DSMTG_CODE_SIGN_IDENTITY_MAC=${identity}" ..
fi
cmake --build . --config Release
buildStatus=$?
if [ $buildStatus -eq 0 ]; then
FILE="./VST3/darvaza.vst3"
# code signing (macOS)
if [ "$identity" ]; then
if [ "$type" == "au" ]; then
FILE="./bin/Release/Darvaza AUV3.app"
fi
codesign -s "${identity}" "${FILE}" --timestamp --deep --strict --options=runtime --force
if [ "$type" == "au" ]; then
codesign -s "${identity}" "${FILE}/Contents/PlugIns/auv3.appex" --timestamp --deep --strict --options=runtime --force --entitlements "${BASEDIR}/mac/audio-unit/plugin.entitlements"
fi
codesign --verify --deep --verbose "${FILE}"
fi
# VST2/AU specific operations
if [ "$type" == "vst2" ]; then
mv "${FILE}" ./VST3/darvaza.vst
fi
echo "Plugin built successfully"
else
echo "An error occurred during build of plugin"
fi
exit $buildStatus