Changeset 1135


Ignore:
Timestamp:
08/14/06 15:59:40 (18 years ago)
Author:
mar637
Message:

more work on a modular scons set up

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/SConstruct

    r1130 r1135  
    11import os
    22import sys
    3 import glob
    43import distutils.sysconfig
    54import platform
     
    1716                            moduledir),
    1817                ("rpfitsdir", "Alternative rpfits location.", ""),
    19                 ("casadir", "Alternative rpfits location", ""),
     18                ("casadir", "Alternative casa location", ""),
    2019                EnumOption("mode", "The type of build.", "debug",
    21                            ["release","debug"], ignorecase=1)
     20                           ["release","debug"], ignorecase=1),
     21                BoolOption("staticlink",
     22                           "Should extrenal libs be linked in statically",
     23                           False)
    2224                )
    2325
    24 def SGlob(pattern):
    25     path = GetBuildPath('SConscript').replace('SConscript', '')
    26     return [ i.replace(path, '') for i in glob.glob(path + pattern) ]
    27 
    28 
    29 env = Environment( toolpath = ['./scons'], tools = ["default", "disttar", "installtree", "malte"],
    30                   ENV = { 'PATH' : os.environ[ 'PATH' ],
     26env = Environment( toolpath = ['./scons'],
     27                   tools = ["default", "disttar", "installtree", "casa",
     28                            "utils"],
     29                   ENV = { 'PATH' : os.environ[ 'PATH' ],
    3130                          'HOME' : os.environ[ 'HOME' ] },
    32                   options = opts)
     31                   options = opts)
    3332
    3433Help(opts.GenerateHelpText(env))
    3534env.SConsignFile()
    36 #env.Append(CASAARCH = '')
    37 #env.Append(CASAROOT = '')
     35env.Append(CASAARCH = '', CASAROOT = '')
    3836
    3937if not env.GetOption('clean'):
    4038    conf = Configure(env)
    4139    # import Custom tests
    42     env.AddCustomTests(conf)
     40    env.AddCasaTest(conf)
    4341    pylib = 'python'+distutils.sysconfig.get_python_version()
    4442    pyinc = "Python.h"
     
    6361    env = conf.Finish()
    6462
    65 env["dist_dir"] = "#/dist/asap"
     63env["stage_dir"] = Dir("#/stage/asap")
     64
    6665# general CPPFLAGS
    67 env.Append(CPPFLAGS='-O3 -Wno-long-long'.split())
     66env.Append(CPPFLAGS=['-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE_SOURCE', '-O3'])
    6867# 64bit flags
    6968if  platform.architecture()[0] == '64bit':
    70     env.Append(CPPFLAGS='-fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__x86_64__ -DAIPS_64B'.split())
     69    env.Append(CPPFLAGS=['-fPIC', '-D__x86_64__', '-DAIPS_64B'])
    7170    # hack to install into /usr/lib64 if scons is in the 32bit /usr/lib/
    7271    if moduledir.startswith("/usr/lib/"):
    7372        moduledir.replace("lib","lib64")
    74 if sys.platform == "darwin":
    75     env['SHLINKFLAGS'] = '$LINKFLAGS -dynamiclib -single_module'
    76     env['SHLIBSUFFIX'] = '.dylib'
     73if env["PLATFORM"] == "darwin":
     74    env['SHLINKFLAGS'] = '$LINKFLAGS -bundle'
     75    #env['SHLIBSUFFIX'] = '.dylib'
    7776
    7877if env['mode'] == 'release':
    7978    env.Append(LINKFLAGS=['-Wl,-O1'])
    80 Export("env","SGlob")
     79Export("env")
    8180
    8281so = env.SConscript("src/SConscript", build_dir="build", duplicate=0)
    83 env.Install(env["dist_dir"], so )
     82env.Install(env["stage_dir"], so )
    8483
    8584pys = env.SConscript("python/SConscript")
    8685asapmod = env.InstallTree(dest_dir = os.path.join(env["moduledir"], "asap"),
    87                       src_dir  = "dist/asap",
    88                       includes = ['*.py', '*.so'],
    89                       excludes = [])
     86                          src_dir  = "stage/asap",
     87                          includes = ['*.py', '*.so'],
     88                          excludes = [])
    9089asapbin = env.Install(os.path.join(env["prefix"], "bin"), "bin/asap")
    9190env.Alias('install', [asapmod, asapbin])
    92 
    93 #if env['mode'] == "release":
    94 #    env.DistTar("dist/asap", ["README", "INSTALL", Dir(env["dist_dir"])])
  • trunk/python/SConscript

    r1122 r1135  
    22
    33# import root environment
    4 Import( "env", "SGlob" )
     4Import( "env")
    55myenv = env.Copy()
    66
    77# gather python files
    8 pys = SGlob("*.py")
     8pys = myenv.SGlob("*.py")
    99pymods = []
    1010for p in pys:
    11     myenv.Install(myenv["dist_dir"],p)
     11    myenv.Install(myenv["stage_dir"],p)
    1212
  • trunk/scons/casa.py

    r1129 r1135  
    11import os
    22import re
     3import sys
     4import platform
    35
    46def generate(env):
     
    1517                        lattices fits measures measures_f \
    1618                        tables scimath scimath_f casa wcs".split()
    17             #env.Prepend( LIBS =  casalibs )
     19            env.Prepend( LIBS =  casalibs )
    1820            casaincd = [os.path.join(env['CASAROOT'], 'code/include'), \
    1921                        os.path.join(env['CASAROOT'], 'code/casa')]
     
    3335            return True
    3436        casaarch = 'linux_gnu'
    35         if sys.platform == 'darwin':
     37        if context.env["PLATFORM"] == 'darwin':
    3638            casaarch = 'darwin'
    3739        elif sys.platform == 'linux2' and platform.architecture()[0] == '64bit':
     
    5254
    5355
    54     def AddCustomTests(conf):
    55         conf.AddTests({
    56                         'CheckCasa'            : CheckCasa,
    57                       })
     56    def AddCasaTest(conf):
     57        conf.AddTests({'CheckCasa': CheckCasa})
    5858
    59     env.AddCustomTests = AddCustomTests
    60 
    61     def AddCustomPath(path=""):
    62         if not len(path) or not os.path.exists(path):
    63             return
    64         env.PrependUnique(CPPPATH = [os.path.join(path, "include")])
    65         env.PrependUnique(LIBPATH = [os.path.join(path, "lib")])
    66     env.AddCustomPath = AddCustomPath
     59    env.AddCasaTest = AddCasaTest
    6760
    6861def exists(env):
  • trunk/src/SConscript

    r1121 r1135  
    22
    33# import root environment
    4 Import( "env", "SGlob" )
     4Import( "env")
    55myenv = env.Copy()
    66
    77# gather cpp files
    8 cpps = SGlob("*.cpp")
    9 pycpps = SGlob("python_*.cpp")
     8cpps = env.SGlob("*.cpp")
     9pycpps = env.SGlob("python_*.cpp")
    1010for pf in pycpps: cpps.remove(pf)
    1111
Note: See TracChangeset for help on using the changeset viewer.