Redetect machines after every change to languages

Currently, detect_machine_info() is called:

- from Environment.__init__(), before we have any compiler available

- from Interpreter.__init__() with the list of languages provided to
project() (determined via the initial parse_project())

This is not sufficent in the case where no languages are specified to
project() and are later added with add_languages().

We cannot correctly detect that the host machine should be treated as
x86 (on x86_64 hardware) until we have a compiler we are told to use.

Redetect machines after project(), and after every add_languages().
pull/6636/head
Jon Turney 5 years ago
parent 0821b182c5
commit 2cf2c80112
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
  1. 3
      mesonbuild/interpreter.py

@ -2216,7 +2216,9 @@ class Interpreter(InterpreterBase):
self.build_def_files = [os.path.join(self.subdir, environment.build_filename)] self.build_def_files = [os.path.join(self.subdir, environment.build_filename)]
if not mock: if not mock:
self.parse_project() self.parse_project()
self._redetect_machines()
def _redetect_machines(self):
# Re-initialize machine descriptions. We can do a better job now because we # Re-initialize machine descriptions. We can do a better job now because we
# have the compilers needed to gain more knowledge, so wipe out old # have the compilers needed to gain more knowledge, so wipe out old
# inference and start over. # inference and start over.
@ -3014,6 +3016,7 @@ external dependencies (including libraries) must go to "dependencies".''')
success &= self.add_languages_for(args, required, MachineChoice.HOST) success &= self.add_languages_for(args, required, MachineChoice.HOST)
if not self.coredata.is_cross_build(): if not self.coredata.is_cross_build():
self.coredata.copy_build_options_from_regular_ones() self.coredata.copy_build_options_from_regular_ones()
self._redetect_machines()
return success return success
def add_languages_for(self, args, required, for_machine: MachineChoice): def add_languages_for(self, args, required, for_machine: MachineChoice):

Loading…
Cancel
Save