Skip to content
Open
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
154 changes: 154 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Foresight

on:
push:
branches:
- "*"
tags:
- "v*"
workflow_dispatch:

# When pushing new commits, cancel any running builds on that branch
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

env:
PROJECT_NAME: Foresight
BUILD_TYPE: Release
BUILD_DIR: Builds
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISPLAY: :0 # linux pluginval needs this
CMAKE_BUILD_PARALLEL_LEVEL: 3 # Use up to 3 cpus to build juceaide, etc
HOMEBREW_NO_INSTALL_CLEANUP: 1

# jobs are run in parallel on different machines
# all steps run in series
jobs:
build_and_test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # show all errors for each platform (vs. cancel jobs on error)
matrix:
include:
- name: Windows
os: windows-latest
pluginval-binary: ./pluginval.exe
ccache: sccache
- name: macOS
os: macos-12
pluginval-binary: pluginval.app/Contents/MacOS/pluginval
ccache: ccache
- name: Linux
os: ubuntu-latest
pluginval-binary: ./pluginval
ccache: ccache

steps:
# This is just easier than debugging different compilers on different platforms
- name: Set up Clang
if: runner.os != 'macOS'
uses: egor-tensin/setup-clang@v1

# This lets us use sscache on Windows
# We need to install ccache here for Windows to grab the right version
- name: Install Ninja (Windows)
if: runner.os == 'Windows'
shell: bash
run: choco install ninja ccache

- name: Install macOS Deps
if: ${{ matrix.name == 'macOS' }}
run: brew install ninja osxutils

# This also starts up our "fake" display Xvfb, needed for pluginval
- name: Install JUCE's Linux Deps
if: runner.os == 'Linux'
# Thanks to McMartin & co https://forum.juce.com/t/list-of-juce-dependencies-under-linux/15121/44
run: |
sudo apt-get update && sudo apt install libasound2-dev libx11-dev libxinerama-dev libxext-dev libfreetype6-dev libwebkit2gtk-4.0-dev libglu1-mesa-dev xvfb ninja-build
sudo /usr/bin/Xvfb $DISPLAY &

- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true # Get JUCE populated

- name: Setup Environment Variables
shell: bash
run: |
VERSION=$(cat VERSION)
ARTIFACTS_PATH="${{ env.BUILD_DIR }}/${{ env.PROJECT_NAME }}_artefacts/${{ env.BUILD_TYPE }}"
echo "ARTIFACTS_PATH=${ARTIFACTS_PATH}" >> $GITHUB_ENV
echo "VST3_PATH=${ARTIFACTS_PATH}/VST3/${{ env.PROJECT_NAME }}.vst3" >> $GITHUB_ENV
echo "AU_PATH=${ARTIFACTS_PATH}/AU/${{ env.PROJECT_NAME }}.component" >> $GITHUB_ENV
echo "AUV3_PATH=${ARTIFACTS_PATH}/AUv3/${{ env.PROJECT_NAME }}.appex" >> $GITHUB_ENV
echo "PRODUCT_NAME=${{ env.PROJECT_NAME }}-$VERSION-${{ matrix.name }}" >> $GITHUB_ENV

- name: ccache
uses: hendrikmuhs/ccache-action@main
with:
key: v3-${{ matrix.os }}-${{ matrix.type }}
variant: ${{ matrix.ccache }}

- name: Configure
shell: bash
run: cmake -B ${{ env.BUILD_DIR }} -G Ninja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=${{ matrix.ccache }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ matrix.ccache }} -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" .

- name: Build
shell: bash
run: cmake --build ${{ env.BUILD_DIR }} --config ${{ env.BUILD_TYPE }} --parallel 4

- name: Pluginval
shell: bash
run: |
curl -LO "https://github.com/Tracktion/pluginval/releases/download/v1.0.3/pluginval_${{ matrix.name }}.zip"
7z x pluginval_${{ matrix.name }}.zip
${{ matrix.pluginval-binary }} --strictness-level 10 --verbose --validate "${{ env.VST3_PATH }}"

- name: Zip VST3, AU and AUv3 (MacOS)
if: runner.os == 'macOS'
run: |
cmake -E tar cvf ${{ env.PRODUCT_NAME }}.zip --format=zip "${{ env.ARTIFACTS_PATH }}"

- name: Upload VST3 (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v3
with:
name: ${{ env.PRODUCT_NAME }}.vst3
path: "${{ env.VST3_PATH }}/**/*.vst3"

- name: Upload zipped VST3, AU and AUv3 (MacOS)
if: runner.os == 'macOS'
uses: actions/upload-artifact@v3
with:
name: ${{ env.PRODUCT_NAME }}.zip
path: ${{ env.PRODUCT_NAME }}.zip

- name: Upload SO (Linux)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: ${{ env.PRODUCT_NAME }}.so
path: "${{ env.VST3_PATH }}/**/*.so"

release:
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: build_and_test

steps:
- name: Get Artifacts
uses: actions/download-artifact@v3

- name: Create Release
uses: softprops/action-gh-release@v1
with:
prerelease: true
# download-artifact puts these files in their own dirs...
# Using globs sidesteps having to pass the version around
files: |
*/*.vst3
*/*.zip
*/*.so
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "Deps/JUCE"]
path = Deps/JUCE
[submodule "deps/juce"]
path = deps/juce
url = https://github.com/juce-framework/JUCE
39 changes: 23 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
cmake_minimum_required(VERSION 3.25)
cmake_minimum_required(VERSION 3.22)

project(FORESIGHT VERSION 1.2.0)
# read VERSION file for version
file(STRINGS VERSION CURRENT_VERSION)

add_subdirectory(Deps)
set(CMAKE_OSX_DEPLOYMENT_TARGET "11" CACHE STRING "Support macOS down to Big Sur")

juce_add_plugin(FORESIGHT
project(Foresight VERSION ${CURRENT_VERSION})

# to enable use of clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# By default we don't want Xcode schemes to be made for modules, etc
set(CMAKE_XCODE_GENERATE_SCHEME OFF)

add_subdirectory(deps)

juce_add_plugin(Foresight
COMPANY_NAME ToadsworthLP
COMPANY_WEBSITE "toadsworthlp.github.io"
NEEDS_MIDI_INPUT TRUE
Expand All @@ -13,15 +24,15 @@ juce_add_plugin(FORESIGHT
VST3_CATEGORIES Delay
PLUGIN_MANUFACTURER_CODE Twlp
PLUGIN_CODE Fsgt
FORMATS VST3
FORMATS VST3 AU AUv3
PRODUCT_NAME "Foresight"
COPY_PLUGIN_AFTER_BUILD TRUE
VST3_COPY_DIR ${CMAKE_CURRENT_LIST_DIR}/output
)

juce_generate_juce_header(FORESIGHT)
juce_generate_juce_header(Foresight)

target_sources(FORESIGHT
target_sources(Foresight
PRIVATE
Source/BufferedMidiMessage.cpp
Source/BufferedNote.cpp
Expand All @@ -43,30 +54,26 @@ target_sources(FORESIGHT
Source/VoiceProcessor.cpp
)

target_compile_features(FORESIGHT PRIVATE cxx_std_20)
target_compile_features(Foresight PRIVATE cxx_std_20)

target_compile_definitions(FORESIGHT
target_compile_definitions(Foresight
PRIVATE
CURRENT_VERSION="${CURRENT_VERSION}"
PUBLIC
# JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_plugin` call
JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_plugin` call
JUCE_VST3_CAN_REPLACE_VST2=0
)

target_link_libraries(FORESIGHT
target_link_libraries(Foresight
PRIVATE
juce::juce_audio_basics
juce::juce_audio_devices
juce::juce_audio_formats
juce::juce_audio_plugin_client
juce::juce_audio_processors
juce::juce_audio_utils
juce::juce_core
juce::juce_data_structures
juce::juce_events
juce::juce_graphics
juce::juce_gui_basics
juce::juce_gui_extra
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
Expand Down
Loading