Skip to content

Commit

Permalink
Initial commit setting up repo structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarler committed Oct 31, 2023
0 parents commit 07f8477
Show file tree
Hide file tree
Showing 30 changed files with 7,969 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CMake

on: [push, pull_request]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

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

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Fetch juce dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxext-dev libfreetype6-dev libasound2-dev

- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DREACTJUCE_JS_LIBRARY=HERMES

- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
build
compile_commands.json
cmake-build-debug
cmake-build-release
.idea
.cache

6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "ext/react-juce"]
path = ext/react-juce
url = [email protected]:JoshMarler/react-juce.git
[submodule "ext/JUCE"]
path = ext/JUCE
url = [email protected]:juce-framework/JUCE.git
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.15)
project(react-juce-examples VERSION 0.1.0)

add_subdirectory(ext/JUCE)
add_subdirectory(ext/react-juce)
add_subdirectory(examples)
86 changes: 86 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# React-JUCE-Examples

## ATTENTION
This repo is currently a work in progress pushed publicly for the purposes of testing CI workflows whilst
it's initial structure is completed. This message will be removed once `react-juce-examples` is ready
for general use.

A collection of example plugins/apps built with the [React-JUCE](https://github.com/JoshMarler/react-juce) framework.

### TODO:
Add instructions for building JS bundles in Debug/Release as well as hot-reloading.

## Examples

#### GainPlugin

[GainPlugin](examples/GainPlugin)
A simple GainPlugin showing the basics of a React-JUCE implementation.

## Building the Examples

### CMake

React-JUCE-Examples supports CMake as a build system.
To build the examples simply run CMake against the root directory/CMakeLists.txt
and use your preferred generator.

We suggest performing an out-of-source build by creating a build directory adjacent
to your react-juce-examples checkout.

Run the following in Powershell/Cmd on Windows or Terminal on Mac.

```
mkdir react-juce-examples-build
cd react-juce-examples
```

##### CMake Build Via Ninja (Mac + Linux + Windows)

```
# Change to -DCMAKE_BUILD_TYPE=Release to see react-juce's
# Release build performance.
cmake ../react-juce-examples -G Ninja -DCMAKE_BUILD_TYPE=Debug .
# Build the example plugin you want to test.
# You can append _Standalone to the plugin target name if you just
# want to test a standalone version rather than making the example
# plugin available in your DAW/Host of choice.
ninja -j8 GainPlugin_Standalone
# If building standalone plugin variant run the following
# from the react-juce-examples-build directory to launch.
examples/GainPlugin/GainPlugin_artefacts/Debug/Standalone/ReactJUCEGainPlugin
```

##### CMake Build Via XCode (Mac)

```
# Change to -DCMAKE_BUILD_TYPE=Release to see react-juce's
# Release build performance.
cmake ../react-juce-examples -G Xcode -DCMAKE_BUILD_TYPE=Debug .
# Open the generated XCode project in XCode IDE and build/run
cmake --open .
```

##### CMake Build Via Visual Studio (Windows)

```
# Change to -DCMAKE_BUILD_TYPE=Release to see react-juce's
# Release build performance.
cmake ../react-juce-examples -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Debug .
# Open the generated Solution in Visual Studio IDE and build/run
cmake --open .
```

### Projucer

Apologies, Projucer support is currently broken for react-juce.
We're in the process of providing a solution for Projucer builds.


### Building React UIs (Hot Reloading)


1 change: 1 addition & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(GainPlugin)
2 changes: 2 additions & 0 deletions examples/GainPlugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Builds
JuceLibraryCode
42 changes: 42 additions & 0 deletions examples/GainPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
cmake_minimum_required(VERSION 3.15)
project(GainPlugin VERSION 0.1.0)

juce_add_plugin(GainPlugin
# VERSION ... # 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 ... # Specify the name of the plugin's author
# IS_SYNTH TRUE/FALSE # Is this a synth or an effect?
# NEEDS_MIDI_INPUT TRUE/FALSE # Does the plugin need midi input?
# NEEDS_MIDI_OUTPUT TRUE/FALSE # Does the plugin need midi output?
# IS_MIDI_EFFECT TRUE/FALSE # Is this plugin a MIDI effect?
# EDITOR_WANTS_KEYBOARD_FOCUS TRUE/FALSE # Does the editor need keyboard focus?
# COPY_PLUGIN_AFTER_BUILD TRUE/FALSE # Should the plugin be installed to a default location after building?
PLUGIN_MANUFACTURER_CODE Reju # A four-character manufacturer id with at least one upper-case character
PLUGIN_CODE Dem0 # A unique four-character plugin id with at least one upper-case character
FORMATS AU VST3 Standalone # The formats to build. Other valid formats are: AAX Unity VST AU AUv3
PRODUCT_NAME "ReactJUCEGainPlugin") # The name of the final executable, which can differ from the target name

juce_generate_juce_header(GainPlugin)

target_sources(GainPlugin PRIVATE PluginProcessor.cpp)

target_compile_definitions(GainPlugin
PRIVATE
GAINPLUGIN_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
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(GainPlugin PRIVATE
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags
juce::juce_core
juce::juce_audio_basics
juce::juce_audio_devices
juce::juce_audio_processors
juce::juce_audio_utils
juce::juce_graphics
juce::juce_gui_basics
react_juce)
Loading

0 comments on commit 07f8477

Please sign in to comment.