Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CMake builds #2

Merged
merged 14 commits into from
Apr 20, 2024
158 changes: 158 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
cmake_minimum_required(VERSION 3.15)
project(TheKissOfShame VERSION "${ProjectVersion}")

# project description stuff
set(BaseTargetName TheKissOfShame)
set(PluginName "The Kiss Of Shame")
set(ProjectVersion 1.0)


include (FetchContent)
Set(FETCHCONTENT_QUIET FALSE) # shows detailed info when fetching from github

# attempt to build with multiple threads
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

if(APPLE)
# apple universal builds
set (CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum OS X deployment version" FORCE)
set (CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE INTERNAL "")

# dSYM files for Xcode release builds
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g")
set(CMAKE_XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Release] "YES")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT[variant=Release] "dwarf-with-dsym")
set(CMAKE_XCODE_ATTRIBUTE_DEPLOYMENT_POSTPROCESSING[variant=Release] "YES")
endif()



FetchContent_Declare(
JUCE
GIT_REPOSITORY https://github.com/juce-framework/JUCE.git
GIT_TAG 7.0.11
GIT_PROGRESS TRUE
GIT_SHALLOW 1
)

FetchContent_MakeAvailable(JUCE)


juce_add_plugin("${BaseTargetName}"
VERSION "${ProjectVersion}" # Set this if the plugin version is different to the project version
# ICON_BIG ... # ICON_* arguments specify a path to an image file to use as an icon for the Standalone
# ICON_SMALL ...
COMPANY_NAME Infernal Love # Specify the name of the plugin's author
COMPANY_WEBSITE "https://github.com/hollance/TheKissOfShame"
COMPANY_EMAIL ""
IS_SYNTH FALSE # Is this a synth or an effect?
NEEDS_MIDI_INPUT FALSE # Does the plugin need midi input?
NEEDS_MIDI_OUTPUT FALSE # Does the plugin need midi output?
IS_MIDI_EFFECT FALSE # Is this plugin a MIDI effect?

COPY_PLUGIN_AFTER_BUILD TRUE # Should the plugin be installed to a default location after building? (will install into sensible locations for most platforms)
# VST3_COPY_DIR ""
# AU_COPY_DIR ""
# AAX_COPY_DIR ""

PLUGIN_MANUFACTURER_CODE ILov # A four-character manufacturer id with at least one upper-case character
PLUGIN_CODE Tkos # A unique four-character plugin id with exactly one upper-case character
# GarageBand 10.3 requires the first letter to be upper-case, and the remaining letters to be lower-case
FORMATS VST3 Standalone AU # The formats to build. Other valid formats are: AAX Unity VST AU AUv3. Enable AAX once you have the AAX SDK installed
PRODUCT_NAME "${PluginName}" # The name of the final executable, which can differ from the target name
)

# for AAX
# juce_set_aax_sdk_path("/aax_sdk")

juce_generate_juce_header("${BaseTargetName}")

# directories to include in the compilation
add_subdirectory(Source)

target_compile_features("${BaseTargetName}" PUBLIC cxx_std_20)

target_compile_definitions("${BaseTargetName}" PUBLIC
DONT_SET_USING_JUCE_NAMESPACE=1
JUCE_DISPLAY_SPLASH_SCREEN=0
JUCE_REPORT_APP_USAGE=0
JUCE_USE_FLAC=0
JUCE_USE_OGGVORBIS=0
JUCE_USE_MP3AUDIOFORMAT=0
JUCE_USE_LAME_AUDIO_FORMAT=0
JUCE_USE_WINDOWS_MEDIA_FORMAT=0
JUCE_VST3_CAN_REPLACE_VST2=0
JUCE_ENABLE_REPAINT_DEBUGGING=0
JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS=1
JUCE_COREGRAPHICS_DRAW_ASYNC=1
JUCE_USE_CURL=0
JUCE_LOAD_CURL_SYMBOLS_LAZILY=1
JUCE_STRICT_REFCOUNTEDPOINTER=1
JUCE_BUILD_EXTRAS=0
JUCE_BUILD_EXAMPLES=0
JUCE_WEB_BROWSER=0
JUCE_USE_WIN_WEBVIEW2=0
JUCE_USE_CAMERA=0)


juce_add_binary_data("${BaseTargetName}BinaryData" HEADER_NAME BinaryData.h NAMESPACE BinaryData SOURCES
Audio_Resources/Hiss.wav
Audio_Resources/LowLevelGrainNoise.wav
Audio_Resources/PinkNoise.wav

GUI_Resources/AgeKnob.png
GUI_Resources/BlendKnob.png
GUI_Resources/Bypass.png
GUI_Resources/Environments.png
GUI_Resources/Face.png
GUI_Resources/FaceWithReels.png
GUI_Resources/HissKnob.png
GUI_Resources/InputKnob.png
GUI_Resources/Link.png
GUI_Resources/OutputKnob.png
GUI_Resources/PrintThrough.png
GUI_Resources/ShameCross.png
GUI_Resources/ShameKnob.png
GUI_Resources/TapeType.png
GUI_Resources/VUMeterL.png
GUI_Resources/VUMeterR.png
GUI_Resources/Wheels.png
)

set_target_properties("${BaseTargetName}BinaryData" PROPERTIES POSITION_INDEPENDENT_CODE TRUE)

# if you ever decide you'd like to support CLAP
# CLAP code does not get automatically copied with COPY_PLUGIN_AFTER_BUILD
# so manually copy it when uncommenting this

# FetchContent_Declare (clap-juce-extensions
# GIT_REPOSITORY https://github.com/free-audio/clap-juce-extensions.git
# GIT_TAG origin/main)

# FetchContent_MakeAvailable (clap-juce-extensions)

# clap_juce_extensions_plugin(TARGET "${BaseTargetName}"
# CLAP_ID "com.InfernalLove.KissOfShame"
# CLAP_FEATURES effect tape saturation audio-effect)

target_link_libraries("${BaseTargetName}"
PRIVATE
"${BaseTargetName}BinaryData"
juce_audio_basics
juce_audio_devices
juce_audio_formats
juce_audio_plugin_client
juce_audio_processors
juce_audio_utils
juce_core
juce_data_structures
juce_events
juce_graphics
juce_gui_basics
juce_gui_extra
juce_opengl
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags)
2 changes: 1 addition & 1 deletion KissOfShame.jucer
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<FILE id="bdyO9s" name="Environments.png" compile="0" resource="1"
file="GUI_Resources/Environments.png"/>
<FILE id="GjHnsU" name="Face.png" compile="0" resource="1" file="GUI_Resources/Face.png"/>
<FILE id="kxlLjo" name="FaceWithReels.png" compile="0" resource="1"
<FILE id="kxlLjo" name="FaceWithReels.png" compile="0" resource="1"
file="GUI_Resources/FaceWithReels.png"/>
<FILE id="RU4sd5" name="HissKnob.png" compile="0" resource="1" file="GUI_Resources/HissKnob.png"/>
<FILE id="zWT5on" name="InputKnob.png" compile="0" resource="1" file="GUI_Resources/InputKnob.png"/>
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ The Kiss of Shame is the first tape plug-in to feature animated, interactive ree

## Building from source code

### Projucer
Brief instructions:

- Install JUCE 7 or newer.
Expand All @@ -103,6 +104,30 @@ Currently only tested with:
- Xcode 15.2 + macOS Sonoma 14.3
- Visual Studio 2022 + Windows 10

### CMake

To set up CMake builds, make sure you have CMake and Ninja installed. Ninja is configured for fast compile times by default, but if you don't want to use it, omit '-G Ninja' from the configure script below and manually specify the number of jobs.
[Check CMake docs on how to do this](https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-build-j)

Configure your project (fetches JUCE, sets up JUCE project)

```
cmake -B "build" -G Ninja
```

Build your project

```
cmake --build "build" --config Release --target all --
```

Replace '--config Release' with '--config Debug' for debug builds.

Builds are automatically copied into sensible folders for your target platform (e.g: `C:\Program Files (x86)\Common Files/VST3/` for Windows), making it easy to open this plugin in your DAW during development.
Builds will also be located under `build/TheKissOfShame_artefacts/(Release or Debug)`.

AAX compilation is not enabled but can be enabled by adding `AAX` to the `FORMATS` definition under `juce_add_plugin` in `/CMakeLists.txt`. To compile for AAX, you need to specify the location of the AAX SDK with `juce_set_aax_sdk_path(" ... ")`. This has not been tested yet.

## How it works

I've added comments to the code to explain what it does, but for a full walk-through, check out [my blog post](https://audiodev.blog/kiss-of-shame/).
Expand Down
18 changes: 18 additions & 0 deletions Source/AudioProcessing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
target_sources("${BaseTargetName}"
PRIVATE
AudioGraph.h
AudioUtils.cpp
Biquads.h
Blend.h
Envelope.h
EnvelopeDips.h
Flange.h
Granulate.h
Granulate.cpp
Hiss.h
HurricaneSandy.h
InputSaturation.h
LoopCrossfade.h
Noise.h
Shame.h
)
13 changes: 13 additions & 0 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
add_subdirectory(AudioProcessing)
add_subdirectory(GUIUtilities)

target_sources("${BaseTargetName}"
PRIVATE
Parameters.h
Parameters.cpp
PluginEditor.h
PluginEditor.cpp
PluginProcessor.h
PluginProcessor.cpp
shameConfig.h
)
11 changes: 11 additions & 0 deletions Source/GUIUtilities/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
target_sources("${BaseTargetName}"
PRIVATE
BacklightComponent.h
CustomButton.h
CustomKnob.h
CustomKnob.cpp
EnvironmentsComponent.h
ImageAnimationComponent.h
ImageInteractor.h
ImageInteractor.cpp
)
1 change: 1 addition & 0 deletions Source/PluginEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "GUIUtilities/EnvironmentsComponent.h"
#include "GUIUtilities/ImageInteractor.h"
#include "GUIUtilities/ImageAnimationComponent.h"
#include "Parameters.h"

class KissOfShameAudioProcessorEditor : public juce::AudioProcessorEditor,
public juce::Timer,
Expand Down