|
2 | 2 | import platform |
3 | 3 | import sys |
4 | 4 |
|
| 5 | +from SCons import __version__ as scons_raw_version |
5 | 6 | from SCons.Action import Action |
6 | 7 | from SCons.Builder import Builder |
7 | 8 | from SCons.Errors import UserError |
@@ -424,6 +425,8 @@ def make_doc_source(target, source, env): |
424 | 425 |
|
425 | 426 |
|
426 | 427 | def generate(env): |
| 428 | + env.scons_version = env._get_major_minor_revision(scons_raw_version) |
| 429 | + |
427 | 430 | # Default num_jobs to local cpu count if not user specified. |
428 | 431 | # SCons has a peculiarity where user-specified options won't be overridden |
429 | 432 | # by SetOption, so we can rely on this to know if we should use our default. |
@@ -481,6 +484,17 @@ def generate(env): |
481 | 484 | else: # Release |
482 | 485 | opt_level = "speed" |
483 | 486 |
|
| 487 | + # Allow marking includes as external/system to avoid raising warnings. |
| 488 | + if env.scons_version < (4, 2): |
| 489 | + env["_CPPEXTINCFLAGS"] = "${_concat(EXTINCPREFIX, CPPEXTPATH, EXTINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}" |
| 490 | + else: |
| 491 | + env["_CPPEXTINCFLAGS"] = ( |
| 492 | + "${_concat(EXTINCPREFIX, CPPEXTPATH, EXTINCSUFFIX, __env__, RDirs, TARGET, SOURCE, affect_signature=False)}" |
| 493 | + ) |
| 494 | + env["CPPEXTPATH"] = [] |
| 495 | + env["EXTINCPREFIX"] = "-isystem " |
| 496 | + env["EXTINCSUFFIX"] = "" |
| 497 | + |
484 | 498 | env["optimize"] = ARGUMENTS.get("optimize", opt_level) |
485 | 499 | env["debug_symbols"] = get_cmdline_bool("debug_symbols", env.dev_build) |
486 | 500 |
|
|
0 commit comments