27
27
import sys
28
28
from os .path import join , exists , abspath , dirname
29
29
from os import getcwd
30
+ from os import environ
30
31
31
32
def configuration (parent_package = '' ,top_path = None ):
32
33
from numpy .distutils .misc_util import Configuration
33
34
from numpy .distutils .system_info import get_info
34
35
config = Configuration ('mkl_fft' , parent_package , top_path )
35
36
37
+ mkl_root = environ .get ('MKLROOT' , None )
38
+ if mkl_root :
39
+ mkl_info = {
40
+ 'include_dirs' : [join (mkl_root , 'include' )],
41
+ 'library_dirs' : [join (mkl_root , 'lib' ), join (mkl_root , 'lib' , 'intel64' )],
42
+ 'libraries' : ['mkl_rt' ]
43
+ }
44
+ else :
45
+ mkl_info = get_info ('mkl' )
46
+
47
+ mkl_include_dirs = mkl_info .get ('include_dirs' , [])
48
+ mkl_library_dirs = mkl_info .get ('library_dirs' , [])
49
+ mkl_libraries = mkl_info .get ('libraries' , ['mkl_rt' ])
50
+
36
51
pdir = dirname (__file__ )
37
52
wdir = join (pdir , 'src' )
38
53
mkl_info = get_info ('mkl' )
39
- libs = mkl_info .get ('libraries' , ['mkl_rt' ])
40
54
41
55
try :
42
56
from Cython .Build import cythonize
@@ -58,8 +72,9 @@ def configuration(parent_package='',top_path=None):
58
72
join (wdir , 'mklfft.h' ),
59
73
join (wdir , 'multi_iter.h' )
60
74
],
61
- include_dirs = [wdir ],
62
- libraries = libs ,
75
+ include_dirs = [wdir ] + mkl_include_dirs ,
76
+ libraries = mkl_libraries ,
77
+ library_dirs = mkl_library_dirs ,
63
78
extra_compile_args = [
64
79
'-DNDEBUG' ,
65
80
# '-ggdb', '-O0', '-Wall', '-Wextra', '-DDEBUG',
0 commit comments