-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSConstruct
More file actions
65 lines (46 loc) · 1.56 KB
/
Copy pathSConstruct
File metadata and controls
65 lines (46 loc) · 1.56 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import os
env = Environment(ENV = os.environ,
TARGET_ARCH = os.environ.get('TARGET_ARCH', 'x86'))
try:
env.Tool('config', toolpath = [os.environ.get('CBANG_HOME')])
except Exception, e:
raise Exception, 'CBANG_HOME not set?\n' + str(e)
env.CBLoadTools('compiler cbang dist resources')
conf = env.CBConfigure()
# Dist
if 'dist' in COMMAND_LINE_TARGETS:
env.__setitem__('dist_build', '')
# Only files check in to Subversion
lines = os.popen('svn status -v').readlines()
lines += os.popen('svn status -v cbang').readlines()
lines = filter(lambda l: len(l) and l[0] in 'MA ', lines)
files = map(lambda l: l.split()[-1], lines)
files = filter(lambda f: not os.path.isdir(f), files)
tar = env.TarBZ2Dist('libpcb', files)
Alias('dist', tar)
Return()
env.Replace(RESOURCES_NS = 'PCB')
if not env.GetOption('clean'):
# Configure compiler
conf.CBConfig('compiler')
conf.CBConfig('cbang')
env.CBDefine('USING_CBANG') # Using CBANG macro namespace
# Include path
env.AppendUnique(CPPPATH = ['#/src'])
conf.Finish()
# Source
src = Glob('src/*.cpp') + Glob('src/pcb/*.cpp')
# Build in 'build'
import re
VariantDir('build', 'src')
src = map(lambda path: re.sub(r'^src/', 'build/', str(path)), src)
env.AppendUnique(CPPPATH = ['#/build'])
# Resources
res = env.Resources('build/resources.cpp', ['#/src/resources'])
src.append(res)
# Build
lib = env.Library('libpcb', src)
prog = env.Program('pcbtool', ['build/pcbtool.cpp'] + lib)
Default(prog)
# Clean
Clean(prog, ['build', 'config.log', 'dist.txt'])