@@ -71,22 +71,29 @@ class BuildExt(build_ext):
71
71
'msvc' : ['/EHsc' ],
72
72
'unix' : [],
73
73
}
74
+ l_opts = {
75
+ 'msvc' : [],
76
+ 'unix' : [],
77
+ }
74
78
75
79
if sys .platform == 'darwin' :
80
+ l_opts ['unix' ] += ['-stdlib=libc++' , '-mmacosx-version-min=10.7' ]
76
81
c_opts ['unix' ] += ['-stdlib=libc++' , '-mmacosx-version-min=10.7' ]
77
82
78
83
def build_extensions (self ):
79
84
ct = self .compiler .compiler_type
80
- opts = self .c_opts .get (ct , [])
85
+ c_opts = self .c_opts .get (ct , [])
86
+ l_opts = self .l_opts .get (ct , [])
81
87
if ct == 'unix' :
82
- opts .append ('-DVERSION_INFO="%s"' % self .distribution .get_version ())
83
- opts .append (cpp_flag (self .compiler ))
88
+ c_opts .append (cpp_flag (self .compiler ))
84
89
if has_flag (self .compiler , '-fvisibility=hidden' ):
85
- opts .append ('-fvisibility=hidden' )
86
- elif ct == 'msvc' :
87
- opts .append ('/DVERSION_INFO=\\ "%s\\ "' % self .distribution .get_version ())
90
+ c_opts .append ('-fvisibility=hidden' )
91
+
88
92
for ext in self .extensions :
89
- ext .extra_compile_args = opts
93
+ ext .extra_compile_args = c_opts
94
+ ext .extra_link_args = l_opts
95
+ ext .define_macros = [('VERSION_INFO' , '"{}"' .format (self .distribution .get_version ()))]
96
+
90
97
build_ext .build_extensions (self )
91
98
92
99
setup (
0 commit comments