Skip to content

Commit 0b6774b

Browse files
authored
Merge pull request #1392 from ericmehl/prioritize-source-includes
Prioritize source tree includes
2 parents 5a8a04a + cd43f41 commit 0b6774b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

SConstruct

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,20 @@ else:
12261226
"/Fd${TARGET}.pdb",
12271227
],
12281228
)
1229+
1230+
# Reorder build commands so that `/external:I` includes come after `/I` includes.
1231+
# Otherwise we'll pick up the Gaffer includes from the build directory, and not
1232+
# the ones in the source tree.
1233+
1234+
for command, cxxFlags in [
1235+
( "CXXCOM", "$CXXFLAGS" ),
1236+
( "SHCXXCOM", "$SHCXXFLAGS" )
1237+
] :
1238+
if env[command].index( cxxFlags ) < env[command].index( "$_CCCOMCOM" ) :
1239+
# `$_CCCOMCOM` contains the preprocessor flags, including `/I`. Swap
1240+
# it with `cxxFlags`, which contains `/external:I`.
1241+
env[command] = env[command].replace( cxxFlags, "<>" ).replace( "$_CCCOMCOM", cxxFlags ).replace( "<>", "$_CCCOMCOM" )
1242+
12291243

12301244

12311245
# autoconf-like checks for stuff.

0 commit comments

Comments
 (0)