Author Topic: Using global variables  (Read 3294 times)

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Using global variables
« on: July 28, 2019, 06:56:04 pm »
I read http://wiki.codeblocks.org/index.php?title=Global_compiler_variables
and i want  define custom variable members
Quote
Example :
global variables : 'sdk143'
base : U:\Donnees\Svn_Compile\Cb\Tdm5103\cb-11798-sdk143\src
          U:\Donnees\Svn_Compile\Cb\Tdm5103\cb-11798-sdk143\src ( no space !)
new fields =>
lib28 : $(#sdk143)\devel\share\CodeBlocks
lib30 : $(#sdk143)\devel30\share\CodeBlocks
lib31 : $(#sdk143)\devel31\share\CodeBlocks

The following use makes it possible to obtain :
Quote
$(#sdk143.lib28) => U:\Donnees\Svn_Compile\Cb\Tdm5103\cb-11798-sdk143\src\devel\share\CodeBlocks

Example : tests under my VISTA configuration and batch command in 
Quote
'Project->Build options...->Pre/post steps->Post-build steps' :
zip -j9 $(#sdk143.lib28\cbBuildTools.zip manifest.xml
is replaced by
zip -j9 U:\Donnees\Svn_Compile\Cb\Tdm5103\cb-11798-sdk143-q\src\devel\share\CodeBlocks\cbBuildTools.zip manifest.xml
which is correct.

and according to the syntax of the global variables of CB
Quote
It is generally recommended to use the syntax $(#variable.include) instead of $(#variable)/include, as it provides additional flexibility and is otherwise exactly identical in functionality
$(#sdk143)\lib28 should be equivalent to $(#sdk143.lib28)
Quote
zip -j9 $(#sdk143)\lib28\cbBuildTools.zip manifest.xml
is replaced by
U:\Donnees\Svn_Compile\Cb\Tdm5103\cb-11798-sdk143-q\src\lib28\cbBuildTools.zip manifest.xml
which is not  correct !

The user fieds do they have the same rules as the built-in fields ?
I have to make a mistake, but I can not find where ?
« Last Edit: July 28, 2019, 07:03:51 pm by LETARTARE »
CB-13515, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.6
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline osdt

  • Multiple posting newcomer
  • *
  • Posts: 63
Re: Using global variables
« Reply #1 on: July 28, 2019, 08:37:05 pm »
Quote
$(#sdk143)\lib28 should be equivalent to $(#sdk143.lib28)

Why do you think so? Variable expansion ends at the closing brace and therefore "\lib28" is just a string as any other.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: Using global variables
« Reply #2 on: July 28, 2019, 11:31:17 pm »
Quote
Quote

    It is generally recommended to use the syntax $(#variable.include) instead of $(#variable)/include, as it provides additional flexibility and is otherwise exactly identical in functionality

$(#sdk143)\lib28 should be equivalent to $(#sdk143.lib28)

There are a few variables that are special. For example the .include and the .lib ecc. If they are empty and the base is not empty then
$(#variable.include) will expand to $(#variable.base)/include   the same for
$(#variable.lib) will expand to $(#variable.base)/lib

but nothing more. As osdt says the expansion works only in the limit of the parenthesis...

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: Using global variables
« Reply #3 on: July 29, 2019, 12:26:32 am »
Thank you for all the answers.

In http://wiki.codeblocks.org/index.php?title=Global_compiler_variables
Quote
Names and Members :
Code::Blocks allows you to define custom variable members in addition to the builtin ones.
As 'lib28' is a  custom variable members, I thought that '$(#variable.lib28)' will expand to '$(#variable.base)/lib28' 

So I'm going to modify the wiki accordingly, by specifying this precision.
CB-13515, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.6
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl