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
160 changes: 160 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
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>")

# apple universal builds
if(APPLE)
set (CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum OS X deployment version" FORCE)
set (CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE INTERNAL "")
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)

# determine folder to place builds, if COPY_PLUGIN_AFTER_BUILD is enabled
if(APPLE)
set(buildFolder "Builds/MacOSX")
else()
if(UNIX)
set(buildFolder "Builds/Linux")
else()
set(buildFolder "Builds/Windows")
endif()
endif()
Davit-G marked this conversation as resolved.
Show resolved Hide resolved


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?
# VST3_COPY_DIR "${buildFolder}"
# VST_COPY_DIR "${buildFolder}"
# AU_COPY_DIR "${buildFolder}"
# AAX_COPY_DIR "${buildFolder}"

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
Davit-G marked this conversation as resolved.
Show resolved Hide resolved
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

# 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)
9 changes: 3 additions & 6 deletions KissOfShame.jucer
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@
<FILE id="tn2JAq" name="AgeKnob.png" compile="0" resource="1" file="GUI_Resources/AgeKnob.png"/>
<FILE id="OVaWWF" name="BlendKnob.png" compile="0" resource="1" file="GUI_Resources/BlendKnob.png"/>
<FILE id="reHHLz" name="Bypass.png" compile="0" resource="1" file="GUI_Resources/Bypass.png"/>
<FILE id="bdyO9s" name="Environments.png" compile="0" resource="1"
file="GUI_Resources/Environments.png"/>
<FILE id="bdyO9s" name="Environments.png" compile="0" resource="1" file="GUI_Resources/Environments.png"/>
Davit-G marked this conversation as resolved.
Show resolved Hide resolved
<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="GUI_Resources/FaceWithReels.png"/>
<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"/>
<FILE id="uyNwpi" name="Link.png" compile="0" resource="1" file="GUI_Resources/Link.png"/>
<FILE id="B7eS9h" name="OutputKnob.png" compile="0" resource="1" file="GUI_Resources/OutputKnob.png"/>
<FILE id="b8aDED" name="PrintThrough.png" compile="0" resource="1"
file="GUI_Resources/PrintThrough.png"/>
<FILE id="b8aDED" name="PrintThrough.png" compile="0" resource="1" file="GUI_Resources/PrintThrough.png"/>
<FILE id="kSiAvW" name="ShameCross.png" compile="0" resource="1" file="GUI_Resources/ShameCross.png"/>
<FILE id="yfcp33" name="ShameKnob.png" compile="0" resource="1" file="GUI_Resources/ShameKnob.png"/>
<FILE id="C42pzM" name="TapeType.png" compile="0" resource="1" file="GUI_Resources/TapeType.png"/>
Expand Down
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ The goal of this open source project is:

> **NOTE:** The source code that was donated does not contain all the features from the description. Notably, there is only one tape type and one environment (Hurricane Sandy), and the print-through function is missing. In its current form the plug-in only works well at a 44100 Hz sample rate. That said, it's still a fun plug-in with a cool UI, and there's a lot to learn from the source code!

## Installation instructions

> **NOTE:** This is currently work-in-progress. There may be issues with the plug-in!

Davit-G marked this conversation as resolved.
Show resolved Hide resolved
### Mac

The Mac version of the plug-in is signed and notarized.
Expand Down Expand Up @@ -91,6 +87,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 +100,29 @@ 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 will be located under `build/TheKissOfShame_artefacts/(Release or Debug)`. To build into `/Builds/<Your OS>`, uncomment `COPY_PLUGIN_AFTER_BUILD` in `/CMakeLists.txt`.

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
5 changes: 5 additions & 0 deletions Source/AudioProcessing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target_sources("${BaseTargetName}"
PRIVATE
AudioUtils.cpp
Granulate.cpp
)
Davit-G marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
add_subdirectory(AudioProcessing)
add_subdirectory(GUIUtilities)

target_sources("${BaseTargetName}"
PRIVATE
Parameters.cpp
PluginEditor.cpp
PluginProcessor.cpp
)
5 changes: 5 additions & 0 deletions Source/GUIUtilities/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target_sources("${BaseTargetName}"
PRIVATE
CustomKnob.cpp
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