Variables in IntroJucer


#1

Is there a way to use the project settings as variables in other settings, for example:

Binary Name = {PROJECT_NAME}-{PROJECT_VERSION}

To get a binary with a filename like Project-1.0.exe

These variables should be resolved when creating/saving the target.

 

Thanks!


#2

Yes - for most settings (let me know if I've missed any!), it'll look for ${name_of_macro} and replace it with the preprocessor definition for that name.


#3

Thanks, and where would I be able to find these macro names? In my case I am looking for a way to add a version number to a release binary, but I cannot find a name of a macro to do this.


#4

There's no list of names - they're just whatever preprocessor definitions you specify in the config settings.


#5

I think I'm overlooking something easy, but I still do not get it to work. I tried the following:

  • In the general project settings I added VERSION_NUM=0.0.2 to the Preprocessor Definitions
  • Then I set the Project Version to $VERSION_NUM (I also tried ${VERSION_NUM}), (first i used VERSION_NUMBER as a macro, but there seemed to be a character limit)
  • Then in my XCode Release target I put Project_$VERSION_NUM as Binary Name
  • Then save

I expected the Info.plist and .xcodeproj to have 0.0.2 but instead I got a literal $VERSION_NUM (both with or without the curly brackets).

 

Did I miss something?


#6

Like I said, not every value is checked for symbols like that, and the version number isn't. I can't really see what would be the advantage of setting a macro for the version when you could just type it into the version setting box? If you need something in your app to tell you what version is being compiled, there's already an auto-generated ProjectInfo::versionNumber value for that.


#7

My goal is to automaticly add the version number to the binary file using the Introducer


#8

What do you mean by "add it to the binary"? It obviously already sets the version number in the binary - that's why the setting exists..


#9

Ah sorry forgot a word, I mean add it to the binary file name


#10

Ah, I see. Well, looks like I forgot to parse the binary name - try it again now.


#11

For the binary name it works now, thanks! For the version number not, is the second on purpose?


#12

The version number is set globally - if you had multiple exporters which all wanted it to be different, things could get a bit complicated.


#13

Ok, but then I still am not able to use the version number in my binary file name with out typing it in two places as far as I see, so it is not DRY?


#14

The best solution would probably be for the introjucer to automatically set a preprocessor macro based on the version number string, so you could just use that in your filename. I've no time to add that right now though.


#15

Yeah, that was what I was looking for. But I will do it this way now then, and I look forward to a change. Thanks!


#16

Let me bring this up - has this been added in the last two years? I can’t make it work with

_${JucePlugin_VersionString}