aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/d.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/compilers/d.py')
-rw-r--r--mesonbuild/compilers/d.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py
index 3065ac7..1390694 100644
--- a/mesonbuild/compilers/d.py
+++ b/mesonbuild/compilers/d.py
@@ -14,7 +14,9 @@
import os.path, subprocess
-from ..mesonlib import EnvironmentException, version_compare, is_windows, is_osx
+from ..mesonlib import (
+ EnvironmentException, MachineChoice, version_compare, is_windows, is_osx
+)
from .compilers import (
CompilerType,
@@ -306,12 +308,17 @@ class DCompiler(Compiler):
# Add link flags needed to find dependencies
args += d.get_link_args()
+ if env.is_cross_build() and not self.is_cross:
+ for_machine = MachineChoice.BUILD
+ else:
+ for_machine = MachineChoice.HOST
+
if mode == 'compile':
# Add DFLAGS from the env
- args += env.coredata.get_external_args(self.language)
+ args += env.coredata.get_external_args(for_machine, self.language)
elif mode == 'link':
# Add LDFLAGS from the env
- args += env.coredata.get_external_link_args(self.language)
+ args += env.coredata.get_external_link_args(for_machine, self.language)
# extra_args must override all other arguments, so we add them last
args += extra_args
return args