Skip to content

Commit

Permalink
cmake: set juce version from cmake [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
zsliu98 committed Sep 1, 2024
1 parent e2a42b1 commit 14086da
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 51 deletions.
39 changes: 20 additions & 19 deletions .github/workflows/cmake_full_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,21 @@ jobs:
run: choco install ninja

- name: Install macOS Deps
if: ${{ matrix.name == 'macOS' }}
if: ${{ runner.os == 'macOS' }}
run: brew install ninja osxutils

# This block can be removed once 15.1 is default (JUCE requires it when building on macOS 14)
- name: Use latest Xcode on system (macOS)
if: ${{ matrix.name == 'macOS' }}
if: ${{ runner.os == 'macOS' }}
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
fetch-depth: 0

- name: Install boost
uses: MarkusJx/[email protected]
Expand All @@ -125,7 +126,7 @@ jobs:

- name: Import Certificates (macOS)
uses: apple-actions/import-codesign-certs@v3 # only exists as a tag right now
if: ${{ (matrix.name == 'macOS') && (env.p12-file-base64 != '')}}
if: ${{ (runner.os == 'macOS') && (env.p12-file-base64 != '')}}
with:
p12-file-base64: ${{ secrets.DEV_ID_APP_CERT }}
p12-password: ${{ secrets.DEV_ID_APP_PASSWORD }}
Expand Down Expand Up @@ -166,8 +167,8 @@ jobs:
- name: Pluginval setup
shell: bash
run: |
curl -LO "https://github.com/Tracktion/pluginval/releases/download/v1.0.3/pluginval_${{ matrix.name }}.zip"
7z x pluginval_${{ matrix.name }}.zip
curl -LO "https://github.com/Tracktion/pluginval/releases/download/v1.0.3/pluginval_${{ runner.os }}.zip"
7z x pluginval_${{ runner.os }}.zip
echo "PLUGINVAL_DISABLED=Plugin state restoration" >> $GITHUB_ENV
- name: Setup Pluginval random seed
Expand All @@ -177,7 +178,7 @@ jobs:
format: YYYYMMDD

- name: Pluginval VST3 validations
if: ${{ matrix.name != 'macOS' }}
if: ${{ runner.os != 'macOS' }}
shell: bash
run: |
${{ matrix.pluginval-binary }} --verbose --validate "${{ env.VST3_PATH }}" --disabled-tests "${{ env.PLUGINVAL_DISABLED }}"
Expand All @@ -188,7 +189,7 @@ jobs:
RANDOM_SEED: "${{ steps.current-time.outputs.formattedTime }}"

- name: Pluginval AU validations (macOS)
if: ${{ matrix.name == 'macOS' }}
if: ${{ runner.os == 'macOS' }}
shell: bash
run: |
sudo cp -r "${{ env.AU_PATH }}" "/Library/Audio/Plug-ins/components"
Expand All @@ -201,75 +202,75 @@ jobs:
RANDOM_SEED: "${{ steps.current-time.outputs.formattedTime }}"

- name: Codesign and Create Individual Packages (macOS)
if: ${{ matrix.name == 'macOS' }}
if: ${{ runner.os == 'macOS' }}
run: |
python3 -u packaging/packager_macOS.py
env:
DEVELOPER_ID_APPLICATION: ${{ secrets.DEVELOPER_ID_APPLICATION }}

- name: Sign Final Package (macOS)
if: ${{ (matrix.name == 'macOS') && (env.APPLE_INSTALLER_DEV != '') }}
if: ${{ (runner.os == 'macOS') && (env.APPLE_INSTALLER_DEV != '') }}
run: productsign --sign "${{ secrets.APPLE_INSTALLER_DEV }}" "${{ env.ARTIFACT_NAME }}_unsigned.pkg" "${{ env.ARTIFACT_NAME }}.pkg"
env:
APPLE_INSTALLER_DEV: ${{ secrets.APPLE_INSTALLER_DEV }}

- name: Rename Final Package (macOS)
if: ${{ (matrix.name == 'macOS') && (env.APPLE_INSTALLER_DEV == '') }}
if: ${{ (runner.os == 'macOS') && (env.APPLE_INSTALLER_DEV == '') }}
run: mv "${{ env.ARTIFACT_NAME }}_unsigned.pkg" "${{ env.ARTIFACT_NAME }}.pkg"
env:
APPLE_INSTALLER_DEV: ${{ secrets.APPLE_INSTALLER_DEV }}

- name: Notarize and Staple PKG (macOS)
if: ${{ (matrix.name == 'macOS') && (env.NOTARIZATION_USERNAME != '')}}
if: ${{ (runner.os == 'macOS') && (env.NOTARIZATION_USERNAME != '')}}
run: |
xcrun notarytool submit "${{ env.ARTIFACT_NAME }}.pkg" --apple-id ${{ secrets.NOTARIZATION_USERNAME }} --password ${{ secrets.NOTARIZATION_PASSWORD }} --team-id ${{ secrets.TEAM_ID }} --wait
xcrun stapler staple "${{ env.ARTIFACT_NAME }}.pkg"
env:
NOTARIZATION_USERNAME: ${{ secrets.NOTARIZATION_USERNAME }}

- name: Create DMG (macOS)
if: ${{ matrix.name == 'macOS' }}
if: ${{ runner.os == 'macOS' }}
run: |
mkdir "${{ env.ARTIFACTS_PATH }}/dmgtmp"
mv "${{ env.ARTIFACT_NAME }}.pkg" "${{ env.ARTIFACTS_PATH }}/dmgtmp"
hdiutil create "${{ env.ARTIFACTS_PATH }}/tmp.dmg" -ov -volname "${{ env.ARTIFACT_NAME }}" -fs HFS+ -srcfolder "${{ env.ARTIFACTS_PATH }}/dmgtmp"
hdiutil convert "${{ env.ARTIFACTS_PATH }}/tmp.dmg" -format UDZO -o "${{ env.ARTIFACT_NAME }}.dmg"
- name: Upload DMG (macOS)
if: ${{ matrix.name == 'macOS' }}
if: ${{ runner.os == 'macOS' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}.dmg
path: "${{ env.ARTIFACT_NAME }}.dmg"

- name: Generate InnoScript (Windows)
if: ${{ matrix.name == 'Windows' }}
if: ${{ runner.os == 'Windows' }}
shell: bash
run: |
python3 -u packaging/packager_Windows.py
cat "packaging\installer.iss"
- name: Generate Installer (Windows)
if: ${{ matrix.name == 'Windows' }}
if: ${{ runner.os == 'Windows' }}
shell: bash
run: |
iscc "packaging\installer.iss"
mv "packaging/Output/${{ env.ARTIFACT_NAME }}.exe" "${{ env.ARTIFACTS_PATH }}/"
- name: Upload Exe (Windows)
if: ${{ matrix.name == 'Windows' }}
if: ${{ runner.os == 'Windows' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}.exe
path: "${{ env.ARTIFACTS_PATH }}/${{ env.ARTIFACT_NAME }}.exe"

- name: Generate Zip (Linux)
if: ${{ matrix.name == 'Linux' }}
if: ${{ runner.os == 'Linux' }}
working-directory: ${{ env.ARTIFACTS_PATH }}
run: 7z a -tzip "${{ env.ARTIFACT_NAME }}.zip" "-xr!lib${{ env.PRODUCT_NAME }}_SharedCode.a" .

- name: Upload Zip (Linux)
if: ${{ matrix.name == 'Linux' }}
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}.zip
Expand Down
62 changes: 33 additions & 29 deletions .github/workflows/cmake_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,31 @@ jobs:
boost_platform_version: "22.04"
boost_toolset: "gcc"
plugin_os_format: "VST3;LV2;Standalone"
checkout_branch: "juce7"
juce_branch: "juce7"
app_suffix: ""
- name: macOS
os: macos-14
pluginval-binary: pluginval.app/Contents/MacOS/pluginval
boost_platform_version: "11"
boost_toolset: "clang"
plugin_os_format: "VST3;AU;Standalone"
checkout_branch: "main"
juce_branch: "main"
app_suffix: ".app"
- name: Windows
os: windows-latest
pluginval-binary: ./pluginval.exe
boost_platform_version: "2022"
boost_toolset: "msvc"
plugin_os_format: "VST3;LV2;Standalone"
checkout_branch: "main"
juce_branch: "main"
app_suffix: ".exe"
- name: Windows-Software
os: windows-latest
pluginval-binary: ./pluginval.exe
boost_platform_version: "2022"
boost_toolset: "msvc"
plugin_os_format: "VST3;LV2;Standalone"
juce_branch: "juce7"
app_suffix: ".exe"

steps:
Expand Down Expand Up @@ -98,30 +106,22 @@ jobs:
run: choco install ninja

- name: Install macOS Deps
if: ${{ matrix.name == 'macOS' }}
if: ${{ runner.os == 'macOS' }}
run: brew install ninja osxutils

# This block can be removed once 15.1 is default (JUCE requires it when building on macOS 14)
- name: Use latest Xcode on system (macOS)
if: ${{ matrix.name == 'macOS' }}
if: ${{ runner.os == 'macOS' }}
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
ref: ${{ matrix.checkout_branch }}
submodules: recursive
fetch-depth: 0

- name: Checkout JUCE 7 (Linux)
if: ${{ matrix.name == 'Linux' }}
shell: bash
run: |
cd JUCE
git checkout 7.0.12
- name: Install boost
uses: MarkusJx/[email protected]
id: install-boost
Expand All @@ -136,7 +136,7 @@ jobs:

- name: Import Certificates (macOS)
uses: apple-actions/import-codesign-certs@v3 # only exists as a tag right now
if: ${{ (matrix.name == 'macOS') && (env.p12-file-base64 != '')}}
if: ${{ (runner.os == 'macOS') && (env.p12-file-base64 != '') }}
with:
p12-file-base64: ${{ secrets.DEV_ID_APP_CERT }}
p12-password: ${{ secrets.DEV_ID_APP_PASSWORD }}
Expand All @@ -149,6 +149,7 @@ jobs:
env:
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
PLUGIN_OS_FORMAT: ${{ matrix.plugin_os_format }}
JUCE_BRANCH: ${{ matrix.juce_branch }}

- name: Build
shell: bash
Expand All @@ -164,8 +165,11 @@ jobs:
cat .env # show us the config
cat .env >> $GITHUB_ENV # pull in our PRODUCT_NAME, etc
- name: Set up custom git config
run: git config --global http.postBuffer 1048576000

- name: Download AAX pre-release repo
if: (runner.os != 'Linux')
if: ${{ (runner.os != 'Linux') && (matrix.juce_branch != 'juce7') }}
uses: actions/checkout@v4
with:
repository: "ZL-Audio/ZLEqualizerAAX"
Expand All @@ -187,8 +191,8 @@ jobs:
- name: Pluginval setup
shell: bash
run: |
curl -LO "https://github.com/Tracktion/pluginval/releases/download/v1.0.3/pluginval_${{ matrix.name }}.zip"
7z x pluginval_${{ matrix.name }}.zip
curl -LO "https://github.com/Tracktion/pluginval/releases/download/v1.0.3/pluginval_${{ runner.os }}.zip"
7z x pluginval_${{ runner.os }}.zip
echo "PLUGINVAL_DISABLED=Plugin state restoration" >> $GITHUB_ENV
- name: Setup Pluginval random seed
Expand All @@ -208,75 +212,75 @@ jobs:
RANDOM_SEED: "${{ steps.current-time.outputs.formattedTime }}"

- name: Codesign and Create Individual Packages (macOS)
if: ${{ matrix.name == 'macOS' }}
if: ${{ runner.os == 'macOS' }}
run: |
python3 -u packaging/packager_macOS.py
env:
DEVELOPER_ID_APPLICATION: ${{ secrets.DEVELOPER_ID_APPLICATION }}

- name: Sign Final Package (macOS)
if: ${{ (matrix.name == 'macOS') && (env.APPLE_INSTALLER_DEV != '') }}
if: ${{ (runner.os == 'macOS') && (env.APPLE_INSTALLER_DEV != '') }}
run: productsign --sign "${{ secrets.APPLE_INSTALLER_DEV }}" "${{ env.ARTIFACT_NAME }}_unsigned.pkg" "${{ env.ARTIFACT_NAME }}.pkg"
env:
APPLE_INSTALLER_DEV: ${{ secrets.APPLE_INSTALLER_DEV }}

- name: Rename Final Package (macOS)
if: ${{ (matrix.name == 'macOS') && (env.APPLE_INSTALLER_DEV == '') }}
if: ${{ (runner.os == 'macOS') && (env.APPLE_INSTALLER_DEV == '') }}
run: mv "${{ env.ARTIFACT_NAME }}_unsigned.pkg" "${{ env.ARTIFACT_NAME }}.pkg"
env:
APPLE_INSTALLER_DEV: ${{ secrets.APPLE_INSTALLER_DEV }}

- name: Notarize and Staple PKG (macOS)
if: ${{ (matrix.name == 'macOS') && (env.NOTARIZATION_USERNAME != '')}}
if: ${{ (runner.os == 'macOS') && (env.NOTARIZATION_USERNAME != '')}}
run: |
xcrun notarytool submit "${{ env.ARTIFACT_NAME }}.pkg" --apple-id ${{ secrets.NOTARIZATION_USERNAME }} --password ${{ secrets.NOTARIZATION_PASSWORD }} --team-id ${{ secrets.TEAM_ID }} --wait
xcrun stapler staple "${{ env.ARTIFACT_NAME }}.pkg"
env:
NOTARIZATION_USERNAME: ${{ secrets.NOTARIZATION_USERNAME }}

- name: Create DMG (macOS)
if: ${{ matrix.name == 'macOS' }}
if: ${{ runner.os == 'macOS' }}
run: |
mkdir "${{ env.ARTIFACTS_PATH }}/dmgtmp"
mv "${{ env.ARTIFACT_NAME }}.pkg" "${{ env.ARTIFACTS_PATH }}/dmgtmp"
hdiutil create "${{ env.ARTIFACTS_PATH }}/tmp.dmg" -ov -volname "${{ env.ARTIFACT_NAME }}" -fs HFS+ -srcfolder "${{ env.ARTIFACTS_PATH }}/dmgtmp"
hdiutil convert "${{ env.ARTIFACTS_PATH }}/tmp.dmg" -format UDZO -o "${{ env.ARTIFACT_NAME }}.dmg"
- name: Upload DMG (macOS)
if: ${{ matrix.name == 'macOS' }}
if: ${{ runner.os == 'macOS' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}.dmg
path: "${{ env.ARTIFACT_NAME }}.dmg"

- name: Generate InnoScript (Windows)
if: ${{ matrix.name == 'Windows' }}
if: ${{ runner.os == 'Windows' }}
shell: bash
run: |
python3 -u packaging/packager_Windows.py
cat "packaging\installer.iss"
- name: Generate Installer (Windows)
if: ${{ matrix.name == 'Windows' }}
if: ${{ runner.os == 'Windows' }}
shell: bash
run: |
iscc "packaging\installer.iss"
mv "packaging/Output/${{ env.ARTIFACT_NAME }}.exe" "${{ env.ARTIFACTS_PATH }}/"
- name: Upload Exe (Windows)
if: ${{ matrix.name == 'Windows' }}
if: ${{ runner.os == 'Windows' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}.exe
path: "${{ env.ARTIFACTS_PATH }}/${{ env.ARTIFACT_NAME }}.exe"

- name: Generate Zip (Linux)
if: ${{ matrix.name == 'Linux' }}
if: ${{ runner.os == 'Linux' }}
working-directory: ${{ env.ARTIFACTS_PATH }}
run: 7z a -tzip "${{ env.ARTIFACT_NAME }}.zip" "-xr!lib${{ env.PRODUCT_NAME }}_SharedCode.a" .

- name: Upload Zip (Linux)
if: ${{ matrix.name == 'Linux' }}
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}.zip
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
if (DEFINED ENV{PLUGIN_OS_FORMAT})
set(FORMATS "$ENV{PLUGIN_OS_FORMAT}")
else ()
set(FORMATS AU VST3 AAX Standalone)
set(FORMATS AU VST3 Standalone)
endif()
if (DEFINED ENV{GITHUB_TOKEN})
set(JUCE_AAX_COPY_DIR "/Users/runner/Library/Audio/Plug-Ins/AAX")
Expand Down Expand Up @@ -156,6 +156,7 @@ target_compile_definitions(SharedCode
PRODUCT_NAME_WITHOUT_VERSION="${PRODUCT_NAME}"
# JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS=1
JUCE_SILENCE_XCODE_15_LINKER_WARNING=1
USE_JUCE7_INSTEAD_OF_LATEST=${USE_JUCE7_INSTEAD_OF_LATEST}
)

# Link to any other modules you added (with juce_add_module) here!
Expand Down
2 changes: 1 addition & 1 deletion cmake-includes/GitVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (GIT_EXECUTABLE)
)
if (NOT GIT_DESCRIBE_ERROR_CODE)
set(FOOBAR_VERSION ${GIT_DESCRIBE_VERSION})
message(WARNING "Using the version \"${FOOBAR_VERSION}\".")
message(STATUS "Using the version \"${FOOBAR_VERSION}\".")
endif ()
execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
Expand Down
17 changes: 17 additions & 0 deletions cmake-includes/JUCEDefaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,20 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options(-fcolor-diagnostics)
endif ()

# Checkout JUCE version
if ((CMAKE_SYSTEM_NAME STREQUAL "Linux" OR "$ENV{JUCE_BRANCH}" STREQUAL "juce7") AND GIT_EXECUTABLE)
execute_process(
COMMAND "${GIT_EXECUTABLE}" checkout "fd933dfac612fcb0bbb1443395da3b5b289604f4"
RESULT_VARIABLE RES
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/JUCE
)
if (NOT RES EQUAL 0)
message(FATAL_ERROR "Failed to check out JUCE 7")
else ()
message(STATUS "Check out JUCE 7")
endif ()
set(USE_JUCE7_INSTEAD_OF_LATEST true CACHE BOOL "")
else ()
set(USE_JUCE7_INSTEAD_OF_LATEST false CACHE BOOL "")
endif ()
Loading

0 comments on commit 14086da

Please sign in to comment.