Skip to content

Commit 57779dd

Browse files
committed
- try to find lib to use on windows
1 parent 7e905aa commit 57779dd

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

setup.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ def get_python_include():
4343
# for whatever reason 2.7 on centos returns a wrong path here
4444
return sysconfig.get_config_vars()['INCLUDEPY']
4545

46+
def get_win_python_lib():
47+
vars = sysconfig.get_config_vars()
48+
path = os.path.join(vars['prefix'], 'libs', 'python' + vars['py_version_nodot'] + '.lib')
49+
if os.path.exists(path):
50+
return path
51+
return None
52+
4653
def prepend_variables(args, variables):
4754
for var in variables:
4855
temp = os.getenv(var)
@@ -252,6 +259,7 @@ def build_cmake(self, extension):
252259
'-DPYTHON_INCLUDE_DIR=' + get_python_include()
253260
]
254261

262+
255263
for package in packages:
256264
libsbml_args.append('-DENABLE_{0}=ON'.format(package.upper()))
257265

@@ -262,6 +270,11 @@ def build_cmake(self, extension):
262270

263271
if not is_win:
264272
libsbml_args.append('-DPYTHON_USE_DYNAMIC_LOOKUP=ON')
273+
else:
274+
lib_path = get_win_python_lib()
275+
if lib_path is not None:
276+
libsbml_args.append('-DPYTHON_LIBRARY={0}'.format(lib_path))
277+
265278

266279
cmake_args = cmake_args + libsbml_args
267280

0 commit comments

Comments
 (0)