The cross module inheritance example is now working. Aside from my figuring out waf, there

are two key things that were necessary:

1.  We have to turn off the -fvisibility=hidden flag, since this hides the symbols in our
    shared libraries from others.  There's probably a better way to handle this, but this
    is expedient for now.

2.  Since I'm testing with GNU compilers & linkers, I have to use the magic lines in python
    before importing the inter-dependent modules (see test_cross_module_inheritance.py):

    import sys, ctypes
    sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL)

    This shouldn't be necessary on all platforms.
This commit is contained in:
Mike Owen committed 2012-12-11 16:01:44 -08:00
1 parent 8b334800da
commit cd928374b0
3 files changed
+38 -33

No files matched your search

+21 -28
View File
@@ -2,33 +2,26 @@
def build(bld):
for src, tgt in (('Agen.py', 'Amodule.cc'),
('Bgen.py', 'Bmodule.cc')):
gen = bld.new_task_gen(
features='command',
source=src,
target=tgt,
command='${PYTHON} ${SRC[0]} ${TGT[0]}')
for src, tgt in (("Agen.py", "Amodule.cc"),
("Bgen.py", "Bmodule.cc")):
gen = bld.new_task_gen(features="command",
source=src,
target=tgt,
command="${PYTHON} ${SRC[0]} ${TGT[0]}")
if bld.env['CXX']:
# bld.shlib(source = 'Amodule.cc',
# target = 'A',
# features = 'pyext',
# use = ['PYTHON'])
# bld.shlib(source = 'Bmodule.cc',
# target = 'B',
# features = 'pyext',
# use = ['PYTHON', 'A'])
if bld.env["CXX"]:
obj = bld.new_task_gen(features="cxx cxxshlib pyext",
source = "Amodule.cc",
target = "A",
install_path = None, # do not install
includes = ".",
cxxflags = "-fvisibility=default", # Hack for gcc only -- need to clean up
)
obj = bld.new_task_gen(features=['cxx', 'cxxshlib', 'pyext'])
obj.source = ['Amodule.cc']
obj.target = 'A'
obj.install_path = None # do not install
obj.includes = '.'
obj = bld.new_task_gen(features=['cxx', 'cxxshlib', 'pyext'])
obj.source = ['Bmodule.cc']
obj.target = 'B'
obj.install_path = None # do not install
obj.includes = '.'
obj.links = ['A']
obj = bld.new_task_gen(features="cxx cxxshlib pyext",
source = "Bmodule.cc",
target = "B",
install_path = None, # do not install
includes = ".",
cxxflags = "-fvisibility=default", # Hack for gcc only -- need to clean up
)