Changeset 1120 for trunk


Ignore:
Timestamp:
08/10/06 12:37:50 (18 years ago)
Author:
mar637
Message:

moved helper functions into scons subdir. added disttar builder. release/debug modes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SConstruct

    r1105 r1120  
    22import distutils.sysconfig
    33import platform
     4sys.path.append("scons")
     5from casa import checkCasa
    46
    5 #vars = distutils.sysconfig.get_config_vars()
    6 moduledir = "/opt/lib/python2/"#distutils.sysconfig.get_python_lib()
     7moduledir = '/tmp'#distutils.sysconfig.get_python_lib()
    78
    8 opts = Options("userconfig.py", ARGUMENTS)
    9 opts.Add("prefix", "The root installation path", distutils.sysconfig.PREFIX)
    10 opts.Add("moduledir", "The python module path (site-packages))", moduledir)
     9opts = Options("userconfig.py")
     10opts.AddOptions(PathOption("prefix", "The root installation path",
     11                distutils.sysconfig.PREFIX),
     12                PathOption("moduledir",
     13                            "The python module path (site-packages))",
     14                            moduledir),
     15                EnumOption("mode", "The type of build.", "debug",
     16                           ["release","debug"], ignorecase=1))
    1117
    1218def SGlob(pattern):
     
    1521
    1622
    17 def addCasaLibs(env):
    18     casalibs = "casav atnf images ms components coordinates \
    19                 lattices fits measures measures_f \
    20                 tables scimath scimath_f casa wcs".split()
    21     env.Prepend( LIBS =  casalibs )
    22     casaincd = [os.path.join(env['CASAROOT'], 'code/include'), \
    23                 os.path.join(env['CASAROOT'], 'code/casa')]
    24     env.Append( CPPPATH = casaincd )
    25     casalibd = os.path.join(env['CASAROOT'], env['CASAARCH'], 'lib')
    26     env.Append( LIBPATH = [ casalibd ] )
    27     # Explicit templates in casa
    28     env.Append( CPPFLAGS = ['-DAIPS_NO_TEMPLATE_SRC'] )
     23env = Environment( toolpath = ['./scons'], tools = ["default", "disttar"],
     24                  ENV = { 'PATH' : os.environ[ 'PATH' ],
     25                          'HOME' : os.environ[ 'HOME' ] },
     26                  options = opts)
    2927
    30 def checkCasa(conf, path=None):
    31     ''' look for casa libraries'''
    32     conf.Message('Checking for casa libraries...')
    33     casaarch = None
    34     if os.environ.has_key('AIPSPATH'):
    35         casa = os.environ.get('AIPSPATH').split()
    36         conf.env.Append(CASAARCH = casa[1])
    37         conf.env.Append(CASAROOT = casa[0])
    38         addCasaLibs(conf.env)
    39         conf.Result('yes')
    40         return True
    41     casaarch = 'linux_gnu'
    42     if sys.platform == 'darwin':
    43         casaarch = darwin
    44     elif sys.platform == 'linux2' and platform.architecture()[0] == '64bit':
    45         casarch = 'linux_64b'
    46     paths = "/nfs/aips++/weekly /aips++ /opt/aips++ ../casa_asap".split()
    47     if path is not None:
    48         paths = [path]
    49     for p in paths:
    50         if os.path.isfile(os.path.join(p,casaarch,"lib/libcasa.a")):
    51             conf.env.Append(CASAARCH = casaarch)
    52             conf.env.Append(CASAROOT = p)
    53             addCasaLibs(conf.env)
    54             conf.Result('yes')
    55             return True
    56     conf.Result('n')
    57     return False
    58 
    59 env = Environment( ENV = { 'PATH' : os.environ[ 'PATH' ],
    60                            'HOME' : os.environ[ 'HOME' ] # required for distcc
    61                    }, options = opts)
     28Help(opts.GenerateHelpText(env))
     29env.SConsignFile()
    6230env.Append(CASAARCH = '')
    6331env.Append(CASAROOT = '')
     
    7139    if not conf.CheckLib(library='boost_python', language='c++'): Exit(1)
    7240    if not conf.CheckLib('rpfits'): Exit(1)
     41    if not conf.CheckHeader('cfitsio/fitsio.h', language='c++'): Exit(1)
    7342    if not conf.CheckLib('cfitsio'): Exit(1)
    7443    if not conf.CheckLib('lapack'): Exit(1)
     
    7847    if not conf.CheckCasa(): Exit(1)
    7948    env = conf.Finish()
     49
     50env["dist_dir"] = "dist/asap"
    8051# general CPPFLAGS
    8152env.Append(CPPFLAGS='-O3 -Wno-long-long'.split())
     
    8354if  platform.architecture()[0] == '64bit':
    8455    env.Append(CPPFLAGS='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__x86_64__ -DAIPS_64B'.split())
     56if env['mode'] == 'release':
     57    env.Append(LINKFLAGS=['-Wl,-O1'])
     58Export("env","SGlob")
    8559
    86 Export("env","SGlob")
    8760so = env.SConscript("src/SConscript", build_dir="build", duplicate=0)
    88 env.Install(moduledir, so )
    89 #pys = env.SConscript("python/SConscript")
    90 # env.Install(moduledir, pys)
     61
     62env.Install(env["dist_dir"], so )
     63pys = env.SConscript("python/SConscript")
     64env.Install(moduledir, Dir(env["dist_dir"]))
    9165env.Alias('install', moduledir)
     66
     67#if env['mode'] == "release":
     68#    env.DistTar("dist/asap", ["README", "INSTALL", Dir(env["dist_dir"])])
Note: See TracChangeset for help on using the changeset viewer.