Skip to content

Commit

Permalink
Added examples and updated folder layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ffAudio committed Jul 27, 2023
1 parent 33519c2 commit 5c69cc2
Show file tree
Hide file tree
Showing 139 changed files with 3,888 additions and 1,032 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CMake

on: push

env:
BUILD_TYPE: Release

jobs:
build_and_test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]

steps:

- uses: actions/checkout@v2
with:
clean: true

- name: Configure CMake
run: cmake --log-level=VERBOSE -D JUCE_COPY_PLUGIN_AFTER_BUILD=OFF

- name: Build
run: cmake --build --config ${{ env.BUILD_TYPE }} -j 8

- name: Run tests
run: ctest -C ${{ env.BUILD_TYPE }} --output-on-failure -j 4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/.DS_*
**/.idea
cmake-build-*
Builds
99 changes: 99 additions & 0 deletions CMakeIncludes/Pluginval.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#[[
This module provides utility functions for setting up pluginval test cases.
This module searches for pluginval in your PATH; this module currently does not download or build
pluginval if it can't be found, it will simply issue a warning and not create any test cases.
]]

include_guard (GLOBAL)

find_program (PLUGINVAL_PROGRAM pluginval DOC "pluginval executable")

if (NOT PLUGINVAL_PROGRAM)
message (WARNING "pluginval not found!")
endif ()

set (PLUGINVAL_STRICTNESS 5 CACHE STRING "pluginval strictness level, 1 to 10")

set_property (
CACHE PLUGINVAL_STRICTNESS
PROPERTY STRINGS
1 2 3 4 5 6 7 8 9 10)

set (PLUGINVAL_REPEATS 0 CACHE STRING "number of times to repeat pluginval tests. This can greatly increase test execution time.")

set (PLUGINVAL_SAMPLERATES "44100;44800;96000" CACHE STRING "list of samplerates to test in pluginval")

set (PLUGINVAL_BLOCKSIZES "1;250;512" CACHE STRING "list of blocksizes to test in pluginval")

mark_as_advanced (PLUGINVAL_PROGRAM PLUGINVAL_STRICTNESS PLUGINVAL_REPEATS PLUGINVAL_SAMPLERATES PLUGINVAL_BLOCKSIZES)

#

#[[
This function registers CTest test cases to run pluginval on the `pluginTarget`.
Of the formats we build, pluginval supports VST3, VST2, and AU (on Mac). Each one will be tested
as a separate CTest test case, named `pluginval.<pluginTarget>.<format>`.
This function does nothing if the `LBA_TESTS` option is not enabled.
On Mac, pluginval can only find audio units that are in the system AU directories, so the AU test
will only be added if the `JUCE_COPY_PLUGIN_AFTER_BUILD` option is enabled.
`pluginTarget` should be the name of your plugin's shared code target (the name you passed to
`juce_add_plugin`).
]]
function (lba_add_pluginval_tests pluginTarget)

if (NOT TARGET "${pluginTarget}")
message (
FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} - plugin target ${pluginTarget} does not exist!")
endif ()

if (NOT (LBA_TESTS AND PLUGINVAL_PROGRAM))
return ()
endif ()

list (JOIN PLUGINVAL_SAMPLERATES "," sample_rates)
list (JOIN PLUGINVAL_BLOCKSIZES "," block_sizes)

get_target_property (format_targets "${pluginTarget}" JUCE_ACTIVE_PLUGIN_TARGETS)

string (LENGTH "${pluginTarget}" pluginNameLen)
math (EXPR startIdx "${pluginNameLen} + 1" OUTPUT_FORMAT DECIMAL)

foreach (format_target IN LISTS format_targets)

string (SUBSTRING "${format_target}" "${startIdx}" "-1" formatName)

# pluginval can't find AUs unless they're copied to system folders
if ("${formatName}" STREQUAL "AU" AND NOT JUCE_COPY_PLUGIN_AFTER_BUILD)
continue ()
endif ()

if ("${formatName}" STREQUAL "Standalone"
OR "${formatName}" STREQUAL "AAX")
continue ()
endif ()

get_target_property (plugin_artefact "${format_target}" JUCE_PLUGIN_ARTEFACT_FILE)

add_test (
NAME "lobith.pluginval.${pluginTarget}.${formatName}"
COMMAND "${PLUGINVAL_PROGRAM}"
--strictness-level "${PLUGINVAL_STRICTNESS}"
--sample-rates "${sample_rates}"
--block-sizes "${block_sizes}"
--repeat "${PLUGINVAL_REPEATS}" --randomise
--validate "${plugin_artefact}")

message (VERBOSE "Added pluginval test for plugin target ${format_target}")

endforeach ()

endfunction ()
65 changes: 54 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,61 @@
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)

set_property(GLOBAL PROPERTY USE_FOLDERS YES)
set (version 1.4.0)

#
# CPM.cmake configuration
project ("foleys_gui_magic"
DESCRIPTION "PluginGuiMagic"
HOMEPAGE_URL "https://foleysfinest.com/PluginGuiMagic"
LANGUAGES CXX)

include (CMake/CPM.cmake)
option (FOLEYS_BUILD_TESTS "Build and run the unit tests" ON)
option (FOLEYS_BUILD_EXAMPLES "Build the examples" ON)
option (FOLEYS_RUN_PLUGINVAL "Run pluginval on the examples" ON)

#
# Add JUCE
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
set_property (GLOBAL PROPERTY DEBUG_CONFIGURATIONS Debug)
set_property (DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${CMAKE_CURRENT_LIST_DIR}/logs")

CPMAddPackage (NAME JUCE
GITHUB_REPOSITORY juce-framework/JUCE
GIT_TAG origin/develop
OPTIONS "JUCE_BUILD_EXAMPLES OFF" "JUCE_BUILD_EXTRAS OFF" "JUCE_ENABLE_MODULE_SOURCE_GROUPS ON")
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)

project (foleys_gui_magic_tests)
set (CMAKE_CXX_VISIBILITY_PRESET hidden)
set (CMAKE_VISIBILITY_INLINES_HIDDEN ON)

# universal binaries on Mac
set (CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING
"Architectures to build on MacOS. Set to arm64\;x86_64 to build universal (fat) binaries, or just one of those for faster build times.")

# static linking on Windows
set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

# JUCE
include (FetchContent)

FetchContent_Declare (
juce
GIT_REPOSITORY https://github.com/juce-framework/JUCE.git
GIT_TAG origin/master
GIT_SHALLOW ON)

set (JUCE_ENABLE_MODULE_SOURCE_GROUPS ON)
set (JUCE_BUILD_EXTRAS OFF)
set (JUCE_BUILD_EXAMPLES OFF)

FetchContent_MakeAvailable (juce)

add_subdirectory (modules)

if (FOLEYS_BUILD_TESTS)
message(Tests are TODO)
endif ()

if (FOLEYS_BUILD_EXAMPLES)
message(Build examples)
add_subdirectory(Examples)
endif ()

if (FOLEYS_RUN_PLUGINVAL)
include (CMakeIncludes/Pluginval.cmake)
endif ()

project (foleys_gui_magic)
Loading

0 comments on commit 5c69cc2

Please sign in to comment.