|
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
|
@@ -380,6 +381,8 @@ def options(opts, env):
|
380 | 381 |
|
381 | 382 |
|
382 | 383 | def generate(env):
|
| 384 | + env.scons_version = env._get_major_minor_revision(scons_raw_version) |
| 385 | + |
383 | 386 | # Default num_jobs to local cpu count if not user specified.
|
384 | 387 | # SCons has a peculiarity where user-specified options won't be overridden
|
385 | 388 | # by SetOption, so we can rely on this to know if we should use our default.
|
@@ -437,6 +440,17 @@ def generate(env):
|
437 | 440 | else: # Release
|
438 | 441 | opt_level = "speed"
|
439 | 442 |
|
| 443 | + # Allow marking includes as external/system to avoid raising warnings. |
| 444 | + if env.scons_version < (4, 2): |
| 445 | + env["_CPPEXTINCFLAGS"] = "${_concat(EXTINCPREFIX, CPPEXTPATH, EXTINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}" |
| 446 | + else: |
| 447 | + env["_CPPEXTINCFLAGS"] = ( |
| 448 | + "${_concat(EXTINCPREFIX, CPPEXTPATH, EXTINCSUFFIX, __env__, RDirs, TARGET, SOURCE, affect_signature=False)}" |
| 449 | + ) |
| 450 | + env["CPPEXTPATH"] = [] |
| 451 | + env["EXTINCPREFIX"] = "-isystem " |
| 452 | + env["EXTINCSUFFIX"] = "" |
| 453 | + |
440 | 454 | env["optimize"] = ARGUMENTS.get("optimize", opt_level)
|
441 | 455 | env["debug_symbols"] = get_cmdline_bool("debug_symbols", env.dev_build)
|
442 | 456 |
|
|
0 commit comments