Skip to content

Commit

Permalink
fix(msvs): correctly rename object files for absolute paths (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed Oct 14, 2020
1 parent 76bbca6 commit f2c7618
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

### Fixed
- Correctly rename object files for absolute paths in MSVS generator.

## [0.6.0] - 2020-10-13

### Added
Expand Down
6 changes: 4 additions & 2 deletions pylib/gyp/generator/msvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3618,9 +3618,11 @@ def _AddSources2(
# Always add an <ObjectFileName> value to support duplicate
# source file basenames.
file_name = os.path.splitext(source)[0] + ".obj"
if (file_name.startswith("..\\")):
if os.path.isabs(file_name):
file_name = os.path.splitdrive(file_name)[1]
elif file_name.startswith("..\\"):
file_name = re.sub(r"^(\.\.\\)+", "", file_name)
elif (file_name.startswith("$(")):
elif file_name.startswith("$("):
file_name = re.sub(r"^\$\([^)]+\)\\", "", file_name)
detail.append(["ObjectFileName", "$(IntDir)\\" + file_name])
grouped_sources[group].append([element, {"Include": source}] + detail)
Expand Down

0 comments on commit f2c7618

Please sign in to comment.