source: branches/Release2.1.2/scons/casa.py@ 1403

Last change on this file since 1403 was 1295, checked in by mar637, 18 years ago

merge form Release2.1.1 branch

File size: 2.2 KB
Line 
1import os
2import re
3import sys
4import platform
5
6def generate(env):
7 def CheckCasaLib(context, lib):
8 context.Message("Checking casa library '%s'..."%lib)
9
10 context.Result(r)
11 return r
12
13 def CheckCasa(context, path=None):
14 ''' look for casa libraries'''
15 def addCasa(env):
16 casalibs = "casav atnf ms components coordinates \
17 lattices fits measures measures_f \
18 tables scimath scimath_f casa wcs".split()
19 env.Prepend( LIBS = casalibs )
20 casaincd = [os.path.join(env['CASAROOT'], 'code/include'), \
21 os.path.join(env['CASAROOT'], 'code/casa')]
22 env.Append( CPPPATH = casaincd )
23 casalibd = os.path.join(env['CASAROOT'], env['CASAARCH'], 'lib')
24 env.Append( LIBPATH = [ casalibd ] )
25 # Explicit templates in casa
26 env.Append( CPPFLAGS = ['-DAIPS_NO_TEMPLATE_SRC'] )
27 context.Message('Checking for casa libraries...')
28 casaarch = None
29 if os.environ.has_key('AIPSPATH'):
30 casa = os.environ.get('AIPSPATH').split()
31 context.env.Append(CASAARCH = casa[1])
32 context.env.Append(CASAROOT = casa[0])
33 addCasa(context.env)
34 context.Result('yes')
35 return True
36 casaarch = 'linux_gnu'
37 if context.env["PLATFORM"] == 'darwin':
38 casaarch = 'darwin'
39 elif sys.platform == 'linux2' and platform.architecture()[0] == '64bit':
40 casaarch = 'linux_64b'
41 paths = "/nfs/aips++/weekly /aips++ /opt/aips++ ../casa_asap".split()
42 if path is not None and len(path):
43 paths = [path]
44 # @todo poor mans detection, do autocontext later
45 for p in paths:
46 if os.path.isfile(os.path.join(p, casaarch, "lib/libcasa.a")):
47 context.env.Append(CASAARCH = casaarch)
48 context.env.Append(CASAROOT = os.path.abspath(p))
49 addCasa(context.env)
50 context.Result('yes')
51 return True
52 context.Result('no')
53 return False
54
55
56 def AddCasaTest(conf):
57 conf.AddTests({'CheckCasa': CheckCasa})
58
59 env.AddCasaTest = AddCasaTest
60
61def exists(env):
62 return true
Note: See TracBrowser for help on using the repository browser.