Skip to content

Commit

Permalink
Automatically glob assets for inclusion from /assets folder
Browse files Browse the repository at this point in the history
  • Loading branch information
sudara committed Sep 4, 2023
1 parent 1f668d6 commit a1c94d2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
27 changes: 15 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@ include (PamplejuceVersion)

# Change me!
# This is the internal name of the project and the name of JUCE's shared code "target"
# Note: This cannot have spaces. It may be 2023, but you can't have it all.
# Worry not, JUCE's PRODUCT_NAME can have spaces (and is external facing).
# Note: This cannot have spaces (it may be 2023, but you can't have it all!)
# Worry not, JUCE's PRODUCT_NAME can have spaces (and is DAWs display)
# You may want to append the major version on the end of this (and PRODUCT_NAME)
# set(PROJECT_NAME "MyPlugin_v${MAJOR_VERSION}")
# Doing so enables major versions to show up in IDEs and DAWs as separate plugins
# allowing you to change parameters and behavior without breaking user projects
# allowing you to change parameters and behavior without breaking existing user projects
set(PROJECT_NAME "Pamplejuce")

# Change me! Used for the MacOS bundle identifier
set(BUNDLE_ID "com.pamplejuce.pamplejuce")

# Set the plugin formats you'll be building here.
# Valid choices here: AAX Unity VST VST3 AU AUv3 Standalone
# Change me! Set the plugin formats you want built
# Valid choices: AAX Unity VST VST3 AU AUv3 Standalone
set(FORMATS Standalone AU VST3 AUv3)

# For simplicity, the name of the CMake project is also the name of the target
Expand All @@ -37,7 +38,7 @@ include(JUCEDefaults)
# On Github Actions, this is done as a part of actions/checkout
add_subdirectory(JUCE)

# Add your modules here
# Add any other modules you want modules here, before the juce_add_plugin call
# juce_add_module(modules/my_module)

# This adds the melatonin inspector module
Expand All @@ -52,7 +53,7 @@ juce_add_plugin("${PROJECT_NAME}"
COMPANY_NAME Pamplejuce
BUNDLE_ID "${BUNDLE_ID}"

# On MacOS, plugin is copied to ~/Users/you/Library/Audio/Plug-Ins/
# On MacOS, plugin is copied to ~/Users/yourname/Library/Audio/Plug-Ins/
COPY_PLUGIN_AFTER_BUILD TRUE

# Change me!
Expand Down Expand Up @@ -91,9 +92,10 @@ target_sources(SharedCode INTERFACE ${SourceFiles})
# Adds a BinaryData target for embedding assets into the binary
include(Assets)

# MacOS only: Clean up folder organization on Xcode.
include(Xcode)
# MacOS only: Cleans up folder and target organization on Xcode.
include(XcodePrettify)

# This is where you can set preprocessor definitions for JUCE and your plugin
target_compile_definitions(SharedCode
INTERFACE

Expand All @@ -113,10 +115,11 @@ target_compile_definitions(SharedCode
PRODUCT_NAME_WITHOUT_VERSION="Pamplejuce"
)

# Usually JUCE modules should have PRIVATE visibility
# Link to any other modules you added (with juce_add_module) here!
# Usually JUCE modules must have PRIVATE visibility
# See https://github.com/juce-framework/JUCE/blob/master/docs/CMake%20API.md#juce_add_module
# However, with Pamplejuce, you will link your modules to SharedCode with INTERFACE visibility
# This allows JUCE targets and the Tests target to link against it
# However, with Pamplejuce, you'll link modules to SharedCode with INTERFACE visibility
# This allows the JUCE plugin targets and the Tests target to link against it
target_link_libraries(SharedCode
INTERFACE
Assets
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![PAMPLEJUCE](pamplejuce.png)
![PAMPLEJUCE](assets/images/pamplejuce.png)
[![](https://github.com/sudara/pamplejuce/workflows/Pamplejuce/badge.svg)](https://github.com/sudara/pamplejuce/actions)

Pamplejuce is a ~~template~~ lifestyle for creating and building JUCE plugins in 2023.
Expand Down
File renamed without changes
6 changes: 5 additions & 1 deletion cmake/Assets.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# HEADS UP: Pamplejuce assumes anything you stick in the assets folder you want to included in your binary!
# This makes life easy, but will bloat your binary needlessly if you include unused files
file(GLOB_RECURSE AssetFiles CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/assets/*")

# Setup our binary data as a target called Assets
juce_add_binary_data(Assets SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/pamplejuce.png)
juce_add_binary_data(Assets SOURCES ${AssetFiles})

# Required for Linux happiness:
# See https://forum.juce.com/t/loading-pytorch-model-using-binarydata/39997/2
Expand Down
File renamed without changes.

0 comments on commit a1c94d2

Please sign in to comment.