2525
2626
2727import os
28+ import sys
2829from os .path import join
2930
3031import Cython .Build
@@ -38,13 +39,15 @@ def extensions():
3839 "include_dirs" : [join (mkl_root , "include" )],
3940 "library_dirs" : [join (mkl_root , "lib" ), join (mkl_root , "lib" , "intel64" )],
4041 "libraries" : ["mkl_rt" ],
42+ "rpaths" : ["$ORIGIN/../.." , "$ORIGIN/../../.." ] if sys .platform != 'win32' else [],
4143 }
4244 else :
4345 raise ValueError ("MKLROOT environment variable not set." )
4446
4547 mkl_include_dirs = mkl_info .get ("include_dirs" , [])
4648 mkl_library_dirs = mkl_info .get ("library_dirs" , [])
4749 mkl_libraries = mkl_info .get ("libraries" , ["mkl_rt" ])
50+ mkl_rpaths = mkl_info .get ("rpaths" , [])
4851
4952 defs = []
5053 if any (["mkl_rt" in li for li in mkl_libraries ]):
@@ -59,7 +62,7 @@ def extensions():
5962 include_dirs = mkl_include_dirs ,
6063 libraries = mkl_libraries + (["pthread" ] if os .name == "posix" else []),
6164 library_dirs = mkl_library_dirs ,
62- runtime_library_dirs = [ "$ORIGIN/../.." , "$ORIGIN/../../.." ] ,
65+ runtime_library_dirs = mkl_rpaths ,
6366 extra_compile_args = [
6467 "-DNDEBUG"
6568 # "-g", "-O2", "-Wall",
@@ -75,6 +78,7 @@ def extensions():
7578 include_dirs = mkl_include_dirs ,
7679 library_dirs = mkl_library_dirs ,
7780 libraries = mkl_libraries ,
81+ runtime_library_dirs = mkl_rpaths ,
7882 extra_compile_args = [
7983 "-DNDEBUG"
8084 # "-g", "-O2", "-Wall",
0 commit comments