How can I specify C++ version from PIP?

I’m making a simple local CI system which is driven by PowerShell.
I need to make unit test projects from PIP by Projucer’s command line mode.
My module uses C++17…so, I assume that I have to declare C++ version in the JUCE_PIP_METADATA.
Is that right? If so, what is the magic word?

I did a very simple customization.
I added these two line to PIPGenerator::setProjectSettings(ValueTree&).

static const Identifier cppver = "cppversion";
setPropertyIfNotEmpty(Ids::cppLanguageStandard, metadata[cppver]);

and my PIP metadata looks like…


name:            myUnitTest
cppversion:      17


And build my custom Projucer, and run it from my script.
It works for now.
Let me know if I’m going totally wrong direction, or you notice any pitfalls.

I think you are on the right track, and I guess there are a few other project settings that could be supported in the same way.

Nitpicking, instead of cppversion, I would use cppStandard, to match the minimumCppStandard value that can be specified by JUCE modules (for instance, juce_dsp).

1 Like

OK! Thanks for your reply.

It didn’t occur to me until you said minimumCppStandard, but should I declare minimumCppStandard: 17 between BEGIN_JUCE_MODULE_DECLARATION and END_JUCE_MODULE_DECLARATION?
It will be more easy and I won’t need to change Projucer’s source code every time I update JUCE.

No, Projucer looks for BEGIN_JUCE_MODULE_DECLARATION and END_JUCE_MODULE_DECLARATION in the main header of each JUCE module, not in PIP files.

1 Like

I take it this never made it in to the main juce repo?
I’m a bit stuck without this as I’m doing the following:

  • Adding choc (which is C++17) to tracktion_graph
  • Trying to generate our example projects from the PIPs on cloud build machines
  • Trying to build all these example projects (on macOS, Windows and Ubuntu 16.04)

The only thing I can think of is to hack the generated PJ file to add cppLanguageStandard="17" but that’s a real pain to do cross-platform.

Anyone got any better ideas?