xilinx_vivado: use .bat on Windows platforms (otherwise Vivado uses Unix scripts...)
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 31 Oct 2014 11:48:30 +0000 (12:48 +0100)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Sat, 1 Nov 2014 12:59:19 +0000 (20:59 +0800)
mibuild/xilinx_vivado.py

index 9f6456c93d0f1e20f1352817d51d75e29968c6d4..abf6ec93a204f1de3a7ba422de90320ac003b461 100644 (file)
@@ -68,17 +68,20 @@ def _build_files(device, sources, vincpaths, build_name, bitstream_compression):
        tools.write_to_file(build_name + ".tcl", "\n".join(tcl))
 
 def _run_vivado(build_name, vivado_path, source, ver=None):
-       if sys.platform == "win32" or sys.platform == "cygwin":
-               source = False
        build_script_contents = "# Autogenerated by mibuild\nset -e\n"
-       if source:
+       if sys.platform == "win32" or sys.platform == "cygwin":
+               build_script_contents += "vivado -mode batch -source " + build_name + ".tcl\n"
+               build_script_file = "build_" + build_name + ".bat"
+               tools.write_to_file(build_script_file, build_script_contents)
+               r = subprocess.call([build_script_file])
+       else:
                settings = xilinx_common.settings(vivado_path, ver)
                build_script_contents += "source " + settings + "\n"
-       build_script_contents += "vivado -mode batch -source " + build_name + ".tcl\n"
-       build_script_file = "build_" + build_name + ".sh"
-       tools.write_to_file(build_script_file, build_script_contents, force_unix=True)
+               build_script_contents += "vivado -mode batch -source " + build_name + ".tcl\n"
+               build_script_file = "build_" + build_name + ".sh"
+               tools.write_to_file(build_script_file, build_script_contents)
+               r = subprocess.call(["bash", build_script_file])
 
-       r = subprocess.call(["bash", build_script_file])
        if r != 0:
                raise OSError("Subprocess failed")