-
Notifications
You must be signed in to change notification settings - Fork 180
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
Improve handling of external dependencies #2859
Conversation
On the configuration issue, unfortunately Eigen 3.4.0 doesn't make use of CMake's best practices so it's wrongly assuming that it's being built as a top level project. This has been fixed in a subsequent commit. Furthermore, CI tests seem to be failing probably because we are using CMake 3.16, but I'm hoping that we can tweak things to build succesfully (hopefully without hitting a dealbreaker). |
clang-tidy review says "All clean, LGTM! 👍" |
Ok, so I've patched eigen removing unncessary configuration messages. This seems to work as expected. cmake -B build --fresh # It reconfigures the project deleting any CMakeCache.txt
cmake --build build --target clean # cleans any build artifacts
cmake --build build --clean-first # Same as previous line but triggers a build From our discussions, it seems that a @MRtrix3/mrtrix3-devs any thoughts? |
clang-tidy review says "All clean, LGTM! 👍" |
clang-tidy review says "All clean, LGTM! 👍" |
Another relevant issue is that if we decide to pull third party source code from a server, our Github tarballs no longer will contain the full source code required to compile once downloaded, but only after the CMake configuration phase. This can be an issue for certain usecases like packaging workflows by Linux distros. To avoid this, @jdtournier suggested that we should instead look into git subtrees, which would effectively integrate thirdparty dependencies into our source code (the third party code will effectively be part of our repo instead of being just a link like in the case of git submodules). @MRtrix3/mrtrix3-devs I'm not really sure how to proceed here, but let me know if anyone has any thoughts. |
The other thought that came up during last meeting (wrote in minutes, didn't get to here yet) was to give
|
I have now rebased this and made some changes to address the issues above:
@MRtrix3/mrtrix3-devs Feedback welcome. |
clang-tidy review says "All clean, LGTM! 👍" |
Made some more changes. Now we only download release artefacts for Eigen instead of cloning the Gitlab repo (which is much faster). Additionally, I got rid of the custom patch to silence Eigen's configuration output and instead create a CMake INTERFACE library manually. Finally, the base location of FetchContent has been globally set to |
clang-tidy review says "All clean, LGTM! 👍" |
clang-tidy review says "All clean, LGTM! 👍" |
As we discussed in the meeting yesterday, I have retracted the change to avoid pull in dependencies in a custom source folder inside the source directory. So dependencies will be downloaded in the build directory. This shouldn't be an issue because download times should be quite short. |
clang-tidy review says "All clean, LGTM! 👍" |
- Json for Modern C++ and Eigen3 are fetched using CMake's FetchContent - Nifti headers are moved to thirdparty/nifti
To remove unnecessary verbose steps we patch Eigen's CMakeLists.txt
- Developers can now specify an optional local folder containing that points to the sources of eigen, json for modern c++ and half. This can be useful in offline environments without network access. - Dependency handling code is moved into a separate CMake module. - Half is directly fetched from sourceforge.net - FetchContent now downloads source repos in PROJECT_SOURCE_DIR/_deps to avoid downloading repos again for separate build directories.
FETCHCONTENT_BASE_DIR is now set globally for the project to `_fetchcontent` directory inside the top level directory.x
clang-tidy review says "All clean, LGTM! 👍" |
Eigen's configuration script is really verbose and we don't need its output when configuring MRtrix3 as it's just a header only library. This also allows to get rid of the custom patch to fix this problem.
clang-tidy review says "All clean, LGTM! 👍" |
@MRtrix3/mrtrix3-devs unless anyone has objections, I will now merge this. |
|
Another factor that comes to mind here is whether |
I'm not sure what the permissions are on
Makes sense to me. |
@Lestropie @jdtournier I have created a new branch fix_pr2859 that splits the commit for removing |
Thanks for investing the energy. I did a visual comparison between #2859 and a hypothetical merge of |
Oh yes I missed that. I rebased again and now put the deletion of |
Aims to address #2584. Eigen and Json for Modern C++ are now fetched using CMake's
FetchContent
. Nifti headers are moved to a newthirdparty/nifti
directory.Seems to work fine locally, but there is a small downside: the configure log is quite a bit more verbose than before because of Eigen (at least the first it is downloaded). Not sure if there is a way to improve on that.