Adding option to automatically installation
This extends FindPystencilsSfG.cmake
with a Cache Variable CODEGEN_PRIVATE_VENV
.
This is set by default and if activate it creates a python venv
and installs either dependencies from a requirements.txt
or if this is not present it downloads the latest pystenicls-sfg/pystencils versions.
If a custom Interpreter is passed to cmake this deactivated.
In external CMake Projects this files could by included via
## Pystencils-sfg setups
set(FIND_PYSTENCILSSFG_CMAKE_PATH "${CMAKE_BINARY_DIR}/_pystencilssfg-cmake/")
file(DOWNLOAD
"https://i10git.cs.fau.de/ob28imeq/pystencils-sfg/-/raw/cmake_setup/src/pystencilssfg/cmake/FindPystencilsSfg.cmake?ref_type=heads"
"${FIND_PYSTENCILSSFG_CMAKE_PATH}/FindPystencilsSfg.cmake"
)
SET ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${FIND_PYSTENCILSSFG_CMAKE_PATH})
find_package( PystencilsSfg REQUIRED )
Merge request reports
Activity
requested review from @da15siwa
assigned to @ob28imeq
- Resolved by Frederik Hennig
- Resolved by Frederik Hennig
I've given this some more thought, and I think the find-module is the wrong place for the venv setup. CMake semantics indicate that a Find module should merely discover an existing installation of a package, and not download and build that package - which is effectively what we are doing.
Instead, I'd suggest we provide a small standalone Cmake project (basically just a CMakeLists.txt) which exposes the venv-functionality. This would also simplify inclusion into downstream projects using FetchContent, something like:
FetchContent_Declare( PystencilsSfg URL https://i10git.cs.fau.de/pycodegen/pystencils-sfg/-/jobs/artifacts/master/raw/CmakeStandalone.tar.gz ) FetchContent_MakeAvailable( PystencilsSfg )
The above would pull the CMake project from CI artifacts. Once we start releasing pystencils-sfg, we can provide this CMake project with fixed dependency versions via a GitLab Release.
added 1 commit
- 4bd3aa7f - Moved the bootstrapping of a pystencilssfg installation to another file
added 1 commit
- b38d5f6a - added a ci job to make standalone cmake files available
- Resolved by Christoph Alt
- Resolved by Christoph Alt
- Resolved by Frederik Hennig
added 1 commit
- c1058bdb - also calling cmake make-find-module on custom python venvs
We'll need a short getting-started guide for this, but considering the changes I made in !21 (merged), we should probably set up a separate MR for it.
mentioned in issue #13
mentioned in commit 25ad35e8