-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[workflow][Nix] initial packaging & flake #5059
base: master
Are you sure you want to change the base?
Conversation
Thanks a lot @nim65s for your PR, that's awesome 🙌 |
Nice. |
we use `#include <QGLViewer/qglviewer.h>`, so `QGLViewer_INCLUDE_DIR` must not include `QGLViewer` component. Also, on darwin, headers are installed in Headers dir, not include, ref: https://github.com/GillesDebunne/libQGLViewer/blob/ba9a875784afbb7ee73088fe0e8701c31bc7277d/QGLViewer/QGLViewer.pro#L138
This require fixes in upstream nixpkgs: NixOS/nixpkgs#348549 So we can use the source of that PR for now
without this, `lib/cmake/Sofa.GUI.Qt/Sofa.GUI.QtConfig.cmake` has: > `set(SOFA_GUI_QT_HAVE_QT6 0)` and therefore, in SofaPython3, `find_package(QGLViewer QUIET REQUIRED)` is not called, and build ends up with: > [ 98%] Linking CXX shared library ../../lib/python3/site-packages/Sofa/Gui.cpython-312-x86_64-linux-gnu.so > […]/ld: cannot find -lQGLViewer: No such file or directory
TODO: This should be fixed in CMake instead, but I have no clue. error was: > dyld[61665]: Library not loaded: /nix/store/aalbn4pznxwy18ydjmb15c3y4izj8isi-sofa-24.06.00/lib/libSceneChecking.24.12.99.dylib > Referenced from: <8B75C775-7FE5-3755-A190-B11A3F4F6666> /nix/store/aalbn4pznxwy18ydjmb15c3y4izj8isi-sofa-24.06.00/bin/.runSofa-24.12.99-wrapped > Reason: tried: '/nix/store/aalbn4pznxwy18ydjmb15c3y4izj8isi-sofa-24.06.00/lib/libSceneChecking.24.12.99.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/nix/store/aalbn4pznxwy18ydjmb15c3y4izj8isi-sofa-24.06.00/lib/libSceneChecking.24.12.99.dylib' (no such file), '/nix/store/aalbn4pznxwy18ydjmb15c3y4izj8isi-sofa-24.06.00/lib/libSceneChecking.24.12.99.dylib' (no such file), '/usr/local/lib/libSceneChecking.24.12.99.dylib' (no such file), '/usr/lib/libSceneChecking.24.12.99.dylib' (no such file, not in dyld cache) > zsh: abort ./result/bin/runSofa
Updated to Qt6, and fixed on macos. This required some fixes in upstream nixpkgs: NixOS/nixpkgs#348549, so until this is merged we have to use its source. |
@@ -24,8 +24,11 @@ endif() | |||
|
|||
if (Qt6Core_FOUND) | |||
message("${PROJECT_NAME}: will use Qt6") | |||
sofa_find_package(Qt6 COMPONENTS Gui GuiTools Widgets WidgetsTools OpenGLWidgets REQUIRED) | |||
set(SOFA_GUI_QT_TARETS ${SOFA_GUI_QT_TARGETS} Qt::Core Qt::Gui Qt::Widgets Qt::OpenGLWidgets ) | |||
find_package(Qt6 COMPONENTS Gui GuiTools Widgets WidgetsTools OpenGLWidgets REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not very familiar with Qt components. Can you give more details on the changes here? Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not familiar with those neither, but as a matter of fact, the Qt6GuiToolsConfig.cmake
file does not define a Qt6::GuiTools
CMake target. Therefore we can not rely on the presence of a Qt6::GuiTools
CMake target to know how should we define SOFA_GUI_QT_HAVE_QT6
.
But I don't know why we are looking for those CMake targets to define if SOFA_GUI_QT_HAVE_QT6
or not. My guess is that Qt6_FOUND
should be enough.
@@ -0,0 +1,25 @@ | |||
{ | |||
description = "Real-time multi-physics simulation with an emphasis on medical simulation."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hugtalbot you may want to suggest another description here
''; | ||
|
||
meta = { | ||
description = "Real-time multi-physics simulation with an emphasis on medical simulation"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#fetchFromGitHub, | ||
glew, | ||
gtest, | ||
lib, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is "Nixpkgs lib", ref. https://github.com/NixOS/nixpkgs/blob/master/lib/README.md
@nim65s The command |
flakes and the
|
After a successful build, I have the following trace when running:
|
Hum, yes, I only tested that on NixOS, sorry. I'll try on ubuntu, with x11 and wayland. I guess this is only a matter of selecting the correct QT_QPA_PLATFORM or something. |
Hi,
As discussed at Journées HPC INRIA in Lille, here is an initial nix package for sofa.
It also include a flake (and its lock), which is not mandatory, but ease the use of the package, with commands like
nix build
, to compile the package in a sandboxnix develop
, to provide a shell with an environment containing all required dependencies to build the project in the usual CMake waynix run
, to start the software.All these commands take an optional path argument, defaulting to the current working directory, but we could also build / develop / run any commit / tag / branch / fork of the project with eg.
nix build github:sofa-framework/sofa
(for master) ornix run github:nim65s/sofa/58ae0644d117aea880ed284f6cc0beb7e9802f96
While here, this also setup some CI for this packaging, mostly to detect early:
But also, a nix binary cache can be set up with eg. https://www.cachix.org/, so that once a commit is build in CI, users & developers can directly use that cache instead of compiling themselves.
(it is also true in the other way: developers with write access to the cache can send their build result to it so that the CI will be instantaneous cache hit)
Here is an example of CI build log: https://github.com/nim65s/sofa/actions/runs/11306279152/job/31446709649
PS: I did not test on macos yet, so this is probably a bit early to expect it work. It at least require darwin signatures I guess, I'll try to test that this week, when I can use an apple system.
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if