diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6440a5..379fecd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: - next env: - CMAKE_BUILD_PARALLEL_LEVEL: 3 # Use up to 3 cpus to build juceaide, etc + SCCACHE_GHA_ENABLED: "true" concurrency: group: ${{ github.workflow }}.${{ github.ref }} @@ -34,6 +34,7 @@ jobs: matrix: app: [ member_enabled, member_disabled, unique_ptr_enabled, unique_ptr_disabled ] os: [ macos-14, windows-2022, ubuntu-latest ] + juce: [ JUCE7, JUCE8 ] steps: - name: Checkout @@ -41,11 +42,24 @@ jobs: with: fetch-depth: 1 + - name: Use dev command prompt (Windows) + uses: ilammy/msvc-dev-cmd@v1 + with: + sdk: 10.0.22621.0 # fixed to break random CI breakage + + - name: Install Ninja (Windows) + if: runner.os == 'Windows' + run: choco install ninja + + - name: Install macOS Deps + if: ${{ runner.os == 'macOS' }} + run: brew install ninja osxutils + - name: Install Linux Deps if: runner.os == 'Linux' run: | sudo apt-get update - sudo apt install libasound2-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxinerama-dev libxrandr-dev libxrender-dev libfreetype6-dev libglu1-mesa-dev libjack-jackd2-dev + sudo apt install libasound2-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxinerama-dev libxrandr-dev libxrender-dev libfreetype6-dev libglu1-mesa-dev libjack-jackd2-dev ninja-build # 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) @@ -55,10 +69,25 @@ jobs: xcode-version: latest-stable - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.4 + uses: mozilla-actions/sccache-action@v0.0.5 - - name: Configure - run: cmake -B Builds -DTARGET_NAME:STRING=${{ matrix.app }} + - name: Configure (Windows without Ninja) + if: runner.os == 'Windows' + run: | + if [ "${{ matrix.juce }}" == "JUCE7" ]; then + cmake -B Builds -DTARGET_NAME:STRING=${{ matrix.app }} -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache . -DJUCE7=ON + else + cmake -B Builds -DTARGET_NAME:STRING=${{ matrix.app }} -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache . + fi + + - name: Configure (Non-Windows with Ninja) + if: runner.os != 'Windows' + run: | + if [ "${{ matrix.juce }}" == "JUCE7" ]; then + cmake -B Builds -G Ninja -DTARGET_NAME:STRING=${{ matrix.app }} -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache . -DJUCE7=ON + else + cmake -B Builds -G Ninja -DTARGET_NAME:STRING=${{ matrix.app }} -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache . + fi - name: Build run: cmake --build Builds --parallel 4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 2565728..9821ced 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,28 +1,37 @@ cmake_minimum_required(VERSION 3.20) project(MelatoninInspector VERSION 1.3.0 LANGUAGES CXX - DESCRIPTION "JUCE module for inspecting Components" - HOMEPAGE_URL "https://github.com/sudara/melatonin_inspector") + DESCRIPTION "JUCE module for inspecting Components" + HOMEPAGE_URL "https://github.com/sudara/melatonin_inspector") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) include(FetchContent) if (MelatoninInspector_IS_TOP_LEVEL) + option(JUCE7 "Run tests on JUCE 7" OFF) + message(STATUS "Cloning JUCE...") + if (JUCE7) + FetchContent_Declare(JUCE + GIT_REPOSITORY https://github.com/juce-framework/JUCE.git + GIT_TAG 7.0.12 + GIT_PROGRESS TRUE + ) + else () - FetchContent_Declare(JUCE + FetchContent_Declare(JUCE GIT_REPOSITORY https://github.com/juce-framework/JUCE.git - GIT_TAG origin/master - GIT_SHALLOW TRUE + GIT_TAG develop GIT_PROGRESS TRUE - FIND_PACKAGE_ARGS 7.0.6) + ) + endif () FetchContent_MakeAvailable(JUCE) SET(TARGET_NAME "unique_ptr_disabled" CACHE STRING "Name of cpp and target to compile") - juce_add_gui_app ("${TARGET_NAME}" VERSION 1.0.0) + juce_add_gui_app("${TARGET_NAME}" VERSION 1.0.0) target_sources("${TARGET_NAME}" PRIVATE "tests/${TARGET_NAME}.cpp") target_compile_definitions("${TARGET_NAME}" PUBLIC @@ -30,6 +39,18 @@ if (MelatoninInspector_IS_TOP_LEVEL) JUCE_WEB_BROWSER=0 ) + # Windows errors due to sccache issues + # see https://github.com/mozilla/sccache/pull/963/files + if (MSVC) + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + string(REPLACE "/MP" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + elseif (CMAKE_BUILD_TYPE STREQUAL "Release") + string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + string(REPLACE "/MP" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + endif () + endif () + set_target_properties("${TARGET_NAME}" PROPERTIES COMPILE_WARNING_AS_ERROR ON) endif () @@ -44,9 +65,9 @@ add_library(Melatonin::Inspector ALIAS melatonin_inspector) if (MelatoninInspector_IS_TOP_LEVEL) target_link_libraries("${TARGET_NAME}" PRIVATE melatonin_inspector - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags) + juce::juce_recommended_config_flags + juce::juce_recommended_lto_flags + juce::juce_recommended_warning_flags) endif () # Assets are precompiled in the module to make it Projucer friendly diff --git a/melatonin/lookandfeel.h b/melatonin/lookandfeel.h index 51c2f62..293555a 100644 --- a/melatonin/lookandfeel.h +++ b/melatonin/lookandfeel.h @@ -235,7 +235,7 @@ namespace melatonin #if JUCE_MAJOR_VERSION == 8 juce::Font testFont = juce::FontOptions { "Verdana", 12, juce::Font::FontStyleFlags::plain }; #else - juce::Font testFont = { "Verdana", 12, juce::Font::FontStyleFlags::plain } + juce::Font testFont = { "Verdana", 12, juce::Font::FontStyleFlags::plain }; #endif if (juce::Typeface::createSystemTypefaceFor (testFont)) { inspectorFont = "Verdana";