forked from diffpy/libdiffpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSConscript
More file actions
46 lines (35 loc) · 1.42 KB
/
SConscript
File metadata and controls
46 lines (35 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
Import('env', 'libdiffpy')
# Environment for building unit test driver
env_test = env.Clone(CXXTEST_SUFFIX='.hpp')
env_test.Tool('cxxtest')
lib_dir = libdiffpy[0].dir.abspath
env_test.PrependUnique(LIBS='diffpy', LIBPATH=lib_dir)
env_test.PrependENVPath('LD_LIBRARY_PATH', lib_dir)
env_test.PrependENVPath('DYLD_LIBRARY_PATH', lib_dir)
# Targets --------------------------------------------------------------------
def srcsupported(f):
rv = env.get('has_objcryst') or 'objcryst' not in str(f).lower()
return rv
def srcincluded(f):
fl = str(f).lower()
rv = srcsupported(f)
if env_test.get('tests') is not None:
rv = rv and any(t.lower() in fl
for t in Split(env_test['tests']))
return rv
# alltests -- the unit test driver source files
test_sources = filter(srcincluded, Glob('Test*.hpp'))
# Define the DIFFPYTESTSDIRPATH macro required for test_helpers.cpp
thisdir = Dir('.').srcnode().abspath
env_th = env_test.Clone()
env_th.AppendUnique(CPPDEFINES=dict(DIFFPYTESTSDIRPATH=thisdir))
thobj = env_th.Object('test_helpers.cpp')
test_helpers = [thobj, 'python_helpers.cpp', 'objcryst_helpers.cpp']
test_helpers = filter(srcsupported, test_helpers)
alltests = env_test.CxxTest('alltests', test_sources + test_helpers)
Alias('alltests', alltests)
# test -- alias for executing unit tests.
test = env_test.Alias('test', alltests, alltests[0].abspath)
AlwaysBuild(test)
# vim: ft=python