Changeset 1120
- Timestamp:
- 08/10/06 12:37:50 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SConstruct
r1105 r1120 2 2 import distutils.sysconfig 3 3 import platform 4 sys.path.append("scons") 5 from casa import checkCasa 4 6 5 #vars = distutils.sysconfig.get_config_vars() 6 moduledir = "/opt/lib/python2/"#distutils.sysconfig.get_python_lib() 7 moduledir = '/tmp'#distutils.sysconfig.get_python_lib() 7 8 8 opts = Options("userconfig.py", ARGUMENTS) 9 opts.Add("prefix", "The root installation path", distutils.sysconfig.PREFIX) 10 opts.Add("moduledir", "The python module path (site-packages))", moduledir) 9 opts = Options("userconfig.py") 10 opts.AddOptions(PathOption("prefix", "The root installation path", 11 distutils.sysconfig.PREFIX), 12 PathOption("moduledir", 13 "The python module path (site-packages))", 14 moduledir), 15 EnumOption("mode", "The type of build.", "debug", 16 ["release","debug"], ignorecase=1)) 11 17 12 18 def SGlob(pattern): … … 15 21 16 22 17 def addCasaLibs(env): 18 casalibs = "casav atnf images ms components coordinates \ 19 lattices fits measures measures_f \ 20 tables scimath scimath_f casa wcs".split() 21 env.Prepend( LIBS = casalibs ) 22 casaincd = [os.path.join(env['CASAROOT'], 'code/include'), \ 23 os.path.join(env['CASAROOT'], 'code/casa')] 24 env.Append( CPPPATH = casaincd ) 25 casalibd = os.path.join(env['CASAROOT'], env['CASAARCH'], 'lib') 26 env.Append( LIBPATH = [ casalibd ] ) 27 # Explicit templates in casa 28 env.Append( CPPFLAGS = ['-DAIPS_NO_TEMPLATE_SRC'] ) 23 env = Environment( toolpath = ['./scons'], tools = ["default", "disttar"], 24 ENV = { 'PATH' : os.environ[ 'PATH' ], 25 'HOME' : os.environ[ 'HOME' ] }, 26 options = opts) 29 27 30 def checkCasa(conf, path=None): 31 ''' look for casa libraries''' 32 conf.Message('Checking for casa libraries...') 33 casaarch = None 34 if os.environ.has_key('AIPSPATH'): 35 casa = os.environ.get('AIPSPATH').split() 36 conf.env.Append(CASAARCH = casa[1]) 37 conf.env.Append(CASAROOT = casa[0]) 38 addCasaLibs(conf.env) 39 conf.Result('yes') 40 return True 41 casaarch = 'linux_gnu' 42 if sys.platform == 'darwin': 43 casaarch = darwin 44 elif sys.platform == 'linux2' and platform.architecture()[0] == '64bit': 45 casarch = 'linux_64b' 46 paths = "/nfs/aips++/weekly /aips++ /opt/aips++ ../casa_asap".split() 47 if path is not None: 48 paths = [path] 49 for p in paths: 50 if os.path.isfile(os.path.join(p,casaarch,"lib/libcasa.a")): 51 conf.env.Append(CASAARCH = casaarch) 52 conf.env.Append(CASAROOT = p) 53 addCasaLibs(conf.env) 54 conf.Result('yes') 55 return True 56 conf.Result('n') 57 return False 58 59 env = Environment( ENV = { 'PATH' : os.environ[ 'PATH' ], 60 'HOME' : os.environ[ 'HOME' ] # required for distcc 61 }, options = opts) 28 Help(opts.GenerateHelpText(env)) 29 env.SConsignFile() 62 30 env.Append(CASAARCH = '') 63 31 env.Append(CASAROOT = '') … … 71 39 if not conf.CheckLib(library='boost_python', language='c++'): Exit(1) 72 40 if not conf.CheckLib('rpfits'): Exit(1) 41 if not conf.CheckHeader('cfitsio/fitsio.h', language='c++'): Exit(1) 73 42 if not conf.CheckLib('cfitsio'): Exit(1) 74 43 if not conf.CheckLib('lapack'): Exit(1) … … 78 47 if not conf.CheckCasa(): Exit(1) 79 48 env = conf.Finish() 49 50 env["dist_dir"] = "dist/asap" 80 51 # general CPPFLAGS 81 52 env.Append(CPPFLAGS='-O3 -Wno-long-long'.split()) … … 83 54 if platform.architecture()[0] == '64bit': 84 55 env.Append(CPPFLAGS='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__x86_64__ -DAIPS_64B'.split()) 56 if env['mode'] == 'release': 57 env.Append(LINKFLAGS=['-Wl,-O1']) 58 Export("env","SGlob") 85 59 86 Export("env","SGlob")87 60 so = env.SConscript("src/SConscript", build_dir="build", duplicate=0) 88 env.Install(moduledir, so ) 89 #pys = env.SConscript("python/SConscript") 90 # env.Install(moduledir, pys) 61 62 env.Install(env["dist_dir"], so ) 63 pys = env.SConscript("python/SConscript") 64 env.Install(moduledir, Dir(env["dist_dir"])) 91 65 env.Alias('install', moduledir) 66 67 #if env['mode'] == "release": 68 # env.DistTar("dist/asap", ["README", "INSTALL", Dir(env["dist_dir"])])
Note:
See TracChangeset
for help on using the changeset viewer.