Set environment variables. Set PATH so that it contains only minimum set of directories,to avoid any possible issues. Set Python include path. Set Mac compiler options. Etc.
()
| 255 | |
| 256 | |
| 257 | def setup_environ(): |
| 258 | """Set environment variables. Set PATH so that it contains only |
| 259 | minimum set of directories,to avoid any possible issues. Set Python |
| 260 | include path. Set Mac compiler options. Etc.""" |
| 261 | print("[build.py] Setup environment variables") |
| 262 | |
| 263 | # PATH |
| 264 | if WINDOWS: |
| 265 | path = [ |
| 266 | "C:\\Windows\\system32", |
| 267 | "C:\\Windows", |
| 268 | "C:\\Windows\\System32\\Wbem", |
| 269 | get_python_path(), |
| 270 | ] |
| 271 | os.environ["PATH"] = os.pathsep.join(path) |
| 272 | print("[build.py] environ PATH: {path}" |
| 273 | .format(path=os.environ["PATH"])) |
| 274 | |
| 275 | # INCLUDE env for vcproj build |
| 276 | if WINDOWS: |
| 277 | if "INCLUDE" not in os.environ: |
| 278 | os.environ["INCLUDE"] = "" |
| 279 | os.environ["INCLUDE"] += os.pathsep + get_python_include_path() |
| 280 | print("[build.py] environ INCLUDE: {include}" |
| 281 | .format(include=os.environ["INCLUDE"])) |
| 282 | |
| 283 | # LIB env for vcproj build |
| 284 | if WINDOWS: |
| 285 | os.environ["AdditionalLibraryDirectories"] = os.path.join( |
| 286 | CEF_BINARIES_LIBRARIES, "lib") |
| 287 | print("[build.py] environ AdditionalLibraryDirectories: {lib}" |
| 288 | .format(lib=os.environ["AdditionalLibraryDirectories"])) |
| 289 | |
| 290 | if LINUX or MAC: |
| 291 | # Env variables for makefiles |
| 292 | os.environ["PYTHON_INCLUDE"] = get_python_include_path() |
| 293 | print("[build.py] PYTHON_INCLUDE: {python_include}" |
| 294 | .format(python_include=os.environ["PYTHON_INCLUDE"])) |
| 295 | |
| 296 | os.environ["CEF_CCFLAGS"] = "-std=gnu++11 -DNDEBUG -Wall -Werror -Wno-deprecated-declarations" |
| 297 | if FAST_FLAG: |
| 298 | os.environ["CEF_CCFLAGS"] += " -O0" |
| 299 | else: |
| 300 | os.environ["CEF_CCFLAGS"] += " -O3" |
| 301 | os.environ["CEF_LINK_FLAGS"] = "" |
| 302 | |
| 303 | os.environ["CEF_BIN"] = os.path.join(CEF_BINARIES_LIBRARIES, "bin") |
| 304 | os.environ["CEF_LIB"] = os.path.join(CEF_BINARIES_LIBRARIES, "lib") |
| 305 | |
| 306 | if LINUX: |
| 307 | # TODO: Set CEF_CCFLAGS and CEF_LINK_FLAGS according to what is |
| 308 | # in upstream cefclient, see cef/cmake/cef_variables.cmake. |
| 309 | pass |
| 310 | |
| 311 | # Mac compiler options |
| 312 | if MAC: |
| 313 | os.environ["PATH"] = "/usr/local/bin:"+os.environ["PATH"] |
| 314 | os.environ["CC"] = "c++" |
no test coverage detected