@@ -64,16 +64,23 @@ def get_gsl_config():
6464
6565
6666def 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 ]}
7784
7885
7986# ----------------------------------------------------------------------------
@@ -87,19 +94,23 @@ def get_gsl_config_win():
8794 gcfg = get_gsl_config ()
8895include_dirs = [MYDIR ] + gcfg ["include_dirs" ]
8996library_dirs = []
90- libraries = []
97+ if sys .platform == "darwin" :
98+ libraries = []
99+ else :
100+ libraries = ["gsl" ]
91101extra_objects = []
92102extra_compile_args = []
93103extra_link_args = []
94104
95105compiler_type = get_compiler_type ()
96106if compiler_type in ("unix" , "cygwin" , "mingw32" ):
97107 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+ ]
99111elif compiler_type == "msvc" :
100112 define_macros += [("_USE_MATH_DEFINES" , None )]
101113 extra_compile_args = ["/EHs" ]
102- libraries += ["gsl" ]
103114 library_dirs += gcfg ["library_dirs" ]
104115# add optimization flags for other compilers if needed
105116
0 commit comments