From a7f17f9915cf8773689a645a4e65f813ebb583b8 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 12 Nov 2018 11:48:30 +0100 Subject: [PATCH] build: use default toolchain_path on all backend when passed value is None --- litex/build/altera/quartus.py | 4 +++- litex/build/lattice/diamond.py | 4 +++- litex/build/xilinx/vivado.py | 9 ++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/litex/build/altera/quartus.py b/litex/build/altera/quartus.py index ef30e78be..1ebc08da6 100644 --- a/litex/build/altera/quartus.py +++ b/litex/build/altera/quartus.py @@ -117,7 +117,9 @@ fi class AlteraQuartusToolchain: def build(self, platform, fragment, build_dir="build", build_name="top", - toolchain_path="/opt/Altera", run=True, **kwargs): + toolchain_path=None, run=True, **kwargs): + if toolchain_path is None: + toolchain_path="/opt/Altera" cwd = os.getcwd() os.makedirs(build_dir, exist_ok=True) os.chdir(build_dir) diff --git a/litex/build/lattice/diamond.py b/litex/build/lattice/diamond.py index cee157bc4..f604877d9 100644 --- a/litex/build/lattice/diamond.py +++ b/litex/build/lattice/diamond.py @@ -132,7 +132,9 @@ class LatticeDiamondToolchain: special_overrides = common.lattice_ecpx_special_overrides def build(self, platform, fragment, build_dir="build", build_name="top", - toolchain_path="/opt/Diamond", run=True, **kwargs): + toolchain_path=None, run=True, **kwargs): + if toolchain_path is None: + toolchain_path = "/opt/Diamond" os.makedirs(build_dir, exist_ok=True) cwd = os.getcwd() os.chdir(build_dir) diff --git a/litex/build/xilinx/vivado.py b/litex/build/xilinx/vivado.py index 501c4417d..ab212b1a7 100644 --- a/litex/build/xilinx/vivado.py +++ b/litex/build/xilinx/vivado.py @@ -214,7 +214,14 @@ class XilinxVivadoToolchain: ) def build(self, platform, fragment, build_dir="build", build_name="top", - toolchain_path="/opt/Xilinx/Vivado", source=True, run=True): + toolchain_path=None, source=True, run=True): + if toolchain_path is None: + if sys.platform == "win32": + toolchain_path = "C:\\Xilinx\\Vivado" + elif sys.platform == "cygwin": + toolchain_path = "/cygdrive/c/Xilinx/Vivado" + else: + toolchain_path = "/opt/Xilinx/Vivado" os.makedirs(build_dir, exist_ok=True) cwd = os.getcwd() os.chdir(build_dir)