source: branches/hpc34/scons/casa.py@ 3072

Last change on this file since 3072 was 2486, checked in by Malte Marquarding, 13 years ago

casacore moved to cmake, add tools locally

File size: 2.6 KB
Line 
1import os
2import re
3import sys
4import platform
5import SCons
6
7def generate(env):
8 env["LEXFLAGS"] = SCons.Util.CLVar("-P${SOURCE.filebase}")
9 env["YACCFLAGS"] = SCons.Util.CLVar("-p ${SOURCE.filebase}")
10
11
12 def DarwinDevSdk():
13 import platform
14 devpath = { "4" : "/Developer/SDKs/MacOSX10.4u.sdk",
15 "5" : "/Developer/SDKs/MacOSX10.5.sdk",
16 "6" : "/Developer/SDKs/MacOSX10.6.sdk" }
17 version = platform.mac_ver()[0].split(".")
18 if version[0] != '10' or int(version[1]) < 4:
19 print "Only Mac OS X >= 10.4 is supported"
20 env.Exit(1)
21 return devpath[version[1]]
22 env.DarwinDevSdk = DarwinDevSdk
23
24 def AddCasaPlatform():
25 pd = { "darwin": [],
26 "64bit": [],
27 "linux2": [],
28 "cray": ["-Minform=severe"]
29 }
30 # -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
31 platfdefs = []
32 sysplf = sys.platform
33 # do some dodgey cray detection...
34 if os.environ.has_key("CATAMOUNT_DIR"):
35 sysplf = "cray"
36 sysarch = platform.architecture()[0]
37 if sysarch == '64bit':
38 platfdefs += pd["64bit"]
39 platfdefs += ["-fPIC"]
40 #don't know why but lib*.a needs to have -fPIC here
41 env.AppendUnique(SHFORTRANFLAGS=["-fPIC"])
42 env.AppendUnique(FORTRANFLAGS=["-fPIC"])
43 elif sysplf == "cray":
44 # pgi compiler
45 # had a go at this, but it seem to need a whole lot
46 # of environment variables
47 # probably nedd a pgi builder
48 platfdefs += pd["cray"]
49 else:
50 platfdefs += pd[sysplf]
51 env.AppendUnique(CPPFLAGS=platfdefs)
52 if env["PLATFORM"] == 'darwin':
53 uniarch = env.get("universal", False)
54 flags = []
55 if uniarch:
56 for i in uniarch.split(','):
57 flags += ['-arch', i]
58 ppflags = flags + ['-isysroot' , env.DarwinDevSdk() ]
59 linkflags = flags + ['-Wl,-syslibroot,%s' % env.DarwinDevSdk()]
60 env.Append(CPPFLAGS=ppflags)
61 env.Append(FORTRANFLAGS=ppflags)
62 env.Append(SHFORTRANFLAGS=ppflags)
63 env.Append(SHLINKFLAGS=linkflags)
64 env.Append(LINKFLAGS=linkflags)
65 # otherwise darwin puts builddir into the name
66 env.Append(SHLINKFLAGS=["-install_name", "${TARGET.file}"])
67 env.Append(SHLINKFLAGS=["-single_module"])
68
69 AddCasaPlatform()
70
71 def CheckCasaLib(context, lib):
72 context.Message("Checking casa library '%s'..."%lib)
73 context.Result(r)
74 return r
75
76def exists(env):
77 return true
Note: See TracBrowser for help on using the repository browser.