[Scons-users] scons command line varibles

Harry Cruise princeharry_89 at yahoo.com
Fri Jul 4 12:48:51 EDT 2014


Hello,


How to set compiler related flags in scons-y way ?

Say if I have three compiler and two of them are having multiple versions:
1) gcc - version 4.6, 4.4 

2) msvc - version 1600, 1700
3) cygwin

There are few flags that helps in setting values for them. But my requirement is if the values are provided in the command line argument then only set the value otherwise let the scons use default value that it picks from user's environment.

Few queries on this:
1) If I am using --cc and -cxx for c and c++ compiler respectively(using AddOption) then,
    whether values for them should set before initialization of environment ?
    As I read that MSVC_VERSION needs to be set during initialization.

    I was following some process like:
    AddOption('--cc', dest='c_compiler',
default=None,
 type='string',
          nargs=1,
          action='store',
          metavar='DIR',
          help='C compiler name')

           env = Environment()

            if c_compiler != None:
                env['CC'] = c_compiler

This makes sure to set only if command line value is provided(or not None).
Is it correct way of using ?

But How in case of MSVC_VERSION varible ?
I read that it needs to be set during construction as follow:
    AddOption('--msvc', dest='msvc_version',  default=None, ...)
    env = Environment(MSVC_VERSION = GetOption('msvc_version'))
But what if msvc_version is None ?


2) What is "metavar" argument in AddOption function?

3) If I run/use on msvc compiler what is significance of 'CXX' and 'CC' variables ?
     Are they still applicable ?

4) How can I use --cc (specified in point (1)), As '-cc' or in some abbreviated way ?

In short I want to know all the clause and process that needs to be follow if I want to make my build script to be work for different compilers and different versions of them.


I would appreciate if some one could share example method to do this.          


Regards,
Harry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140704/7a8cf35a/attachment.html>


More information about the Scons-users mailing list