-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathwscript
More file actions
153 lines (117 loc) · 4.66 KB
/
Copy pathwscript
File metadata and controls
153 lines (117 loc) · 4.66 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#! /usr/bin/env python
# encoding: utf-8
import os
from waflib.TaskGen import feature, after_method
APPNAME = 'kodo-python'
VERSION = '6.0.2'
def recurse_helper(ctx, name):
if not ctx.has_dependency_path(name):
ctx.fatal('Load a tool to find %s as system dependency' % name)
else:
p = ctx.dependency_path(name)
ctx.recurse([p])
def options(opt):
import waflib.extras.wurf_dependency_bundle as bundle
import waflib.extras.wurf_dependency_resolve as resolve
bundle.add_dependency(opt, resolve.ResolveGitMajorVersion(
name='boost',
git_repository='github.com/steinwurf/boost.git',
major_version=1))
bundle.add_dependency(opt, resolve.ResolveGitMajorVersion(
name='cpuid',
git_repository='github.com/steinwurf/cpuid.git',
major_version=3))
bundle.add_dependency(opt, resolve.ResolveGitMajorVersion(
name='fifi',
git_repository='github.com/steinwurf/fifi.git',
major_version=17))
bundle.add_dependency(opt, resolve.ResolveGitMajorVersion(
name='kodo',
git_repository='github.com/steinwurf/kodo.git',
major_version=22))
bundle.add_dependency(opt, resolve.ResolveGitMajorVersion(
name='platform',
git_repository='github.com/steinwurf/platform.git',
major_version=1))
bundle.add_dependency(opt, resolve.ResolveGitMajorVersion(
name='recycle',
git_repository='github.com/steinwurf/recycle.git',
major_version=1))
bundle.add_dependency(opt, resolve.ResolveGitMajorVersion(
name='sak',
git_repository='github.com/steinwurf/sak.git',
major_version=14))
bundle.add_dependency(opt, resolve.ResolveGitMajorVersion(
name='waf-tools',
git_repository='github.com/steinwurf/waf-tools.git',
major_version=2))
opt.load("wurf_configure_output")
opt.load('wurf_dependency_bundle')
opt.load('wurf_tools')
opt.load('python')
def configure(conf):
if conf.is_toplevel():
conf.load('wurf_dependency_bundle')
conf.load('wurf_tools')
conf.load_external_tool('mkspec', 'wurf_cxx_mkspec_tool')
conf.load_external_tool('runners', 'wurf_runner')
conf.load_external_tool('install_path', 'wurf_install_path')
conf.load_external_tool('project_gen', 'wurf_project_generator')
recurse_helper(conf, 'boost')
recurse_helper(conf, 'cpuid')
recurse_helper(conf, 'fifi')
recurse_helper(conf, 'kodo')
recurse_helper(conf, 'platform')
recurse_helper(conf, 'recycle')
recurse_helper(conf, 'sak')
# Ensure that Python is configured properly
if not conf.env['BUILD_PYTHON']:
conf.fatal('Python was not configured properly')
def build(bld):
# Remove NDEBUG which is added from conf.check_python_headers
flag_to_remove = 'NDEBUG'
defines = ['DEFINES_PYEMBED', 'DEFINES_PYEXT']
for define in defines:
while(flag_to_remove in bld.env[define]):
bld.env[define].remove(flag_to_remove)
bld.env['CFLAGS_PYEXT'] = []
bld.env['CXXFLAGS_PYEXT'] = []
CXX = bld.env.get_flat("CXX")
# Matches both /usr/bin/g++ and /user/bin/clang++
if 'g++' in CXX or 'clang' in CXX:
bld.env.append_value('CXXFLAGS', '-fPIC')
if bld.is_toplevel():
bld.load('wurf_dependency_bundle')
recurse_helper(bld, 'boost')
recurse_helper(bld, 'cpuid')
recurse_helper(bld, 'fifi')
recurse_helper(bld, 'kodo')
recurse_helper(bld, 'platform')
recurse_helper(bld, 'recycle')
recurse_helper(bld, 'sak')
bld.recurse('src/kodo_python')
bld.env.append_unique(
'DEFINES_STEINWURF_VERSION',
'STEINWURF_KODO_PYTHON_VERSION="{}"'.format(VERSION))
@feature('pyext')
@after_method('apply_link')
def test(self):
if self.bld.has_tool_option('run_tests'):
self.bld.add_post_fun(exec_test_python)
def exec_test_python(bld):
python = bld.env['PYTHON'][0]
env = dict(os.environ)
env['PYTHONPATH'] = os.path.join(bld.out_dir, 'src', 'kodo_python')
# First, run the unit tests in the 'test' folder
if os.path.exists('test'):
for f in sorted(os.listdir('test')):
if f.endswith('.py'):
test = os.path.join('test', f)
bld.cmd_and_log('{0} {1}\n'.format(python, test), env=env)
# Then run the examples in the 'examples' folder
if os.path.exists('examples'):
for f in sorted(os.listdir('examples')):
if f.endswith('.py'):
example = os.path.join('examples', f)
bld.cmd_and_log(
'{0} {1} --dry-run\n'.format(python, example), env=env)