Skip to content

Commit

Permalink
Merge pull request #1392 from ericmehl/prioritize-source-includes
Browse files Browse the repository at this point in the history
Prioritize source tree includes
  • Loading branch information
johnhaddon authored Nov 3, 2023
2 parents 5a8a04a + cd43f41 commit 0b6774b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,20 @@ else:
"/Fd${TARGET}.pdb",
],
)

# Reorder build commands so that `/external:I` includes come after `/I` includes.
# Otherwise we'll pick up the Gaffer includes from the build directory, and not
# the ones in the source tree.

for command, cxxFlags in [
( "CXXCOM", "$CXXFLAGS" ),
( "SHCXXCOM", "$SHCXXFLAGS" )
] :
if env[command].index( cxxFlags ) < env[command].index( "$_CCCOMCOM" ) :
# `$_CCCOMCOM` contains the preprocessor flags, including `/I`. Swap
# it with `cxxFlags`, which contains `/external:I`.
env[command] = env[command].replace( cxxFlags, "<>" ).replace( "$_CCCOMCOM", cxxFlags ).replace( "<>", "$_CCCOMCOM" )



# autoconf-like checks for stuff.
Expand Down

0 comments on commit 0b6774b

Please sign in to comment.