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
This commit is contained in:
@ -47,10 +47,16 @@ def findCython(root,base=None,pyrexs=None):
|
|||||||
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):
|
|||||||
|
|
||||||
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
|
||||||
|
Reference in New Issue
Block a user