mirror of
https://github.com/godotengine/godot-cpp.git
synced 2025-12-31 01:48:45 +03:00
SCons: Add CPPEXTPATH for external includes
(cherry picked from commit 30bfa6f215)
This commit is contained in:
committed by
David Snopek
parent
6182a2728b
commit
b905a87ebe
@@ -2,6 +2,7 @@ import os
|
||||
import platform
|
||||
import sys
|
||||
|
||||
from SCons import __version__ as scons_raw_version
|
||||
from SCons.Action import Action
|
||||
from SCons.Builder import Builder
|
||||
from SCons.Errors import UserError
|
||||
@@ -380,6 +381,8 @@ def options(opts, env):
|
||||
|
||||
|
||||
def generate(env):
|
||||
env.scons_version = env._get_major_minor_revision(scons_raw_version)
|
||||
|
||||
# Default num_jobs to local cpu count if not user specified.
|
||||
# SCons has a peculiarity where user-specified options won't be overridden
|
||||
# by SetOption, so we can rely on this to know if we should use our default.
|
||||
@@ -437,6 +440,17 @@ def generate(env):
|
||||
else: # Release
|
||||
opt_level = "speed"
|
||||
|
||||
# Allow marking includes as external/system to avoid raising warnings.
|
||||
if env.scons_version < (4, 2):
|
||||
env["_CPPEXTINCFLAGS"] = "${_concat(EXTINCPREFIX, CPPEXTPATH, EXTINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}"
|
||||
else:
|
||||
env["_CPPEXTINCFLAGS"] = (
|
||||
"${_concat(EXTINCPREFIX, CPPEXTPATH, EXTINCSUFFIX, __env__, RDirs, TARGET, SOURCE, affect_signature=False)}"
|
||||
)
|
||||
env["CPPEXTPATH"] = []
|
||||
env["EXTINCPREFIX"] = "-isystem "
|
||||
env["EXTINCSUFFIX"] = ""
|
||||
|
||||
env["optimize"] = ARGUMENTS.get("optimize", opt_level)
|
||||
env["debug_symbols"] = get_cmdline_bool("debug_symbols", env.dev_build)
|
||||
|
||||
|
||||
@@ -130,6 +130,11 @@ def generate(env):
|
||||
if env["silence_msvc"] and not env.GetOption("clean"):
|
||||
silence_msvc(env)
|
||||
|
||||
if not env["use_llvm"]:
|
||||
env.AppendUnique(CCFLAGS=["/experimental:external", "/external:anglebrackets"])
|
||||
env.AppendUnique(CCFLAGS=["/external:W0"])
|
||||
env["EXTINCPREFIX"] = "/external:I"
|
||||
|
||||
elif (sys.platform == "win32" or sys.platform == "msys") and not env["mingw_prefix"]:
|
||||
env["use_mingw"] = True
|
||||
mingw.generate(env)
|
||||
|
||||
Reference in New Issue
Block a user