MCPcopy Create free account
hub / github.com/cztomczak/cefpython / set_compiler_options

Function set_compiler_options

tools/cython_setup.py:174–294  ·  view source on GitHub ↗

Extends options and also sets environment variables.

(options)

Source from the content-addressed store, hash-verified

172
173
174def set_compiler_options(options):
175 """Extends options and also sets environment variables."""
176 print("[cython_setup.py] Set compiler options")
177
178 extra_compile_args = list()
179 extra_link_args = list()
180
181 if WINDOWS:
182 # /EHsc - using STL string, multimap and others that use
183 # C++ exceptions.
184 #
185 # /ignore:4217 - disable warnings such as this:
186 #
187 # client_handler_py27_32bit.lib(client_handler.obj): warning LNK4217:
188 # locally defined symbol _RemovePythonCallbacksForFrame imported in
189 # function "public: virtual bool __thiscall
190 # ClientHandler::OnProcessMessageReceived
191 #
192 # /wd4305 - disable warnnings such as this:
193 #
194 # warning C4305: '=' : truncation from 'int' to 'bool'
195 # Code: > cdef public cpp_bool ExecutePythonCallback(...) except *:
196 # > return True
197 # Discussed on cython group error 4800 which is similar to this,
198 # but there is no other way to fix this warning:
199 # https://groups.google.com/d/topic/cython-users/X_X0lfIBCqo/discussion
200 #
201 # The above warning LNK4217 is caused by the warning below which occurs
202 # when building the client_handler.lib static library:
203 extra_compile_args.extend(["/EHsc", "/wd4305"])
204 extra_link_args.extend(["/ignore:4217"])
205
206 if LINUX or MAC:
207 # Compiler flags
208 if FAST_FLAG:
209 extra_compile_args.append("-O0")
210 else:
211 extra_compile_args.append("-O3")
212
213 extra_compile_args.extend([
214 "-DNDEBUG",
215 "-std=gnu++11",
216 ])
217
218 if LINUX:
219 os.environ["CC"] = "g++"
220 os.environ["CXX"] = "g++"
221 extra_compile_args.extend(["-std=gnu++11"])
222
223 # Fix "ImportError ... undefined symbol ..." caused by CEF's
224 # include/base/ headers by adding the -flto flag (Issue #230).
225 # Unfortunately -flto prolongs compilation time significantly.
226 # More on the other flags: https://stackoverflow.com/questions/
227 # 6687630/ .
228
229 if FAST_FLAG:
230 extra_compile_args.extend(["-flto"])
231 extra_link_args.extend(["-flto"])

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected