Don't automatically override the -L flag of D compilers

Works around / resolves #702.
pull/703/head
Matthias Klumpp 8 years ago
parent fae8ad90a4
commit 76fe77f9a8
  1. 17
      mesonbuild/compilers.py

@ -1542,7 +1542,7 @@ class DCompiler(Compiler):
for la in linkargs: for la in linkargs:
dcargs.append('-L' + la.strip()) dcargs.append('-L' + la.strip())
continue continue
elif arg.startswith(('-l', '-L')): elif arg.startswith('-l'):
# translate library link flag # translate library link flag
dcargs.append('-L' + arg) dcargs.append('-L' + arg)
continue continue
@ -1581,6 +1581,9 @@ class GnuDCompiler(DCompiler):
def get_werror_args(self): def get_werror_args(self):
return ['-Werror'] return ['-Werror']
def get_linker_search_args(self, dirname):
return ['-L'+dirname]
def get_buildtype_args(self, buildtype): def get_buildtype_args(self, buildtype):
return d_gdc_buildtype_args[buildtype] return d_gdc_buildtype_args[buildtype]
@ -1627,6 +1630,12 @@ class LLVMDCompiler(DCompiler):
def get_pic_args(self): def get_pic_args(self):
return ['-relocation-model=pic'] return ['-relocation-model=pic']
def get_linker_search_args(self, dirname):
# -L is recognized as "add this to the search path" by the linker,
# while the compiler recognizes it as "pass to linker". So, the first
# -L is for the compiler, telling it to pass the second -L to the linker.
return ['-L-L'+dirname]
def unix_link_flags_to_native(self, args): def unix_link_flags_to_native(self, args):
return self.translate_args_to_nongnu(args) return self.translate_args_to_nongnu(args)
@ -1664,6 +1673,12 @@ class DmdDCompiler(DCompiler):
def get_coverage_args(self): def get_coverage_args(self):
return ['-cov'] return ['-cov']
def get_linker_search_args(self, dirname):
# -L is recognized as "add this to the search path" by the linker,
# while the compiler recognizes it as "pass to linker". So, the first
# -L is for the compiler, telling it to pass the second -L to the linker.
return ['-L-L'+dirname]
def get_buildtype_args(self, buildtype): def get_buildtype_args(self, buildtype):
return d_dmd_buildtype_args[buildtype] return d_dmd_buildtype_args[buildtype]

Loading…
Cancel
Save