-
Notifications
You must be signed in to change notification settings - Fork 0
/
wscript
88 lines (70 loc) · 2.41 KB
/
wscript
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
80
81
82
83
84
85
86
87
88
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2012-2020 Association Prologin <[email protected]>
import glob
import os
import os.path
import shutil
from wafgenerator import generator_player_install
def options(opt):
...
def configure(cfg):
cfg.load('compiler_cxx')
cfg.env.append_value('INCLUDES', ['lib', 'src'])
def _copy_assets(source_dir, build_dir):
assets = [
'maps/colibri.json',
'maps/coq.json',
]
for asset in assets:
print(os.path)
src_path = os.path.join(source_dir, asset)
dst_path = os.path.join(build_dir, os.path.basename(asset))
try:
shutil.copyfile(src_path, dst_path)
except IOError as exception:
print(exception)
def build(bld):
bld.shlib(
source='''
src/action_tourner_case.cc
src/action_activer_aigle.cc
src/action_deplacer_aigle.cc
src/action_debug_poser_drakkar.cc
src/api.cc
src/entry.cc
src/game_state.cc
src/interface.cc
src/rules.cc
src/carte.cc
src/joueur.cc
src/aigle.cc
''',
defines=['MODULE_COLOR=ANSI_COL_BROWN', 'MODULE_NAME="rules"'],
target='prologin2024',
use=['stechec2'],
)
if not os.environ.get("WSCRIPT_SKIP_TESTS"):
source_dir = bld.path.abspath()
build_dir = os.path.join(bld.out_dir, os.path.relpath(source_dir, bld.top_dir))
os.makedirs(build_dir, exist_ok=True)
_copy_assets(source_dir, build_dir)
abs_pattern = os.path.join(bld.path.abspath(), 'src/tests/test-*.cc')
for test_src in glob.glob(abs_pattern):
test_name = os.path.split(test_src)[-1]
test_name = test_name[len("test-"):-(len(".cc"))]
# Waf requires a relative path for the source
src_relpath = os.path.relpath(test_src, bld.path.abspath())
bld.program(
features='gtest',
source=src_relpath,
target='prologin2024-test-{}'.format(test_name),
use=['prologin2024', 'stechec2-utils'],
includes=['.'],
defines=['MODULE_COLOR=ANSI_COL_PURPLE',
'MODULE_NAME="prologin2024"'],
)
bld.install_files('${PREFIX}/share/stechec2/prologin2024', [
'prologin2024.yml',
])
generator_player_install(bld, 'prologin2024')