Rewrite, modernize and complete cmake install
Summary
WIP: this is currently a proof-of-concept to improve the situation for plugin writers. I've explicitly not looked at platform specific issues like Windows builds, but maintained some of the helper functionality that was part of LAMMPSCXXInterface.cmake.
- update how LAMMPSConfig.cmake is generated; note there will be more changes necessary to make it complete, e.g. detecting more dependencies
- installs all headers necessary for plugins, including package headers like OPENMP
- make compilation definitions / compile options PUBLIC so they are inherited by plugins
- add
lammps_add_pluginhelper - rewrote the
examples/plugins/CMakeLists.txtto take advantage of the update CMake install
Related Issue(s)
Author(s)
@rbberger
Licensing
By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).
Backward Compatibility
Implementation Notes
Post Submission Checklist
- [ ] The feature or features in this pull request is complete
- [ ] Licensing information is complete
- [ ] Corresponding author information is complete
- [ ] The source code follows the LAMMPS formatting guidelines
- [ ] Suitable new documentation files and/or updates to the existing docs are included
- [ ] The added/updated documentation is integrated and tested with the documentation build system
- [ ] The feature has been verified to work with the conventional build system
- [ ] The feature has been verified to work with the CMake based build system
- [ ] Suitable tests have been added to the unittest tree.
- [ ] A package specific README file has been included or updated
- [ ] One or more example input decks are included
Further Information, Files, and Links
@akohlmey this one might still take a bit, will need to recreate the windows environment somehow. in the meantime, you should probably cherry-pick 8119d8a7e7a9e69410c16e3f8099674f20857279
@akohlmey this one might still take a bit, will need to recreate the windows environment somehow. in the meantime, you should probably cherry-pick 8119d8a
Thanks, done.
@rbberger can we (that is you and I) have a discussion within the next few weeks on how we tackle this and also PR #4128?
I suspect that raising the minimum CMake version to 3.20 is not going to be enough, but on the other hand for some newer CMake versions, the current scripting may not be compatible. So there would have to be some duplication based on CMake versions. But at the same time, we have the process of slowly removing functionality from the GNU make build and the time for a proper from-the-ground-up refactor of CMake would be once GNU make is history. This means, there is a lot of moving targets and we need some kind of strategy to navigate them.
Yes, let's figure out a time via Slack.
@akohlmey I don't have a windows system a the moment, could you check out why the path becomes \\D:\\a\\lammps\\lammps\\build\\helloplugin.so ?
@akohlmey I don't have a windows system a the moment, could you check out why the path becomes
\\D:\\a\\lammps\\lammps\\build\\helloplugin.so?
I will give it a look when I find some time between waiting for merges to pass testing. :wink:
@akohlmey I don't have a windows system a the moment, could you check out why the path becomes
\\D:\\a\\lammps\\lammps\\build\\helloplugin.so?
@rbberger I think I have figured it out. There is a problem with manipulating windows PATH variables, since they use a semi-colon as a separator (unlike unix with a colon). However, that conflicts with CMake's interpretation of a semi-colon as a separator of list items. We need to require for Windows CMake version 3.20 so we can use the cmake_path() command: https://cmake.org/cmake/help/v3.20/command/cmake_path.html
Will make some tests and update the PR branch accordingly, if they succeed.
@rbberger I am stumped. It works nicely on my Windows virtual machine with Windows 11 and up-to-date MSVC, but fails on GitHub's Windows Server machine.
We need to look into ways to have the LAMMPS python module installed as part of make install. I am thinking of just bypassing the complex processing with building a wheel that is done by make install-python and just copy the files at some suitable location under CMAKE_INSTALL_PREFIX and leave the rest (python dependencies, setting LD_LIBRARY_PATH or adding a file to /etc/ld.so.conf.d) to the user.