Commit 306da846 authored by Celine Mercier's avatar Celine Mercier

obidistutils: link obi3 C shared library instead of compiling all C

files with all modules (creating issues with global/static variables).
EXCEPT RUNTIME LINKING DOESN'T WORK YET
parent af57e532
...@@ -46,11 +46,17 @@ def findCython(root,base=None,pyrexs=None): ...@@ -46,11 +46,17 @@ def findCython(root,base=None,pyrexs=None):
base=[] base=[]
for module in (path.basename(path.dirname(x)) for module in (path.basename(path.dirname(x))
for x in glob.glob(path.join(root,'*','__init__.py'))): for x in glob.glob(path.join(root,'*','__init__.py'))):
for pyrex in glob.glob(path.join(root,module,'*.pyx')): for pyrex in glob.glob(path.join(root,module,'*.pyx')):
libabspath = os.path.abspath('obi_libdir')
obiabspath = os.path.abspath('.')
pyrexs.append(Extension('.'.join(base+[module,path.splitext(path.basename(pyrex))[0]]), pyrexs.append(Extension('.'.join(base+[module,path.splitext(path.basename(pyrex))[0]]),
[pyrex] [pyrex],
library_dirs=[libabspath],
include_dirs=[libabspath],
libraries=["obi3"],
runtime_library_dirs=[libabspath],
extra_link_args=["-Wl,-rpath,"+libabspath, "-R"+libabspath]
) )
) )
try: try:
...@@ -63,13 +69,14 @@ def findCython(root,base=None,pyrexs=None): ...@@ -63,13 +69,14 @@ def findCython(root,base=None,pyrexs=None):
log.info("Cython module : %s",cfiles) log.info("Cython module : %s",cfiles)
incdir = set(os.path.dirname(x) for x in cfiles if x[-2:]==".h") incdir = set(os.path.dirname(x) for x in cfiles if x[-2:]==".h")
cfiles = [x for x in cfiles if x[-2:]==".c"] #cfiles = [x for x in cfiles if x[-2:]==".c"]
pyrexs[-1].sources.extend(cfiles) #pyrexs[-1].sources.extend(cfiles)
pyrexs[-1].include_dirs.extend(incdir) pyrexs[-1].include_dirs.extend(incdir)
pyrexs[-1].extra_compile_args.extend(['-msse2', pyrexs[-1].extra_compile_args.extend(['-msse2',
'-Wno-unused-function', '-Wno-unused-function',
'-Wmissing-braces', '-Wmissing-braces',
'-Wchar-subscripts']) '-Wchar-subscripts'
])
except IOError: except IOError:
pass pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment