From b3ea870723a80ee38123bbb81d58b1b7d13c1d8f Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Sun, 26 Apr 2020 17:52:43 +0200 Subject: [PATCH] Use define_macros for macros (@isuruf, #39) --- setup.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 00d88a2..181e8cf 100644 --- a/setup.py +++ b/setup.py @@ -83,13 +83,12 @@ class BuildExt(build_ext): 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)