source: trunk/SConstruct@ 1083

Last change on this file since 1083 was 1082, checked in by mar637, 18 years ago

Initial rev of scons files

File size: 2.6 KB
Line 
1import os,sys
2import distutils.sysconfig
3import platform
4
5#vars = distutils.sysconfig.get_config_vars()
6moduledir = "/tmp/dummy"#distutils.sysconfig.get_python_lib()
7
8opts = Options("userconfig.py", ARGUMENTS)
9opts.Add("prefix", "The root installation path", distutils.sysconfig.PREFIX)
10opts.Add("moduledir", "The python module path (site-packages))", moduledir)
11
12
13def checkCasa(conf, path=None):
14 ''' look for casa libraries'''
15 conf.Message('Checking for casa libraries...')
16 casaarch = None
17 if os.environ.has_key('AIPSPATH'):
18 casa = os.environ.get('AIPSPATH').split()
19 conf.env.Append(CASAARCH = casa[1])
20 conf.env.Append(CASAROOT = casa[0])
21 conf.Result('yes')
22 return True
23 casaarch = 'linux_gnu'
24 if sys.platform == 'darwin':
25 casaarch = darwin
26 elif sys.platform == 'linux2' and platform.architecture()[0] == '64bit':
27 casarch = 'linux_64b'
28 paths = "/nfs/aips++/weekly /aips++ /opt/aips++ ../casa_asap".split()
29 if path is not None:
30 paths = [path]
31 for p in paths:
32 if os.path.isfile(os.path.join(p,casaarch,"lib/libcasa.a")):
33 conf.env.Append(CASAARCH = casaarch)
34 conf.env.Append(CASAROOT = p)
35 conf.Result('yes')
36 return True
37 conf.Result('n')
38 return False
39
40env = Environment( ENV = { 'PATH' : os.environ[ 'PATH' ],
41 'HOME' : os.environ[ 'HOME' ] # required for distcc
42 }, options = opts)
43env.Append(CASAARCH = '')
44env.Append(CASAROOT = '')
45if not env.GetOption('clean'):
46 conf = Configure(env,custom_tests = {'CheckCasa': checkCasa} )
47 pyvers = 'python'+distutils.sysconfig.get_python_version()
48 if not conf.CheckLib(library=pyvers, language='c'): Exit(1)
49 if not conf.CheckHeader(pyvers+'/Python.h', language='c'): Exit(1)
50 else: conf.env.Append(CPPPATH=[distutils.sysconfig.get_python_inc()])
51 #if not conf.CheckHeader(['boost/python.hpp'], language="C++"): Exit(1)
52 if not conf.CheckLib(library='boost_python', language='c++'): Exit(1)
53# # if not conf.CheckLib('g2c'): Exit(1)
54# # if not conf.CheckLib('lapack'): Exit(1)
55# # if not conf.CheckLib('blas'): Exit(1)
56# # if not conf.CheckLib('stdc++',language='c++'): Exit(1)
57 if not conf.CheckCasa(): Exit(1)
58 env = conf.Finish()
59env.Append(CPPFLAGS='-O3 -Wno-long-long'.split())
60if platform.architecture()[0] == '64bit':
61 env.Append(CPPFLAGS='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__x86_64__ -DAIPS_64B -DAIPS_GCC3'.split())
62
63#env.BuildDir('build', 'src')
64Export("env")
65so = env.SConscript("src/SConscript", build_dir="build", duplicate=0)
66env.Install(moduledir, so )
67env.Alias('install',moduledir)
Note: See TracBrowser for help on using the repository browser.