Commits

Chris Lee-Messer  committed 01b2a07

use numpy functions to find includes

  • Participants
  • Parent commits b4da5b8

Comments (0)

Files changed (1)

 from distutils.extension import Extension
 from Cython.Distutils import build_ext
 
-import sys
+import sys, numpy
+
 if sys.platform == 'win32':
     # could just import numpy and use that as base library
-    include_dirs=['src', r"c:/Python26/Lib/site-packages/numpy/core/include"]
-    define=['-D_CRT_SECURE_NO_WARNINGS']
-else:
-    include_dirs=['src',"edflib"]
-    define=[]
+    include_dirs=['src', numpy.get_include() ]
+    defines = ['_CRT_SECURE_NO_WARNINGS', '_LARGEFILE64_SOURCE', '_LARGEFILE_SOURCE']
+else: # 'linux' or 'darwin'
+    defines = [('_LARGEFILE64_SOURCE',None), ('_LARGEFILE_SOURCE',None)]
+    include_dirs = ['src','edflib', numpy.get_include()]
     
-# ext_modules_edf = [Extension("edf", ["edf.pyx", "edflib.c"],
-#                          library_dirs=['.'],
-#                          include_dirs=include_dirs,
-#                          )]
-
-ext_modules_edflib = [Extension("edflib._edflib", ["edflib/_edflib.pyx", "src/edflib.c"],
-                         library_dirs=['src'],
-                         include_dirs=include_dirs,
-#                         define=define,
-                         )]               
+ext_modules_edflib = Extension(
+    "edflib._edflib", ["edflib/_edflib.pyx", "src/edflib.c"],
+    library_dirs=['src'],
+    include_dirs=include_dirs,
+    define_macros=defines,
+    extra_compile_args = ['-O2','-g'],
+    #extra_compile_args = ['-g'],
+    #libraries=['m']
+    #extra_link_args =
+    #export_symbols  #only useful on windows
+    #depends = 
+    )
 
 setup(
     name = 'python-edf',
     url="http://bitbucket.org/cleemesser/python-edf",
     download_url="http://bitbucket.org/cleemesser/python-edf/downloads",
     cmdclass = {'build_ext': build_ext},
-    ext_modules = ext_modules_edflib,
+    ext_modules = [ext_modules_edflib],
     packages=["edflib"],
     classifiers=['Topic :: Science :: EEG'],
     package_data={'edflib' : ['_edflib.so']},