CIRCT 22.0.0git
Loading...
Searching...
No Matches
utils.py
Go to the documentation of this file.
1# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2# See https://llvm.org/LICENSE.txt for license information.
3# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5from . import codegen
6
7import platform
8from pathlib import Path
9import subprocess
10import sys
11
12_thisdir = Path(__file__).absolute().resolve().parent
13
14
16 """Run the esiquery executable with the same arguments as this script."""
17 if platform.system() == "Windows":
18 esiquery = _thisdir / "esiquery.exe"
19 else:
20 esiquery = _thisdir / "bin" / "esiquery"
21 return subprocess.call([esiquery] + sys.argv[1:])
22
23
25 """Run the esi-cosim.py script with the same arguments as this script."""
26 import importlib.util
27 if platform.system() == "Windows":
28 esi_cosim = _thisdir / "esi-cosim.py"
29 else:
30 esi_cosim = _thisdir / "bin" / "esi-cosim.py"
31 spec = importlib.util.spec_from_file_location("esi_cosim", esi_cosim)
32 assert spec is not None
33 assert spec.loader is not None
34 cosim_import = importlib.util.module_from_spec(spec)
35 spec.loader.exec_module(cosim_import)
36 return cosim_import.__main__(sys.argv)
37
38
40 return codegen.run()
41
42
43def get_cmake_dir() -> Path:
44 return _thisdir / "cmake"
45
46
47def get_dll_dir() -> Path:
48 """Return the directory where the ESI dll's are located"""
49 import sys
50 import os
51 if sys.platform == "win32":
52 return _thisdir
53 else:
54 return _thisdir / "lib"
Path get_dll_dir()
Definition utils.py:47
run_esi_cosim()
Definition utils.py:24
Path get_cmake_dir()
Definition utils.py:43