1 | import os
|
---|
2 | import re
|
---|
3 | import sys
|
---|
4 | import platform
|
---|
5 | import SCons
|
---|
6 |
|
---|
7 | def 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 | # need flat_namespace to prevent segv in boost
|
---|
66 | env.Append(LDMODULEFLAGS=["-single_module", "-flat_namespace"])
|
---|
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 |
|
---|
75 | def exists(env):
|
---|
76 | return true
|
---|