| 1 |
## -*- python -*- |
| 2 |
#import Action |
| 3 |
#import Object |
| 4 |
#import Params |
| 5 |
#import Task |
| 6 |
import os |
| 7 |
|
| 8 |
if 0: |
| 9 |
DEPRECATION_ERRORS = '-Werror::DeprecationWarning' # deprecations become errors |
| 10 |
else: |
| 11 |
DEPRECATION_ERRORS = '-Wdefault::DeprecationWarning' # normal python behaviour |
| 12 |
|
| 13 |
def build(bld): |
| 14 |
if not bld.env['ENABLE_PYGCCXML']: |
| 15 |
print("gccxml not available; skipping the C hello demo") |
| 16 |
return |
| 17 |
|
| 18 |
bindgen = bld( |
| 19 |
features='command', |
| 20 |
source='hellomodulegen.py hello.h', |
| 21 |
target='hellomodule.c', |
| 22 |
command='${PYTHON} %s ${SRC[0]} ${PYGCCXML_MODE} ${SRC[1]} > ${TGT[0]}' % (DEPRECATION_ERRORS,)) |
| 23 |
|
| 24 |
os.environ["PYTHONPATH"] = os.pathsep.join([os.environ.get("PYTHONPATH", ''), bindgen.path.get_bld().abspath()]) |
| 25 |
|
| 26 |
if bld.env['CXX']: |
| 27 |
obj = bld(features='c cshlib pyext') |
| 28 |
obj.source = [ |
| 29 |
'hello.c', |
| 30 |
'hellomodule.c' |
| 31 |
] |
| 32 |
obj.target = 'hello' |
| 33 |
obj.install_path = None # do not install |
| 34 |
obj.env.append_value("INCLUDES", '.') |
| 35 |
|