Add gccxml-based variants to the 'a' example.

This commit is contained in:
Gustavo J. A. M. Carneiro committed 2008-06-02 14:06:06 +01:00
1 parent abfe0a2b34
commit 1c2134b7b4
3 files changed
+77

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
#! /usr/bin/env python
import sys
import pybindgen
from pybindgen import FileCodeSink
from pybindgen.gccxmlparser import ModuleParser
def my_module_gen():
module_parser = ModuleParser('a1', '::')
module = module_parser.parse([sys.argv[1]])
module.add_include('"a.h"')
pybindgen.write_preamble(FileCodeSink(sys.stdout))
module.generate(FileCodeSink(sys.stdout))
if __name__ == '__main__':
my_module_gen()
+13
View File
@@ -0,0 +1,13 @@
#! /usr/bin/env python
import sys
from pybindgen import FileCodeSink
from pybindgen.gccxmlparser import ModuleParser
def my_module_gen():
module_parser = ModuleParser('a2', '::')
module_parser.parse([sys.argv[1]], includes=['"a.h"'], pygen_sink=FileCodeSink(sys.stdout))
if __name__ == '__main__':
my_module_gen()
+46
View File
@@ -26,3 +26,49 @@ def build(bld):
obj.target = 'a'
obj.inst_var = 0 # do not install
obj.includes = '.'
if bld.env()['ENABLE_PYGCCXML']:
## gccxml direct generation method
bindgen = bld.create_obj('command-output')
bindgen.stdout = 'a1module.cc'
bindgen.argv = [bindgen.input_file('module-autogen.py'),
bindgen.input_file('a.h')]
bindgen.command = bindgen.env['PYTHON']
bindgen.command_is_external = True
bindgen.prio = 55 # must run after the 'py' objects in ../pybindgen
obj = create_pyext_obj(bld, 'cpp')
obj.source = [
'a.cc',
'a1module.cc'
]
obj.target = 'a1'
obj.inst_var = 0 # do not install
obj.includes = '.'
## gccxml indirect generation method
bindgen = bld.create_obj('command-output')
bindgen.stdout = 'a2modulegen.py'
bindgen.argv = [bindgen.input_file('module-autoscan.py'),
bindgen.input_file('a.h')]
bindgen.command = bindgen.env['PYTHON']
bindgen.command_is_external = True
bindgen.prio = 55 # must run after the 'py' objects in ../pybindgen
bindgen = bld.create_obj('command-output')
bindgen.stdout = 'a2module.cc'
bindgen.argv = [bindgen.input_file('a2modulegen.py')]
bindgen.command = bindgen.env['PYTHON']
bindgen.command_is_external = True
bindgen.prio = 56 # must run after the 'py' objects in ../pybindgen
obj = create_pyext_obj(bld, 'cpp')
obj.source = [
'a.cc',
'a2module.cc'
]
obj.target = 'a2'
obj.inst_var = 0 # do not install
obj.includes = '.'