[1105] | 1 | import os, sys, glob
|
---|
[1082] | 2 | import distutils.sysconfig
|
---|
| 3 | import platform
|
---|
[1120] | 4 | sys.path.append("scons")
|
---|
| 5 | from casa import checkCasa
|
---|
[1082] | 6 |
|
---|
[1120] | 7 | moduledir = '/tmp'#distutils.sysconfig.get_python_lib()
|
---|
[1082] | 8 |
|
---|
[1120] | 9 | opts = Options("userconfig.py")
|
---|
| 10 | opts.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] | 18 | def SGlob(pattern):
|
---|
| 19 | path = GetBuildPath('SConscript').replace('SConscript', '')
|
---|
| 20 | return [ i.replace(path, '') for i in glob.glob(path + pattern) ]
|
---|
| 21 |
|
---|
| 22 |
|
---|
[1120] | 23 | env = Environment( toolpath = ['./scons'], tools = ["default", "disttar"],
|
---|
| 24 | ENV = { 'PATH' : os.environ[ 'PATH' ],
|
---|
| 25 | 'HOME' : os.environ[ 'HOME' ] },
|
---|
| 26 | options = opts)
|
---|
[1082] | 27 |
|
---|
[1120] | 28 | Help(opts.GenerateHelpText(env))
|
---|
| 29 | env.SConsignFile()
|
---|
[1082] | 30 | env.Append(CASAARCH = '')
|
---|
| 31 | env.Append(CASAROOT = '')
|
---|
| 32 | if 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 |
|
---|
| 50 | env["dist_dir"] = "dist/asap"
|
---|
[1090] | 51 | # general CPPFLAGS
|
---|
[1082] | 52 | env.Append(CPPFLAGS='-O3 -Wno-long-long'.split())
|
---|
[1090] | 53 | # 64bit flags
|
---|
[1082] | 54 | if platform.architecture()[0] == '64bit':
|
---|
[1090] | 55 | env.Append(CPPFLAGS='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__x86_64__ -DAIPS_64B'.split())
|
---|
[1120] | 56 | if env['mode'] == 'release':
|
---|
| 57 | env.Append(LINKFLAGS=['-Wl,-O1'])
|
---|
| 58 | Export("env","SGlob")
|
---|
[1082] | 59 |
|
---|
| 60 | so = env.SConscript("src/SConscript", build_dir="build", duplicate=0)
|
---|
[1120] | 61 |
|
---|
| 62 | env.Install(env["dist_dir"], so )
|
---|
| 63 | pys = env.SConscript("python/SConscript")
|
---|
| 64 | env.Install(moduledir, Dir(env["dist_dir"]))
|
---|
[1105] | 65 | env.Alias('install', moduledir)
|
---|
[1120] | 66 |
|
---|
| 67 | #if env['mode'] == "release":
|
---|
| 68 | # env.DistTar("dist/asap", ["README", "INSTALL", Dir(env["dist_dir"])])
|
---|