3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-10-09 01:11:58 +00:00

misc: WITH_PYTHON -> YOSYS_ENABLE_PYTHON

For consistency.

Also trying a new thing: only rebuilding objects that use the pybind11 library. The idea is these are the only objects that include the Python/pybind headers and thus the only ones that depend on the Python ABI in any capacity, so other objects can be reused across wheel builds. This has the potential to cut down build times.
This commit is contained in:
Mohamed Gaber 2025-09-23 15:29:01 +03:00
parent dc88906c91
commit 447a6cb3f0
No known key found for this signature in database
12 changed files with 82 additions and 60 deletions

View file

@ -37,6 +37,12 @@
# include <tcl.h>
#endif
#ifdef YOSYS_ENABLE_PYTHON
# include <Python.h>
# include <pybind11/pybind11.h>
namespace py = pybind11;
#endif
#include <stdio.h>
#include <string.h>
#include <limits.h>
@ -91,7 +97,7 @@ int main(int argc, char **argv)
log_error_stderr = true;
yosys_banner();
yosys_setup();
#ifdef WITH_PYTHON
#ifdef YOSYS_ENABLE_PYTHON
py::object sys = py::module_::import("sys");
sys.attr("path").attr("append")(proc_self_dirname());
sys.attr("path").attr("append")(proc_share_dirname());
@ -227,10 +233,10 @@ int main(int argc, char **argv)
cxxopts::value<std::string>(),"<tcl_scriptfile>")
("C,tcl-interactive", "enters TCL interactive shell mode")
#endif // YOSYS_ENABLE_TCL
#ifdef WITH_PYTHON
#ifdef YOSYS_ENABLE_PYTHON
("y,py-scriptfile", "execute the Python <script>",
cxxopts::value<std::string>(), "<script>")
#endif // WITH_PYTHON
#endif // YOSYS_ENABLE_PYTHON
("p,commands", "execute <commands> (to chain commands, separate them with semicolon + whitespace: 'cmd1; cmd2')",
cxxopts::value<std::vector<std::string>>(), "<commands>")
("r,top", "elaborate the specified HDL <top> module",
@ -516,7 +522,7 @@ int main(int argc, char **argv)
#endif
yosys_setup();
#ifdef WITH_PYTHON
#ifdef YOSYS_ENABLE_PYTHON
py::object sys = py::module_::import("sys");
sys.attr("path").attr("append")(proc_self_dirname());
sys.attr("path").attr("append")(proc_share_dirname());
@ -568,7 +574,7 @@ int main(int argc, char **argv)
log_error("Can't execute TCL script: this version of yosys is not built with TCL support enabled.\n");
#endif
} else if (scriptfile_python) {
#ifdef WITH_PYTHON
#ifdef YOSYS_ENABLE_PYTHON
py::list new_argv;
int py_argc = special_args.size() + 1;
new_argv.append(scriptfile);