2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-29 13:30:32 +01:00
waf/playground/cython/wscript

67 lines
1.3 KiB
Plaintext
Raw Normal View History

2011-09-10 11:13:51 +02:00
#!/usr/bin/env python
# encoding: ISO8859-1
# Thomas Nagy, 2010
2012-05-29 23:43:56 +02:00
from waflib import Logs
2012-05-29 23:46:00 +02:00
APPNAME = 'wafcython'
VERSION = '1.0'
2011-09-10 11:13:51 +02:00
top = '.'
out = 'build'
def options(ctx):
ctx.load('compiler_c')
ctx.load('compiler_cxx')
ctx.load('python')
ctx.load('cython')
2012-05-29 23:43:56 +02:00
ctx.load('cython_cache', tooldir='.')
2011-09-10 11:13:51 +02:00
def configure(ctx):
ctx.load('compiler_c')
ctx.load('compiler_cxx')
ctx.load('python')
ctx.check_python_headers()
2012-05-29 23:43:56 +02:00
try:
ctx.load('cython')
except ctx.errors.ConfigurationError:
Logs.warn('Cython was not found, using the cache')
2011-09-10 11:13:51 +02:00
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'
)