import os
import subprocess
+import sys
import math
from migen.fhdl.structure import _Fragment
def _run_quartus(build_name, quartus_path, create_rbf):
- build_script_contents = "# Autogenerated by LiteX / git: " + tools.get_litex_git_revision() + "\n"
+ if sys.platform == "win32" or sys.platform == "cygwin":
+ build_script_contents = "REM Autogenerated by LiteX / git: " + tools.get_litex_git_revision() + "\n"
+ build_script_file = "build_" + build_name + ".bat"
+ command = build_script_file
+ else:
+ build_script_contents = "# Autogenerated by LiteX / git: " + tools.get_litex_git_revision() + "\nset -e\n"
+ build_script_file = "build_" + build_name + ".sh"
+ command = ["bash", build_script_file]
build_script_contents += """
set -e
"""
build_script_contents = build_script_contents.format(build_name=build_name) # noqa
- build_script_file = "build_" + build_name + ".sh"
tools.write_to_file(build_script_file,
build_script_contents,
force_unix=True)
- if subprocess.call(["bash", build_script_file]):
+ if subprocess.call(command):
raise OSError("Subprocess failed")