Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions mesonbuild/backend/ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,13 @@ def detect_vs_dep_prefix(self, tempfilename: str) -> T.TextIO:
filebase)
with open(filename, 'w', encoding='utf-8') as f:
f.write(dedent('''\
#include<stdio.h>
#include"incdetect2"
int dummy;
'''))
filename_inc = os.path.join(self.environment.get_scratch_dir(),
'incdetect2')
with open(filename_inc, 'w', encoding='utf-8') as f:
pass

# The output of cl dependency information is language
# and locale dependent. Any attempt at converting it to
Expand All @@ -562,18 +566,18 @@ def detect_vs_dep_prefix(self, tempfilename: str) -> T.TextIO:
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = pc.communicate()

# We want to match 'Note: including file: ' in the line
# 'Note: including file: d:\MyDir\include\stdio.h', however
# 'Note: including file: d:\build\meson-private\incdetect2', however
# different locales have different messages with a different
# number of colons. Match up to the drive name 'd:\'.
# number of colons. Match up to the drive name 'd:\' or
# a relative path '.\'.
# When used in cross compilation, the path separator is a
# forward slash rather than a backslash so handle both; i.e.
# the path is /MyDir/include/stdio.h.
# the path is /build/meson-private/incdetect or ./incdetect2.
# With certain cross compilation wrappings of MSVC, the paths
# use backslashes, but without the leading drive name, so
# allow the path to start with any path separator, i.e.
# \MyDir\include\stdio.h.
matchre = re.compile(rb"^(.*\s)([a-zA-Z]:[\\/]|[\\\/]).*stdio.h$")
# \build\meson-private\incdetect2
matchre = re.compile(rb"^(.*\s)([a-zA-Z]:[\\/]|\.?[\\/]).*incdetect2$")

def detect_prefix(out: bytes) -> T.TextIO:
for line in re.split(rb'\r?\n', out):
Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/compilers/mixins/clike.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def _get_basic_compiler_args(self, mode: CompileCheckMode) -> T.Tuple[T.List[str
if mode is CompileCheckMode.LINK:
ld_value = self.environment.lookup_binary_entry(self.for_machine, self.language + '_ld')
if ld_value is not None:
largs += self.use_linker_args(ld_value[0], self.version)
cargs += self.use_linker_args(ld_value[0], self.version)

# Add LDFLAGS from the env
sys_ld_args = self.environment.coredata.get_external_link_args(self.for_machine, self.language)
Expand Down
Loading