source: trunk/SConstruct@ 1120

Last change on this file since 1120 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
Line 
1import os, sys, glob
2import distutils.sysconfig
3import platform
4sys.path.append("scons")
5from casa import checkCasa
6
7moduledir = '/tmp'#distutils.sysconfig.get_python_lib()
8
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))
17
18def SGlob(pattern):
19 path = GetBuildPath('SConscript').replace('SConscript', '')
20 return [ i.replace(path, '') for i in glob.glob(path + pattern) ]
21
22
23env = Environment( toolpath = ['./scons'], tools = ["default", "disttar"],
24 ENV = { 'PATH' : os.environ[ 'PATH' ],
25 'HOME' : os.environ[ 'HOME' ] },
26 options = opts)
27
28Help(opts.GenerateHelpText(env))
29env.SConsignFile()
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()])
38 if not conf.CheckHeader(['boost/python.hpp'], language="C++"): Exit(1)
39 if not conf.CheckLib(library='boost_python', language='c++'): Exit(1)
40 if not conf.CheckLib('rpfits'): Exit(1)
41 if not conf.CheckHeader('cfitsio/fitsio.h', language='c++'): Exit(1)
42 if not conf.CheckLib('cfitsio'): Exit(1)
43 if not conf.CheckLib('lapack'): Exit(1)
44 if not conf.CheckLib('blas'): Exit(1)
45 if not conf.CheckLib('g2c'): Exit(1)
46 if not conf.CheckLib('stdc++',language='c++'): Exit(1)
47 if not conf.CheckCasa(): Exit(1)
48 env = conf.Finish()
49
50env["dist_dir"] = "dist/asap"
51# general CPPFLAGS
52env.Append(CPPFLAGS='-O3 -Wno-long-long'.split())
53# 64bit flags
54if platform.architecture()[0] == '64bit':
55 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")
59
60so = env.SConscript("src/SConscript", build_dir="build", duplicate=0)
61
62env.Install(env["dist_dir"], so )
63pys = env.SConscript("python/SConscript")
64env.Install(moduledir, Dir(env["dist_dir"]))
65env.Alias('install', moduledir)
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.