Skip to content

Commit a02bafd

Browse files
committed
Build: Added support for building via CMake
1 parent 13dabcc commit a02bafd

File tree

7 files changed

+253
-8
lines changed

7 files changed

+253
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ enc_temp_folder/
6363
install/testresults.txt
6464
**/bin
6565
**/tmp
66+
**/cmake_build

CMakeLists.txt

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
3+
project(pluginval VERSION 0.2.7)
4+
5+
add_subdirectory(modules/juce)
6+
7+
if (DEFINED ENV{VST2_SDK_DIR})
8+
MESSAGE(STATUS "Building with VST2 SDK: $ENV{VST2_SDK_DIR}")
9+
juce_set_vst2_sdk_path($ENV{VST2_SDK_DIR})
10+
else()
11+
MESSAGE(STATUS "Not building with VST2")
12+
endif()
13+
14+
juce_add_gui_app(pluginval
15+
BUNDLE_ID com.Tracktion.pluginval
16+
COMPANY_NAME Tracktion
17+
ICON_BIG "${CMAKE_CURRENT_SOURCE_DIR}/Source/binarydata/icon.png"
18+
HARDENED_RUNTIME_ENABLED TRUE
19+
HARDENED_RUNTIME_OPTIONS com.apple.security.cs.allow-unsigned-executable-memory com.apple.security.cs.disable-library-validation)
20+
21+
juce_generate_juce_header(pluginval)
22+
23+
target_compile_features(pluginval PRIVATE cxx_std_14)
24+
25+
set_target_properties(pluginval PROPERTIES
26+
C_VISIBILITY_PRESET hidden
27+
CXX_VISIBILITY_PRESET hidden)
28+
29+
target_sources(pluginval PRIVATE
30+
Source/CommandLine.h
31+
Source/CrashHandler.h
32+
Source/MainComponent.h
33+
Source/PluginTests.h
34+
Source/TestUtilities.h
35+
Source/Validator.h
36+
37+
Source/CommandLine.cpp
38+
Source/CrashHandler.cpp
39+
Source/Main.cpp
40+
Source/MainComponent.cpp
41+
Source/PluginTests.cpp
42+
Source/tests/BasicTests.cpp
43+
Source/tests/BusTests.cpp
44+
Source/tests/ParameterFuzzTests.cpp
45+
Source/TestUtilities.cpp
46+
Source/Validator.cpp)
47+
48+
if (DEFINED ENV{VST2_SDK_DIR})
49+
target_compile_definitions(pluginval PRIVATE
50+
JUCE_PLUGINHOST_VST=1)
51+
endif()
52+
53+
target_compile_definitions(pluginval PRIVATE
54+
JUCE_PLUGINHOST_AU=1
55+
JUCE_PLUGINHOST_LADSPA=1
56+
JUCE_PLUGINHOST_VST3=1
57+
JUCE_USE_CURL=0
58+
JUCE_WEB_BROWSER=0
59+
JUCER_ENABLE_GPL_MODE=1
60+
JUCE_DISPLAY_SPLASH_SCREEN=0
61+
JUCE_REPORT_APP_USAGE=0)
62+
63+
target_link_libraries(pluginval PRIVATE
64+
juce::juce_audio_devices
65+
juce::juce_audio_processors
66+
juce::juce_audio_utils
67+
juce::juce_recommended_warning_flags)

Source/Main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
==============================================================================*/
1414

15-
#include "../JuceLibraryCode/JuceHeader.h"
15+
#include <JuceHeader.h>
1616
#include "MainComponent.h"
1717
#include "Validator.h"
1818
#include "CommandLine.h"

Source/MainComponent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#pragma once
1616

17-
#include "../JuceLibraryCode/JuceHeader.h"
17+
#include <JuceHeader.h>
1818
#include "Validator.h"
1919
#include "CrashHandler.h"
2020

azure-pipelines.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
Xvfb :99 &
1616
export DISPLAY=:99
1717
sleep 3 # give xvfb some time to start
18-
install/linux_build
18+
install/build
1919
displayName: 'Linux Build'
2020
- task: PublishPipelineArtifact@0
2121
inputs:
@@ -44,7 +44,7 @@ jobs:
4444
certSecureFile: 'Installer.p12'
4545
certPwd: '$(CERT_PASSWORD)'
4646
keychain: 'temp'
47-
- script: tests/mac_tests
47+
- script: install/build
4848
displayName: 'macOS Build'
4949
- script: install/notarise ../bin/mac/pluginval_macOS.zip com.tracktion.pluginval $(AC_USERNAME) $(AC_PASSWORD)
5050
displayName: 'notarise'
@@ -57,9 +57,9 @@ jobs:
5757
pool:
5858
vmImage: 'vs2017-win2016'
5959
steps:
60-
- script: |
61-
set MSBUILD_EXE=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe
62-
tests/windows_tests
60+
- bash: |
61+
export MSBUILD_EXE="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe"
62+
install/build
6363
displayName: 'Windows Build'
6464
- task: PublishPipelineArtifact@0
6565
inputs:

install/build

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
#!/bin/bash -e
2+
3+
#========================================================
4+
# Configure build environment
5+
#========================================================
6+
cmake --version
7+
8+
if [[ "$OSTYPE" == "linux-gnu" ]]; then PLATFORM=linux
9+
elif [[ "$OSTYPE" == "darwin"* ]]; then PLATFORM=mac
10+
elif [[ "$OSTYPE" == "msys" ]]; then PLATFORM=windows
11+
fi
12+
13+
if [ -z "$PLATFORM" ]; then
14+
echo ERROR: Unknown platform
15+
exit 1
16+
fi
17+
18+
ROOT=$(cd "$(dirname "$0")/.."; pwd)
19+
CMAKE_ROOT="$ROOT/cmake_build"
20+
CMAKE_BUILD_DIR="$CMAKE_ROOT/${PLATFORM}"
21+
22+
if [ -z "$ROOT" ]; then
23+
echo "ERROR: Unknown workspace"
24+
exit 1
25+
fi
26+
27+
if [ ! -d "$ROOT/modules/juce/modules" ]; then
28+
echo "ERROR: juce library module not preset!"
29+
exit 1
30+
fi
31+
32+
echo "\n=========================================="
33+
echo ROOT: "$ROOT"
34+
echo CMAKE_BUILD_DIR: "$CMAKE_BUILD_DIR"
35+
36+
PROJECT_NAME=pluginval
37+
DEPLOYMENT_DIR="${ROOT}/bin/${PLATFORM}"
38+
39+
if [[ "$PLATFORM" == "linux" ]]; then
40+
BINARY_NAME="$PROJECT_NAME"
41+
APP_NAME=$BINARY_NAME
42+
APP_DIR="${CMAKE_BUILD_DIR}/${PROJECT_NAME}_artefacts"
43+
APP_FILE=$APP_DIR/$BINARY_NAME
44+
APP_BINARY="$APP_FILE"
45+
ZIP_FILE="${DEPLOYMENT_DIR}/${PROJECT_NAME}_Linux.zip"
46+
47+
CMAKE_GENERATOR="Unix Makefiles"
48+
elif [[ "$PLATFORM" == "mac" ]]; then
49+
BINARY_NAME="$PROJECT_NAME"
50+
APP_NAME=$BINARY_NAME".app"
51+
APP_DIR=$CMAKE_BUILD_DIR/${PROJECT_NAME}_artefacts/Release
52+
APP_FILE=$APP_DIR/$APP_NAME
53+
APP_BINARY="$APP_FILE/Contents/MacOS/${PROJECT_NAME}"
54+
ZIP_FILE="$DEPLOYMENT_DIR/$PROJECT_NAME"_macOS.zip
55+
56+
CMAKE_GENERATOR="Xcode"
57+
elif [[ "$PLATFORM" == "windows" ]]; then
58+
BINARY_NAME="$PROJECT_NAME".exe
59+
APP_NAME="$BINARY_NAME"
60+
APP_DIR=$CMAKE_BUILD_DIR/${PROJECT_NAME}_artefacts/Release
61+
APP_FILE="$APP_DIR/$BINARY_NAME"
62+
APP_BINARY="$APP_FILE"
63+
ZIP_NAME="${PROJECT_NAME}_Windows.zip"
64+
ZIP_FILE="${DEPLOYMENT_DIR}/${ZIP_NAME}"
65+
66+
CMAKE_GENERATOR="Visual Studio 15 2017"
67+
CMAKE_PLATFORM_ARGS="-A x64"
68+
69+
if [ -z "$MSBUILD_EXE" ]; then
70+
MSBUILD_EXE="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe"
71+
fi
72+
73+
if [ ! -f "$MSBUILD_EXE" ]; then
74+
echo MSBuild.exe not found!
75+
exit 1
76+
fi
77+
fi
78+
79+
echo PROJECT_NAME: "$PROJECT_NAME"
80+
echo DEPLOYMENT_DIR: "$DEPLOYMENT_DIR"
81+
echo BINARY_NAME: "$BINARY_NAME"
82+
echo APP_NAME: "$APP_NAME"
83+
echo APP_DIR: "$APP_DIR"
84+
echo APP_FILE: "$APP_FILE"
85+
echo ZIP_FILE: "$ZIP_FILE"
86+
echo CMAKE_GENERATOR: "$CMAKE_GENERATOR"
87+
88+
89+
#============================================================
90+
# Prepare VST2 SDK
91+
#============================================================
92+
if [ -n "$VST2_SDK_URL" ]; then
93+
rm -rf "$ROOT"/tmp
94+
mkdir "$ROOT"/tmp
95+
cd "$ROOT"/tmp
96+
97+
if [[ "$PLATFORM" == "linux" ]] || [[ "$PLATFORM" == "mac" ]]; then
98+
curl -O $VST2_SDK_URL
99+
unzip vstsdk2.4.zip
100+
elif [[ "$PLATFORM" == "windows" ]]; then
101+
powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest ${VST2_SDK_URL} -OutFile vstsdk2.4.zip"
102+
powershell -Command "Expand-Archive vstsdk2.4.zip -DestinationPath ."
103+
fi
104+
105+
if [ -d "vstsdk2.4" ]; then
106+
export VST2_SDK_DIR="$ROOT"/tmp/vstsdk2.4;
107+
fi
108+
else
109+
echo "Not building with VST2 support. To enable VST2 support, set the VST2_SDK_URL environment variable"
110+
fi
111+
112+
113+
#============================================================
114+
# Build
115+
#============================================================
116+
# rm -rf "$CMAKE_BUILD_DIR"
117+
mkdir -p "$CMAKE_BUILD_DIR"
118+
cd "$CMAKE_ROOT"
119+
pwd
120+
121+
cmake -S "$ROOT" -B "$CMAKE_BUILD_DIR" -G "$CMAKE_GENERATOR" $CMAKE_PLATFORM_ARGS
122+
cd "$CMAKE_BUILD_DIR"
123+
124+
if [[ "$PLATFORM" == "linux" ]]; then
125+
make CONFIG=Release
126+
elif [[ "$PLATFORM" == "mac" ]]; then
127+
xcodebuild -configuration Release
128+
elif [[ "$PLATFORM" == "windows" ]]; then
129+
"$MSBUILD_EXE" "$PROJECT_NAME".sln -p:VisualStudioVersion=15.0 -m -t:Build -p:Configuration=Release -p:Platform=x64 -p:PreferredToolArchitecture=x64 -p:TreatWarningsAsErrors=true
130+
fi
131+
132+
133+
#============================================================
134+
# Run tests
135+
#============================================================
136+
if [[ "$PLATFORM" == "mac" ]] || [[ "$PLATFORM" == "windows" ]]; then
137+
"$APP_BINARY" --run-tests || exit 1
138+
# Linux app doesn't shut down cleanly after tests have run yet!
139+
fi
140+
141+
#============================================================
142+
# Sign with hardened runtime
143+
#============================================================
144+
if [[ "$PLATFORM" == "mac" ]]; then
145+
if [ -n "$SIGN_ID" ]; then
146+
ENTITLEMENTS_FILE="${CMAKE_BUILD_DIR}/${PROJECT_NAME}_artefacts/JuceLibraryCode/${PROJECT_NAME}.entitlements"
147+
148+
codesign --entitlements "${ENTITLEMENTS_FILE}" --force -s "$SIGN_ID" -v "$APP_FILE" --deep --strict --options=runtime
149+
150+
echo "\nVerifying ..."
151+
spctl -vvv --assess --type exec "$APP_FILE"
152+
codesign -dvv "$APP_FILE"
153+
codesign -vvv --deep --strict "$APP_FILE"
154+
else
155+
echo "Not notarising. To enable, set the SIGN_ID environment variable"
156+
fi
157+
fi
158+
159+
160+
#============================================================
161+
# Copy to deployment directory
162+
#============================================================
163+
cd "$ROOT"
164+
rm -rf "$DEPLOYMENT_DIR"
165+
mkdir -p "$DEPLOYMENT_DIR"
166+
167+
echo "\nDeploying to: " "$DEPLOYMENT_DIR"
168+
cd "$APP_DIR"
169+
170+
if [[ "$PLATFORM" == "linux" ]] || [[ "$PLATFORM" == "mac" ]]; then
171+
zip -r "$ZIP_FILE" "$APP_NAME"
172+
elif [[ "$PLATFORM" == "windows" ]]; then
173+
# N.B. we can't provide unix paths to powershell
174+
cd "$APP_DIR"
175+
powershell -Command "Compress-Archive -Path '$BINARY_NAME' -DestinationPath '$ZIP_NAME' -Force"
176+
mv "$ZIP_NAME" "$DEPLOYMENT_DIR"
177+
fi

modules/juce

Submodule juce updated from 4c2c087 to 268ac3d

0 commit comments

Comments
 (0)