@@ -64,16 +64,23 @@ def get_gsl_config():
64
64
65
65
66
66
def get_gsl_config_win ():
67
- """Return dictionary with paths to GSL library, windwows version.
68
- This version is installed with conda.
69
- """
70
- conda_prefix = os .environ ["CONDA_PREFIX" ]
71
- inc = os .path .join (conda_prefix , "Library" , "include" )
72
- lib = os .path .join (conda_prefix , "Library" , "lib" )
73
- rv = {"include_dirs" : [], "library_dirs" : []}
74
- rv ["include_dirs" ] += [inc ]
75
- rv ["library_dirs" ] += [lib ]
76
- return rv
67
+ """Return dictionary with paths to GSL library on Windows."""
68
+ gsl_path = os .environ .get ("GSL_PATH" )
69
+ if gsl_path :
70
+ inc = os .path .join (gsl_path , "include" )
71
+ lib = os .path .join (gsl_path , "lib" )
72
+ else :
73
+ conda_prefix = os .environ .get ("CONDA_PREFIX" )
74
+ if conda_prefix :
75
+ inc = os .path .join (conda_prefix , "Library" , "include" )
76
+ lib = os .path .join (conda_prefix , "Library" , "lib" )
77
+ else :
78
+ raise EnvironmentError (
79
+ "Neither GSL_PATH nor CONDA_PREFIX environment variables are set. "
80
+ "Please ensure GSL is installed and GSL_PATH is correctly set."
81
+ )
82
+
83
+ return {"include_dirs" : [inc ], "library_dirs" : [lib ]}
77
84
78
85
79
86
# ----------------------------------------------------------------------------
@@ -87,19 +94,23 @@ def get_gsl_config_win():
87
94
gcfg = get_gsl_config ()
88
95
include_dirs = [MYDIR ] + gcfg ["include_dirs" ]
89
96
library_dirs = []
90
- libraries = []
97
+ if sys .platform == "darwin" :
98
+ libraries = []
99
+ else :
100
+ libraries = ["gsl" ]
91
101
extra_objects = []
92
102
extra_compile_args = []
93
103
extra_link_args = []
94
104
95
105
compiler_type = get_compiler_type ()
96
106
if compiler_type in ("unix" , "cygwin" , "mingw32" ):
97
107
extra_compile_args = ["-std=c++11" , "-Wall" , "-Wno-write-strings" , "-O3" , "-funroll-loops" , "-ffast-math" ]
98
- extra_objects += ((p + "/libgsl.a" ) for p in gcfg ["library_dirs" ])
108
+ extra_objects += [
109
+ os .path .join (p , "libgsl.a" ) for p in gcfg ["library_dirs" ] if os .path .isfile (os .path .join (p , "libgsl.a" ))
110
+ ]
99
111
elif compiler_type == "msvc" :
100
112
define_macros += [("_USE_MATH_DEFINES" , None )]
101
113
extra_compile_args = ["/EHs" ]
102
- libraries += ["gsl" ]
103
114
library_dirs += gcfg ["library_dirs" ]
104
115
# add optimization flags for other compilers if needed
105
116
0 commit comments