summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2025-03-10 15:57:24 -0700
committerJussi Pakkanen <jpakkane@gmail.com>2025-04-02 23:02:17 +0300
commitd6d1daf9cfc717bf000b2b83d776b6d35ab651b7 (patch)
treed1919f6151e0b75f2dcb27726e225d97ff1c9bc3
parent7f1614494df8a1d5d11bb7505a95f1db9aa53f10 (diff)
downloadmeson-d6d1daf9cfc717bf000b2b83d776b6d35ab651b7.tar.gz
environment: filter machine file build options that are invalid
Because it makes machine files more generically useful (ie, you can use a file as both a cross and native file) we allow all options to be defined in native files, even when those options are not per machine. It makes more sense to filter invalid options at Environment setup time then to wait and have them filtered when the initializing the project call.
-rw-r--r--mesonbuild/environment.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 12f94bbd4..92ce9c511 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -690,6 +690,13 @@ class Environment:
'See: https://mesonbuild.com/Builtin-options.html#build-type-options',
fatal=False)
+ # Filter out build machine options that are not valid per-project.
+ # We allow this in the file because it makes the machine files more
+ # useful (ie, the same file can be used for host == build configuration
+ # a host != build configuration)
+ self.options = {k: v for k, v in self.options.items()
+ if k.machine is MachineChoice.HOST or self.coredata.optstore.is_per_machine_option(k)}
+
exe_wrapper = self.lookup_binary_entry(MachineChoice.HOST, 'exe_wrapper')
if exe_wrapper is not None:
self.exe_wrapper = ExternalProgram.from_bin_list(self, MachineChoice.HOST, 'exe_wrapper')