@@ -42,16 +42,23 @@ def get_lib_dir():
4242 return os .path .join (_HERE , "lib" )
4343
4444
45- def get_library ():
46- """Return the lib name needed for linking
45+ def get_library (fullname = False ):
46+ """Return the lib name needed for linking. If `fullname` then return the
47+ filename of the library, otherwise return the link name.
4748 """
4849 if sys .platform == "win32" :
4950 libs = [x for x in os .listdir (get_lib_dir ()) if x .endswith (".lib" )]
50- return os .path .splitext (libs [0 ])[0 ]
51+ if fullname :
52+ return libs [0 ]
53+ else :
54+ return os .path .splitext (libs [0 ])[0 ]
5155 else :
5256 libs = [x for x in os .listdir (get_lib_dir ()) if x .startswith ("libscipy_openblas" )]
53- # remove the leading lib from libscipy_openblas*
54- return os .path .splitext (libs [0 ])[0 ][3 :]
57+ if fullname :
58+ return libs [0 ]
59+ else :
60+ # remove the leading lib from libscipy_openblas*
61+ return os .path .splitext (libs [0 ])[0 ][3 :]
5562
5663def get_pkg_config (use_preloading = False ):
5764 """Return a multi-line string that, when saved to a file, can be used with
@@ -69,7 +76,7 @@ def get_pkg_config(use_preloading=False):
6976 if use_preloading :
7077 libs_flags = ""
7178 else :
72- libs_flags = f"-L ${{libdir}} -l { get_library () } "
79+ libs_flags = f"${{libdir}}/ { get_library (fullname = True ) } -Wl,-rpath,${{libdir} }"
7380 cflags = "-DBLAS_SYMBOL_PREFIX=scipy_ -DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64 -DOPENBLAS_ILP64_NAMING_SCHEME"
7481 return dedent (f"""\
7582 libdir={ get_lib_dir ()}
0 commit comments