First
mamba create -n qgis-build qgis --only-deps
mamba activate qgis-build
mamba install cmake winflexbison expat setuptools compilers pip
pip install pyqt-builder
cmake ..
But when you open the SLN file separate from the conda env, the env vars don't carry over. Using devenv qgis.sln
should work but compilers installed VS 2019 and I'd already built most of the project using VS 2022 and don't want to rebuild. Also, there is a relatively recent issue about VS 2022 not build activated or something when installed via compilers
(conda-forge/compilers-feedstock#66). So now trying...
mamba create -n qgis-build qgis --only-deps
mamba activate qgis-build
mamba install cmake winflexbison expat setuptools compilers pip ninja
pip install pyqt-builder
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..
ninja -j8
The obvious drawback of this approach is that a debug build is probably problematic using the Conda dependencies, but I'll live with that for now.
These approaches have had issues still, not the least of which is that the Python plugins weren't enabled. Revisiting building from the conda-forge feedstock for QGIS, I came across https://conda-forge.org/docs/maintainer/knowledge_base/#particularities-on-windows which seems to outline an alternative to python build-locally.py
. Currently trying this and if it works, I should be able to point to a local filepath as opposed to the tarball.
The current workflow follows, but is still very slow for iterating on source code changes. Builds are taking about one hour give or take.
conda build recipe/ -m .ci_support\win_64_python3.12.____cpython.yaml
mamba create -n local-qgis -c local c:\Users\BradChambers\miniforge3\conda-bld\broken\qgis-3.40.0-py311h3f7eae9_1.conda
mamba activate local-qgis
mamba install python=3.11 icu libzip qt-main pyqt pyqt5-sip qtwebkit qscintilla2 qca qjson qwt qtkeychain libgdal gdal geos proj gsl sqlite libspatialindex libspatialite psycopg2 postgresql exiv2 libprotobuf python-dateutil future httplib2 jinja2 markupsafe mock nose2 plotly pygments pyproj requests six pytz pyyaml yaml owslib pyqtwebkit pdal laz-perf khronos-opencl-icd-loader
qgis
Or with mambabuild
conda mambabuild recipe/ -m .ci_support\win_64_python3.11.____cpython.yaml --build-only
cd C:\Users\BradChambers\miniforge3\envs\boapy11\conda-bld\qgis_1732033580405\work
mamba activate ..\..\_build_env
code .
cd build
ninja -j8
ninja install
mamba activate ..\..\_h_env
I think the better way to go might end up being something like this.
conda build --dirty or perhaps --no-remove-work-dir and the path can be reverted back to the Git repo
cd to the work dir
make edits to the source
activate the build env
build the code
package it?
install in run env?