/[escript]/branches/scons-dev/bruce/src/SConscript
ViewVC logotype

Contents of /branches/scons-dev/bruce/src/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1658 - (show annotations)
Thu Jul 17 04:10:35 2008 UTC (11 years, 2 months ago) by ksteube
File size: 2535 byte(s)
Improved handling of scons 0.98 versus 0.96

1 #
2 # $Id$
3 #
4 #######################################################
5 #
6 # Copyright 2003-2007 by ACceSS MNRF
7 # Copyright 2007 by University of Queensland
8 #
9 # http://esscc.uq.edu.au
10 # Primary Business: Queensland, Australia
11 # Licensed under the Open Software License version 3.0
12 # http://www.opensource.org/licenses/osl-3.0.php
13 #
14 #######################################################
15 #
16
17 import os
18 Import('*')
19
20 if 'Clone' in dir(env): local_env = env.Clone() # scons-0.98
21 else: local_env = env.Copy() # scons-0.96
22
23 py_wrapper_local_env=env.Copy()
24 # Remove the sharedlibrary prefix on all platform - we don't want 'lib' mucking with our python modules
25 del py_wrapper_local_env['SHLIBPREFIX']
26
27 lib_name = 'bruce'
28 py_wrapper_name = lib_name+'cpp'
29 py_wrapper_source = py_wrapper_name+'.cpp'
30 py_wrapper_lib_name = py_wrapper_name
31
32 # get the relevant file names:
33 src_dir = local_env.Dir('.').srcnode().abspath
34 filenames = [ x for x in os.listdir(src_dir) if os.path.splitext(x)[1] in [".h", ".c", ".cpp"] ]
35
36 sources = [x for x in filenames if os.path.splitext(x)[1] in ['.cpp', '.c']]
37 headers = [x for x in filenames if os.path.splitext(x)[1] in ['.h']]
38 # Filter out sources that should not be in the list automatically
39 sources.remove(py_wrapper_source) # FIXME: should probably refactor the source tree so the python wrapper isn't colocated with c++ sources
40
41 local_env.Append(LIBS = ['escript', 'esysUtils'])
42 py_wrapper_local_env.Append(LIBS = [lib_name, 'escript', 'esysUtils'])
43
44 local_env.Append(CPPDEFINES = 'BRUCE_EXPORTS')
45
46 lib = local_env.SharedLibrary(lib_name, sources)
47 py_wrapper_lib = py_wrapper_local_env.SharedLibrary( py_wrapper_lib_name, py_wrapper_source)
48
49 include_path = Dir(lib_name, local_env['incinstall'])
50
51 local_env.Install(include_path, headers )
52 local_env.Install(local_env['libinstall'], lib)
53 py_wrapper_local_env.Install(local_env['pyinstall']+'/bruce', py_wrapper_lib)
54
55 # export the lib target since tests will depend on it
56 # the lib target is a list of file nodes (why? win32 produces more than one output file: .lib, .dll, .pdb)
57 # FIXME: This list handling produces the desired result but can this be done directly with scons File nodes?
58 dep_lib = [local_env['libinstall']+'/'+str(x) for x in lib]
59 Export('dep_lib')
60
61 # Call the python sconscript
62 env.SConscript(dirs = ['#/bruce/py_src'], build_dir='py', duplicate=0)
63
64 # Call the unit tests SConscript
65 local_env.SConscript(dirs = ['#/bruce/test'], build_dir='#/build/$PLATFORM/bruce/test', duplicate=0)

  ViewVC Help
Powered by ViewVC 1.1.26