Changeset 1130


Ignore:
Timestamp:
08/11/06 12:28:15 (18 years ago)
Author:
mar637
Message:

changed to use scons environments. added cutom paths.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SConstruct

    r1128 r1130  
    55import platform
    66# scons plug-ins
    7 sys.path.append("scons")
    8 from casa import checkCasa
    9 from installtree import InstallTree
     7#from installtree import InstallTree
    108
    119moduledir = distutils.sysconfig.get_python_lib()
    1210
    1311opts = Options("userconfig.py")
    14 opts.AddOptions(PathOption("prefix", "The root installation path",
    15                 distutils.sysconfig.PREFIX),
     12opts.AddOptions(PathOption("prefix",
     13                           "The root installation path",
     14                           distutils.sysconfig.PREFIX),
    1615                PathOption("moduledir",
    1716                            "The python module path (site-packages))",
    1817                            moduledir),
    19                 ("casadir", "Where casa lives. Default is to autodetect", ""),
     18                ("rpfitsdir", "Alternative rpfits location.", ""),
     19                ("casadir", "Alternative rpfits location", ""),
    2020                EnumOption("mode", "The type of build.", "debug",
    21                            ["release","debug"], ignorecase=1))
     21                           ["release","debug"], ignorecase=1)
     22                )
    2223
    2324def SGlob(pattern):
     
    2627
    2728
    28 env = Environment( toolpath = ['./scons'], tools = ["default", "disttar"],
     29env = Environment( toolpath = ['./scons'], tools = ["default", "disttar", "installtree", "malte"],
    2930                  ENV = { 'PATH' : os.environ[ 'PATH' ],
    3031                          'HOME' : os.environ[ 'HOME' ] },
     
    3334Help(opts.GenerateHelpText(env))
    3435env.SConsignFile()
    35 env.Append(CASAARCH = '')
    36 env.Append(CASAROOT = '')
     36#env.Append(CASAARCH = '')
     37#env.Append(CASAROOT = '')
     38
    3739if not env.GetOption('clean'):
    38     conf = Configure(env,custom_tests = {'CheckCasa': checkCasa} )
    39     pyvers = 'python'+distutils.sysconfig.get_python_version()
    40     if not conf.CheckLib(library=pyvers, language='c'): Exit(1)
    41     if not conf.CheckHeader(pyvers+'/Python.h', language='c'): Exit(1)
    42     else: conf.env.Append(CPPPATH=[distutils.sysconfig.get_python_inc()])
    43     if not conf.CheckHeader(['boost/python.hpp'], language="C++"): Exit(1)
    44     if not conf.CheckLib(library='boost_python', language='c++'): Exit(1)
     40    conf = Configure(env)
     41    # import Custom tests
     42    env.AddCustomTests(conf)
     43    pylib = 'python'+distutils.sysconfig.get_python_version()
     44    pyinc = "Python.h"
     45    if env['PLATFORM'] == "darwin":
     46        pylib = "Python"
     47    if not conf.CheckLib(library=pylib, language='c'): Exit(1)
     48    conf.env.Append(CPPPATH=[distutils.sysconfig.get_python_inc()])
     49    if not conf.CheckHeader("Python.h", language='c'):
     50        Exit(1)
     51    if not conf.CheckLibWithHeader('boost_python', 'boost/python.hpp', 'c++'): Exit(1)
     52    conf.env.AddCustomPath(env["rpfitsdir"])
    4553    if not conf.CheckLib('rpfits'): Exit(1)
    46     if not conf.CheckHeader('cfitsio/fitsio.h', language='c++'): Exit(1)
    47     if not conf.CheckLib('cfitsio'): Exit(1)
    48     if not conf.CheckLib('lapack'): Exit(1)
    49     if not conf.CheckLib('blas'): Exit(1)
     54    if not conf.CheckLibWithHeader('cfitsio', 'fitsio.h', 'c'): Exit(1)
     55    if (sys.platform == "darwin"):
     56        conf.env.Append(LIBS = ['-framework vecLib'])
     57    else:
     58        if not conf.CheckLib('lapack'): Exit(1)
     59        if not conf.CheckLib('blas'): Exit(1)
    5060    if not conf.CheckLib('g2c'): Exit(1)
    51     if not conf.CheckLib('stdc++',language='c++'): Exit(1)
     61    if not conf.CheckLib('stdc++', language='c++'): Exit(1)
    5262    if not conf.CheckCasa(env["casadir"]): Exit(1)
    5363    env = conf.Finish()
    5464
    55 env["dist_dir"] = "dist/asap"
     65env["dist_dir"] = "#/dist/asap"
    5666# general CPPFLAGS
    5767env.Append(CPPFLAGS='-O3 -Wno-long-long'.split())
     
    5969if  platform.architecture()[0] == '64bit':
    6070    env.Append(CPPFLAGS='-fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__x86_64__ -DAIPS_64B'.split())
    61     # hack to install into /usr/lib64 if scons isn't installed there
     71    # hack to install into /usr/lib64 if scons is in the 32bit /usr/lib/
    6272    if moduledir.startswith("/usr/lib/"):
    6373        moduledir.replace("lib","lib64")
     74if sys.platform == "darwin":
     75    env['SHLINKFLAGS'] = '$LINKFLAGS -dynamiclib -single_module'
     76    env['SHLIBSUFFIX'] = '.dylib'
     77
    6478if env['mode'] == 'release':
    6579    env.Append(LINKFLAGS=['-Wl,-O1'])
     
    6781
    6882so = env.SConscript("src/SConscript", build_dir="build", duplicate=0)
     83env.Install(env["dist_dir"], so )
    6984
    70 env.Install(env["dist_dir"], so )
    7185pys = env.SConscript("python/SConscript")
    72 asapmod = InstallTree(env,
    73                       dest_dir = os.path.join(moduledir, "asap"),
     86asapmod = env.InstallTree(dest_dir = os.path.join(env["moduledir"], "asap"),
    7487                      src_dir  = "dist/asap",
    7588                      includes = ['*.py', '*.so'],
    7689                      excludes = [])
    77 asapbin = env.Install(os.path.join(distutils.sysconfig.PREFIX, "bin"),"bin/asap")
     90asapbin = env.Install(os.path.join(env["prefix"], "bin"), "bin/asap")
    7891env.Alias('install', [asapmod, asapbin])
    7992
Note: See TracChangeset for help on using the changeset viewer.