diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..870e30c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,143 @@ +name: Release + +on: + workflow_dispatch: + push: + tags: + - "v*" + +jobs: + create_release: + name: Create release + runs-on: ubuntu-latest + outputs: + upload_id: ${{ steps.draft_release.outputs.id }} + upload_url: ${{ steps.draft_release.outputs.upload_url }} + steps: + - name: Draft release + id: draft_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: true + + build_release: + name: Build release + needs: create_release + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + include: + - os: ubuntu-latest + name: linux + generator: Unix Makefiles + path: ./build/Release + - os: macos-latest + name: mac + generator: Xcode + path: ./build/Release + - os: windows-latest + name: win + generator: Visual Studio 16 2019 + path: ./build/Release + steps: + - name: Install Linux dependencies + if: matrix.os == 'ubuntu-latest' + run: sudo apt-get update && sudo apt-get install cmake pkg-config gcc "libstdc++6" libx11-xcb-dev libxcb-util-dev libxcb-cursor-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev libfontconfig1-dev libcairo2-dev libgtkmm-3.0-dev libsqlite3-dev libxcb-keysyms1-dev libasound2-dev + + - name: Install macOS dependencies + if: matrix.os == 'macos-latest' + run: brew install cmake pkg-config + + - name: Install Windows dependencies + if: matrix.os == 'windows-latest' + run: choco install cmake pkgconfiglite zip + + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Build plugins + run: | + cmake \ + -G "${{ matrix.generator }}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DJUCE_BUILD_EXAMPLES=OFF \ + -DJUCE_BUILD_EXTRAS=OFF \ + -S ./ \ + -B ./build + cmake --build ./build --config Release --target JuicySFPlugin_VST3 + + - name: List files + run: ls "${{ matrix.path }}" + + - name: Metadata + run: | + npm install @studiorack/cli -g + cp -v ./src/assets/* "${{ matrix.path }}" + studiorack validate "${{ matrix.path }}/**/*.{vst,vst3}" --files --json --txt --zip --summary + + - name: Upload + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const path = require('path'); + const fs = require('fs'); + const release_id = '${{ needs.create_release.outputs.upload_id }}'; + for (let file of await fs.readdirSync('${{ matrix.path }}')) { + if (path.extname(file) === '.zip') { + console.log('upload zip', `${{ matrix.path }}/${file}`); + await github.repos.uploadReleaseAsset({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: release_id, + name: `${path.basename(file, path.extname(file))}-${{ matrix.name }}.zip`, + data: await fs.readFileSync(`${{ matrix.path }}/${file}`) + }); + if ("${{ matrix.os }}" == 'macos-latest') { + console.log('upload png', `${{ matrix.path }}/${path.basename(file, path.extname(file))}.png`); + await github.repos.uploadReleaseAsset({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: release_id, + name: `${path.basename(file, path.extname(file))}.png`, + data: await fs.readFileSync(`${{ matrix.path }}/${path.basename(file, path.extname(file))}.png`) + }); + console.log('upload wav', `${{ matrix.path }}/${path.basename(file, path.extname(file))}.wav`); + await github.repos.uploadReleaseAsset({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: release_id, + name: `${path.basename(file, path.extname(file))}.wav`, + data: await fs.readFileSync(`${{ matrix.path }}/${path.basename(file, path.extname(file))}.wav`) + }); + } + } + } + - name: Upload metadata + if: matrix.os == 'macos-latest' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ${{ matrix.path }}/plugins.json + asset_name: plugins.json + asset_content_type: application/json + + publish_release: + name: Publish release + needs: [create_release, build_release] + runs-on: ubuntu-latest + steps: + - uses: eregon/publish-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_id: ${{ needs.create_release.outputs.upload_id }} diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2405dce --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "JUCE"] + path = JUCE + url = https://github.com/juce-framework/JUCE +[submodule "fluidsynth"] + path = fluidsynth + url = https://github.com/FluidSynth/fluidsynth.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 534008b..eac7394 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,9 +25,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # included JUCE directly in your source tree (perhaps as a submodule), you'll need to tell CMake to # include that subdirectory as part of the build. -find_package(JUCE CONFIG REQUIRED) # If you've installed JUCE to your system +# find_package(JUCE CONFIG REQUIRED) # If you've installed JUCE to your system # or -# add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE +add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE +add_subdirectory(fluidsynth) # default to static libraries, since distribution is easier option(BUILD_SHARED_LIBS "Build using shared libraries" off) diff --git a/JUCE b/JUCE new file mode 160000 index 0000000..4c43bf4 --- /dev/null +++ b/JUCE @@ -0,0 +1 @@ +Subproject commit 4c43bf429e90690cb1f05b7c8a044cc9f5a59e7d diff --git a/README.md b/README.md index 19a7b54..e777fa5 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,38 @@ Or any output device that you can hear audio through. # Building from source (macOS) +Install CMake, FluidSynth and Xcode using: + + brew install cmake pkg-config + xcode-select --install + +Check you have the correct dependencies installed: + + cmake -version + xcodebuild -version + +Ensure all git submodules are initialized: + + git submodule update --init --recursive + +Depending on the the operating system you are on/building for, swap the generator string in the build commands: + +* Linux: "Unix Makefiles" +* MacOS: "Xcode" +* Windows: "Visual Studio 16 2019" + +Compile a development version of the plugin using: + + cmake \ + -G "Xcode" \ + -DCMAKE_BUILD_TYPE=Debug \ + -DJUCE_BUILD_EXAMPLES=ON \ + -DJUCE_BUILD_EXTRAS=OFF \ + -S ./ \ + -B ./build + + cmake --build ./build --config Debug --target JuicySFPlugin_VST3 + Install XCode and XCode command line tools. Accept terms. Install [JUCE](https://shop.juce.com/get-juce) 5.3 in `/Applications`. diff --git a/fluidsynth b/fluidsynth new file mode 160000 index 0000000..e64ad84 --- /dev/null +++ b/fluidsynth @@ -0,0 +1 @@ +Subproject commit e64ad841cb4b6afdc66a0231835b16638108c727