diff options
author | Mats Wichmann <mats@linux.com> | 2019-05-02 19:03:15 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2019-05-02 19:03:58 (GMT) |
commit | cb83cf38c8f8c17bfc06610b20e01ef23c19a368 (patch) | |
tree | df0bc5ea584eb57b167c285d4c1e39e60248af71 /src/engine | |
parent | 624df56fb21efc3fa0e8851964dd11d942d55ee3 (diff) | |
download | SCons-cb83cf38c8f8c17bfc06610b20e01ef23c19a368.zip SCons-cb83cf38c8f8c17bfc06610b20e01ef23c19a368.tar.gz SCons-cb83cf38c8f8c17bfc06610b20e01ef23c19a368.tar.bz2 |
Add -iquote and -idirafter for CCFLAGS
Recognize two additional GNU compiler header directory search options:
-iquote and -idirafter. Each takes a following arg, which scons now
recognizes and adds together with the option to CCFLAGS. Note that
(similar to -isystem which was added in git commit f8614aa2), this does
not tell scons anything special, it only recognizes the flag + argument
so it can be passed on to the compiler.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Environment.py | 8 | ||||
-rw-r--r-- | src/engine/SCons/EnvironmentTests.py | 22 |
2 files changed, 22 insertions, 8 deletions
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 488b574..7f9a76c 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -719,6 +719,12 @@ class SubstitutionEnvironment(object): elif append_next_arg_to == '-isystem': t = ('-isystem', arg) dict['CCFLAGS'].append(t) + elif append_next_arg_to == '-iquote': + t = ('-iquote', arg) + dict['CCFLAGS'].append(t) + elif append_next_arg_to == '-idirafter': + t = ('-idirafter', arg) + dict['CCFLAGS'].append(t) elif append_next_arg_to == '-arch': t = ('-arch', arg) dict['CCFLAGS'].append(t) @@ -791,7 +797,7 @@ class SubstitutionEnvironment(object): elif arg[0] == '+': dict['CCFLAGS'].append(arg) dict['LINKFLAGS'].append(arg) - elif arg in ['-include', '-isysroot', '-isystem', '-arch']: + elif arg in ['-include', '-isysroot', '-isystem', '-iquote', '-idirafter', '-arch']: append_next_arg_to = arg else: dict['CCFLAGS'].append(arg) diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 347c410..1a75a90 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -800,7 +800,9 @@ sys.exit(0) "-fopenmp " + \ "-mno-cygwin -mwindows " + \ "-arch i386 -isysroot /tmp " + \ - "-isystem /usr/include/foo " + \ + "-iquote /usr/include/foo1 " + \ + "-isystem /usr/include/foo2 " + \ + "-idirafter /usr/include/foo3 " + \ "+DD64 " + \ "-DFOO -DBAR=value -D BAZ " @@ -809,10 +811,12 @@ sys.exit(0) assert d['ASFLAGS'] == ['-as'], d['ASFLAGS'] assert d['CFLAGS'] == ['-std=c99'] assert d['CCFLAGS'] == ['-X', '-Wa,-as', - '-pthread', '-fopenmp', '-mno-cygwin', - ('-arch', 'i386'), ('-isysroot', '/tmp'), - ('-isystem', '/usr/include/foo'), - '+DD64'], repr(d['CCFLAGS']) + '-pthread', '-fopenmp', '-mno-cygwin', + ('-arch', 'i386'), ('-isysroot', '/tmp'), + ('-iquote', '/usr/include/foo1'), + ('-isystem', '/usr/include/foo2'), + ('-idirafter', '/usr/include/foo3'), + '+DD64'], repr(d['CCFLAGS']) assert d['CXXFLAGS'] == ['-std=c++0x'], repr(d['CXXFLAGS']) assert d['CPPDEFINES'] == ['FOO', ['BAR', 'value'], 'BAZ'], d['CPPDEFINES'] assert d['CPPFLAGS'] == ['-Wp,-cpp'], d['CPPFLAGS'] @@ -2022,7 +2026,9 @@ def generate(env): "-pthread " + \ "-mno-cygwin -mwindows " + \ "-arch i386 -isysroot /tmp " + \ - "-isystem /usr/include/foo " + \ + "-iquote /usr/include/foo1 " + \ + "-isystem /usr/include/foo2 " + \ + "-idirafter /usr/include/foo3 " + \ "+DD64 " + \ "-DFOO -DBAR=value") env.ParseConfig("fake $COMMAND") @@ -2031,7 +2037,9 @@ def generate(env): assert env['CCFLAGS'] == ['', '-X', '-Wa,-as', '-pthread', '-mno-cygwin', ('-arch', 'i386'), ('-isysroot', '/tmp'), - ('-isystem', '/usr/include/foo'), + ('-iquote', '/usr/include/foo1'), + ('-isystem', '/usr/include/foo2'), + ('-idirafter', '/usr/include/foo3'), '+DD64'], env['CCFLAGS'] assert env['CPPDEFINES'] == ['FOO', ['BAR', 'value']], env['CPPDEFINES'] assert env['CPPFLAGS'] == ['', '-Wp,-cpp'], env['CPPFLAGS'] |