1 |
Import('*') |
2 |
|
3 |
local_env=env.Copy() |
4 |
|
5 |
src_dir = local_env.Dir('.').srcnode().abspath |
6 |
|
7 |
import os |
8 |
filenames = os.listdir(src_dir) |
9 |
sources = [x for x in filenames if os.path.splitext(x)[1] in ['.cpp', '.c']] |
10 |
headers = [x for x in filenames if os.path.splitext(x)[1] in ['.h']] |
11 |
|
12 |
# Filter unused sources |
13 |
sources.remove('ElementFile_borrowLocalVolume.c') # FIXME: Should this file be removed? |
14 |
|
15 |
# finleycpp has additional source in the CPPAdapter sub-directory. Append these to the list |
16 |
cppadapter_filenames = os.listdir(src_dir+'/CPPAdapter'); |
17 |
sources += ['CPPAdapter/'+x for x in cppadapter_filenames if os.path.splitext(x)[1] in ['.cpp', '.c']] |
18 |
cppadapter_headers = ['CPPAdapter/'+x for x in cppadapter_filenames if os.path.splitext(x)[1] in ['.h']] |
19 |
|
20 |
local_env.Append(LIBS = [boost_lib, python_lib, sys_libs, 'esysUtils', 'escriptcpp', 'paso']) |
21 |
|
22 |
if mkl_libs: |
23 |
local_env.Append(CPPDEFINES=['MKL',]) |
24 |
local_env.Append(LIBS = mkl_libs) |
25 |
if scsl_libs: |
26 |
local_env.Append(CPPDEFINES=['SCSL',]) |
27 |
local_env.Append(LIBS = scsl_libs) |
28 |
if umf_libs: |
29 |
local_env.Append(CPPDEFINES=['UMFPACK',]) |
30 |
local_env.Append(LIBS = umf_libs) |
31 |
if papi_libs: |
32 |
local_env.Append(CPPDEFINES=['PAPI',]) |
33 |
local_env.Append(LIBS = papi_libs) |
34 |
|
35 |
lib_name = 'finleycpp' |
36 |
|
37 |
lib = local_env.SharedLibrary(lib_name, sources) |
38 |
|
39 |
include_path = Dir(lib_name, incinstall) |
40 |
cppadapter_include_path = Dir('CppAdapter', include_path) |
41 |
|
42 |
local_env.Install(include_path, headers ) |
43 |
local_env.Install(cppadapter_include_path, cppadapter_headers ) |
44 |
local_env.Install(libinstall, lib) |
45 |
|
46 |
# export the lib target since tests will depend on it |
47 |
# the lib target is a list of file nodes (why? win32 produces more than one output file: .lib, .dll, .pdb) |
48 |
# FIXME: This list handling produces the desired result but can this be done directly with scons File nodes? |
49 |
dep_lib = [libinstall+'/'+str(x) for x in lib] |
50 |
Export('dep_lib') |
51 |
|
52 |
# Call the python sconscript |
53 |
env.SConscript(dirs = ['#/finley/py_src'], build_dir='py', duplicate=0) |
54 |
|
55 |
# Call the unit tests SConscript |
56 |
local_env.SConscript(dirs = ['#/finley/test'], build_dir='#/build/$PLATFORM/finley/test', duplicate=0) |
57 |
|