Skip to content

Commit

Permalink
ENH: spatial/qhull: use qh_QHpointer
Browse files Browse the repository at this point in the history
  • Loading branch information
pv committed Dec 17, 2012
1 parent 3c03c49 commit 4e52583
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
3 changes: 2 additions & 1 deletion scipy/spatial/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ src = [join('qhull', 'src', s) for s in [
'random.c', 'rboxlib.c', 'stat.c', 'user.c', 'usermem.c',
'userprintf.c']]

env.NumpyPythonExtension('qhull', source = ['qhull.c'] + src)
env.NumpyPythonExtension('qhull', source = ['qhull.c'] + src,
CDEFINES={'qh_QHpointer': '1'})
3 changes: 2 additions & 1 deletion scipy/spatial/bscript
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ from bento.commands import hooks

@hooks.pre_build
def pre_build(context):
context.tweak_extension("qhull", use="FLAPACK CLIB")
context.tweak_extension("qhull", use="FLAPACK CLIB",
defines=['qh_QHpointer=1'])
2 changes: 1 addition & 1 deletion scipy/spatial/qhull.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ cdef extern from "qhull/src/qhull.h":
realT MINoutside
realT DISTround

extern qhT qh_qh
extern qhT *qh_qh
extern int qh_PRINToff
extern int qh_ALL

Expand Down
23 changes: 7 additions & 16 deletions scipy/spatial/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,20 @@ def configuration(parent_package = '', top_path = None):
qhull_src = ['geom2.c', 'geom.c', 'global.c', 'io.c', 'libqhull.c',
'mem.c', 'merge.c', 'poly2.c', 'poly.c', 'qset.c',
'random.c', 'rboxlib.c', 'stat.c', 'user.c', 'usermem.c',
'userprintf.c']
'userprintf.c', 'userprintf_rbox.c']
qhull_src = [join('qhull', 'src', x) for x in qhull_src]

inc_dirs = [get_python_inc()]
if inc_dirs[0] != get_python_inc(plat_specific=1):
inc_dirs.append(get_python_inc(plat_specific=1))
inc_dirs.append(get_numpy_include_dirs())

config.add_library('qhull',
sources=[join('qhull', 'src', x) for x in qhull_src],
include_dirs=inc_dirs,
# XXX: GCC dependency!
#extra_compiler_args=['-fno-strict-aliasing'],
)

lapack = dict(get_info('lapack_opt'))
try:
libs = ['qhull'] + lapack.pop('libraries')
except KeyError:
libs = ['qhull']
cfg = dict(get_info('lapack_opt'))
cfg.setdefault('include_dirs', []).extend(inc_dirs)
cfg.setdefault('define_macros', []).append(('qh_QHpointer','1'))
config.add_extension('qhull',
sources=['qhull.c'],
libraries=libs,
**lapack)
sources=['qhull.c'] + qhull_src,
**cfg)

config.add_extension('ckdtree', sources=['ckdtree.c']) # FIXME: cython

Expand Down

0 comments on commit 4e52583

Please sign in to comment.