source: trunk/scons/casa.py@ 2934

Last change on this file since 2934 was 2648, checked in by Malte Marquarding, 12 years ago

make asap run under OS 10.7+

File size: 2.5 KB
RevLine 
[2486]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)
[2648]65 # need flat_namespace to prevent segv in boost
66 env.Append(LDMODULEFLAGS=["-single_module", "-flat_namespace"])
[2486]67
68 AddCasaPlatform()
69
70 def CheckCasaLib(context, lib):
71 context.Message("Checking casa library '%s'..."%lib)
72 context.Result(r)
73 return r
74
75def exists(env):
76 return true
Note: See TracBrowser for help on using the repository browser.