This repository has been archived by the owner on Jan 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
/
SConstruct
64 lines (47 loc) · 1.67 KB
/
SConstruct
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import os
def missing_boost(headers):
header_str = "\n ".join(headers)
error_message = """You are missing these boost headers:
%s
Try setting the path to boost with --boost-path. Ex. scons --boost-path=/opt/local/include""" % header_str
print error_message
Exit(1)
AddOption('--boost-path',
dest='boost_path',
type='string',
nargs=1,
metavar='BOOST_PATH',
help='path to the include directory containing boost'
)
AddOption('--prefix',
dest='prefix',
type='string',
nargs=1,
metavar='PREFIX',
help='path to install directory for kdtree2'
)
VariantDir('build', 'src-c++')
env = Environment()
if env.GetOption('boost_path'):
env.AppendUnique(CPPPATH = env.GetOption('boost_path'))
env.Append(CXXFLAGS='-Wall -fast')
# This is a common path for OS X
env.AppendUnique(CPPPATH = '/opt/local/include')
conf = Configure(env)
if not env.GetOption('clean'):
missing_headers = []
if not conf.CheckCXXHeader('boost/multi_array.hpp'):
missing_headers.append('boost/multi_array.hpp')
if not conf.CheckCXXHeader('boost/random.hpp'):
missing_headers.append('boost/random.hpp')
if missing_headers != []:
missing_boost(missing_headers)
env = conf.Finish()
kdtree2 = env.SharedLibrary('build/kdtree2', 'build/kdtree2.cpp')
if env.GetOption('prefix'):
prefix_path = env.GetOption('prefix') + '/lib'
env.Install(prefix_path, kdtree2)
else:
env.Install('/usr/local/lib', kdtree2)
env.Alias('install', '/usr/local/lib')
kdtest = env.Program('build/kdtree2_test', 'build/kdtree2_test.cpp', LIBS=kdtree2)