forked from ArduPilot/waf
/
wscript
66 lines (56 loc) · 1.34 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
#!/usr/bin/env python3
# encoding: utf-8
# Thomas Nagy, 2010
from waflib import Logs
APPNAME = 'wafcython'
VERSION = '1.0'
top = '.'
out = 'build'
def options(ctx):
ctx.load('compiler_c')
ctx.load('compiler_cxx')
ctx.load('python')
ctx.load('cython')
ctx.load('cython_cache', tooldir='.')
def configure(ctx):
ctx.load('compiler_c')
ctx.load('compiler_cxx')
ctx.load('python')
ctx.check_python_headers()
try:
ctx.load('cython')
except ctx.errors.ConfigurationError:
Logs.warn('Cython was not found, using the cache')
def build(ctx):
# a C library
ctx(features = 'c cshlib',
source = 'c_lib/lib.c',
target = 'c_lib',
includes = 'c_lib')
# a C++ library
ctx(features = 'cxx cxxshlib',
source = 'cxx_lib/lib.cxx',
target = 'cxx_lib',
includes = 'cxx_lib')
# first try to build a C-based cython extension
ctx(
features = 'c cshlib pyext',
source = 'src/cy_ctest.pyx',
target = 'cy_ctest',
includes = 'c_lib',
use = 'c_lib')
# then a C++-based one
ctx(
features = 'cxx cxxshlib pyext',
source = 'src/cy_cxxtest.pyx',
target = 'cy_cxxtest',
includes = 'cxx_lib',
use = 'cxx_lib')
# a C++ application which uses a C function from a cython module
ctx(
features = 'cxx cxxprogram pyembed',
source = 'cxx_lib/app.cxx',
target = 'cy-app',
includes = 'cxx_lib src',
use = 'cxx_lib'
)