aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/ninjabackend.py2
-rw-r--r--mesonbuild/compilers/compilers.py5
-rw-r--r--mesonbuild/compilers/mixins/visualstudio.py12
-rw-r--r--mesonbuild/linkers.py11
4 files changed, 28 insertions, 2 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 417f6d9..8315ab1 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -2385,7 +2385,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
build_dir = self.environment.get_build_dir()
# the following loop sometimes consumes two items from command in one pass
- it = iter(commands)
+ it = iter(linker.native_args_to_unix(commands))
for item in it:
if item in internal and not item.startswith('-'):
continue
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index bb698fc..2c9508b 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -900,6 +900,11 @@ class Compiler:
"Always returns a copy that can be independently mutated"
return args[:]
+ @classmethod
+ def native_args_to_unix(cls, args: typing.List[str]) -> typing.List[str]:
+ "Always returns a copy that can be independently mutated"
+ return args[:]
+
def find_library(self, *args, **kwargs):
raise EnvironmentException('Language {} does not support library finding.'.format(self.get_display_language()))
diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py
index 5fe8599..48a2229 100644
--- a/mesonbuild/compilers/mixins/visualstudio.py
+++ b/mesonbuild/compilers/mixins/visualstudio.py
@@ -234,6 +234,18 @@ class VisualStudioLikeCompiler(metaclass=abc.ABCMeta):
result.append(i)
return result
+ @classmethod
+ def native_args_to_unix(cls, args: typing.List[str]) -> typing.List[str]:
+ result = []
+ for arg in args:
+ if arg.startswith('/LIBPATH:'):
+ result.append('-L' + arg[9:])
+ elif arg.endswith(('.a', '.lib')) and not os.path.isabs(arg):
+ result.append('-l' + arg)
+ else:
+ result.append(arg)
+ return result
+
def get_werror_args(self) -> typing.List[str]:
return ['/WX']
diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py
index 8c5bd99..c5c9813 100644
--- a/mesonbuild/linkers.py
+++ b/mesonbuild/linkers.py
@@ -69,7 +69,11 @@ class StaticLinker:
@classmethod
def unix_args_to_native(cls, args: typing.List[str]) -> typing.List[str]:
- return args
+ return args[:]
+
+ @classmethod
+ def native_args_to_unix(cls, args: typing.List[str]) -> typing.List[str]:
+ return args[:]
def get_link_debugfile_args(self, targetfile: str) -> typing.List[str]:
# Static libraries do not have PDB files
@@ -106,6 +110,11 @@ class VisualStudioLikeLinker:
from .compilers import VisualStudioCCompiler
return VisualStudioCCompiler.unix_args_to_native(args)
+ @classmethod
+ def native_args_to_unix(cls, args: typing.List[str]) -> typing.List[str]:
+ from .compilers import VisualStudioCCompiler
+ return VisualStudioCCompiler.native_args_to_unix(args)
+
class VisualStudioLinker(VisualStudioLikeLinker, StaticLinker):