lattice: use pnmainc on windows

This commit is contained in:
Shawn Hoffman 2021-03-27 04:36:02 -07:00
parent e56268d419
commit fc75e57d9a
1 changed files with 7 additions and 4 deletions

View File

@ -115,7 +115,8 @@ def _build_tcl(device, sources, vincpaths, build_name):
# Script ------------------------------------------------------------------------------------------- # Script -------------------------------------------------------------------------------------------
def _build_script(build_name, device): def _build_script(build_name, device):
if sys.platform in ("win32", "cygwin"): on_windows = sys.platform in ("win32", "cygwin")
if on_windows:
script_ext = ".bat" script_ext = ".bat"
script_contents = "@echo off\nrem Autogenerated by LiteX / git: " + tools.get_litex_git_revision() + "\n\n" script_contents = "@echo off\nrem Autogenerated by LiteX / git: " + tools.get_litex_git_revision() + "\n\n"
copy_stmt = "copy" copy_stmt = "copy"
@ -126,7 +127,8 @@ def _build_script(build_name, device):
copy_stmt = "cp" copy_stmt = "cp"
fail_stmt = "" fail_stmt = ""
script_contents += "diamondc {tcl_script}{fail_stmt}\n".format( script_contents += "{tool} {tcl_script}{fail_stmt}\n".format(
tool = "pnmainc" if on_windows else "diamondc",
tcl_script = build_name + ".tcl", tcl_script = build_name + ".tcl",
fail_stmt = fail_stmt) fail_stmt = fail_stmt)
for ext in (".bit", ".jed"): for ext in (".bit", ".jed"):
@ -143,12 +145,13 @@ def _build_script(build_name, device):
return build_script_file return build_script_file
def _run_script(script): def _run_script(script):
if sys.platform in ("win32", "cygwin"): on_windows = sys.platform in ("win32", "cygwin")
if on_windows:
shell = ["cmd", "/c"] shell = ["cmd", "/c"]
else: else:
shell = ["bash"] shell = ["bash"]
if which("diamondc") is None: if which("pnmainc" if on_windows else "diamondc") is None:
msg = "Unable to find Diamond toolchain, please:\n" msg = "Unable to find Diamond toolchain, please:\n"
msg += "- Add Diamond toolchain to your $PATH.\n" msg += "- Add Diamond toolchain to your $PATH.\n"
raise OSError(msg) raise OSError(msg)