From 2a109c3a3ee1d765f6c8da7f637d76f2f10e9af7 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 18 Oct 2021 08:41:51 +0200 Subject: [PATCH] integration/builder: Add Meson install/version check. --- litex/soc/integration/builder.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/litex/soc/integration/builder.py b/litex/soc/integration/builder.py index b286cb68c..98e357a42 100644 --- a/litex/soc/integration/builder.py +++ b/litex/soc/integration/builder.py @@ -239,9 +239,23 @@ class Builder: def _generate_rom_software(self, compile_bios=True): # Compile all software packages. for name, src_dir in self.software_packages: + # 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")