Skip to content

Commit

Permalink
Fix regression to rc.exe usage.
Browse files Browse the repository at this point in the history
(Yes, it parses includes different from cl.exe, somehow...)
  • Loading branch information
dvander committed Aug 25, 2020
1 parent a7985fc commit b158427
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ambuild2/frontend/v2_2/cpp/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def buildRcItem(self, inputObj, sourceFile, encodedName):
for include in (self.compiler.includes + self.compiler.cxxincludes):
if isinstance(include, PchNodes):
continue
rc_argv += ['/i', self.vendor.IncludePath(objectFile, include)]
rc_argv += ['/i', self.vendor.RcIncludePath(objectFile, include)]
rc_argv += ['/fo' + objectFile, sourceFile]

return RCFile(self, inputObj, [objectFile, encodedName + '.i'], cl_argv, rc_argv)
Expand Down
12 changes: 12 additions & 0 deletions ambuild2/frontend/v2_2/cpp/msvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@ def IncludePath(outputPath, includePath):
return includePath
return os.path.relpath(includePath, outputPath)

@staticmethod
def RcIncludePath(outputPath, includePath):
# Same as IncludePath, but prefer absolute paths because it breaks on
# relative ones...
outputPath = os.path.normcase(outputPath)
includePath = os.path.normcase(includePath)
outputDrive = os.path.splitdrive(outputPath)[0]
includeDrive = os.path.splitdrive(includePath)[0]
if outputDrive != includeDrive:
return includePath
return os.path.relpath(includePath, outputPath)

def formatInclude(self, output_path, include):
return ['/I', MSVC.IncludePath(output_path, include)]

Expand Down

0 comments on commit b158427

Please sign in to comment.