# Project Python venv and generator script paths. # Included by the components that generate code (e.g. MsgUtils and CloudConnect). # # qmake evaluates system() at qmake time, while QMAKE_EXTRA_COMPILERS / # QMAKE_EXTRA_TARGETS run at make time. The venv is created here (once, shared); # the generators are wired as make-time rules in the including .pro so they # re-run on input change. PROJECT_ROOT = $$clean_path($$PWD/../..) MSGUTILS_SCRIPTS_DIR = $$PROJECT_ROOT/scripts/MsgUtils # BUILD_ROOT is set by the repo-root .qmake.conf — identical for every component # in the tree, so all components share ONE venv. Fall back to OUT_PWD when built # without the .qmake.conf in scope (e.g. a leaf .pro copied elsewhere). isEmpty(BUILD_ROOT): BUILD_ROOT = $$OUT_PWD PROJECT_VENV_DIR = $$BUILD_ROOT/.venv PROJECT_PYTHON = $$PROJECT_VENV_DIR/bin/python # Create the venv, then editable-install the msgutils package so the generator # scripts can `import msgutils`. Runs once per qmake invocation; pip is a skipped # when already satisfied. !exists($$PROJECT_PYTHON) { message("Creating project Python venv at $$PROJECT_VENV_DIR") system(python3 -m venv $$shell_quote($$PROJECT_VENV_DIR)) } system($$shell_quote($$PROJECT_PYTHON) -m pip install --upgrade pip --quiet) system($$shell_quote($$PROJECT_PYTHON) -m pip install -e $$shell_quote($$MSGUTILS_SCRIPTS_DIR) --quiet) PROTOC = protoc