-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSConstruct
More file actions
80 lines (67 loc) · 2.75 KB
/
SConstruct
File metadata and controls
80 lines (67 loc) · 2.75 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/python
from paths import AKIMOT, CXX_TEST_PATH, CXX_INCLUDE_DIR
AKIMOT_AEI_DIR = AKIMOT + '/other/aei/akimot'
AKIMOT_ATS_DIR = AKIMOT + '/other/ats/akimot'
AKIMOT_MATCH_DIR = AKIMOT + '/other/match/bot_akimot'
RABBITS_TEST_DIR = AKIMOT + '/other/rabbits'
TAGUI_TEST_DIR = AKIMOT + '/other/tagui'
CXX_TEST_PATH = CXX_TEST_PATH
CXX_INCLUDE_DIR = CXX_INCLUDE_DIR
alias_dirs = [('aei',AKIMOT_AEI_DIR), ('ats', AKIMOT_ATS_DIR), ('match', AKIMOT_MATCH_DIR), ('rt', RABBITS_TEST_DIR), ('tg', TAGUI_TEST_DIR)]
AKIMOT_LIBS = ['pthread']
TARGET = 'akimot'
OPT_TARGET = TARGET #'opt_akimot'
common = Environment(CC='g++', CCFLAGS = '-Wall ', LINKFLAGS = '')
opt = common.Clone()
opt.Append(CCFLAGS = '-O3 -DNDEBUG -ffast-math -fomit-frame-pointer -frename-registers') #-march=native
dbg = common.Clone()
dbg.Append(CCFLAGS = '-ansi -DDEBUG')
prof = common.Clone()
prof.Append(CCFLAGS = '-O1 -DNEDBUG -ffast-math -g -pg', LINKFLAGS = '-pg')
std = common.Clone()
std.Append(CCFLAGS = '')
src_files_common = 'board.cpp old_board.cpp engine.cpp uct.cpp utils.cpp benchmark.cpp eval.cpp config.cpp hash.cpp aei.cpp timer.cpp'.split()
src_files_build = src_files_common + ['main.cpp']
src_files_test = src_files_common
#todo - is this portable ? determine the extension of object file ( '.o' at linux) dynamically
obj_files_build = [src_file[:src_file.rindex('.')] + '.o' for src_file in src_files_build]
obj_files_test = [src_file[:src_file.rindex('.')] + '.o' for src_file in src_files_test]
do_build = False
do_prof = False
if ARGUMENTS.get('opt'):
env = opt.Clone()
do_build = True
TARGET = OPT_TARGET
elif ARGUMENTS.get('dbg'):
env = dbg.Clone()
do_build = True
elif ARGUMENTS.get('prof'):
env = prof.Clone()
do_build = True
elif ARGUMENTS.get('doprof'):
do_prof = True
elif ARGUMENTS.get('doc'):
bld = Builder(action = '/usr/bin/doxygen Doxy')
doc = Environment(BUILDERS = {'Foo' : bld})
doxy = doc.Foo(source=src_files_build)
elif ARGUMENTS.get('cfg'):
import shutil
for alias, dir in alias_dirs:
shutil.copy("default.cfg", dir)
print "copying default.cfg to ", dir
else: #standard
env = std.Clone()
do_build = True
if do_build:
env.Object(src_files_build)
akimot = env.Program(target = TARGET, source = obj_files_build, LIBS = AKIMOT_LIBS, CPPPATH = '.')
for alias, dir in alias_dirs:
env.Alias(alias, dir)
env.Install(dir, akimot)
#tst = Environment(tools = ['default','cxxtest'], CXXTEST=CXX_TEST_PATH, LIBS = AKIMOT_LIBS, CXXTEST_DIR='',
# CPPPATH=['.',CXX_INCLUDE_DIR])
#tst.CxxTest('do_tests', ['tests.h'] + obj_files_test)
#print "CCCOM is ", env.subst('$CCCOM')
if do_prof:
import os
os.system('./akimot -b; gprof akimot gmon.out | head -n 45');