Open sdeleon28 opened 3 years ago
I've already forked and solved this. Working on some docs to put a PR together.
BTW, contributing guidelines say I should assign this to myself but it looks like I have no permissions to do so.
Thanks @sdeleon28! I wasn't even aware of CPM :)
I think this is related to an issue we've started seeing a fair amount recently, and one which @JoshMarler I think has some ideas on.
Thanks for tackling it. I'll assign it to you and check the permissions settings!
Yep was hoping to tackle this week but I've been tight on time so apologies @sdeleon28 ! For what it's worth, I was thinking the nicest approach might be to separate the examples CMakeLists.txt into it's own project and remove add_subdirectory(examples/GainPlugin)
from the top level react_juce
CMakeLists.txt
.
My hope is that we can then remove add_subdirectory(ext/juce)
from the top level CMakeLists.txt
and instead specify that users need to place add_subdirectory(juce)
before add_subdirectory(react-juce)
in their own CMakeLists.txt
. I'm hoping this should mean that the juce_add_module
function then becomes available to react-juce
CMakeLists.txt
without us having clashes with juce targets added twice etc.
No worries about the delay, @JoshMarler! I've been teaching myself some CMake for the past few days and now feel confident enough to contribute a solution that doesn't break anything.
When you say "into its own project" do you mean a separate repo? That could work but would also make the example a bit less discoverable. On the plus side, it would actually be a more useful example if the inclusion of the library is explicit in code, since that structure more closely resembles client code.
Anyhow, I've already fixed this in a slightly more duck-tape-y way. I'll send a PR to see if it's something you might want to merge as a temporary fix while the broader refactoring doesn't happen. I've added some docs about how to use it with CPM. Not sure if that's the main way you want to encourage users to install the library, but it's the most straight-forward I'm aware of.
My PR also takes care of the extra step that builds JUCE in an optional way.
Essentially, everything that used to happen, still happens by default (I haven't broken anyone's current tooling or workflow) but it allows you to opt out of certain features.
I've also added an extra check for the js library, so that you're able to set whether to use Duktape or Hermes from client code.
Hey @sdeleon28 !
Sorry "project" was a poor choice of words. I mean more that examples would have it's own "top level" CMakeLists.txt
.
i.e. users would do the following to run the example projetct:
mkdir react-juce-examples-build
cd react-juce-examples-build
cmake ../react-juce/examples .
cmake --build . --target GainPlugin_Standalone
So under react-juce/examples
there would be a top level examples project which pulls in each of the example targets and also uses an add_subdirectory(../react-juce)
to add react-juce
as a dependency to the example projects.
Either way though I'll take a look at your PR later this evening!
I'm trying to add react-juce as a CPM dependency with this code:
And when I try to build with my usual
cmake -S . -B out/builds/
I get these errors: