[1119] | 1 | import os
|
---|
[1129] | 2 | import re
|
---|
[1135] | 3 | import sys
|
---|
| 4 | import platform
|
---|
[1119] | 5 |
|
---|
[1129] | 6 | def generate(env):
|
---|
| 7 | def CheckCasaLib(context, lib):
|
---|
| 8 | context.Message("Checking casa library '%s'..."%lib)
|
---|
[1119] | 9 |
|
---|
[1129] | 10 | context.Result(r)
|
---|
| 11 | return r
|
---|
| 12 |
|
---|
| 13 | def CheckCasa(context, path=None):
|
---|
| 14 | ''' look for casa libraries'''
|
---|
| 15 | def addCasa(env):
|
---|
[1295] | 16 | casalibs = "casav atnf ms components coordinates \
|
---|
[1129] | 17 | lattices fits measures measures_f \
|
---|
| 18 | tables scimath scimath_f casa wcs".split()
|
---|
[1135] | 19 | env.Prepend( LIBS = casalibs )
|
---|
[1129] | 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')
|
---|
[1119] | 35 | return True
|
---|
[1129] | 36 | casaarch = 'linux_gnu'
|
---|
[1135] | 37 | if context.env["PLATFORM"] == 'darwin':
|
---|
[1129] | 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 |
|
---|
[1135] | 56 | def AddCasaTest(conf):
|
---|
| 57 | conf.AddTests({'CheckCasa': CheckCasa})
|
---|
[1129] | 58 |
|
---|
[1135] | 59 | env.AddCasaTest = AddCasaTest
|
---|
[1129] | 60 |
|
---|
| 61 | def exists(env):
|
---|
| 62 | return true
|
---|