Skip to content

Commit

Permalink
Build with either JUCE 7 or 8 (#126)
Browse files Browse the repository at this point in the history
* Build with either JUCE 7 or 8

* darn-windows-dots
  • Loading branch information
baconpaul authored Sep 3, 2024
1 parent 9a4091a commit 62241c6
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ jobs:
name: ubuntu
cmakeArgs: -DCMAKE_BUILD_TYPE=Debug

- os: windows-latest
name: windows msvc Juce 8
cmakeArgs: -DCMAKE_BUILD_TYPE=Debug -DSST_JUCEGUI_JUCE_VERSION="8.0.1"

- os: macos-latest
name: macos Juce 8
cmakeArgs: -DCMAKE_BUILD_TYPE=Debug -DSST_JUCEGUI_JUCE_VERSION="8.0.1" -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"

- os: ubuntu-latest
name: ubuntu Juce 8
cmakeArgs: -DCMAKE_BUILD_TYPE=Debug -DSST_JUCEGUI_JUCE_VERSION="8.0.1"

- os: windows-latest
name: windows unity
cmakeArgs: -DCMAKE_BUILD_TYPE=Debug -DCMAKE_UNITY_BUILD=TRUE
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ if (${SST_JUCEGUI_BUILD_EXAMPLES})
message(STATUS "Including SST JUCEGUI Examples")

if (NOT TARGET juce::juce_gui_basics)
message(STATUS "Downloading JUCE")
if (NOT DEFINED SST_JUCEGUI_JUCE_VERSION)
set(SST_JUCEGUI_JUCE_VERSION 7.0.12)
endif()
message(STATUS "Downloading JUCE ${SST_JUCEGUI_JUCE_VERSION}")
set(FETCHCONTENT_QUIET FALSE)
include(cmake/CPM.cmake)
CPMAddPackage("gh:juce-framework/JUCE#7.0.3")
CPMAddPackage("gh:juce-framework/JUCE#${SST_JUCEGUI_JUCE_VERSION}")

add_library(JUCE INTERFACE)
endif ()
Expand Down Expand Up @@ -114,7 +117,6 @@ else()
JUCE_JACK=0
JUCE_ALSA=0
JUCE_WASAPI=0
JUCE_STANDALONE_APPLICATION=0
JUCE_DIRECTSOUND=0)
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion include/sst/jucegui/style/StyleAndSettingsConsumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct StyleConsumer
{
if (style())
return style()->getFont(getStyleClass(), p);
return {1};
return SST_JUCE_FONT_CTOR(1);
}

// these don't belong on instances they belong on stylesheets
Expand Down
6 changes: 6 additions & 0 deletions include/sst/jucegui/style/StyleSheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#include <juce_gui_basics/juce_gui_basics.h>
#include <cassert>

#if JUCE_VERSION >= 0x080000
#define SST_JUCE_FONT_CTOR(...) juce::Font(juce::FontOptions(__VA_ARGS__))
#else
#define SST_JUCE_FONT_CTOR(...) juce::Font(__VA_ARGS__)
#endif

namespace sst::jucegui::style
{
struct StyleConsumer;
Expand Down
8 changes: 4 additions & 4 deletions src/sst/jucegui/style/StyleSheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ struct StyleSheetBuiltInImpl : public StyleSheet
{
for (auto &[pn, f] : propFonts)
{
auto nf = juce::Font(p);
auto nf = SST_JUCE_FONT_CTOR(p);
nf.setHeight(f.getHeight());
f = nf;
}
Expand Down Expand Up @@ -185,7 +185,7 @@ struct StyleSheetBuiltInImpl : public StyleSheet

std::cout << __FILE__ << ":" << __LINE__ << " FONT Missing : " << c.cname << "::" << p.pname
<< std::endl;
return juce::Font(36, juce::Font::italic);
return SST_JUCE_FONT_CTOR(36, juce::Font::italic);
}
std::optional<juce::Font> getFontOptional(const Class &c, const Property &p) const override
{
Expand Down Expand Up @@ -247,7 +247,7 @@ struct DarkSheet : public StyleSheetBuiltInImpl
using n = components::base_styles::BaseLabel;
setColour(n::styleClass, n::labelcolor, juce::Colour(220, 220, 220));
setColour(n::styleClass, n::labelcolor_hover, juce::Colour(240, 240, 235));
setFont(n::styleClass, n::labelfont, juce::Font(13));
setFont(n::styleClass, n::labelfont, SST_JUCE_FONT_CTOR(13));
}

{
Expand Down Expand Up @@ -386,7 +386,7 @@ struct LightSheet : public StyleSheetBuiltInImpl
using n = components::base_styles::BaseLabel;
setColour(n::styleClass, n::labelcolor, juce::Colour(30, 30, 30));
setColour(n::styleClass, n::labelcolor_hover, juce::Colour(30, 30, 40));
setFont(n::styleClass, n::labelfont, juce::Font(13));
setFont(n::styleClass, n::labelfont, SST_JUCE_FONT_CTOR(13));
}

{
Expand Down

0 comments on commit 62241c6

Please sign in to comment.