File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,21 @@ def _pack_std_jsonnet(self):
60
60
f .write ("," .join (str (x ) for x in stdlib ))
61
61
f .write (",0\n \n " )
62
62
63
+ def build_extension (self , ext ):
64
+ # At this point, the compiler has been chosen so we add compiler-specific flags.
65
+ # There is unfortunately no built in support for this in setuptools.
66
+ # Feature request: https://github.com/pypa/setuptools/issues/1819
67
+
68
+ print ("Setting compile flags for compiler type " + self .compiler .compiler_type )
69
+ # This is quite hacky as we're modifying the Extension object itself.
70
+ if self .compiler .compiler_type == "msvc" :
71
+ ext .extra_compile_args .append ("/std:c++17" )
72
+ else :
73
+ ext .extra_compile_args .append ("-std=c++17" )
74
+
75
+ # Actually build.
76
+ super ().build_extension (ext )
77
+
63
78
def run (self ):
64
79
self ._pack_std_jsonnet ()
65
80
super ().run ()
@@ -89,7 +104,6 @@ def run(self):
89
104
"third_party/json" ,
90
105
"third_party/rapidyaml" ,
91
106
],
92
- extra_compile_args = ["-std=c++17" ],
93
107
language = "c++" ,
94
108
)
95
109
],
You can’t perform that action at this time.
0 commit comments