diff --git a/Makefile b/Makefile index 5be8b96cb1..35d2db1f21 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,9 @@ uv-installed: .PHONY: ${VENV_DIR}/ ${VENV_DIR}/: uv-installed XDSL_VERSION_OVERRIDE="0+dynamic" uv sync ${VENV_EXTRAS} + @if [ ! -z "$(XDSL_MLIR_OPT_PATH)" ]; then \ + ln -sf $(XDSL_MLIR_OPT_PATH) ${VENV_DIR}/bin/mlir-opt; \ + fi # make sure `make venv` also works correctly .PHONY: venv diff --git a/README.md b/README.md index 7bba91ca5d..93232d8dc9 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,12 @@ cd xdsl make venv ``` +To make a custom mlir-opt available in the virtual environment, set the `XDSL_MLIR_OPT_PATH` variable when running `make venv`, like so: + +``` bash +XDSL_MLIR_OPT_PATH=/PATH/TO/LLVM/BUILD/bin/mlir-opt make venv +``` + #### If you can't use `uv` For some systems and workflows, changing to a new dependency management system