Skip to content

Commit

Permalink
Use define_macros for macros (@isuruf, #39)
Browse files Browse the repository at this point in the history
  • Loading branch information
wjakob committed Apr 26, 2020
1 parent 8f86e4c commit b3ea870
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,12 @@ def build_extensions(self):
opts = self.c_opts.get(ct, [])
link_opts = self.l_opts.get(ct, [])
if ct == 'unix':
opts.append('-DVERSION_INFO="%s"' % self.distribution.get_version())
opts.append(cpp_flag(self.compiler))
if has_flag(self.compiler, '-fvisibility=hidden'):
opts.append('-fvisibility=hidden')
elif ct == 'msvc':
opts.append('/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version())

for ext in self.extensions:
ext.define_macros = [('VERSION_INFO', '"{}"'.format(self.distribution.get_version()))]
ext.extra_compile_args = opts
ext.extra_link_args = link_opts
build_ext.build_extensions(self)
Expand Down

0 comments on commit b3ea870

Please sign in to comment.