@@ -28,6 +28,7 @@ ENABLE_HELP_SOURCE := 0
2828
2929# python wrappers
3030ENABLE_PYOSYS := 0
31+ PYOSYS_USE_UV := 1
3132
3233# other configuration flags
3334ENABLE_GCOV := 0
@@ -352,16 +353,22 @@ PYTHON_OBJECTS = pyosys/wrappers.o kernel/drivers.o kernel/yosys.o passes/cmds/p
352353
353354ifeq ($(ENABLE_PYOSYS ) ,1)
354355# python-config --ldflags includes -l and -L, but LINKFLAGS is only -L
356+
357+ UV_ENV :=
358+ ifeq ($(PYOSYS_USE_UV ) ,1)
359+ UV_ENV := uv run --no-project --with 'pybind11>3,<4' --with 'cxxheaderparser'
360+ endif
361+
355362LINKFLAGS += $(filter-out -l% ,$(shell $(PYTHON_CONFIG ) --ldflags) )
356363LIBS += $(shell $(PYTHON_CONFIG ) --libs)
357364EXE_LIBS += $(filter-out $(LIBS ) ,$(shell $(PYTHON_CONFIG_FOR_EXE ) --libs) )
358- PYBIND11_INCLUDE ?= $(shell $(PYTHON_EXECUTABLE ) -m pybind11 --includes)
365+ PYBIND11_INCLUDE ?= $(shell $(UV_ENV ) $( PYTHON_EXECUTABLE ) -m pybind11 --includes)
359366CXXFLAGS += -I$(PYBIND11_INCLUDE ) -DYOSYS_ENABLE_PYTHON
360367CXXFLAGS += $(shell $(PYTHON_CONFIG ) --includes) -DYOSYS_ENABLE_PYTHON
361368
362369OBJS += $(PY_WRAPPER_FILE ) .o
363370PY_GEN_SCRIPT = pyosys/generator.py
364- PY_WRAP_INCLUDES := $(shell $(PYTHON_EXECUTABLE ) $(PY_GEN_SCRIPT ) --print-includes)
371+ PY_WRAP_INCLUDES := $(shell $(UV_ENV ) $( PYTHON_EXECUTABLE ) $(PY_GEN_SCRIPT ) --print-includes)
365372endif # ENABLE_PYOSYS
366373
367374ifeq ($(ENABLE_READLINE ) ,1)
@@ -777,7 +784,7 @@ endif
777784ifeq ($(ENABLE_PYOSYS ) ,1)
778785$(PY_WRAPPER_FILE ) .cc : $(PY_GEN_SCRIPT ) pyosys/wrappers_tpl.cc $(PY_WRAP_INCLUDES ) pyosys/hashlib.h
779786 $(Q ) mkdir -p $(dir $@ )
780- $(P ) $(PYTHON_EXECUTABLE ) $(PY_GEN_SCRIPT ) $(PY_WRAPPER_FILE ) .cc
787+ $(P ) $(UV_ENV ) $( PYTHON_EXECUTABLE ) $(PY_GEN_SCRIPT ) $(PY_WRAPPER_FILE ) .cc
781788endif
782789
783790% .o : % .cpp
0 commit comments