source: trunk/SConstruct@ 1122

Last change on this file since 1122 was 1120, checked in by mar637, 18 years ago

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

File size: 2.6 KB
RevLine 
[1105]1import os, sys, glob
[1082]2import distutils.sysconfig
3import platform
[1120]4sys.path.append("scons")
5from casa import checkCasa
[1082]6
[1120]7moduledir = '/tmp'#distutils.sysconfig.get_python_lib()
[1082]8
[1120]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))
[1082]17
[1105]18def SGlob(pattern):
19 path = GetBuildPath('SConscript').replace('SConscript', '')
20 return [ i.replace(path, '') for i in glob.glob(path + pattern) ]
21
22
[1120]23env = Environment( toolpath = ['./scons'], tools = ["default", "disttar"],
24 ENV = { 'PATH' : os.environ[ 'PATH' ],
25 'HOME' : os.environ[ 'HOME' ] },
26 options = opts)
[1082]27
[1120]28Help(opts.GenerateHelpText(env))
29env.SConsignFile()
[1082]30env.Append(CASAARCH = '')
31env.Append(CASAROOT = '')
32if not env.GetOption('clean'):
33 conf = Configure(env,custom_tests = {'CheckCasa': checkCasa} )
34 pyvers = 'python'+distutils.sysconfig.get_python_version()
35 if not conf.CheckLib(library=pyvers, language='c'): Exit(1)
36 if not conf.CheckHeader(pyvers+'/Python.h', language='c'): Exit(1)
37 else: conf.env.Append(CPPPATH=[distutils.sysconfig.get_python_inc()])
[1090]38 if not conf.CheckHeader(['boost/python.hpp'], language="C++"): Exit(1)
[1082]39 if not conf.CheckLib(library='boost_python', language='c++'): Exit(1)
[1090]40 if not conf.CheckLib('rpfits'): Exit(1)
[1120]41 if not conf.CheckHeader('cfitsio/fitsio.h', language='c++'): Exit(1)
[1090]42 if not conf.CheckLib('cfitsio'): Exit(1)
43 if not conf.CheckLib('lapack'): Exit(1)
44 if not conf.CheckLib('blas'): Exit(1)
[1105]45 if not conf.CheckLib('g2c'): Exit(1)
[1090]46 if not conf.CheckLib('stdc++',language='c++'): Exit(1)
[1082]47 if not conf.CheckCasa(): Exit(1)
48 env = conf.Finish()
[1120]49
50env["dist_dir"] = "dist/asap"
[1090]51# general CPPFLAGS
[1082]52env.Append(CPPFLAGS='-O3 -Wno-long-long'.split())
[1090]53# 64bit flags
[1082]54if platform.architecture()[0] == '64bit':
[1090]55 env.Append(CPPFLAGS='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__x86_64__ -DAIPS_64B'.split())
[1120]56if env['mode'] == 'release':
57 env.Append(LINKFLAGS=['-Wl,-O1'])
58Export("env","SGlob")
[1082]59
60so = env.SConscript("src/SConscript", build_dir="build", duplicate=0)
[1120]61
62env.Install(env["dist_dir"], so )
63pys = env.SConscript("python/SConscript")
64env.Install(moduledir, Dir(env["dist_dir"]))
[1105]65env.Alias('install', moduledir)
[1120]66
67#if env['mode'] == "release":
68# env.DistTar("dist/asap", ["README", "INSTALL", Dir(env["dist_dir"])])
Note: See TracBrowser for help on using the repository browser.