1 | import os
|
---|
2 | from SCons.Script import *
|
---|
3 |
|
---|
4 | def addCasaLibs(env):
|
---|
5 | casalibs = "casav atnf images ms components coordinates \
|
---|
6 | lattices fits measures measures_f \
|
---|
7 | tables scimath scimath_f casa wcs".split()
|
---|
8 | env.Prepend( LIBS = casalibs )
|
---|
9 | casaincd = [os.path.join(env['CASAROOT'], 'code/include'), \
|
---|
10 | os.path.join(env['CASAROOT'], 'code/casa')]
|
---|
11 | env.Append( CPPPATH = casaincd )
|
---|
12 | casalibd = os.path.join(env['CASAROOT'], env['CASAARCH'], 'lib')
|
---|
13 | env.Append( LIBPATH = [ casalibd ] )
|
---|
14 | # Explicit templates in casa
|
---|
15 | env.Append( CPPFLAGS = ['-DAIPS_NO_TEMPLATE_SRC'] )
|
---|
16 |
|
---|
17 | def checkCasa(conf, path=None):
|
---|
18 | ''' look for casa libraries'''
|
---|
19 | conf.Message('Checking for casa libraries...')
|
---|
20 | casaarch = None
|
---|
21 | if os.environ.has_key('AIPSPATH'):
|
---|
22 | casa = os.environ.get('AIPSPATH').split()
|
---|
23 | conf.env.Append(CASAARCH = casa[1])
|
---|
24 | conf.env.Append(CASAROOT = casa[0])
|
---|
25 | addCasaLibs(conf.env)
|
---|
26 | conf.Result('yes')
|
---|
27 | return True
|
---|
28 | casaarch = 'linux_gnu'
|
---|
29 | if sys.platform == 'darwin':
|
---|
30 | casaarch = darwin
|
---|
31 | elif sys.platform == 'linux2' and platform.architecture()[0] == '64bit':
|
---|
32 | casarch = 'linux_64b'
|
---|
33 | paths = "/nfs/aips++/weekly /aips++ /opt/aips++ ../casa_asap".split()
|
---|
34 | if path is not None:
|
---|
35 | paths = [path]
|
---|
36 | for p in paths:
|
---|
37 | if os.path.isfile(os.path.join(p,casaarch,"lib/libcasa.a")):
|
---|
38 | conf.env.Append(CASAARCH = casaarch)
|
---|
39 | conf.env.Append(CASAROOT = p)
|
---|
40 | addCasaLibs(conf.env)
|
---|
41 | conf.Result('yes')
|
---|
42 | return True
|
---|
43 | conf.Result('n')
|
---|
44 | return False
|
---|