CMake support in the Projucer

Would being able to add a custom header in each platform’s section of the generated CMakeLists.txt improve this significantly?

I’m more into a full blown cmake solution like mdsp one using find_package style

1 Like

Thank you for this!
It is working, but since I want to crosscompile for linux-arm on a mac I need to edit the CMakeLists.txt every time.

  1. I need to add the “find_package (XXX REQUIRED)”-line. Would be great to have a text field for these in the Projucer.
  2. If I want to crosscompile the Linux Makefile, I need to remove “if (UNIX AND NOT APPLE)” condition. Even if I add "-DAPPLE=0 " to the cmake options in the clion Preferences it doesn’t work. One Way would be to use a dedicated variable like CC_LINUX (Checkbox in the projucer?)

set(JUCE_APPLE APPLE)
if (CC_LINUX)
set (JUCE_APPLE 0)
endif (CC_LINUX)
if (UNIX AND NOT JUCE_APPLE)

Did you have a look at FRUT (previously known as JUCE.cmake)? It might be more flexible for what you want to do. Check it out at https://github.com/McMartin/FRUT.

The CLion exporter works fine (at least with Ubuntu). It would be nice to add a field in Projucer to pass some parameters to the CMake file generated. Actually, I have to edit it manually each time the project is saved in Projucer. For information, I want to see all the warnings generated by the compiler, so I need to add the following instruction:
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
Thanks.

You shouldn’t have to edit CMakeLists.txt to add compiler flags:

So just add the desired flags to the Linux Makefile exporter.

Thanks. I didn’t know that there was a link between the CLion exporter and the others.

Is this topic still active?
All I would like to see is a official way to setup juce projects using CMakeLists. Maybe something like a few macros that do all the stuff that the projucer does. For instance, collecting files, lib dependencies. Maybe spit out some compiler flags or defines that are required for juce to work. A macro that does this proxy source include thingy.
I could write this myself but I always expect that there are some “hidden” settings I would forget.

What would be nice to is to have a way to create some files to get going. The project define header, entry points for UI apps or plugins, this kind of stuff.

Would something like this be possible? Guess I’ll have to annoy some JUCE employees at ADC '18. (Oh, I’m looking forward to this!)

My motivation to use CMake mostly comes from the fact that many other projects use cmake and this makes them easy to combine. For example, using google test is a matter of one cmake-include and setting up a target for the test suit. I also would like to create a multi-project solution.

1 Like

@WilliamR: Today is your lucky day, since what you described does exist: https://github.com/McMartin/FRUT

I’m the author of this project, so feel free to ask me any questions or to share with me any desires, preferably by creating an issue (https://github.com/McMartin/FRUT/issues) or by PM to avoid spamming this thread.

5 Likes

JUCE’s implementation is somewhat different to what you want: the Projucer will create the cmakelist files for you - not the other way around. Currently, it’s also limited to CLion support.

Will CLion support be extended? Currently it’s not possible to build multiple targets (without an annoying workaround) or use custom compiler flags for different configurations.

For example, you can only use the debugger in CLion with the Debug configuration or with the -g compiler flag, which means you have to edit the CMakeLists.txt file for different build configs as the Projucer doesn’t add that flag (even if “Debug Mode” is enabled) and compiler flags are set in the exporter, not each configuration.

I would also love to see generic CMake support, rather than just another exporter in the Projucer for CLion. While this exporter is much appreciated (!) I find it a pretty silly workflow to have to work in a powerful IDE like CLion for anything that doesn’t involve creating/deleting/renaming files, adding libraries, etc., but then switch back to the Projucer for these tasks. Intellij provides amazing support for auto-refactoring when making file changes (automatically renaming class names in headers and cpp files for example). It just doesn’t make sense to separate these coding tasks between two running native apps. I would really like to develop in CLion and not have to think about the Projucer, but just use the JUCE code like a library.

EDIT: I am checking out McMartin’s FRUT project for now :slight_smile:

1 Like

Bump for an official way to add CMake support as an alternative to Projucer

Like this post if you feel the same way :slight_smile:

15 Likes

Bump for this to happen in 2019 :slight_smile:

Thanks !

3 Likes

I’m on it :wink:

3 Likes

Yep, I’d love to see this too.
Due to the number of CI builds I have running these days avoiding to have to build the PJ first will be a big help. And editing it programatically (for VST2 SDK locations etc.) is likely to be easier in CMake (or you can probably use environment variables).

6 Likes

I would love the projucer to export easily to Clion

1 Like

It does easily export to Clion. I use it all the time. What is not working for you?

I think it morphed a bit into this request:

The Projucer is not very popular, since it developed from a project-setup tool Introjucer into a GUI-designer then a Live-coding environment, and now back to a project maintenance tool :wink:

Even though the other features are still present, I know…

1 Like

I tried once a while back I will try again !