@@ -48,20 +48,46 @@ def get_boost_config():
4848 return {"include_dirs" : [str (inc )], "library_dirs" : [str (lib )]}
4949
5050
51+ def get_objcryst_libraries ():
52+ conda_prefix = os .environ .get ("CONDA_PREFIX" )
53+ if not conda_prefix :
54+ raise EnvironmentError (
55+ "CONDA_PREFIX is not set. Please install ObjCryst using conda and activate the environment."
56+ )
57+ if os .name == "nt" :
58+ libdir = Path (conda_prefix ) / "Library" / "lib"
59+ else :
60+ libdir = Path (conda_prefix ) / "lib"
61+
62+ libs = []
63+ for fn in os .listdir (libdir ):
64+ low = fn .lower ()
65+ if "objcryst" in low :
66+ libs .append (os .path .splitext (fn )[0 ])
67+ if not libs :
68+ raise RuntimeError (f"No ObjCryst libraries found in { libdir } " )
69+ return libs
70+
71+
5172if os .name == "nt" :
5273 compile_args = ["/std:c++14" ]
5374 macros = [("_USE_MATH_DEFINES" , None )]
75+ extra_link_args = ["/FORCE:MULTIPLE" ]
5476else :
5577 compile_args = ["-std=c++11" ]
5678 macros = []
79+ extra_link_args = []
5780
5881boost_cfg = get_boost_config ()
82+ objcryst_libs = get_objcryst_libraries ()
83+
5984ext_kws = {
60- "libraries" : ["diffpy" ] + get_boost_libraries (),
85+ "libraries" : ["diffpy" ] + get_boost_libraries () + objcryst_libs ,
6186 "extra_compile_args" : compile_args ,
62- "extra_link_args" : [] ,
87+ "extra_link_args" : extra_link_args ,
6388 "include_dirs" : [numpy .get_include ()] + boost_cfg ["include_dirs" ],
6489 "library_dirs" : boost_cfg ["library_dirs" ],
90+ "runtime_library_dirs" : boost_cfg ["library_dirs" ],
6591 "define_macros" : macros ,
6692}
6793
0 commit comments