1 |
######################################################## |
2 |
# |
3 |
# Copyright (c) 2003-2010 by University of Queensland |
4 |
# Earth Systems Science Computational Center (ESSCC) |
5 |
# http://www.uq.edu.au/esscc |
6 |
# |
7 |
# Primary Business: Queensland, Australia |
8 |
# Licensed under the Open Software License version 3.0 |
9 |
# http://www.opensource.org/licenses/osl-3.0.php |
10 |
# |
11 |
######################################################## |
12 |
|
13 |
import os |
14 |
Import('*') |
15 |
|
16 |
local_env = env.Clone() |
17 |
py_wrapper_local_env = env.Clone() |
18 |
|
19 |
# Remove the shared library prefix on all platforms - we don't want 'lib' |
20 |
# mucking with our python modules |
21 |
del py_wrapper_local_env['SHLIBPREFIX'] |
22 |
|
23 |
sources = """ |
24 |
DataVar.cpp |
25 |
EscriptDataset.cpp |
26 |
FileWriter.cpp |
27 |
FinleyDomain.cpp |
28 |
FinleyElements.cpp |
29 |
FinleyNodes.cpp |
30 |
VisItControl.cpp |
31 |
""".split() |
32 |
|
33 |
headers = """ |
34 |
DataVar.h |
35 |
DomainChunk.h |
36 |
ElementData.h |
37 |
EscriptDataset.h |
38 |
FileWriter.h |
39 |
FinleyDomain.h |
40 |
FinleyElements.h |
41 |
FinleyNodes.h |
42 |
NodeData.h |
43 |
VisItControl.h |
44 |
vtkCellType.h |
45 |
weipa.h |
46 |
""".split() |
47 |
|
48 |
if local_env['visit']: |
49 |
sources.append(['VisItData.cpp']) |
50 |
headers.append(['VisItData.h']) |
51 |
local_env.Append(CPPDEFINES = ['USE_VISIT']) |
52 |
local_env.AppendUnique(LIBS = ['simV2']) |
53 |
|
54 |
local_env.Append(LIBS = ['finley', 'dudley','escript', 'esysUtils']) |
55 |
if local_env['silo']: |
56 |
local_env.Append(CPPDEFINES = ['USE_SILO']) |
57 |
local_env.AppendUnique(LIBS = env['silo_libs']) |
58 |
|
59 |
if IS_WINDOWS: |
60 |
local_env.Append(CPPDEFINES = ['WEIPA_EXPORTS']) |
61 |
|
62 |
module_name = 'weipa' |
63 |
|
64 |
lib = local_env.SharedLibrary(module_name, sources) |
65 |
env.Alias('build_weipa_lib', lib) |
66 |
|
67 |
include_path = Dir('weipa', local_env['incinstall']) |
68 |
|
69 |
hdr_inst = local_env.Install(include_path, headers) |
70 |
env.Alias('install_weipa_headers', hdr_inst) |
71 |
|
72 |
lib_inst = local_env.Install(local_env['libinstall'], lib) |
73 |
env.Alias('install_weipa_lib', lib_inst) |
74 |
|
75 |
### Python wrapper ### |
76 |
py_wrapper_local_env.Append(LIBS = ['weipa', 'dudley','finley', 'escript', 'esysUtils']) |
77 |
py_wrapper_name = module_name + 'cpp' |
78 |
py_wrapper_lib = py_wrapper_local_env.SharedLibrary(py_wrapper_name, 'weipacpp.cpp') |
79 |
env.Alias('build_weipacpp_lib', py_wrapper_lib) |
80 |
|
81 |
tmp_inst = os.path.join(local_env['pyinstall'], module_name) |
82 |
if IS_WINDOWS: |
83 |
wrapper_ext = '.pyd' |
84 |
else: |
85 |
wrapper_ext = '.so' |
86 |
|
87 |
share_name = os.path.join(tmp_inst, py_wrapper_name+wrapper_ext) |
88 |
mod_inst = py_wrapper_local_env.InstallAs(target=share_name, |
89 |
source=py_wrapper_lib[0]) |
90 |
env.Alias('install_weipacpp_lib', mod_inst) |
91 |
|
92 |
###################### |
93 |
### Plugin library ### |
94 |
###################### |
95 |
# This is disabled on Windows since Scons complains about compiling the same |
96 |
# files in the same build directory twice. The plugin is currently only for |
97 |
# Linux anyway. Correct fix is probably a second SConscript file with different |
98 |
# build_dir setting. |
99 |
if not IS_WINDOWS: |
100 |
visitplugin_env = env.Clone() |
101 |
plugin_sources = """ |
102 |
DataVar.cpp |
103 |
EscriptDataset.cpp |
104 |
FinleyDomain.cpp |
105 |
FinleyElements.cpp |
106 |
FinleyNodes.cpp |
107 |
""".split() |
108 |
|
109 |
visitplugin_env.Append(LIBS = ['esysUtils' ]) |
110 |
visitplugin_env.Append(CPPDEFINES = ['VISIT_PLUGIN']) |
111 |
|
112 |
plugin_lib = visitplugin_env.StaticLibrary('escriptreader', plugin_sources) |
113 |
env.Alias('build_escriptreader_lib', plugin_lib) |
114 |
|
115 |
tmp = local_env.Install(local_env['libinstall'], plugin_lib) |
116 |
env.Alias('install_escriptreader_lib', tmp) |
117 |
|
118 |
# configure python module |
119 |
local_env.SConscript(dirs = ['#/weipa/py_src'], variant_dir='py', duplicate=0, exports=['py_wrapper_lib']) |
120 |
|
121 |
# configure unit tests |
122 |
local_env.SConscript(dirs = ['#/weipa/test'], variant_dir='$BUILD_DIR/$PLATFORM/weipa/test', duplicate=0) |
123 |
|