Skip to content

Commit

Permalink
(fix) linking on windows requires to prepend with 'lib'
Browse files Browse the repository at this point in the history
  • Loading branch information
MementoRC committed Dec 21, 2023
1 parent e6ad6a4 commit bd0afe0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,12 @@ def run(self):

self.define = _build_clib.build_flags['define']

print(self)
if os.name == 'nt' or sys.platform == 'win32':
# Apparently, the linker on Windows interprets -lxxx as xxx.lib, not libxxx.lib
for i, v in enumerate(self.__dict__.get('extra_link_args')):
if v.endswith('.lib'):
self.__dict__['extra_link_args'][i] = f'lib{v}'

return _build_ext.run(self)


Expand Down

0 comments on commit bd0afe0

Please sign in to comment.