Changeset 1130 for trunk/SConstruct
- Timestamp:
- 08/11/06 12:28:15 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SConstruct
r1128 r1130 5 5 import platform 6 6 # scons plug-ins 7 sys.path.append("scons") 8 from casa import checkCasa 9 from installtree import InstallTree 7 #from installtree import InstallTree 10 8 11 9 moduledir = distutils.sysconfig.get_python_lib() 12 10 13 11 opts = Options("userconfig.py") 14 opts.AddOptions(PathOption("prefix", "The root installation path", 15 distutils.sysconfig.PREFIX), 12 opts.AddOptions(PathOption("prefix", 13 "The root installation path", 14 distutils.sysconfig.PREFIX), 16 15 PathOption("moduledir", 17 16 "The python module path (site-packages))", 18 17 moduledir), 19 ("casadir", "Where casa lives. Default is to autodetect", ""), 18 ("rpfitsdir", "Alternative rpfits location.", ""), 19 ("casadir", "Alternative rpfits location", ""), 20 20 EnumOption("mode", "The type of build.", "debug", 21 ["release","debug"], ignorecase=1)) 21 ["release","debug"], ignorecase=1) 22 ) 22 23 23 24 def SGlob(pattern): … … 26 27 27 28 28 env = Environment( toolpath = ['./scons'], tools = ["default", "disttar" ],29 env = Environment( toolpath = ['./scons'], tools = ["default", "disttar", "installtree", "malte"], 29 30 ENV = { 'PATH' : os.environ[ 'PATH' ], 30 31 'HOME' : os.environ[ 'HOME' ] }, … … 33 34 Help(opts.GenerateHelpText(env)) 34 35 env.SConsignFile() 35 env.Append(CASAARCH = '') 36 env.Append(CASAROOT = '') 36 #env.Append(CASAARCH = '') 37 #env.Append(CASAROOT = '') 38 37 39 if not env.GetOption('clean'): 38 conf = Configure(env,custom_tests = {'CheckCasa': checkCasa} ) 39 pyvers = 'python'+distutils.sysconfig.get_python_version() 40 if not conf.CheckLib(library=pyvers, language='c'): Exit(1) 41 if not conf.CheckHeader(pyvers+'/Python.h', language='c'): Exit(1) 42 else: conf.env.Append(CPPPATH=[distutils.sysconfig.get_python_inc()]) 43 if not conf.CheckHeader(['boost/python.hpp'], language="C++"): Exit(1) 44 if not conf.CheckLib(library='boost_python', language='c++'): Exit(1) 40 conf = Configure(env) 41 # import Custom tests 42 env.AddCustomTests(conf) 43 pylib = 'python'+distutils.sysconfig.get_python_version() 44 pyinc = "Python.h" 45 if env['PLATFORM'] == "darwin": 46 pylib = "Python" 47 if not conf.CheckLib(library=pylib, language='c'): Exit(1) 48 conf.env.Append(CPPPATH=[distutils.sysconfig.get_python_inc()]) 49 if not conf.CheckHeader("Python.h", language='c'): 50 Exit(1) 51 if not conf.CheckLibWithHeader('boost_python', 'boost/python.hpp', 'c++'): Exit(1) 52 conf.env.AddCustomPath(env["rpfitsdir"]) 45 53 if not conf.CheckLib('rpfits'): Exit(1) 46 if not conf.CheckHeader('cfitsio/fitsio.h', language='c++'): Exit(1) 47 if not conf.CheckLib('cfitsio'): Exit(1) 48 if not conf.CheckLib('lapack'): Exit(1) 49 if not conf.CheckLib('blas'): Exit(1) 54 if not conf.CheckLibWithHeader('cfitsio', 'fitsio.h', 'c'): Exit(1) 55 if (sys.platform == "darwin"): 56 conf.env.Append(LIBS = ['-framework vecLib']) 57 else: 58 if not conf.CheckLib('lapack'): Exit(1) 59 if not conf.CheckLib('blas'): Exit(1) 50 60 if not conf.CheckLib('g2c'): Exit(1) 51 if not conf.CheckLib('stdc++', language='c++'): Exit(1)61 if not conf.CheckLib('stdc++', language='c++'): Exit(1) 52 62 if not conf.CheckCasa(env["casadir"]): Exit(1) 53 63 env = conf.Finish() 54 64 55 env["dist_dir"] = " dist/asap"65 env["dist_dir"] = "#/dist/asap" 56 66 # general CPPFLAGS 57 67 env.Append(CPPFLAGS='-O3 -Wno-long-long'.split()) … … 59 69 if platform.architecture()[0] == '64bit': 60 70 env.Append(CPPFLAGS='-fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__x86_64__ -DAIPS_64B'.split()) 61 # hack to install into /usr/lib64 if scons is n't installed there71 # hack to install into /usr/lib64 if scons is in the 32bit /usr/lib/ 62 72 if moduledir.startswith("/usr/lib/"): 63 73 moduledir.replace("lib","lib64") 74 if sys.platform == "darwin": 75 env['SHLINKFLAGS'] = '$LINKFLAGS -dynamiclib -single_module' 76 env['SHLIBSUFFIX'] = '.dylib' 77 64 78 if env['mode'] == 'release': 65 79 env.Append(LINKFLAGS=['-Wl,-O1']) … … 67 81 68 82 so = env.SConscript("src/SConscript", build_dir="build", duplicate=0) 83 env.Install(env["dist_dir"], so ) 69 84 70 env.Install(env["dist_dir"], so )71 85 pys = env.SConscript("python/SConscript") 72 asapmod = InstallTree(env, 73 dest_dir = os.path.join(moduledir, "asap"), 86 asapmod = env.InstallTree(dest_dir = os.path.join(env["moduledir"], "asap"), 74 87 src_dir = "dist/asap", 75 88 includes = ['*.py', '*.so'], 76 89 excludes = []) 77 asapbin = env.Install(os.path.join( distutils.sysconfig.PREFIX, "bin"),"bin/asap")90 asapbin = env.Install(os.path.join(env["prefix"], "bin"), "bin/asap") 78 91 env.Alias('install', [asapmod, asapbin]) 79 92
Note:
See TracChangeset
for help on using the changeset viewer.