From 467c1b9b889f8cf1b1ab6955a716ae7e0e01e634 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 18 Oct 2021 18:48:47 +0200 Subject: [PATCH] builder: Move Meson check to _check_meson and only do it when using BIOS. --- litex/soc/integration/builder.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/litex/soc/integration/builder.py b/litex/soc/integration/builder.py index 98e357a42..1ea772ca3 100644 --- a/litex/soc/integration/builder.py +++ b/litex/soc/integration/builder.py @@ -231,6 +231,19 @@ class Builder: csr_svd_contents = export.get_csr_svd(self.soc) write_to_file(os.path.realpath(self.csr_svd), csr_svd_contents) + def _check_meson(self): + # Check Meson install/version. + meson_present = (shutil.which("meson") is not None) + meson_version = [0, 0, 0] + meson_major_min = 0 + meson_minor_min = 59 + if meson_present: + meson_version = subprocess.check_output(["meson", "-v"]).decode("utf-8").split(".") + if (not meson_present) or (int(meson_version[0]) < meson_major_min) or (int(meson_version[1]) < meson_minor_min): + msg = "Unable to find valid Meson build system, please install it with:\n" + msg += "- pip3 install meson.\n" + raise OSError(msg) + def _prepare_rom_software(self): # Create directories for all software packages. for name, src_dir in self.software_packages: @@ -243,19 +256,6 @@ class Builder: # Skip BIOS compilation when disabled. if name == "bios" and not compile_bios: continue - - # Check Meson install/version. - meson_present = (shutil.which("meson") is not None) - meson_version = [0, 0, 0] - meson_major_min = 0 - meson_minor_min = 59 - if meson_present: - meson_version = subprocess.check_output(["meson", "-v"]).decode("utf-8").split(".") - if (not meson_present) or (int(meson_version[0]) < meson_major_min) or (int(meson_version[1]) < meson_minor_min): - msg = "Unable to find valid Meson build system, please install it with:\n" - msg += "- pip3 install meson.\n" - raise OSError(msg) - # Compile software package. dst_dir = os.path.join(self.software_dir, name) makefile = os.path.join(src_dir, "Makefile") @@ -314,6 +314,7 @@ class Builder: ) if use_bios: self.soc.check_bios_requirements() + self._check_meson() self._prepare_rom_software() self._generate_rom_software(compile_bios=use_bios)