Merge branch 'develop' into replicate_periodic_box
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -3,6 +3,7 @@
|
|||||||
.github export-ignore
|
.github export-ignore
|
||||||
.lgtm.yml export-ignore
|
.lgtm.yml export-ignore
|
||||||
SECURITY.md export-ignore
|
SECURITY.md export-ignore
|
||||||
|
CITATION.cff export-ignore
|
||||||
* text=auto
|
* text=auto
|
||||||
*.jpg -text
|
*.jpg -text
|
||||||
*.pdf -text
|
*.pdf -text
|
||||||
|
|||||||
79
.github/CODEOWNERS
vendored
79
.github/CODEOWNERS
vendored
@ -13,39 +13,45 @@ lib/kim/* @ellio167
|
|||||||
lib/mesont/* @iafoss
|
lib/mesont/* @iafoss
|
||||||
|
|
||||||
# whole packages
|
# whole packages
|
||||||
src/COMPRESS/* @rbberger
|
src/ADIOS/* @pnorbert
|
||||||
src/GPU/* @ndtrung81
|
src/AMOEBA/* @sjplimp
|
||||||
src/KOKKOS/* @stanmoore1
|
src/BPM/* @jtclemm
|
||||||
src/KIM/* @ellio167
|
|
||||||
src/LATTE/* @cnegre
|
|
||||||
src/MESSAGE/* @sjplimp
|
|
||||||
src/MLIAP/* @athomps
|
|
||||||
src/SNAP/* @athomps
|
|
||||||
src/SPIN/* @julient31
|
|
||||||
src/BROWNIAN/* @samueljmcameron
|
src/BROWNIAN/* @samueljmcameron
|
||||||
src/CG-DNA/* @ohenrich
|
src/CG-DNA/* @ohenrich
|
||||||
src/CG-SDK/* @akohlmey
|
src/CG-SPICA/* @yskmiyazaki
|
||||||
src/COLVARS/* @giacomofiorin
|
src/COLVARS/* @giacomofiorin
|
||||||
|
src/COMPRESS/* @rbberger
|
||||||
src/DIELECTRIC/* @ndtrung81
|
src/DIELECTRIC/* @ndtrung81
|
||||||
|
src/ELECTRODE/* @ludwig-ahrens
|
||||||
src/FEP/* @agiliopadua
|
src/FEP/* @agiliopadua
|
||||||
src/ML-HDNNP/* @singraber
|
src/GPU/* @ndtrung81
|
||||||
|
src/GRANULAR/* @jtclemm @dsbolin
|
||||||
src/INTEL/* @wmbrownintel
|
src/INTEL/* @wmbrownintel
|
||||||
|
src/KIM/* @ellio167
|
||||||
|
src/KOKKOS/* @stanmoore1
|
||||||
|
src/LATTE/* @cnegre
|
||||||
src/MANIFOLD/* @Pakketeretet2
|
src/MANIFOLD/* @Pakketeretet2
|
||||||
src/MDI/* @taylor-a-barnes
|
src/MDI/* @taylor-a-barnes @sjplimp
|
||||||
src/MEAM/* @martok
|
src/MEAM/* @martok
|
||||||
src/MESONT/* @iafoss
|
src/MESONT/* @iafoss
|
||||||
|
src/ML-HDNNP/* @singraber
|
||||||
|
src/ML-IAP/* @athomps
|
||||||
|
src/ML-PACE/* @yury-lysogorskiy
|
||||||
|
src/ML-POD/* @exapde @rohskopf
|
||||||
src/MOFFF/* @hheenen
|
src/MOFFF/* @hheenen
|
||||||
src/MOLFILE/* @akohlmey
|
src/MOLFILE/* @akohlmey
|
||||||
src/NETCDF/* @pastewka
|
src/NETCDF/* @pastewka
|
||||||
src/ML-PACE/* @yury-lysogorskiy
|
|
||||||
src/PLUMED/* @gtribello
|
|
||||||
src/PHONON/* @lingtikong
|
|
||||||
src/PTM/* @pmla
|
|
||||||
src/OPENMP/* @akohlmey
|
src/OPENMP/* @akohlmey
|
||||||
|
src/PHONON/* @lingtikong
|
||||||
|
src/PLUGIN/* @akohlmey
|
||||||
|
src/PLUMED/* @gtribello
|
||||||
|
src/PTM/* @pmla
|
||||||
src/QMMM/* @akohlmey
|
src/QMMM/* @akohlmey
|
||||||
src/REAXFF/* @hasanmetin @stanmoore1
|
|
||||||
src/REACTION/* @jrgissing
|
src/REACTION/* @jrgissing
|
||||||
|
src/REAXFF/* @hasanmetin @stanmoore1
|
||||||
src/SCAFACOS/* @rhalver
|
src/SCAFACOS/* @rhalver
|
||||||
|
src/SNAP/* @athomps
|
||||||
|
src/SPIN/* @julient31
|
||||||
src/TALLY/* @akohlmey
|
src/TALLY/* @akohlmey
|
||||||
src/UEF/* @danicholson
|
src/UEF/* @danicholson
|
||||||
src/VTK/* @rbberger
|
src/VTK/* @rbberger
|
||||||
@ -55,9 +61,14 @@ src/GPU/pair_vashishta_gpu.* @andeplane
|
|||||||
src/KOKKOS/pair_vashishta_kokkos.* @andeplane
|
src/KOKKOS/pair_vashishta_kokkos.* @andeplane
|
||||||
src/MANYBODY/pair_vashishta_table.* @andeplane
|
src/MANYBODY/pair_vashishta_table.* @andeplane
|
||||||
src/MANYBODY/pair_atm.* @sergeylishchuk
|
src/MANYBODY/pair_atm.* @sergeylishchuk
|
||||||
|
src/MANYBODY/pair_nb3b_screened.* @flodesani
|
||||||
src/REPLICA/*_grem.* @dstelter92
|
src/REPLICA/*_grem.* @dstelter92
|
||||||
src/EXTRA-COMPUTE/compute_stress_mop*.* @RomainVermorel
|
src/EXTRA-COMPUTE/compute_stress_mop*.* @RomainVermorel
|
||||||
|
src/EXTRA-COMPUTE/compute_born_matrix.* @Bibobu @athomps
|
||||||
src/MISC/*_tracker.* @jtclemm
|
src/MISC/*_tracker.* @jtclemm
|
||||||
|
src/MC/fix_gcmc.* @athomps
|
||||||
|
src/MC/fix_sgcmc.* @athomps
|
||||||
|
src/REPLICA/fix_pimd_langevin.* @Yi-FanLi
|
||||||
|
|
||||||
# core LAMMPS classes
|
# core LAMMPS classes
|
||||||
src/lammps.* @sjplimp
|
src/lammps.* @sjplimp
|
||||||
@ -119,41 +130,47 @@ src/dump_movie.* @akohlmey
|
|||||||
src/exceptions.h @rbberger
|
src/exceptions.h @rbberger
|
||||||
src/fix_nh.* @athomps
|
src/fix_nh.* @athomps
|
||||||
src/info.* @akohlmey @rbberger
|
src/info.* @akohlmey @rbberger
|
||||||
src/timer.* @akohlmey
|
|
||||||
src/min* @sjplimp @stanmoore1
|
src/min* @sjplimp @stanmoore1
|
||||||
|
src/platform.* @akohlmey
|
||||||
|
src/timer.* @akohlmey
|
||||||
src/utils.* @akohlmey @rbberger
|
src/utils.* @akohlmey @rbberger
|
||||||
src/verlet.* @sjplimp @stanmoore1
|
src/verlet.* @sjplimp @stanmoore1
|
||||||
src/math_eigen_impl.h @jewettaij
|
src/math_eigen_impl.h @jewettaij
|
||||||
|
src/fix_press_langevin.* @Bibobu
|
||||||
|
|
||||||
# tools
|
# tools
|
||||||
tools/msi2lmp/* @akohlmey
|
tools/coding_standard/* @akohlmey @rbberger
|
||||||
tools/emacs/* @HaoZeke
|
tools/emacs/* @HaoZeke
|
||||||
tools/singularity/* @akohlmey @rbberger
|
tools/lammps-shell/* @akohlmey
|
||||||
tools/coding_standard/* @rbberger
|
tools/msi2lmp/* @akohlmey
|
||||||
tools/valgrind/* @akohlmey
|
|
||||||
tools/swig/* @akohlmey
|
|
||||||
tools/offline/* @rbberger
|
tools/offline/* @rbberger
|
||||||
|
tools/singularity/* @akohlmey @rbberger
|
||||||
|
tools/swig/* @akohlmey
|
||||||
|
tools/valgrind/* @akohlmey
|
||||||
|
tools/vim/* @hammondkd
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
unittest/* @akohlmey @rbberger
|
unittest/* @akohlmey
|
||||||
|
|
||||||
# cmake
|
# cmake
|
||||||
cmake/* @junghans @rbberger
|
cmake/* @akohlmey
|
||||||
cmake/Modules/Packages/COLVARS.cmake @junghans @rbberger @giacomofiorin
|
cmake/Modules/LAMMPSInterfacePlugin.cmake @akohlmey
|
||||||
cmake/Modules/Packages/KIM.cmake @junghans @rbberger @ellio167
|
cmake/Modules/MPI4WIN.cmake @akohlmey
|
||||||
|
cmake/Modules/OpenCLLoader.cmake @akohlmey
|
||||||
|
cmake/Modules/Packages/COLVARS.cmake @giacomofiorin
|
||||||
|
cmake/Modules/Packages/KIM.cmake @ellio167
|
||||||
cmake/presets/*.cmake @akohlmey
|
cmake/presets/*.cmake @akohlmey
|
||||||
|
|
||||||
# python
|
# python
|
||||||
python/* @rbberger
|
python/* @rbberger
|
||||||
|
|
||||||
# fortran
|
# fortran
|
||||||
fortran/* @akohlmey
|
fortran/* @akohlmey @hammondkd
|
||||||
|
|
||||||
# docs
|
# docs
|
||||||
doc/utils/*/* @rbberger
|
doc/* @akohlmey
|
||||||
doc/Makefile @rbberger
|
|
||||||
doc/README @rbberger
|
|
||||||
examples/plugin/* @akohlmey
|
examples/plugin/* @akohlmey
|
||||||
|
examples/PACKAGES/pace/plugin/* @akohlmey
|
||||||
|
|
||||||
# for releases
|
# for releases
|
||||||
src/version.h @sjplimp
|
src/version.h @sjplimp
|
||||||
|
|||||||
24
.github/CONTRIBUTING.md
vendored
24
.github/CONTRIBUTING.md
vendored
@ -1,13 +1,13 @@
|
|||||||
# Contributing to LAMMPS via GitHub
|
# Contributing to LAMMPS via GitHub
|
||||||
|
|
||||||
Thank your for considering to contribute to the LAMMPS software project.
|
Thank you for considering to contribute to the LAMMPS software project.
|
||||||
|
|
||||||
The following is a set of guidelines as well as explanations of policies and work flows for contributing to the LAMMPS molecular dynamics software project. These guidelines focus on submitting issues or pull requests on the LAMMPS GitHub project.
|
The following is a set of guidelines as well as explanations of policies and work flows for contributing to the LAMMPS molecular dynamics software project. These guidelines focus on submitting issues or pull requests on the LAMMPS GitHub project.
|
||||||
|
|
||||||
Thus please also have a look at:
|
Thus please also have a look at:
|
||||||
* [The guide for submitting new features in the LAMMPS manual](https://www.lammps.org/doc/Modify_contribute.html)
|
* [The guide for submitting new features in the LAMMPS manual](https://docs.lammps.org/Modify_contribute.html)
|
||||||
* [The guide on programming style and requirement in the LAMMPS manual](https://www.lammps.org/doc/Modify_style.html)
|
* [The guide on programming style and requirement in the LAMMPS manual](https://docs.lammps.org/Modify_requirements.html)
|
||||||
* [The GitHub tutorial in the LAMMPS manual](http://lammps.sandia.gov/doc/Howto_github.html)
|
* [The GitHub tutorial in the LAMMPS manual](http://docs.lammps.org/Howto_github.html)
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
@ -27,17 +27,17 @@ __
|
|||||||
|
|
||||||
## I don't want to read this whole thing I just have a question!
|
## I don't want to read this whole thing I just have a question!
|
||||||
|
|
||||||
> **Note:** Please do not file an issue to ask a general question about LAMMPS, its features, how to use specific commands, or how perform simulations or analysis in LAMMPS. Instead post your question to either the ['lammps-users' mailing list](https://lammps.sandia.gov/mail.html) or the [LAMMPS Material Science Discourse forum](https://matsci.org/lammps). You do not need to be subscribed to post to the list (but a mailing list subscription avoids having your post delayed until it is approved by a mailing list moderator). Most posts to the mailing list receive a response within less than 24 hours. Before posting to the mailing list, please read the [mailing list guidelines](https://lammps.sandia.gov/guidelines.html). Following those guidelines will help greatly to get a helpful response. Always mention which LAMMPS version you are using. The LAMMPS forum was recently created as part of a larger effort to build a materials science community and have discussions not just about using LAMMPS. Thus the forum may be also used for discussions that would be off-topic for the mailing list. Those will just have to be posted to a more general category.
|
> **Note:** Please do not file an issue to ask a general question about LAMMPS, its features, how to use specific commands, or how perform simulations or analysis in LAMMPS. Instead post your question to the [LAMMPS Material Science Discourse forum](https://matsci.org/lammps). Before posting to the forum, please read the general [guidelines](https://www.lammps.org/guidelines.html) and the forum specific [suggestions](https://matsci.org/t/please-read-this-first-guidelines-and-suggestions-for-posting-lammps-questions/49913). Following those guidelines and suggestions will help greatly to get a helpful response. *Always* mention which LAMMPS version you are using. The MatSci website may be also used for discussions that would be off-topic for the LAMMPS categories. Those will just have to be posted to a different category.
|
||||||
|
|
||||||
## How Can I Contribute?
|
## How Can I Contribute?
|
||||||
|
|
||||||
There are several ways how you can actively contribute to the LAMMPS project: you can discuss compiling and using LAMMPS, and solving LAMMPS related problems with other LAMMPS users on the lammps-users mailing list or the forum, you can report bugs or suggest enhancements by creating issues on GitHub (or posting them to the lammps-users mailing list or posting in the LAMMPS Materials Science Discourse forum), and you can contribute by submitting pull requests on GitHub or e-mail your code
|
There are several ways how you can actively contribute to the LAMMPS project: you can discuss compiling and using LAMMPS, and solving LAMMPS related problems with other LAMMPS users on the lammps-users mailing list or the forum, you can report bugs or suggest enhancements by creating issues on GitHub (or posting them to the lammps-users mailing list or posting in the LAMMPS Materials Science Discourse forum), and you can contribute by submitting pull requests on GitHub or e-mail your code
|
||||||
to one of the [LAMMPS core developers](https://lammps.sandia.gov/authors.html). As you may see from the aforementioned developer page, the LAMMPS software package includes the efforts of a very large number of contributors beyond the principal authors and maintainers.
|
to one of the [LAMMPS core developers](https://www.lammps.org/authors.html). As you may see from the aforementioned developer page, the LAMMPS software package includes the efforts of a very large number of contributors beyond the principal authors and maintainers.
|
||||||
|
|
||||||
### Discussing How To Use LAMMPS
|
### Discussing How To Use LAMMPS
|
||||||
|
|
||||||
The LAMMPS mailing list is hosted at SourceForge. The mailing list began in 2005, and now includes tens of thousands of messages in thousands of threads. LAMMPS developers try to respond to posted questions in a timely manner, but there are no guarantees. Please consider that people live in different timezone and may not have time to answer e-mails outside of their work hours.
|
The LAMMPS mailing list is hosted at SourceForge. The mailing list began in 2005, and now includes tens of thousands of messages in thousands of threads. LAMMPS developers try to respond to posted questions in a timely manner, but there are no guarantees. Please consider that people live in different timezone and may not have time to answer e-mails outside of their work hours.
|
||||||
You can post to list by sending your email to lammps-users at lists.sourceforge.net (no subscription required), but before posting, please read the [mailing list guidelines](https://lammps.sandia.gov/guidelines.html) to maximize your chances to receive a helpful response.
|
You can post to list by sending your email to lammps-users at lists.sourceforge.net (no subscription required), but before posting, please read the [mailing list guidelines](https://www.lammps.org/guidelines.html) to maximize your chances to receive a helpful response.
|
||||||
|
|
||||||
Anyone can browse/search previous questions/answers in the archives. You do not have to subscribe to the list to post questions, receive answers (to your questions), or browse/search the archives. You **do** need to subscribe to the list if you want emails for **all** the posts (as individual messages or in digest form), or to answer questions yourself. Feel free to sign up and help us out! Answering questions from fellow LAMMPS users is a great way to pay back the community for providing you a useful tool for free, and to pass on the advice you have received yourself to others. It improves your karma and helps you understand your own research better.
|
Anyone can browse/search previous questions/answers in the archives. You do not have to subscribe to the list to post questions, receive answers (to your questions), or browse/search the archives. You **do** need to subscribe to the list if you want emails for **all** the posts (as individual messages or in digest form), or to answer questions yourself. Feel free to sign up and help us out! Answering questions from fellow LAMMPS users is a great way to pay back the community for providing you a useful tool for free, and to pass on the advice you have received yourself to others. It improves your karma and helps you understand your own research better.
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ The LAMMPS Materials Science Discourse forum was created recently to facilitate
|
|||||||
|
|
||||||
### Reporting Bugs
|
### Reporting Bugs
|
||||||
|
|
||||||
While developers writing code for LAMMPS are careful to test their code, LAMMPS is such a large and complex software, that it is impossible to test for all combinations of features under all normal and not so normal circumstances. Thus bugs do happen, and if you suspect, that you have encountered one, please try to document it and report it as an [Issue](https://github.com/lammps/lammps/issues) on the LAMMPS GitHub project web page. However, before reporting a bug, you need to check whether this is something that may have already been corrected. The [Latest Features and Bug Fixes in LAMMPS](https://lammps.sandia.gov/bug.html) web page lists all significant changes to LAMMPS over the years. It also tells you what the current latest development version of LAMMPS is, and you should test whether your issue still applies to that version.
|
While developers writing code for LAMMPS are careful to test their code, LAMMPS is such a large and complex software, that it is impossible to test for all combinations of features under all normal and not so normal circumstances. Thus bugs do happen, and if you suspect, that you have encountered one, please try to document it and report it as an [Issue](https://github.com/lammps/lammps/issues) on the LAMMPS GitHub project web page. However, before reporting a bug, you need to check whether this is something that may have already been corrected. The [Latest Features and Bug Fixes in LAMMPS](https://www.lammps.org/bug.html) web page lists all significant changes to LAMMPS over the years. It also tells you what the current latest development version of LAMMPS is, and you should test whether your issue still applies to that version.
|
||||||
|
|
||||||
When you click on the green "New Issue" button, you will be provided with a text field, where you can enter your message. That text field with contain a template with several headlines and some descriptions. Keep the headlines that are relevant to your reported potential bug and replace the descriptions with the information as suggested by the descriptions.
|
When you click on the green "New Issue" button, you will be provided with a text field, where you can enter your message. That text field with contain a template with several headlines and some descriptions. Keep the headlines that are relevant to your reported potential bug and replace the descriptions with the information as suggested by the descriptions.
|
||||||
You can also attach small text files (please add the file name extension `.txt` or it will be rejected), images, or small compressed text files (using gzip, do not use RAR or 7-ZIP or similar tools that are uncommon outside of Windows machines). In many cases, bugs are best illustrated by providing a small input deck (do **not** attach your entire production input, but remove everything that is not required to reproduce the issue, and scale down your system size, that the resulting calculation runs fast and can be run on small desktop quickly).
|
You can also attach small text files (please add the file name extension `.txt` or it will be rejected), images, or small compressed text files (using gzip, do not use RAR or 7-ZIP or similar tools that are uncommon outside of Windows machines). In many cases, bugs are best illustrated by providing a small input deck (do **not** attach your entire production input, but remove everything that is not required to reproduce the issue, and scale down your system size, that the resulting calculation runs fast and can be run on small desktop quickly).
|
||||||
@ -65,9 +65,9 @@ To be able to submit an issue on GitHub, you have to register for an account (fo
|
|||||||
|
|
||||||
We encourage users to submit new features or modifications for LAMMPS. Instructions, guidelines, requirements,
|
We encourage users to submit new features or modifications for LAMMPS. Instructions, guidelines, requirements,
|
||||||
and recommendations are in the following sections of the LAMMPS manual:
|
and recommendations are in the following sections of the LAMMPS manual:
|
||||||
* [The guide for submitting new features in the LAMMPS manual](https://lammps.sandia.gov/doc/Modify_contribute.html)
|
* [The guide for submitting new features in the LAMMPS manual](https://docs.lammps.org/Modify_contribute.html)
|
||||||
* [The guide on programming style and requirement in the LAMMPS manual](https://lammps.sandia.gov/doc/Modify_contribute.html)
|
* [The guide on programming style and requirement in the LAMMPS manual](https://docs.lammps.org/Modify_requirements.html)
|
||||||
* [The GitHub tutorial in the LAMMPS manual](http://lammps.sandia.gov/doc/Howto_github.html)
|
* [The GitHub tutorial in the LAMMPS manual](http://docs.lammps.org/Howto_github.html)
|
||||||
|
|
||||||
|
|
||||||
## GitHub Workflows
|
## GitHub Workflows
|
||||||
@ -85,7 +85,7 @@ For bug reports, the next step is that one of the core LAMMPS developers will se
|
|||||||
### Pull Requests
|
### Pull Requests
|
||||||
|
|
||||||
Pull requests are the **only** way that changes get made to the LAMMPS distribution. So also the LAMMPS core developers will submit pull requests for their own changes and discuss them on GitHub. Thus if you submit a pull request it will be treated in a similar fashion. When you submit a pull request you may opt to submit a "Draft" pull request. That means your changes are visible and will be subject to testing, but reviewers will not be (auto-)assigned and comments will take into account that this is not complete. On the other hand, this is a perfect way to ask the LAMMPS developers for comments on non-obvious changes and get feedback and possible suggestions for improvements or recommendations about what to avoid.
|
Pull requests are the **only** way that changes get made to the LAMMPS distribution. So also the LAMMPS core developers will submit pull requests for their own changes and discuss them on GitHub. Thus if you submit a pull request it will be treated in a similar fashion. When you submit a pull request you may opt to submit a "Draft" pull request. That means your changes are visible and will be subject to testing, but reviewers will not be (auto-)assigned and comments will take into account that this is not complete. On the other hand, this is a perfect way to ask the LAMMPS developers for comments on non-obvious changes and get feedback and possible suggestions for improvements or recommendations about what to avoid.
|
||||||
Immediately after the submission, the LAMMPS continuing integration server at ci.lammps.org will download your submitted branch and perform a number of tests: it will tests whether it compiles cleanly under various conditions, it will also do a check on whether your included documentation translates cleanly and run some unit tests and other checks. Whether these tests are successful or fail will be recorded. If a test fails, please inspect the corresponding output on the CI server and take the necessary steps, if needed, so that the code can compile cleanly again. The test will be re-run each time the pull request is updated with a push to the remote branch on GitHub. If you are unsure about what you need to change, ask a question in the discussion area of the pull request.
|
Immediately after the submission, the LAMMPS continuing integration server at https://ci.lammps.org will download your submitted branch and perform a number of tests: it will tests whether it compiles cleanly under various conditions, it will also do a check on whether your included documentation translates cleanly and run some unit tests and other checks. Whether these tests are successful or fail will be recorded. If a test fails, please inspect the corresponding output on the CI server and take the necessary steps, if needed, so that the code can compile cleanly again. The test will be re-run each time the pull request is updated with a push to the remote branch on GitHub. If you are unsure about what you need to change, ask a question in the discussion area of the pull request.
|
||||||
Next a LAMMPS core developer will self-assign and do an overall technical assessment of the submission. If you submitted a draft pull request, this will not happen unless you mark it "ready for review". If you are not yet invited as a LAMMPS collaborator, and your contribution seems significant, you may also receive an invitation for collaboration on the LAMMPS repository. As part of the assessment, the pull request will be categorized with labels. There are two special labels: `needs_work` (indicates that work from the submitter of the pull request is needed) and `work_in_progress` (indicates, that the assigned LAMMPS developer will make changes, if not done by the contributor who made the submit).
|
Next a LAMMPS core developer will self-assign and do an overall technical assessment of the submission. If you submitted a draft pull request, this will not happen unless you mark it "ready for review". If you are not yet invited as a LAMMPS collaborator, and your contribution seems significant, you may also receive an invitation for collaboration on the LAMMPS repository. As part of the assessment, the pull request will be categorized with labels. There are two special labels: `needs_work` (indicates that work from the submitter of the pull request is needed) and `work_in_progress` (indicates, that the assigned LAMMPS developer will make changes, if not done by the contributor who made the submit).
|
||||||
You may also receive comments and suggestions on the overall submission or specific details and on occasion specific requests for changes as part of the review. If permitted, also additional changes may be pushed into your pull request branch or a pull request may be filed in your LAMMPS fork on GitHub to include those changes.
|
You may also receive comments and suggestions on the overall submission or specific details and on occasion specific requests for changes as part of the review. If permitted, also additional changes may be pushed into your pull request branch or a pull request may be filed in your LAMMPS fork on GitHub to include those changes.
|
||||||
The LAMMPS developer may then decide to assign the pull request to another developer (e.g. when that developer is more knowledgeable about the submitted feature or enhancement or has written the modified code). It may also happen, that additional developers are requested to provide a review and approve the changes. For submissions, that may change the general behavior of LAMMPS, or where a possibility of unwanted side effects exists, additional tests may be requested by the assigned developer.
|
The LAMMPS developer may then decide to assign the pull request to another developer (e.g. when that developer is more knowledgeable about the submitted feature or enhancement or has written the modified code). It may also happen, that additional developers are requested to provide a review and approve the changes. For submissions, that may change the general behavior of LAMMPS, or where a possibility of unwanted side effects exists, additional tests may be requested by the assigned developer.
|
||||||
|
|||||||
7
.github/ISSUE_TEMPLATE/help_request.md
vendored
7
.github/ISSUE_TEMPLATE/help_request.md
vendored
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: Request for Help
|
name: Request for Help
|
||||||
about: "Don't post help requests here, email the lammps-users mailing list"
|
about: "Don't post help requests here, post in the LAMMPS forum"
|
||||||
title: ""
|
title: ""
|
||||||
labels: invalid
|
labels: invalid
|
||||||
assignees: ''
|
assignees: ''
|
||||||
@ -8,8 +8,9 @@ assignees: ''
|
|||||||
---
|
---
|
||||||
|
|
||||||
Please **do not** post requests for help (e.g. with installing or using LAMMPS) here.
|
Please **do not** post requests for help (e.g. with installing or using LAMMPS) here.
|
||||||
Instead send an e-mail to the lammps-users mailing list.
|
Instead, you can post to the LAMMPS category in the Materials Science Community
|
||||||
|
Discourse forum at: https://matsci.org/lammps/
|
||||||
|
|
||||||
This issue tracker is for tracking LAMMPS development related issues only.
|
This issue tracker is for tracking LAMMPS development related issues only.
|
||||||
|
|
||||||
Thanks for your cooperation.
|
Thank you in advance for your cooperation.
|
||||||
|
|||||||
6
.github/codecov.yml
vendored
6
.github/codecov.yml
vendored
@ -7,7 +7,7 @@ coverage:
|
|||||||
threshold: 10%
|
threshold: 10%
|
||||||
only_pulls: false
|
only_pulls: false
|
||||||
branches:
|
branches:
|
||||||
- "master"
|
- "develop"
|
||||||
flags:
|
flags:
|
||||||
- "unit"
|
- "unit"
|
||||||
paths:
|
paths:
|
||||||
@ -16,14 +16,14 @@ coverage:
|
|||||||
project:
|
project:
|
||||||
default:
|
default:
|
||||||
branches:
|
branches:
|
||||||
- "master"
|
- "develop"
|
||||||
paths:
|
paths:
|
||||||
- "src"
|
- "src"
|
||||||
informational: true
|
informational: true
|
||||||
patch:
|
patch:
|
||||||
default:
|
default:
|
||||||
branches:
|
branches:
|
||||||
- "master"
|
- "develop"
|
||||||
paths:
|
paths:
|
||||||
- "src"
|
- "src"
|
||||||
informational: true
|
informational: true
|
||||||
|
|||||||
6
.github/dependabot.yml
vendored
Normal file
6
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
17
.github/workflows/codeql-analysis.yml
vendored
17
.github/workflows/codeql-analysis.yml
vendored
@ -13,6 +13,11 @@ jobs:
|
|||||||
if: ${{ github.repository == 'lammps/lammps' }}
|
if: ${{ github.repository == 'lammps/lammps' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
security-events: write
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -20,17 +25,17 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
config-file: ./.github/codeql/${{ matrix.language }}.yml
|
config-file: ./.github/codeql/${{ matrix.language }}.yml
|
||||||
@ -44,8 +49,10 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
working-directory: build
|
working-directory: build
|
||||||
run: |
|
run: |
|
||||||
cmake -C ../cmake/presets/most.cmake ../cmake
|
cmake -C ../cmake/presets/most.cmake \
|
||||||
|
-D DOWNLOAD_POTENTIALS=off \
|
||||||
|
../cmake
|
||||||
cmake --build . --parallel 2
|
cmake --build . --parallel 2
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v3
|
||||||
|
|||||||
21
.github/workflows/compile-msvc.yml
vendored
21
.github/workflows/compile-msvc.yml
vendored
@ -3,7 +3,11 @@ name: "Native Windows Compilation and Unit Tests"
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [develop]
|
branches:
|
||||||
|
- develop
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
@ -15,27 +19,32 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
- name: Select Python version
|
- name: Select Python version
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.11'
|
||||||
|
|
||||||
- name: Building LAMMPS via CMake
|
- name: Building LAMMPS via CMake
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install numpy
|
python3 -m pip install numpy
|
||||||
python3 -m pip install pyyaml
|
python3 -m pip install pyyaml
|
||||||
|
nuget install MSMPIsdk
|
||||||
|
nuget install MSMPIDIST
|
||||||
cmake -C cmake/presets/windows.cmake \
|
cmake -C cmake/presets/windows.cmake \
|
||||||
|
-D DOWNLOAD_POTENTIALS=off \
|
||||||
-D PKG_PYTHON=on \
|
-D PKG_PYTHON=on \
|
||||||
|
-D WITH_PNG=off \
|
||||||
|
-D WITH_JPEG=off \
|
||||||
-S cmake -B build \
|
-S cmake -B build \
|
||||||
-D BUILD_SHARED_LIBS=on \
|
-D BUILD_SHARED_LIBS=on \
|
||||||
-D LAMMPS_EXCEPTIONS=on \
|
-D LAMMPS_EXCEPTIONS=on \
|
||||||
-D ENABLE_TESTING=on
|
-D ENABLE_TESTING=on
|
||||||
cmake --build build --config Release
|
cmake --build build --config Release --parallel 2
|
||||||
|
|
||||||
- name: Run LAMMPS executable
|
- name: Run LAMMPS executable
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -46,4 +55,4 @@ jobs:
|
|||||||
- name: Run Unit Tests
|
- name: Run Unit Tests
|
||||||
working-directory: build
|
working-directory: build
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ctest -V -C Release
|
run: ctest -V -C Release -E FixTimestep:python_move_nve
|
||||||
|
|||||||
99
.github/workflows/coverity.yml
vendored
Normal file
99
.github/workflows/coverity.yml
vendored
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
name: "Run Coverity Scan"
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * FRI"
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
if: ${{ github.repository == 'lammps/lammps' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: lammps/buildenv:ubuntu20.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 2
|
||||||
|
|
||||||
|
- name: Create Build and Download Folder
|
||||||
|
run: mkdir build download
|
||||||
|
|
||||||
|
- name: Cache Coverity
|
||||||
|
id: cache-coverity
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ./download/
|
||||||
|
key: ${{ runner.os }}-download-${{ hashFiles('**/coverity_tool.*') }}
|
||||||
|
|
||||||
|
- name: Download Coverity if necessary
|
||||||
|
if: steps.cache-coverity.outputs.cache-hit != 'true'
|
||||||
|
working-directory: download
|
||||||
|
run: |
|
||||||
|
wget -nv https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_TOKEN }}&project=LAMMPS" -O coverity_tool.tgz
|
||||||
|
wget -nv https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_TOKEN }}&project=LAMMPS&md5=1" -O coverity_tool.md5
|
||||||
|
echo " coverity_tool.tgz" >> coverity_tool.md5
|
||||||
|
md5sum -c coverity_tool.md5
|
||||||
|
|
||||||
|
- name: Setup Coverity
|
||||||
|
run: |
|
||||||
|
tar xzf download/coverity_tool.tgz
|
||||||
|
ln -s cov-analysis-linux64-* coverity
|
||||||
|
|
||||||
|
- name: Configure LAMMPS via CMake
|
||||||
|
shell: bash
|
||||||
|
working-directory: build
|
||||||
|
run: |
|
||||||
|
cmake \
|
||||||
|
-C ../cmake/presets/clang.cmake \
|
||||||
|
-C ../cmake/presets/most.cmake \
|
||||||
|
-C ../cmake/presets/kokkos-openmp.cmake \
|
||||||
|
-D CMAKE_BUILD_TYPE="RelWithDebug" \
|
||||||
|
-D CMAKE_TUNE_FLAGS="-Wall -Wextra -Wno-unused-result" \
|
||||||
|
-D BUILD_MPI=on \
|
||||||
|
-D BUILD_OMP=on \
|
||||||
|
-D BUILD_SHARED_LIBS=on \
|
||||||
|
-D LAMMPS_SIZES=SMALLBIG \
|
||||||
|
-D LAMMPS_EXCEPTIONS=off \
|
||||||
|
-D PKG_ATC=on \
|
||||||
|
-D PKG_AWPMD=on \
|
||||||
|
-D PKG_H5MD=on \
|
||||||
|
-D PKG_INTEL=on \
|
||||||
|
-D PKG_LATBOLTZ=on \
|
||||||
|
-D PKG_MANIFOLD=on \
|
||||||
|
-D PKG_MDI=on \
|
||||||
|
-D PKG_MGPT=on \
|
||||||
|
-D PKG_ML-PACE=on \
|
||||||
|
-D PKG_ML-RANN=on \
|
||||||
|
-D PKG_MOLFILE=on \
|
||||||
|
-D PKG_NETCDF=on \
|
||||||
|
-D PKG_PTM=on \
|
||||||
|
-D PKG_QTB=on \
|
||||||
|
-D PKG_SMTBQ=on \
|
||||||
|
../cmake
|
||||||
|
|
||||||
|
- name: Run Coverity Scan
|
||||||
|
shell: bash
|
||||||
|
working-directory: build
|
||||||
|
run: |
|
||||||
|
export PATH=$GITHUB_WORKSPACE/coverity/bin:$PATH
|
||||||
|
cov-build --dir cov-int cmake --build . --parallel 2
|
||||||
|
|
||||||
|
- name: Create tarball with scan results
|
||||||
|
shell: bash
|
||||||
|
working-directory: build
|
||||||
|
run: tar czf lammps.tgz cov-int
|
||||||
|
|
||||||
|
- name: Upload scan result to Coverity
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
curl --form token=${{ secrets.COVERITY_TOKEN }} \
|
||||||
|
--form email=${{ secrets.COVERITY_EMAIL }} \
|
||||||
|
--form file=@build/lammps.tgz \
|
||||||
|
--form version=${{ github.sha }} \
|
||||||
|
--form description="LAMMPS automated build" \
|
||||||
|
https://scan.coverity.com/builds?project=LAMMPS
|
||||||
12
.github/workflows/unittest-macos.yml
vendored
12
.github/workflows/unittest-macos.yml
vendored
@ -3,7 +3,11 @@ name: "Unittest for MacOS"
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [develop]
|
branches:
|
||||||
|
- develop
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
@ -17,7 +21,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
@ -28,7 +32,7 @@ jobs:
|
|||||||
run: mkdir build
|
run: mkdir build
|
||||||
|
|
||||||
- name: Set up ccache
|
- name: Set up ccache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ env.CCACHE_DIR }}
|
path: ${{ env.CCACHE_DIR }}
|
||||||
key: macos-ccache-${{ github.sha }}
|
key: macos-ccache-${{ github.sha }}
|
||||||
@ -39,9 +43,11 @@ jobs:
|
|||||||
working-directory: build
|
working-directory: build
|
||||||
run: |
|
run: |
|
||||||
ccache -z
|
ccache -z
|
||||||
|
python3 -m pip install numpy
|
||||||
python3 -m pip install pyyaml
|
python3 -m pip install pyyaml
|
||||||
cmake -C ../cmake/presets/clang.cmake \
|
cmake -C ../cmake/presets/clang.cmake \
|
||||||
-C ../cmake/presets/most.cmake \
|
-C ../cmake/presets/most.cmake \
|
||||||
|
-D DOWNLOAD_POTENTIALS=off \
|
||||||
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||||
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
|
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||||
-D ENABLE_TESTING=on \
|
-D ENABLE_TESTING=on \
|
||||||
|
|||||||
5
.gitignore
vendored
5
.gitignore
vendored
@ -55,3 +55,8 @@ out/RelWithDebInfo
|
|||||||
out/Release
|
out/Release
|
||||||
out/x86
|
out/x86
|
||||||
out/x64
|
out/x64
|
||||||
|
src/Makefile.package-e
|
||||||
|
src/Makefile.package.settings-e
|
||||||
|
/cmake/build/x64-Debug-Clang
|
||||||
|
/install/x64-GUI-MSVC
|
||||||
|
/install
|
||||||
|
|||||||
91
CITATION.cff
Normal file
91
CITATION.cff
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
# YAML 1.2
|
||||||
|
---
|
||||||
|
cff-version: 1.2.0
|
||||||
|
title: "LAMMPS: Large-scale Atomic/Molecular Massively Parallel Simulator"
|
||||||
|
type: software
|
||||||
|
authors:
|
||||||
|
- family-names: "Plimpton"
|
||||||
|
given-names: "Steven J."
|
||||||
|
- family-names: "Kohlmeyer"
|
||||||
|
given-names: "Axel"
|
||||||
|
orcid: "https://orcid.org/0000-0001-6204-6475"
|
||||||
|
- family-names: "Thompson"
|
||||||
|
given-names: "Aidan P."
|
||||||
|
orcid: "https://orcid.org/0000-0002-0324-9114"
|
||||||
|
- family-names: "Moore"
|
||||||
|
given-names: "Stan G."
|
||||||
|
- family-names: "Berger"
|
||||||
|
given-names: "Richard"
|
||||||
|
orcid: "https://orcid.org/0000-0002-3044-8266"
|
||||||
|
doi: 10.5281/zenodo.3726416
|
||||||
|
license: GPL-2.0-only
|
||||||
|
url: https://www.lammps.org
|
||||||
|
repository-code: https://github.com/lammps/lammps/
|
||||||
|
keywords:
|
||||||
|
- "Molecular Dynamics"
|
||||||
|
- "Materials Modeling"
|
||||||
|
message: "If you are referencing LAMMPS in a publication, please cite the paper below."
|
||||||
|
preferred-citation:
|
||||||
|
type: article
|
||||||
|
doi: "10.1016/j.cpc.2021.108171"
|
||||||
|
url: "https://www.sciencedirect.com/science/article/pii/S0010465521002836"
|
||||||
|
authors:
|
||||||
|
- family-names: "Thompson"
|
||||||
|
given-names: "Aidan P."
|
||||||
|
orcid: "https://orcid.org/0000-0002-0324-9114"
|
||||||
|
- family-names: "Aktulga"
|
||||||
|
given-names: "H. Metin"
|
||||||
|
- family-names: "Berger"
|
||||||
|
given-names: "Richard"
|
||||||
|
orcid: "https://orcid.org/0000-0002-3044-8266"
|
||||||
|
- family-names: "Bolintineanu"
|
||||||
|
given-names: "Dan S."
|
||||||
|
- family-names: "Brown"
|
||||||
|
given-names: "W. Michael"
|
||||||
|
- family-names: "Crozier"
|
||||||
|
given-names: "Paul S."
|
||||||
|
- family-names: "in 't Veld"
|
||||||
|
given-names: "Pieter J."
|
||||||
|
- family-names: "Kohlmeyer"
|
||||||
|
given-names: "Axel"
|
||||||
|
orcid: "https://orcid.org/0000-0001-6204-6475"
|
||||||
|
- family-names: "Moore"
|
||||||
|
given-names: "Stan G."
|
||||||
|
- family-names: "Nguyen"
|
||||||
|
given-names: "Trung Dac"
|
||||||
|
- family-names: "Shan"
|
||||||
|
given-names: "Ray"
|
||||||
|
- family-names: "Stevens"
|
||||||
|
given-names: "Mark J."
|
||||||
|
- family-names: "Tranchida"
|
||||||
|
given-names: "Julien"
|
||||||
|
- family-names: "Trott"
|
||||||
|
given-names: "Christian"
|
||||||
|
- family-names: "Plimpton"
|
||||||
|
given-names: "Steven J."
|
||||||
|
title: "LAMMPS - a flexible simulation tool for particle-based materials modeling at the atomic, meso, and continuum scales"
|
||||||
|
journal: "Computer Physics Communications"
|
||||||
|
keywords:
|
||||||
|
- Molecular dynamics
|
||||||
|
- Materials modeling
|
||||||
|
- Parallel algorithms
|
||||||
|
- LAMMPS
|
||||||
|
month: 2
|
||||||
|
volume: 271
|
||||||
|
issn: 0010-4655
|
||||||
|
pages: 108171
|
||||||
|
year: 2022
|
||||||
|
references:
|
||||||
|
- title: "Fast Parallel Algorithms for Short-Range Molecular Dynamics"
|
||||||
|
type: article
|
||||||
|
journal: Journal of Computational Physics
|
||||||
|
volume: 117
|
||||||
|
number: 1
|
||||||
|
pages: "1-19"
|
||||||
|
year: 1995
|
||||||
|
issn: 0021-9991
|
||||||
|
doi: 10.1006/jcph.1995.1039
|
||||||
|
url: https://www.sciencedirect.com/science/article/pii/S002199918571039X
|
||||||
|
authors:
|
||||||
|
- family-names: "Plimpton"
|
||||||
|
given-names: "Steve"
|
||||||
4
README
4
README
@ -16,8 +16,8 @@ National Laboratories, a US Department of Energy facility, with
|
|||||||
funding from the DOE. It is an open-source code, distributed freely
|
funding from the DOE. It is an open-source code, distributed freely
|
||||||
under the terms of the GNU Public License (GPL) version 2.
|
under the terms of the GNU Public License (GPL) version 2.
|
||||||
|
|
||||||
The primary author of the code is Steve Plimpton, who can be emailed
|
The code is maintained by the LAMMPS development team who can be emailed
|
||||||
at sjplimp@sandia.gov. The LAMMPS WWW Site at www.lammps.org has
|
at developers@lammps.org. The LAMMPS WWW Site at www.lammps.org has
|
||||||
more information about the code and its uses.
|
more information about the code and its uses.
|
||||||
|
|
||||||
The LAMMPS distribution includes the following files and directories:
|
The LAMMPS distribution includes the following files and directories:
|
||||||
|
|||||||
33
SECURITY.md
33
SECURITY.md
@ -19,9 +19,9 @@ kinds of filesystem manipulations. And because of that LAMMPS should
|
|||||||
"administrator" account directly or indirectly via "sudo" or "su".
|
"administrator" account directly or indirectly via "sudo" or "su".
|
||||||
|
|
||||||
Therefore what could be seen as a security vulnerability is usually
|
Therefore what could be seen as a security vulnerability is usually
|
||||||
either a user mistake or a bug in the code. Bugs can be reported in
|
either a user mistake or a bug in the code. Bugs can be reported in the
|
||||||
the LAMMPS project
|
LAMMPS project [issue tracker on
|
||||||
[issue tracker on GitHub](https://github.com/lammps/lammps/issues).
|
GitHub](https://github.com/lammps/lammps/issues).
|
||||||
|
|
||||||
To mitigate issues with using homoglyphs or bidirectional reordering in
|
To mitigate issues with using homoglyphs or bidirectional reordering in
|
||||||
unicode, which have been demonstrated as a vector to obfuscate and hide
|
unicode, which have been demonstrated as a vector to obfuscate and hide
|
||||||
@ -30,10 +30,23 @@ for unicode characters and only all-ASCII source code is accepted.
|
|||||||
|
|
||||||
# Version Updates
|
# Version Updates
|
||||||
|
|
||||||
LAMMPS follows continuous release development model. We aim to keep all
|
LAMMPS follows a continuous release development model. We aim to keep
|
||||||
release versions (stable or patch) fully functional and employ a variety
|
the development version (`develop` branch) always fully functional and
|
||||||
of automatic testing procedures to detect failures of existing
|
employ a variety of automatic testing procedures to detect failures of
|
||||||
functionality from adding new features before releases are made. Thus
|
existing functionality from adding or modifying features. Most of those
|
||||||
bugfixes and updates are only integrated into the current development
|
tests are run on pull requests and must be passed *before* merging to
|
||||||
branch and thus the next (patch) release and users are recommended to
|
the `develop` branch. The `develop` branch is protected, so all changes
|
||||||
update regularly.
|
*must* be submitted as a pull request and thus cannot avoid the
|
||||||
|
automated tests.
|
||||||
|
|
||||||
|
Additional tests are run *after* merging. Before releases are made
|
||||||
|
*all* tests must have cleared. Then a release tag is applied and the
|
||||||
|
`release` branch is fast-forwarded to that tag. This is referred to to
|
||||||
|
as a "feature release". Bug fixes and updates are applied first to the
|
||||||
|
`develop` branch. Later, they appear in the `release` branch when the
|
||||||
|
next patch release occurs. For stable releases, backported bug fixes
|
||||||
|
and infrastructure updates are first applied to the `maintenance` branch
|
||||||
|
and then merged to `stable` and published as "updates". For a new
|
||||||
|
stable release the `stable` branch is updated to the corresponding state
|
||||||
|
of the `release` branch and a new stable tag is applied in addition to
|
||||||
|
the release tag.
|
||||||
|
|||||||
@ -1,615 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
|
||||||
# When using CMake 3.4 and later, don't export symbols from executables unless
|
|
||||||
# the CMAKE_ENABLE_EXPORTS variable is set.
|
|
||||||
if(POLICY CMP0065)
|
|
||||||
cmake_policy(SET CMP0065 NEW)
|
|
||||||
endif()
|
|
||||||
if (POLICY CMP0077)
|
|
||||||
cmake_policy(SET CMP0077 NEW)
|
|
||||||
endif()
|
|
||||||
if(CMAKE_EXECUTABLE_SUFFIX)
|
|
||||||
set(CMAKE_EXECUTABLE_SUFFIX_TMP ${CMAKE_EXECUTABLE_SUFFIX})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
project(libjpeg-turbo C)
|
|
||||||
set(VERSION 2.1.3)
|
|
||||||
set(COPYRIGHT_YEAR "1991-2022")
|
|
||||||
string(REPLACE "." ";" VERSION_TRIPLET ${VERSION})
|
|
||||||
list(GET VERSION_TRIPLET 0 VERSION_MAJOR)
|
|
||||||
list(GET VERSION_TRIPLET 1 VERSION_MINOR)
|
|
||||||
list(GET VERSION_TRIPLET 2 VERSION_REVISION)
|
|
||||||
function(pad_number NUMBER OUTPUT_LEN)
|
|
||||||
string(LENGTH "${${NUMBER}}" INPUT_LEN)
|
|
||||||
if(INPUT_LEN LESS OUTPUT_LEN)
|
|
||||||
math(EXPR ZEROES "${OUTPUT_LEN} - ${INPUT_LEN} - 1")
|
|
||||||
set(NUM ${${NUMBER}})
|
|
||||||
foreach(C RANGE ${ZEROES})
|
|
||||||
set(NUM "0${NUM}")
|
|
||||||
endforeach()
|
|
||||||
set(${NUMBER} ${NUM} PARENT_SCOPE)
|
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
pad_number(VERSION_MINOR 3)
|
|
||||||
pad_number(VERSION_REVISION 3)
|
|
||||||
set(LIBJPEG_TURBO_VERSION_NUMBER ${VERSION_MAJOR}${VERSION_MINOR}${VERSION_REVISION})
|
|
||||||
|
|
||||||
# CMake 3.14 and later sets CMAKE_MACOSX_BUNDLE to TRUE by default when
|
|
||||||
# CMAKE_SYSTEM_NAME is iOS, tvOS, or watchOS, which breaks the libjpeg-turbo
|
|
||||||
# build. (Specifically, when CMAKE_MACOSX_BUNDLE is TRUE, executables for
|
|
||||||
# Apple platforms are built as application bundles, which causes CMake to
|
|
||||||
# complain that our install() directives for executables do not specify a
|
|
||||||
# BUNDLE DESTINATION. Even if CMake did not complain, building executables as
|
|
||||||
# application bundles would break our iOS packages.)
|
|
||||||
set(CMAKE_MACOSX_BUNDLE FALSE)
|
|
||||||
|
|
||||||
string(TIMESTAMP DEFAULT_BUILD "%Y%m%d")
|
|
||||||
set(BUILD ${DEFAULT_BUILD} CACHE STRING "Build string (default: ${DEFAULT_BUILD})")
|
|
||||||
|
|
||||||
# NOTE: On Windows, this does nothing except when using MinGW or Cygwin.
|
|
||||||
# CMAKE_BUILD_TYPE has no meaning in Visual Studio, and it always defaults to
|
|
||||||
# Debug when using NMake.
|
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
|
||||||
set(CMAKE_BUILD_TYPE Release)
|
|
||||||
endif()
|
|
||||||
message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
|
|
||||||
|
|
||||||
message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}")
|
|
||||||
|
|
||||||
include(cmakescripts/PackageInfo.cmake)
|
|
||||||
|
|
||||||
# Detect CPU type and whether we're building 64-bit or 32-bit code
|
|
||||||
math(EXPR BITS "${CMAKE_SIZEOF_VOID_P} * 8")
|
|
||||||
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_LC)
|
|
||||||
set(COUNT 1)
|
|
||||||
foreach(ARCH ${CMAKE_OSX_ARCHITECTURES})
|
|
||||||
if(COUNT GREATER 1)
|
|
||||||
message(FATAL_ERROR "The libjpeg-turbo build system does not support multiple values in CMAKE_OSX_ARCHITECTURES.")
|
|
||||||
endif()
|
|
||||||
math(EXPR COUNT "${COUNT}+1")
|
|
||||||
endforeach()
|
|
||||||
if(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86_64" OR
|
|
||||||
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "amd64" OR
|
|
||||||
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "i[0-9]86" OR
|
|
||||||
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86" OR
|
|
||||||
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "ia32")
|
|
||||||
if(BITS EQUAL 64 OR CMAKE_C_COMPILER_ABI MATCHES "ELF X32")
|
|
||||||
set(CPU_TYPE x86_64)
|
|
||||||
else()
|
|
||||||
set(CPU_TYPE i386)
|
|
||||||
endif()
|
|
||||||
if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ${CPU_TYPE})
|
|
||||||
set(CMAKE_SYSTEM_PROCESSOR ${CPU_TYPE})
|
|
||||||
endif()
|
|
||||||
elseif(CMAKE_SYSTEM_PROCESSOR_LC STREQUAL "aarch64" OR
|
|
||||||
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^arm")
|
|
||||||
if(BITS EQUAL 64)
|
|
||||||
set(CPU_TYPE arm64)
|
|
||||||
else()
|
|
||||||
set(CPU_TYPE arm)
|
|
||||||
endif()
|
|
||||||
elseif(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^ppc" OR
|
|
||||||
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^powerpc")
|
|
||||||
set(CPU_TYPE powerpc)
|
|
||||||
else()
|
|
||||||
set(CPU_TYPE ${CMAKE_SYSTEM_PROCESSOR_LC})
|
|
||||||
endif()
|
|
||||||
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR
|
|
||||||
CMAKE_OSX_ARCHITECTURES MATCHES "arm64" OR
|
|
||||||
CMAKE_OSX_ARCHITECTURES MATCHES "i386")
|
|
||||||
set(CPU_TYPE ${CMAKE_OSX_ARCHITECTURES})
|
|
||||||
endif()
|
|
||||||
if(CMAKE_OSX_ARCHITECTURES MATCHES "ppc")
|
|
||||||
set(CPU_TYPE powerpc)
|
|
||||||
endif()
|
|
||||||
if(MSVC_IDE AND CMAKE_GENERATOR_PLATFORM MATCHES "arm64")
|
|
||||||
set(CPU_TYPE arm64)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message(STATUS "${BITS}-bit build (${CPU_TYPE})")
|
|
||||||
|
|
||||||
macro(report_directory var)
|
|
||||||
if(CMAKE_INSTALL_${var} STREQUAL CMAKE_INSTALL_FULL_${var})
|
|
||||||
message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}}")
|
|
||||||
else()
|
|
||||||
message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}} (${CMAKE_INSTALL_FULL_${var}})")
|
|
||||||
endif()
|
|
||||||
mark_as_advanced(CLEAR CMAKE_INSTALL_${var})
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
set(DIRLIST "BINDIR;DATAROOTDIR;DOCDIR;INCLUDEDIR;LIBDIR")
|
|
||||||
if(UNIX)
|
|
||||||
list(APPEND DIRLIST "MANDIR")
|
|
||||||
endif()
|
|
||||||
foreach(dir ${DIRLIST})
|
|
||||||
report_directory(${dir})
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# CONFIGURATION OPTIONS
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
macro(boolean_number var)
|
|
||||||
if(${var})
|
|
||||||
set(${var} 1 ${ARGN})
|
|
||||||
else()
|
|
||||||
set(${var} 0 ${ARGN})
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
option(ENABLE_SHARED "Build shared libraries" FALSE)
|
|
||||||
boolean_number(ENABLE_SHARED)
|
|
||||||
option(ENABLE_STATIC "Build static libraries" TRUE)
|
|
||||||
boolean_number(ENABLE_STATIC)
|
|
||||||
option(REQUIRE_SIMD "Generate a fatal error if SIMD extensions are not available for this platform (default is to fall back to a non-SIMD build)" FALSE)
|
|
||||||
boolean_number(REQUIRE_SIMD)
|
|
||||||
option(WITH_12BIT "Encode/decode JPEG images with 12-bit samples (implies WITH_ARITH_DEC=0 WITH_ARITH_ENC=0 WITH_JAVA=0 WITH_SIMD=0 WITH_TURBOJPEG=0 )" FALSE)
|
|
||||||
boolean_number(WITH_12BIT)
|
|
||||||
option(WITH_ARITH_DEC "Include arithmetic decoding support when emulating the libjpeg v6b API/ABI" TRUE)
|
|
||||||
boolean_number(WITH_ARITH_DEC)
|
|
||||||
option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" TRUE)
|
|
||||||
boolean_number(WITH_ARITH_ENC)
|
|
||||||
if(CMAKE_C_COMPILER_ABI MATCHES "ELF X32")
|
|
||||||
set(WITH_JAVA 0)
|
|
||||||
else()
|
|
||||||
option(WITH_JAVA "Build Java wrapper for the TurboJPEG API library (implies ENABLE_SHARED=1)" FALSE)
|
|
||||||
boolean_number(WITH_JAVA)
|
|
||||||
endif()
|
|
||||||
option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE)
|
|
||||||
boolean_number(WITH_JPEG7)
|
|
||||||
option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE)
|
|
||||||
boolean_number(WITH_JPEG8)
|
|
||||||
option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI" TRUE)
|
|
||||||
boolean_number(WITH_MEM_SRCDST)
|
|
||||||
option(WITH_SIMD "Include SIMD extensions, if available for this platform" FALSE)
|
|
||||||
boolean_number(WITH_SIMD)
|
|
||||||
option(WITH_TURBOJPEG "Include the TurboJPEG API library and associated test programs" FALSE)
|
|
||||||
boolean_number(WITH_TURBOJPEG)
|
|
||||||
option(WITH_FUZZ "Build fuzz targets" FALSE)
|
|
||||||
|
|
||||||
macro(report_option var desc)
|
|
||||||
if(${var})
|
|
||||||
message(STATUS "${desc} enabled (${var} = ${${var}})")
|
|
||||||
else()
|
|
||||||
message(STATUS "${desc} disabled (${var} = ${${var}})")
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
if(WITH_JAVA)
|
|
||||||
set(ENABLE_SHARED 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Explicitly setting CMAKE_POSITION_INDEPENDENT_CODE=FALSE disables PIC for all
|
|
||||||
# targets, which will cause the shared library builds to fail. Thus, if shared
|
|
||||||
# libraries are enabled and CMAKE_POSITION_INDEPENDENT_CODE is explicitly set
|
|
||||||
# to FALSE, we need to unset it, thus restoring the default behavior
|
|
||||||
# (automatically using PIC for shared library targets.)
|
|
||||||
if(DEFINED CMAKE_POSITION_INDEPENDENT_CODE AND
|
|
||||||
NOT CMAKE_POSITION_INDEPENDENT_CODE AND ENABLE_SHARED)
|
|
||||||
unset(CMAKE_POSITION_INDEPENDENT_CODE CACHE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
report_option(ENABLE_SHARED "Shared libraries")
|
|
||||||
report_option(ENABLE_STATIC "Static libraries")
|
|
||||||
|
|
||||||
if(ENABLE_SHARED)
|
|
||||||
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_JPEG8 OR WITH_JPEG7)
|
|
||||||
set(WITH_ARITH_ENC 1)
|
|
||||||
set(WITH_ARITH_DEC 1)
|
|
||||||
endif()
|
|
||||||
if(WITH_JPEG8)
|
|
||||||
set(WITH_MEM_SRCDST 0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_12BIT)
|
|
||||||
set(WITH_ARITH_DEC 0)
|
|
||||||
set(WITH_ARITH_ENC 0)
|
|
||||||
set(WITH_JAVA 0)
|
|
||||||
set(WITH_SIMD 0)
|
|
||||||
set(WITH_TURBOJPEG 0)
|
|
||||||
set(BITS_IN_JSAMPLE 12)
|
|
||||||
else()
|
|
||||||
set(BITS_IN_JSAMPLE 8)
|
|
||||||
endif()
|
|
||||||
report_option(WITH_12BIT "12-bit JPEG support")
|
|
||||||
|
|
||||||
if(WITH_ARITH_DEC)
|
|
||||||
set(D_ARITH_CODING_SUPPORTED 1)
|
|
||||||
endif()
|
|
||||||
if(NOT WITH_12BIT)
|
|
||||||
report_option(WITH_ARITH_DEC "Arithmetic decoding support")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_ARITH_ENC)
|
|
||||||
set(C_ARITH_CODING_SUPPORTED 1)
|
|
||||||
endif()
|
|
||||||
if(NOT WITH_12BIT)
|
|
||||||
report_option(WITH_ARITH_ENC "Arithmetic encoding support")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT WITH_12BIT)
|
|
||||||
report_option(WITH_TURBOJPEG "TurboJPEG API library")
|
|
||||||
report_option(WITH_JAVA "TurboJPEG Java wrapper")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_MEM_SRCDST)
|
|
||||||
set(MEM_SRCDST_SUPPORTED 1)
|
|
||||||
set(MEM_SRCDST_FUNCTIONS "global: jpeg_mem_dest; jpeg_mem_src;")
|
|
||||||
endif()
|
|
||||||
if(NOT WITH_JPEG8)
|
|
||||||
report_option(WITH_MEM_SRCDST "In-memory source/destination managers")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(SO_AGE 2)
|
|
||||||
if(WITH_MEM_SRCDST)
|
|
||||||
set(SO_AGE 3)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_JPEG8)
|
|
||||||
set(JPEG_LIB_VERSION 80)
|
|
||||||
elseif(WITH_JPEG7)
|
|
||||||
set(JPEG_LIB_VERSION 70)
|
|
||||||
else()
|
|
||||||
set(JPEG_LIB_VERSION 62)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
math(EXPR JPEG_LIB_VERSION_DIV10 "${JPEG_LIB_VERSION} / 10")
|
|
||||||
math(EXPR JPEG_LIB_VERSION_MOD10 "${JPEG_LIB_VERSION} % 10")
|
|
||||||
if(JPEG_LIB_VERSION STREQUAL "62")
|
|
||||||
set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION})
|
|
||||||
else()
|
|
||||||
set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION_DIV10})
|
|
||||||
endif()
|
|
||||||
if(JPEG_LIB_VERSION STREQUAL "80")
|
|
||||||
set(DEFAULT_SO_MINOR_VERSION 2)
|
|
||||||
else()
|
|
||||||
set(DEFAULT_SO_MINOR_VERSION 0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# This causes SO_MAJOR_VERSION/SO_MINOR_VERSION to reset to defaults if
|
|
||||||
# WITH_JPEG7 or WITH_JPEG8 has changed.
|
|
||||||
if((DEFINED WITH_JPEG7_INT AND NOT WITH_JPEG7 EQUAL WITH_JPEG7_INT) OR
|
|
||||||
(DEFINED WITH_JPEG8_INT AND NOT WITH_JPEG8 EQUAL WITH_JPEG8_INT))
|
|
||||||
set(FORCE_SO_VERSION "FORCE")
|
|
||||||
endif()
|
|
||||||
set(WITH_JPEG7_INT ${WITH_JPEG7} CACHE INTERNAL "")
|
|
||||||
set(WITH_JPEG8_INT ${WITH_JPEG8} CACHE INTERNAL "")
|
|
||||||
|
|
||||||
set(SO_MAJOR_VERSION ${DEFAULT_SO_MAJOR_VERSION} CACHE STRING
|
|
||||||
"Major version of the libjpeg API shared library (default: ${DEFAULT_SO_MAJOR_VERSION})"
|
|
||||||
${FORCE_SO_VERSION})
|
|
||||||
set(SO_MINOR_VERSION ${DEFAULT_SO_MINOR_VERSION} CACHE STRING
|
|
||||||
"Minor version of the libjpeg API shared library (default: ${DEFAULT_SO_MINOR_VERSION})"
|
|
||||||
${FORCE_SO_VERSION})
|
|
||||||
|
|
||||||
set(JPEG_LIB_VERSION_DECIMAL "${JPEG_LIB_VERSION_DIV10}.${JPEG_LIB_VERSION_MOD10}")
|
|
||||||
message(STATUS "Emulating libjpeg API/ABI v${JPEG_LIB_VERSION_DECIMAL} (WITH_JPEG7 = ${WITH_JPEG7}, WITH_JPEG8 = ${WITH_JPEG8})")
|
|
||||||
message(STATUS "libjpeg API shared library version = ${SO_MAJOR_VERSION}.${SO_AGE}.${SO_MINOR_VERSION}")
|
|
||||||
|
|
||||||
# Because the TurboJPEG API library uses versioned symbols and changes the
|
|
||||||
# names of functions whenever they are modified in a backward-incompatible
|
|
||||||
# manner, it is always backward-ABI-compatible with itself, so the major and
|
|
||||||
# minor SO versions don't change. However, we increase the middle number (the
|
|
||||||
# SO "age") whenever functions are added to the API.
|
|
||||||
set(TURBOJPEG_SO_MAJOR_VERSION 0)
|
|
||||||
set(TURBOJPEG_SO_AGE 2)
|
|
||||||
set(TURBOJPEG_SO_VERSION 0.${TURBOJPEG_SO_AGE}.0)
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# COMPILER SETTINGS
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
option(WITH_CRT_DLL
|
|
||||||
"Link all ${CMAKE_PROJECT_NAME} libraries and executables with the C run-time DLL (msvcr*.dll) instead of the static C run-time library (libcmt*.lib.) The default is to use the C run-time DLL only with the libraries and executables that need it."
|
|
||||||
FALSE)
|
|
||||||
if(NOT WITH_CRT_DLL)
|
|
||||||
# Use the static C library for all build types
|
|
||||||
foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
|
||||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
|
||||||
if(${var} MATCHES "/MD")
|
|
||||||
string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
||||||
# Use the maximum optimization level for release builds
|
|
||||||
foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO)
|
|
||||||
if(${var} MATCHES "-O2")
|
|
||||||
string(REGEX REPLACE "-O2" "-O3" ${var} "${${var}}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
|
||||||
if(CMAKE_C_COMPILER_ID MATCHES "SunPro")
|
|
||||||
# Use the maximum optimization level for release builds
|
|
||||||
foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO)
|
|
||||||
if(${var} MATCHES "-xO3")
|
|
||||||
string(REGEX REPLACE "-xO3" "-xO5" ${var} "${${var}}")
|
|
||||||
endif()
|
|
||||||
if(${var} MATCHES "-xO2")
|
|
||||||
string(REGEX REPLACE "-xO2" "-xO5" ${var} "${${var}}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
|
|
||||||
|
|
||||||
set(EFFECTIVE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
|
|
||||||
message(STATUS "Compiler flags = ${EFFECTIVE_C_FLAGS}")
|
|
||||||
|
|
||||||
set(EFFECTIVE_LD_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
|
|
||||||
message(STATUS "Linker flags = ${EFFECTIVE_LD_FLAGS}")
|
|
||||||
|
|
||||||
include(CheckCSourceCompiles)
|
|
||||||
include(CheckIncludeFiles)
|
|
||||||
include(CheckTypeSize)
|
|
||||||
|
|
||||||
check_type_size("size_t" SIZE_T)
|
|
||||||
check_type_size("unsigned long" UNSIGNED_LONG)
|
|
||||||
|
|
||||||
if(SIZE_T EQUAL UNSIGNED_LONG)
|
|
||||||
check_c_source_compiles("int main(int argc, char **argv) { unsigned long a = argc; return __builtin_ctzl(a); }"
|
|
||||||
HAVE_BUILTIN_CTZL)
|
|
||||||
endif()
|
|
||||||
if(MSVC)
|
|
||||||
check_include_files("intrin.h" HAVE_INTRIN_H)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
if(CMAKE_CROSSCOMPILING)
|
|
||||||
set(RIGHT_SHIFT_IS_UNSIGNED 0)
|
|
||||||
else()
|
|
||||||
include(CheckCSourceRuns)
|
|
||||||
check_c_source_runs("
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
int is_shifting_signed (long arg) {
|
|
||||||
long res = arg >> 4;
|
|
||||||
if (res == -0x7F7E80CL)
|
|
||||||
return 1; /* right shift is signed */
|
|
||||||
/* see if unsigned-shift hack will fix it. */
|
|
||||||
/* we can't just test exact value since it depends on width of long... */
|
|
||||||
res |= (~0L) << (32-4);
|
|
||||||
if (res == -0x7F7E80CL)
|
|
||||||
return 0; /* right shift is unsigned */
|
|
||||||
printf(\"Right shift isn't acting as I expect it to.\\\\n\");
|
|
||||||
printf(\"I fear the JPEG software will not work at all.\\\\n\\\\n\");
|
|
||||||
return 0; /* try it with unsigned anyway */
|
|
||||||
}
|
|
||||||
int main (void) {
|
|
||||||
exit(is_shifting_signed(-0x7F7E80B1L));
|
|
||||||
}" RIGHT_SHIFT_IS_UNSIGNED)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
set(INLINE_OPTIONS "__inline;inline")
|
|
||||||
else()
|
|
||||||
set(INLINE_OPTIONS "__inline__;inline")
|
|
||||||
endif()
|
|
||||||
option(FORCE_INLINE "Force function inlining" TRUE)
|
|
||||||
boolean_number(FORCE_INLINE)
|
|
||||||
if(FORCE_INLINE)
|
|
||||||
if(MSVC)
|
|
||||||
list(INSERT INLINE_OPTIONS 0 "__forceinline")
|
|
||||||
else()
|
|
||||||
list(INSERT INLINE_OPTIONS 0 "inline __attribute__((always_inline))")
|
|
||||||
list(INSERT INLINE_OPTIONS 0 "__inline__ __attribute__((always_inline))")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
foreach(inline ${INLINE_OPTIONS})
|
|
||||||
check_c_source_compiles("${inline} static int foo(void) { return 0; } int main(void) { return foo(); }"
|
|
||||||
INLINE_WORKS)
|
|
||||||
if(INLINE_WORKS)
|
|
||||||
set(INLINE ${inline})
|
|
||||||
break()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
if(NOT INLINE_WORKS)
|
|
||||||
message(FATAL_ERROR "Could not determine how to inline functions.")
|
|
||||||
endif()
|
|
||||||
message(STATUS "INLINE = ${INLINE} (FORCE_INLINE = ${FORCE_INLINE})")
|
|
||||||
|
|
||||||
if(WITH_TURBOJPEG)
|
|
||||||
if(MSVC)
|
|
||||||
set(THREAD_LOCAL "__declspec(thread)")
|
|
||||||
else()
|
|
||||||
set(THREAD_LOCAL "__thread")
|
|
||||||
endif()
|
|
||||||
check_c_source_compiles("${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }" HAVE_THREAD_LOCAL)
|
|
||||||
if(HAVE_THREAD_LOCAL)
|
|
||||||
message(STATUS "THREAD_LOCAL = ${THREAD_LOCAL}")
|
|
||||||
else()
|
|
||||||
message(WARNING "Thread-local storage is not available. The TurboJPEG API library's global error handler will not be thread-safe.")
|
|
||||||
unset(THREAD_LOCAL)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map "VERS_1 { global: *; };")
|
|
||||||
set(CMAKE_REQUIRED_FLAGS
|
|
||||||
"-Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
|
||||||
check_c_source_compiles("int main(void) { return 0; }" HAVE_VERSION_SCRIPT)
|
|
||||||
set(CMAKE_REQUIRED_FLAGS)
|
|
||||||
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map)
|
|
||||||
if(HAVE_VERSION_SCRIPT)
|
|
||||||
message(STATUS "Linker supports GNU-style version scripts")
|
|
||||||
set(MAPFLAG "-Wl,--version-script,")
|
|
||||||
set(TJMAPFLAG "-Wl,--version-script,")
|
|
||||||
else()
|
|
||||||
message(STATUS "Linker does not support GNU-style version scripts")
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
|
||||||
# The Solaris linker doesn't like our version script for the libjpeg API
|
|
||||||
# library, but the version script for the TurboJPEG API library should
|
|
||||||
# still work.
|
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map
|
|
||||||
"VERS_1 { global: foo; local: *; }; VERS_2 { global: foo2; } VERS_1;")
|
|
||||||
set(CMAKE_REQUIRED_FLAGS "-Wl,-M,${CMAKE_CURRENT_BINARY_DIR}/conftest.map -shared")
|
|
||||||
check_c_source_compiles("int foo() { return 0; } int foo2() { return 2; }"
|
|
||||||
HAVE_MAPFILE)
|
|
||||||
set(CMAKE_REQUIRED_FLAGS)
|
|
||||||
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map)
|
|
||||||
if(HAVE_MAPFILE)
|
|
||||||
message(STATUS "Linker supports mapfiles")
|
|
||||||
set(TJMAPFLAG "-Wl,-M,")
|
|
||||||
else()
|
|
||||||
message(STATUS "Linker does not support mapfiles")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Generate files
|
|
||||||
if(WIN32)
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/win/jconfig.h.in jconfig.h)
|
|
||||||
else()
|
|
||||||
configure_file(jconfig.h.in jconfig.h)
|
|
||||||
endif()
|
|
||||||
configure_file(jconfigint.h.in jconfigint.h)
|
|
||||||
configure_file(jversion.h.in jversion.h)
|
|
||||||
if(UNIX)
|
|
||||||
configure_file(libjpeg.map.in libjpeg.map)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Include directories and compiler definitions
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# TARGETS
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
if(CMAKE_EXECUTABLE_SUFFIX_TMP)
|
|
||||||
set(CMAKE_EXECUTABLE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX_TMP})
|
|
||||||
endif()
|
|
||||||
message(STATUS "CMAKE_EXECUTABLE_SUFFIX = ${CMAKE_EXECUTABLE_SUFFIX}")
|
|
||||||
|
|
||||||
set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c
|
|
||||||
jcicc.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c
|
|
||||||
jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c
|
|
||||||
jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdicc.c jdinput.c
|
|
||||||
jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c
|
|
||||||
jdtrans.c jerror.c jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c
|
|
||||||
jidctint.c jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c)
|
|
||||||
|
|
||||||
if(WITH_ARITH_ENC OR WITH_ARITH_DEC)
|
|
||||||
set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_ARITH_ENC)
|
|
||||||
set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_ARITH_DEC)
|
|
||||||
set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_SIMD)
|
|
||||||
add_subdirectory(simd)
|
|
||||||
if(NEON_INTRINSICS)
|
|
||||||
add_definitions(-DNEON_INTRINSICS)
|
|
||||||
endif()
|
|
||||||
elseif(NOT WITH_12BIT)
|
|
||||||
message(STATUS "SIMD extensions: None (WITH_SIMD = ${WITH_SIMD})")
|
|
||||||
endif()
|
|
||||||
if(WITH_SIMD)
|
|
||||||
message(STATUS "SIMD extensions: ${CPU_TYPE} (WITH_SIMD = ${WITH_SIMD})")
|
|
||||||
if(MSVC_IDE OR XCODE)
|
|
||||||
set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
add_library(simd OBJECT jsimd_none.c)
|
|
||||||
if(NOT WIN32 AND (CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED))
|
|
||||||
set_target_properties(simd PROPERTIES POSITION_INDEPENDENT_CODE 1)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_JAVA)
|
|
||||||
add_subdirectory(java)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_SHARED)
|
|
||||||
add_subdirectory(sharedlib)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_STATIC)
|
|
||||||
add_library(jpeg-static STATIC ${JPEG_SOURCES} $<TARGET_OBJECTS:simd>
|
|
||||||
${SIMD_OBJS})
|
|
||||||
if(NOT MSVC)
|
|
||||||
set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_TURBOJPEG)
|
|
||||||
if(ENABLE_SHARED)
|
|
||||||
set(TURBOJPEG_SOURCES ${JPEG_SOURCES} $<TARGET_OBJECTS:simd> ${SIMD_OBJS}
|
|
||||||
turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c rdbmp.c rdppm.c
|
|
||||||
wrbmp.c wrppm.c)
|
|
||||||
set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg-mapfile)
|
|
||||||
if(WITH_JAVA)
|
|
||||||
set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c)
|
|
||||||
include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
|
|
||||||
set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg-mapfile.jni)
|
|
||||||
endif()
|
|
||||||
if(MSVC)
|
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/win/turbojpeg.rc.in
|
|
||||||
${CMAKE_BINARY_DIR}/win/turbojpeg.rc)
|
|
||||||
set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES}
|
|
||||||
${CMAKE_BINARY_DIR}/win/turbojpeg.rc)
|
|
||||||
endif()
|
|
||||||
add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES})
|
|
||||||
set_property(TARGET turbojpeg PROPERTY COMPILE_FLAGS
|
|
||||||
"-DBMP_SUPPORTED -DPPM_SUPPORTED")
|
|
||||||
if(WIN32)
|
|
||||||
set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE)
|
|
||||||
endif()
|
|
||||||
if(MINGW)
|
|
||||||
set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at)
|
|
||||||
endif()
|
|
||||||
if(APPLE AND (NOT CMAKE_OSX_DEPLOYMENT_TARGET OR
|
|
||||||
CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.4))
|
|
||||||
if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
|
|
||||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
|
|
||||||
endif()
|
|
||||||
set_target_properties(turbojpeg PROPERTIES MACOSX_RPATH 1)
|
|
||||||
endif()
|
|
||||||
set_target_properties(turbojpeg PROPERTIES
|
|
||||||
SOVERSION ${TURBOJPEG_SO_MAJOR_VERSION} VERSION ${TURBOJPEG_SO_VERSION})
|
|
||||||
if(TJMAPFLAG)
|
|
||||||
set_target_properties(turbojpeg PROPERTIES
|
|
||||||
LINK_FLAGS "${TJMAPFLAG}${TJMAPFILE}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_STATIC)
|
|
||||||
add_library(turbojpeg-static STATIC ${JPEG_SOURCES} $<TARGET_OBJECTS:simd>
|
|
||||||
${SIMD_OBJS} turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c rdbmp.c
|
|
||||||
rdppm.c wrbmp.c wrppm.c)
|
|
||||||
set_property(TARGET turbojpeg-static PROPERTY COMPILE_FLAGS
|
|
||||||
"-DBMP_SUPPORTED -DPPM_SUPPORTED")
|
|
||||||
if(NOT MSVC)
|
|
||||||
set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
set(USE_SETMODE "-DUSE_SETMODE")
|
|
||||||
endif()
|
|
||||||
if(WITH_12BIT)
|
|
||||||
set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED ${USE_SETMODE}")
|
|
||||||
else()
|
|
||||||
set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED ${USE_SETMODE}")
|
|
||||||
set(CJPEG_BMP_SOURCES rdbmp.c rdtarga.c)
|
|
||||||
set(DJPEG_BMP_SOURCES wrbmp.c wrtarga.c)
|
|
||||||
endif()
|
|
||||||
@ -1,741 +0,0 @@
|
|||||||
# CMakeLists.txt
|
|
||||||
|
|
||||||
# Copyright (C) 2018 Cosmin Truta
|
|
||||||
# Copyright (C) 2007,2009-2018 Glenn Randers-Pehrson
|
|
||||||
# Written by Christian Ehrlicher, 2007
|
|
||||||
# Revised by Roger Lowman, 2009-2010
|
|
||||||
# Revised by Clifford Yapp, 2011-2012,2017
|
|
||||||
# Revised by Roger Leigh, 2016
|
|
||||||
# Revised by Andreas Franek, 2016
|
|
||||||
# Revised by Sam Serrels, 2017
|
|
||||||
# Revised by Vadim Barkov, 2017
|
|
||||||
# Revised by Vicky Pfau, 2018
|
|
||||||
# Revised by Cameron Cawley, 2018
|
|
||||||
# Revised by Cosmin Truta, 2018
|
|
||||||
# Revised by Kyle Bentley, 2018
|
|
||||||
|
|
||||||
# This code is released under the libpng license.
|
|
||||||
# For conditions of distribution and use, see the disclaimer
|
|
||||||
# and license in png.h
|
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.10)
|
|
||||||
cmake_policy(VERSION 3.1)
|
|
||||||
# When using CMake 3.4 and later, don't export symbols from executables unless
|
|
||||||
# the CMAKE_ENABLE_EXPORTS variable is set.
|
|
||||||
if(POLICY CMP0065)
|
|
||||||
cmake_policy(SET CMP0065 NEW)
|
|
||||||
endif()
|
|
||||||
if (POLICY CMP0077)
|
|
||||||
cmake_policy(SET CMP0077 NEW)
|
|
||||||
endif()
|
|
||||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
|
|
||||||
|
|
||||||
project(libpng C ASM)
|
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
set(PNGLIB_MAJOR 1)
|
|
||||||
set(PNGLIB_MINOR 6)
|
|
||||||
set(PNGLIB_RELEASE 37)
|
|
||||||
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
|
||||||
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
# needed packages
|
|
||||||
|
|
||||||
# Allow users to specify location of Zlib.
|
|
||||||
# Useful if zlib is being built alongside this as a sub-project.
|
|
||||||
option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" ON)
|
|
||||||
|
|
||||||
if(NOT PNG_BUILD_ZLIB)
|
|
||||||
find_package(ZLIB REQUIRED)
|
|
||||||
include_directories(${ZLIB_INCLUDE_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
|
|
||||||
find_library(M_LIBRARY m)
|
|
||||||
else()
|
|
||||||
# libm is not needed and/or not available
|
|
||||||
set(M_LIBRARY "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# COMMAND LINE OPTIONS
|
|
||||||
option(PNG_SHARED "Build shared lib" OFF)
|
|
||||||
option(PNG_STATIC "Build static lib" ON)
|
|
||||||
option(PNG_TESTS "Build libpng tests" OFF)
|
|
||||||
|
|
||||||
# Many more configuration options could be added here
|
|
||||||
option(PNG_FRAMEWORK "Build OS X framework" OFF)
|
|
||||||
option(PNG_DEBUG "Build with debug output" OFF)
|
|
||||||
option(PNG_HARDWARE_OPTIMIZATIONS "Enable hardware optimizations" OFF)
|
|
||||||
|
|
||||||
set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
|
|
||||||
set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
|
|
||||||
|
|
||||||
if(PNG_HARDWARE_OPTIMIZATIONS)
|
|
||||||
|
|
||||||
# set definitions and sources for arm
|
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
|
|
||||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
|
|
||||||
set(PNG_ARM_NEON_POSSIBLE_VALUES check on off)
|
|
||||||
set(PNG_ARM_NEON "check" CACHE STRING "Enable ARM NEON optimizations:
|
|
||||||
check: (default) use internal checking code;
|
|
||||||
off: disable the optimizations;
|
|
||||||
on: turn on unconditionally.")
|
|
||||||
set_property(CACHE PNG_ARM_NEON PROPERTY STRINGS
|
|
||||||
${PNG_ARM_NEON_POSSIBLE_VALUES})
|
|
||||||
list(FIND PNG_ARM_NEON_POSSIBLE_VALUES ${PNG_ARM_NEON} index)
|
|
||||||
if(index EQUAL -1)
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"PNG_ARM_NEON must be one of [${PNG_ARM_NEON_POSSIBLE_VALUES}]")
|
|
||||||
elseif(NOT ${PNG_ARM_NEON} STREQUAL "off")
|
|
||||||
set(libpng_arm_sources
|
|
||||||
arm/arm_init.c
|
|
||||||
arm/filter_neon.S
|
|
||||||
arm/filter_neon_intrinsics.c
|
|
||||||
arm/palette_neon_intrinsics.c)
|
|
||||||
|
|
||||||
if(${PNG_ARM_NEON} STREQUAL "on")
|
|
||||||
add_definitions(-DPNG_ARM_NEON_OPT=2)
|
|
||||||
elseif(${PNG_ARM_NEON} STREQUAL "check")
|
|
||||||
add_definitions(-DPNG_ARM_NEON_CHECK_SUPPORTED)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
add_definitions(-DPNG_ARM_NEON_OPT=0)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# set definitions and sources for powerpc
|
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
|
|
||||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*")
|
|
||||||
set(PNG_POWERPC_VSX_POSSIBLE_VALUES on off)
|
|
||||||
set(PNG_POWERPC_VSX "on" CACHE STRING "Enable POWERPC VSX optimizations:
|
|
||||||
off: disable the optimizations.")
|
|
||||||
set_property(CACHE PNG_POWERPC_VSX PROPERTY STRINGS
|
|
||||||
${PNG_POWERPC_VSX_POSSIBLE_VALUES})
|
|
||||||
list(FIND PNG_POWERPC_VSX_POSSIBLE_VALUES ${PNG_POWERPC_VSX} index)
|
|
||||||
if(index EQUAL -1)
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"PNG_POWERPC_VSX must be one of [${PNG_POWERPC_VSX_POSSIBLE_VALUES}]")
|
|
||||||
elseif(NOT ${PNG_POWERPC_VSX} STREQUAL "off")
|
|
||||||
set(libpng_powerpc_sources
|
|
||||||
powerpc/powerpc_init.c
|
|
||||||
powerpc/filter_vsx_intrinsics.c)
|
|
||||||
if(${PNG_POWERPC_VSX} STREQUAL "on")
|
|
||||||
add_definitions(-DPNG_POWERPC_VSX_OPT=2)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
add_definitions(-DPNG_POWERPC_VSX_OPT=0)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# set definitions and sources for intel
|
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
|
|
||||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*")
|
|
||||||
set(PNG_INTEL_SSE_POSSIBLE_VALUES on off)
|
|
||||||
set(PNG_INTEL_SSE "on" CACHE STRING "Enable INTEL_SSE optimizations:
|
|
||||||
off: disable the optimizations")
|
|
||||||
set_property(CACHE PNG_INTEL_SSE PROPERTY STRINGS
|
|
||||||
${PNG_INTEL_SSE_POSSIBLE_VALUES})
|
|
||||||
list(FIND PNG_INTEL_SSE_POSSIBLE_VALUES ${PNG_INTEL_SSE} index)
|
|
||||||
if(index EQUAL -1)
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"PNG_INTEL_SSE must be one of [${PNG_INTEL_SSE_POSSIBLE_VALUES}]")
|
|
||||||
elseif(NOT ${PNG_INTEL_SSE} STREQUAL "off")
|
|
||||||
set(libpng_intel_sources
|
|
||||||
intel/intel_init.c
|
|
||||||
intel/filter_sse2_intrinsics.c)
|
|
||||||
if(${PNG_INTEL_SSE} STREQUAL "on")
|
|
||||||
add_definitions(-DPNG_INTEL_SSE_OPT=1)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
add_definitions(-DPNG_INTEL_SSE_OPT=0)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# set definitions and sources for MIPS
|
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
|
|
||||||
CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*")
|
|
||||||
set(PNG_MIPS_MSA_POSSIBLE_VALUES on off)
|
|
||||||
set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations:
|
|
||||||
off: disable the optimizations")
|
|
||||||
set_property(CACHE PNG_MIPS_MSA PROPERTY STRINGS
|
|
||||||
${PNG_MIPS_MSA_POSSIBLE_VALUES})
|
|
||||||
list(FIND PNG_MIPS_MSA_POSSIBLE_VALUES ${PNG_MIPS_MSA} index)
|
|
||||||
if(index EQUAL -1)
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"PNG_MIPS_MSA must be one of [${PNG_MIPS_MSA_POSSIBLE_VALUES}]")
|
|
||||||
elseif(NOT ${PNG_MIPS_MSA} STREQUAL "off")
|
|
||||||
set(libpng_mips_sources
|
|
||||||
mips/mips_init.c
|
|
||||||
mips/filter_msa_intrinsics.c)
|
|
||||||
if(${PNG_MIPS_MSA} STREQUAL "on")
|
|
||||||
add_definitions(-DPNG_MIPS_MSA_OPT=2)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
add_definitions(-DPNG_MIPS_MSA_OPT=0)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
else(PNG_HARDWARE_OPTIMIZATIONS)
|
|
||||||
|
|
||||||
# set definitions and sources for arm
|
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
|
|
||||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
|
|
||||||
add_definitions(-DPNG_ARM_NEON_OPT=0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# set definitions and sources for powerpc
|
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
|
|
||||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*")
|
|
||||||
add_definitions(-DPNG_POWERPC_VSX_OPT=0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# set definitions and sources for intel
|
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
|
|
||||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*")
|
|
||||||
add_definitions(-DPNG_INTEL_SSE_OPT=0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# set definitions and sources for MIPS
|
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
|
|
||||||
CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*")
|
|
||||||
add_definitions(-DPNG_MIPS_MSA_OPT=0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endif(PNG_HARDWARE_OPTIMIZATIONS)
|
|
||||||
|
|
||||||
# SET LIBNAME
|
|
||||||
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
|
||||||
|
|
||||||
# to distinguish between debug and release lib
|
|
||||||
set(CMAKE_DEBUG_POSTFIX "d")
|
|
||||||
|
|
||||||
include(CheckCSourceCompiles)
|
|
||||||
option(ld-version-script "Enable linker version script" ON)
|
|
||||||
if(ld-version-script AND NOT APPLE)
|
|
||||||
# Check if LD supports linker scripts.
|
|
||||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 {
|
|
||||||
global: sym;
|
|
||||||
local: *;
|
|
||||||
};
|
|
||||||
|
|
||||||
VERS_2 {
|
|
||||||
global: sym2;
|
|
||||||
main;
|
|
||||||
} VERS_1;
|
|
||||||
")
|
|
||||||
set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
|
|
||||||
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'")
|
|
||||||
check_c_source_compiles("void sym(void) {}
|
|
||||||
void sym2(void) {}
|
|
||||||
int main(void) {return 0;}
|
|
||||||
" HAVE_LD_VERSION_SCRIPT)
|
|
||||||
if(NOT HAVE_LD_VERSION_SCRIPT)
|
|
||||||
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE} "-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
|
||||||
check_c_source_compiles("void sym(void) {}
|
|
||||||
void sym2(void) {}
|
|
||||||
int main(void) {return 0;}
|
|
||||||
" HAVE_SOLARIS_LD_VERSION_SCRIPT)
|
|
||||||
endif()
|
|
||||||
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
|
|
||||||
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Find symbol prefix. Likely obsolete and unnecessary with recent
|
|
||||||
# toolchains (it's not done in many other projects).
|
|
||||||
function(symbol_prefix)
|
|
||||||
set(SYMBOL_PREFIX)
|
|
||||||
|
|
||||||
execute_process(COMMAND "${CMAKE_C_COMPILER}" "-E" "-"
|
|
||||||
INPUT_FILE /dev/null
|
|
||||||
OUTPUT_VARIABLE OUT
|
|
||||||
RESULT_VARIABLE STATUS)
|
|
||||||
|
|
||||||
if(CPP_FAIL)
|
|
||||||
message(WARNING "Failed to run the C preprocessor")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
string(REPLACE "\n" ";" OUT "${OUT}")
|
|
||||||
foreach(line ${OUT})
|
|
||||||
string(REGEX MATCH "^PREFIX=" found_match "${line}")
|
|
||||||
if(found_match)
|
|
||||||
string(REGEX REPLACE "^PREFIX=(.*\)" "\\1" prefix "${line}")
|
|
||||||
string(REGEX MATCH "__USER_LABEL_PREFIX__" found_match "${prefix}")
|
|
||||||
if(found_match)
|
|
||||||
string(REGEX REPLACE "(.*)__USER_LABEL_PREFIX__(.*)" "\\1\\2" prefix "${prefix}")
|
|
||||||
endif()
|
|
||||||
set(SYMBOL_PREFIX "${prefix}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
message(STATUS "Symbol prefix: ${SYMBOL_PREFIX}")
|
|
||||||
set(SYMBOL_PREFIX "${SYMBOL_PREFIX}" PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
symbol_prefix()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_program(AWK NAMES gawk awk)
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
if(NOT AWK OR ANDROID)
|
|
||||||
# No awk available to generate sources; use pre-built pnglibconf.h
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
|
|
||||||
add_custom_target(genfiles) # Dummy
|
|
||||||
else()
|
|
||||||
include(CMakeParseArguments)
|
|
||||||
# Generate .chk from .out with awk
|
|
||||||
# generate_chk(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]])
|
|
||||||
function(generate_chk)
|
|
||||||
set(options)
|
|
||||||
set(oneValueArgs INPUT OUTPUT)
|
|
||||||
set(multiValueArgs DEPENDS)
|
|
||||||
cmake_parse_arguments(_GC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
||||||
if(NOT _GC_INPUT)
|
|
||||||
message(FATAL_ERROR "generate_chk: Missing INPUT argument")
|
|
||||||
endif()
|
|
||||||
if(NOT _GC_OUTPUT)
|
|
||||||
message(FATAL_ERROR "generate_chk: Missing OUTPUT argument")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT "${_GC_OUTPUT}"
|
|
||||||
COMMAND "${CMAKE_COMMAND}"
|
|
||||||
"-DINPUT=${_GC_INPUT}"
|
|
||||||
"-DOUTPUT=${_GC_OUTPUT}"
|
|
||||||
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake"
|
|
||||||
DEPENDS "${_GC_INPUT}" ${_GC_DEPENDS}
|
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# Generate .out from .c with awk
|
|
||||||
# generate_out(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]])
|
|
||||||
function(generate_out)
|
|
||||||
set(options)
|
|
||||||
set(oneValueArgs INPUT OUTPUT)
|
|
||||||
set(multiValueArgs DEPENDS)
|
|
||||||
cmake_parse_arguments(_GO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
||||||
if(NOT _GO_INPUT)
|
|
||||||
message(FATAL_ERROR "generate_out: Missing INPUT argument")
|
|
||||||
endif()
|
|
||||||
if(NOT _GO_OUTPUT)
|
|
||||||
message(FATAL_ERROR "generate_out: Missing OUTPUT argument")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT "${_GO_OUTPUT}"
|
|
||||||
COMMAND "${CMAKE_COMMAND}"
|
|
||||||
"-DINPUT=${_GO_INPUT}"
|
|
||||||
"-DOUTPUT=${_GO_OUTPUT}"
|
|
||||||
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake"
|
|
||||||
DEPENDS "${_GO_INPUT}" ${_GO_DEPENDS}
|
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# Generate specific source file with awk
|
|
||||||
# generate_source(OUTPUT outputfile [DEPENDS dep1 [dep2...]])
|
|
||||||
function(generate_source)
|
|
||||||
set(options)
|
|
||||||
set(oneValueArgs OUTPUT)
|
|
||||||
set(multiValueArgs DEPENDS)
|
|
||||||
cmake_parse_arguments(_GSO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
||||||
if(NOT _GSO_OUTPUT)
|
|
||||||
message(FATAL_ERROR "generate_source: Missing OUTPUT argument")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}"
|
|
||||||
COMMAND "${CMAKE_COMMAND}"
|
|
||||||
"-DOUTPUT=${_GSO_OUTPUT}"
|
|
||||||
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake"
|
|
||||||
DEPENDS ${_GSO_DEPENDS}
|
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# Copy file
|
|
||||||
function(generate_copy source destination)
|
|
||||||
add_custom_command(OUTPUT "${destination}"
|
|
||||||
COMMAND "${CMAKE_COMMAND}" -E remove "${destination}"
|
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy "${source}"
|
|
||||||
"${destination}"
|
|
||||||
DEPENDS "${source}")
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# Generate scripts/pnglibconf.h
|
|
||||||
generate_source(OUTPUT "scripts/pnglibconf.c"
|
|
||||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
|
|
||||||
|
|
||||||
# Generate pnglibconf.c
|
|
||||||
generate_source(OUTPUT "pnglibconf.c"
|
|
||||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
|
|
||||||
|
|
||||||
if(PNG_PREFIX)
|
|
||||||
set(PNGLIBCONF_H_EXTRA_DEPENDS
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/macro.lst")
|
|
||||||
set(PNGPREFIX_H_EXTRA_DEPENDS
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
generate_out(INPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c"
|
|
||||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
|
|
||||||
|
|
||||||
# Generate pnglibconf.h
|
|
||||||
generate_source(OUTPUT "pnglibconf.h"
|
|
||||||
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out"
|
|
||||||
${PNGLIBCONF_H_EXTRA_DEPENDS})
|
|
||||||
|
|
||||||
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/intprefix.c"
|
|
||||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out"
|
|
||||||
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
|
|
||||||
|
|
||||||
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/prefix.c"
|
|
||||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
|
|
||||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
|
|
||||||
|
|
||||||
# Generate pngprefix.h
|
|
||||||
generate_source(OUTPUT "pngprefix.h"
|
|
||||||
DEPENDS ${PNGPREFIX_H_EXTRA_DEPENDS})
|
|
||||||
|
|
||||||
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/sym.c"
|
|
||||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
|
|
||||||
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
|
|
||||||
|
|
||||||
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.c"
|
|
||||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
|
|
||||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt")
|
|
||||||
|
|
||||||
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/vers.c"
|
|
||||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
|
|
||||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
|
|
||||||
|
|
||||||
generate_chk(INPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
|
|
||||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
|
|
||||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/checksym.awk"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.def")
|
|
||||||
|
|
||||||
add_custom_target(symbol-check DEPENDS
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk")
|
|
||||||
|
|
||||||
generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/libpng.sym")
|
|
||||||
generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/libpng.vers")
|
|
||||||
|
|
||||||
add_custom_target(genvers DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers")
|
|
||||||
add_custom_target(gensym DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym")
|
|
||||||
|
|
||||||
add_custom_target("genprebuilt"
|
|
||||||
COMMAND "${CMAKE_COMMAND}"
|
|
||||||
"-DOUTPUT=scripts/pnglibconf.h.prebuilt"
|
|
||||||
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake"
|
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
|
||||||
|
|
||||||
# A single target handles generation of all generated files. If
|
|
||||||
# they are depended upon separately by multiple targets, this
|
|
||||||
# confuses parallel make (it would require a separate top-level
|
|
||||||
# target for each file to track the dependencies properly).
|
|
||||||
add_custom_target(genfiles DEPENDS
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/libpng.sym"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/libpng.vers"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out")
|
|
||||||
endif(NOT AWK OR ANDROID)
|
|
||||||
|
|
||||||
# OUR SOURCES
|
|
||||||
set(libpng_public_hdrs
|
|
||||||
png.h
|
|
||||||
pngconf.h
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h"
|
|
||||||
)
|
|
||||||
set(libpng_private_hdrs
|
|
||||||
pngpriv.h
|
|
||||||
pngdebug.h
|
|
||||||
pnginfo.h
|
|
||||||
pngstruct.h
|
|
||||||
)
|
|
||||||
if(AWK AND NOT ANDROID)
|
|
||||||
list(APPEND libpng_private_hdrs "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h")
|
|
||||||
endif()
|
|
||||||
set(libpng_sources
|
|
||||||
${libpng_public_hdrs}
|
|
||||||
${libpng_private_hdrs}
|
|
||||||
png.c
|
|
||||||
pngerror.c
|
|
||||||
pngget.c
|
|
||||||
pngmem.c
|
|
||||||
pngpread.c
|
|
||||||
pngread.c
|
|
||||||
pngrio.c
|
|
||||||
pngrtran.c
|
|
||||||
pngrutil.c
|
|
||||||
pngset.c
|
|
||||||
pngtrans.c
|
|
||||||
pngwio.c
|
|
||||||
pngwrite.c
|
|
||||||
pngwtran.c
|
|
||||||
pngwutil.c
|
|
||||||
${libpng_arm_sources}
|
|
||||||
${libpng_intel_sources}
|
|
||||||
${libpng_mips_sources}
|
|
||||||
${libpng_powerpc_sources}
|
|
||||||
)
|
|
||||||
set(pngtest_sources
|
|
||||||
pngtest.c
|
|
||||||
)
|
|
||||||
set(pngvalid_sources
|
|
||||||
contrib/libtests/pngvalid.c
|
|
||||||
)
|
|
||||||
set(pngstest_sources
|
|
||||||
contrib/libtests/pngstest.c
|
|
||||||
)
|
|
||||||
set(pngunknown_sources
|
|
||||||
contrib/libtests/pngunknown.c
|
|
||||||
)
|
|
||||||
set(pngimage_sources
|
|
||||||
contrib/libtests/pngimage.c
|
|
||||||
)
|
|
||||||
set(pngfix_sources
|
|
||||||
contrib/tools/pngfix.c
|
|
||||||
)
|
|
||||||
set(png_fix_itxt_sources
|
|
||||||
contrib/tools/png-fix-itxt.c
|
|
||||||
)
|
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PNG_DEBUG)
|
|
||||||
add_definitions(-DPNG_DEBUG)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# NOW BUILD OUR TARGET
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
|
|
||||||
|
|
||||||
unset(PNG_LIB_TARGETS)
|
|
||||||
|
|
||||||
if(PNG_STATIC)
|
|
||||||
# does not work without changing name
|
|
||||||
set(PNG_LIB_NAME_STATIC png_static)
|
|
||||||
add_library(png_static STATIC ${libpng_sources})
|
|
||||||
add_dependencies(png_static genfiles)
|
|
||||||
# MSVC doesn't use a different file extension for shared vs. static
|
|
||||||
# libs. We are able to change OUTPUT_NAME to remove the _static
|
|
||||||
# for all other platforms.
|
|
||||||
if(NOT MSVC)
|
|
||||||
set_target_properties(png_static PROPERTIES
|
|
||||||
OUTPUT_NAME "${PNG_LIB_NAME}"
|
|
||||||
CLEAN_DIRECT_OUTPUT 1)
|
|
||||||
else()
|
|
||||||
set_target_properties(png_static PROPERTIES
|
|
||||||
OUTPUT_NAME "${PNG_LIB_NAME}_static"
|
|
||||||
CLEAN_DIRECT_OUTPUT 1)
|
|
||||||
endif()
|
|
||||||
list(APPEND PNG_LIB_TARGETS png_static)
|
|
||||||
if(MSVC)
|
|
||||||
# msvc does not append 'lib' - do it here to have consistent name
|
|
||||||
set_target_properties(png_static PROPERTIES PREFIX "lib")
|
|
||||||
endif()
|
|
||||||
target_link_libraries(png_static ${M_LIBRARY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT PNG_LIB_TARGETS)
|
|
||||||
message(SEND_ERROR
|
|
||||||
"No library variant selected to build. "
|
|
||||||
"Please enable at least one of the following options: "
|
|
||||||
"PNG_STATIC, PNG_SHARED, PNG_FRAMEWORK")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Set a variable with CMake code which:
|
|
||||||
# Creates a symlink from src to dest (if possible) or alternatively
|
|
||||||
# copies if different.
|
|
||||||
include(CMakeParseArguments)
|
|
||||||
|
|
||||||
function(create_symlink DEST_FILE)
|
|
||||||
|
|
||||||
cmake_parse_arguments(S "" "FILE;TARGET" "" ${ARGN})
|
|
||||||
|
|
||||||
if(NOT S_TARGET AND NOT S_FILE)
|
|
||||||
message(FATAL_ERROR "create_symlink: Missing TARGET or FILE argument")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(S_TARGET AND S_FILE)
|
|
||||||
message(FATAL_ERROR "create_symlink: Both source file ${S_FILE} and build target ${S_TARGET} arguments are present; can only have one.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(S_FILE)
|
|
||||||
# If we don't need to symlink something that's coming from a build target,
|
|
||||||
# we can go ahead and symlink/copy at configure time.
|
|
||||||
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
|
|
||||||
execute_process(
|
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${S_FILE} ${DEST_FILE}
|
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
|
||||||
else()
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${S_FILE} ${DEST_FILE}
|
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(S_TARGET)
|
|
||||||
# We need to use generator expressions, which can be a bit tricky, so for
|
|
||||||
# simplicity make the symlink a POST_BUILD step and use the TARGET
|
|
||||||
# signature of add_custom_command.
|
|
||||||
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
|
|
||||||
add_custom_command(TARGET ${S_TARGET} POST_BUILD
|
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
|
|
||||||
else()
|
|
||||||
add_custom_command(TARGET ${S_TARGET} POST_BUILD
|
|
||||||
COMMAND "${CMAKE_COMMAND}" -E create_symlink $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# Create source generation scripts.
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake @ONLY)
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake @ONLY)
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake @ONLY)
|
|
||||||
|
|
||||||
# libpng is a library so default to 'lib'
|
|
||||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
|
||||||
set(CMAKE_INSTALL_LIBDIR lib)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# CREATE PKGCONFIG FILES
|
|
||||||
# We use the same files like ./configure, so we have to set its vars.
|
|
||||||
# Only do this on Windows for Cygwin - the files don't make much sense outside
|
|
||||||
# of a UNIX look-alike.
|
|
||||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
|
||||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
|
||||||
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
|
||||||
set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
|
|
||||||
set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
|
|
||||||
set(LIBS "-lz -lm")
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
|
|
||||||
create_symlink(libpng.pc FILE ${PNGLIB_NAME}.pc)
|
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
|
|
||||||
create_symlink(libpng-config FILE ${PNGLIB_NAME}-config)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# SET UP LINKS
|
|
||||||
if(PNG_SHARED)
|
|
||||||
set_target_properties(png PROPERTIES
|
|
||||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.37
|
|
||||||
VERSION 16.${PNGLIB_RELEASE}.0
|
|
||||||
SOVERSION 16
|
|
||||||
CLEAN_DIRECT_OUTPUT 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# INSTALL
|
|
||||||
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
|
|
||||||
install(TARGETS ${PNG_LIB_TARGETS}
|
|
||||||
EXPORT libpng
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
|
|
||||||
if(PNG_SHARED)
|
|
||||||
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
|
|
||||||
if(CYGWIN OR MINGW)
|
|
||||||
create_symlink(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png)
|
|
||||||
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT WIN32)
|
|
||||||
create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png)
|
|
||||||
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PNG_STATIC)
|
|
||||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
|
||||||
create_symlink(libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static)
|
|
||||||
install(FILES $<TARGET_LINKER_FILE_DIR:png_static>/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL)
|
|
||||||
install(FILES ${libpng_public_hdrs} DESTINATION include)
|
|
||||||
install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
|
|
||||||
endif()
|
|
||||||
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL)
|
|
||||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
|
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL)
|
|
||||||
install(TARGETS ${PNG_BIN_TARGETS}
|
|
||||||
RUNTIME DESTINATION bin)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL)
|
|
||||||
# Install man pages
|
|
||||||
if(NOT PNG_MAN_DIR)
|
|
||||||
set(PNG_MAN_DIR "share/man")
|
|
||||||
endif()
|
|
||||||
install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
|
|
||||||
install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
|
|
||||||
# Install pkg-config files
|
|
||||||
if(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW)
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
|
|
||||||
DESTINATION bin)
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
|
||||||
DESTINATION bin)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Create an export file that CMake users can include() to import our targets.
|
|
||||||
if(NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL)
|
|
||||||
install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# what's with libpng-manual.txt and all the extra files?
|
|
||||||
|
|
||||||
# UNINSTALL
|
|
||||||
# do we need this?
|
|
||||||
|
|
||||||
# DIST
|
|
||||||
# do we need this?
|
|
||||||
|
|
||||||
# to create msvc import lib for mingw compiled shared lib
|
|
||||||
# pexports libpng.dll > libpng.def
|
|
||||||
# lib /def:libpng.def /machine:x86
|
|
||||||
@ -1,17 +1,22 @@
|
|||||||
|
# -*- CMake -*- master configuration file for building LAMMPS
|
||||||
########################################
|
########################################
|
||||||
# CMake build system
|
# CMake build system
|
||||||
# This file is part of LAMMPS
|
# This file is part of LAMMPS
|
||||||
# Created by Christoph Junghans and Richard Berger
|
cmake_minimum_required(VERSION 3.16)
|
||||||
cmake_minimum_required(VERSION 3.10)
|
########################################
|
||||||
# set policy to silence warnings about ignoring <PackageName>_ROOT but use it
|
# set policy to silence warnings about ignoring <PackageName>_ROOT but use it
|
||||||
if(POLICY CMP0074)
|
if(POLICY CMP0074)
|
||||||
cmake_policy(SET CMP0074 NEW)
|
cmake_policy(SET CMP0074 NEW)
|
||||||
endif()
|
endif()
|
||||||
# set policy to silence warnings about missing executable permissions in
|
# set policy to silence warnings about ignoring ${CMAKE_REQUIRED_LIBRARIES} but use it
|
||||||
# pythonx.y-config when cross-compiling. review occasionally if it may be set to NEW
|
if(POLICY CMP0075)
|
||||||
if(POLICY CMP0109)
|
cmake_policy(SET CMP0075 NEW)
|
||||||
cmake_policy(SET CMP0109 OLD)
|
|
||||||
endif()
|
endif()
|
||||||
|
# set policy to silence warnings about timestamps of downloaded files. review occasionally if it may be set to NEW
|
||||||
|
if(POLICY CMP0135)
|
||||||
|
cmake_policy(SET CMP0135 OLD)
|
||||||
|
endif()
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
|
|
||||||
project(lammps CXX)
|
project(lammps CXX)
|
||||||
@ -100,7 +105,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
|||||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4)
|
||||||
set(CMAKE_TUNE_DEFAULT "-xCOMMON-AVX512")
|
set(CMAKE_TUNE_DEFAULT "-xCOMMON-AVX512")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_TUNE_DEFAULT "-xHost")
|
set(CMAKE_TUNE_DEFAULT "-xHost -fp-model fast=2 -no-prec-div -qoverride-limits -diag-disable=10441 -diag-disable=11074 -diag-disable=11076 -diag-disable=2196")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -120,25 +125,26 @@ if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA) AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL
|
|||||||
set(CMAKE_TUNE_DEFAULT "${CMAKE_TUNE_DEFAULT} -Xcudafe --diag_suppress=unrecognized_pragma")
|
set(CMAKE_TUNE_DEFAULT "${CMAKE_TUNE_DEFAULT} -Xcudafe --diag_suppress=unrecognized_pragma")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# we require C++11 without extensions. Kokkos requires at least C++14 (currently)
|
# we require C++11 without extensions. Kokkos requires at least C++17 (currently)
|
||||||
if(NOT CMAKE_CXX_STANDARD)
|
if(NOT CMAKE_CXX_STANDARD)
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_CXX_STANDARD LESS 11)
|
if(CMAKE_CXX_STANDARD LESS 11)
|
||||||
message(FATAL_ERROR "C++ standard must be set to at least 11")
|
message(FATAL_ERROR "C++ standard must be set to at least 11")
|
||||||
endif()
|
endif()
|
||||||
if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 14))
|
if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 17))
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions")
|
set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions")
|
||||||
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
|
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
|
||||||
# and prints lots of pointless warnings about "unsafe" functions
|
# and prints lots of pointless warnings about "unsafe" functions
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Intel"))
|
||||||
add_compile_options(/Zc:__cplusplus)
|
add_compile_options(/Zc:__cplusplus)
|
||||||
add_compile_options(/wd4244)
|
add_compile_options(/wd4244)
|
||||||
add_compile_options(/wd4267)
|
add_compile_options(/wd4267)
|
||||||
if(LAMMPS_EXCEPTIONS)
|
add_compile_options(/wd4250)
|
||||||
add_compile_options(/EHsc)
|
add_compile_options(/EHsc)
|
||||||
endif()
|
endif()
|
||||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||||
@ -152,6 +158,22 @@ endif()
|
|||||||
########################################################################
|
########################################################################
|
||||||
# User input options #
|
# User input options #
|
||||||
########################################################################
|
########################################################################
|
||||||
|
# backward compatibility with CMake before 3.12 and older LAMMPS documentation
|
||||||
|
if (PYTHON_EXECUTABLE)
|
||||||
|
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
|
||||||
|
endif()
|
||||||
|
# set path to python interpreter and thus enforcing python version when
|
||||||
|
# in a virtual environment and Python_EXECUTABLE is not set on command line
|
||||||
|
if(DEFINED ENV{VIRTUAL_ENV} AND NOT Python_EXECUTABLE)
|
||||||
|
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
set(Python_EXECUTABLE "$ENV{VIRTUAL_ENV}/Scripts/python.exe")
|
||||||
|
else()
|
||||||
|
set(Python_EXECUTABLE "$ENV{VIRTUAL_ENV}/bin/python")
|
||||||
|
endif()
|
||||||
|
message(STATUS "Running in virtual environment: $ENV{VIRTUAL_ENV}\n"
|
||||||
|
" Setting Python interpreter to: ${Python_EXECUTABLE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(LAMMPS_MACHINE "" CACHE STRING "Suffix to append to lmp binary (WON'T enable any features automatically")
|
set(LAMMPS_MACHINE "" CACHE STRING "Suffix to append to lmp binary (WON'T enable any features automatically")
|
||||||
mark_as_advanced(LAMMPS_MACHINE)
|
mark_as_advanced(LAMMPS_MACHINE)
|
||||||
if(LAMMPS_MACHINE)
|
if(LAMMPS_MACHINE)
|
||||||
@ -163,6 +185,7 @@ option(BUILD_SHARED_LIBS "Build shared library" OFF)
|
|||||||
option(CMAKE_POSITION_INDEPENDENT_CODE "Create object compatible with shared libraries" ON)
|
option(CMAKE_POSITION_INDEPENDENT_CODE "Create object compatible with shared libraries" ON)
|
||||||
option(BUILD_TOOLS "Build and install LAMMPS tools (msi2lmp, binary2txt, chain)" OFF)
|
option(BUILD_TOOLS "Build and install LAMMPS tools (msi2lmp, binary2txt, chain)" OFF)
|
||||||
option(BUILD_LAMMPS_SHELL "Build and install the LAMMPS shell" OFF)
|
option(BUILD_LAMMPS_SHELL "Build and install the LAMMPS shell" OFF)
|
||||||
|
option(BUILD_LAMMPS_GUI "Build and install the LAMMPS GUI" OFF)
|
||||||
|
|
||||||
# Support using clang-tidy for C++ files with selected options
|
# Support using clang-tidy for C++ files with selected options
|
||||||
set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Include clang-tidy processing when compiling")
|
set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Include clang-tidy processing when compiling")
|
||||||
@ -173,8 +196,8 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
file(GLOB ALL_SOURCES ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
|
file(GLOB ALL_SOURCES CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
|
||||||
file(GLOB MAIN_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp)
|
file(GLOB MAIN_SOURCES CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/main.cpp)
|
||||||
list(REMOVE_ITEM ALL_SOURCES ${MAIN_SOURCES})
|
list(REMOVE_ITEM ALL_SOURCES ${MAIN_SOURCES})
|
||||||
add_library(lammps ${ALL_SOURCES})
|
add_library(lammps ${ALL_SOURCES})
|
||||||
|
|
||||||
@ -192,6 +215,7 @@ option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF)
|
|||||||
|
|
||||||
set(STANDARD_PACKAGES
|
set(STANDARD_PACKAGES
|
||||||
ADIOS
|
ADIOS
|
||||||
|
AMOEBA
|
||||||
ASPHERE
|
ASPHERE
|
||||||
ATC
|
ATC
|
||||||
AWPMD
|
AWPMD
|
||||||
@ -200,7 +224,7 @@ set(STANDARD_PACKAGES
|
|||||||
BPM
|
BPM
|
||||||
BROWNIAN
|
BROWNIAN
|
||||||
CG-DNA
|
CG-DNA
|
||||||
CG-SDK
|
CG-SPICA
|
||||||
CLASS2
|
CLASS2
|
||||||
COLLOID
|
COLLOID
|
||||||
COLVARS
|
COLVARS
|
||||||
@ -227,7 +251,7 @@ set(STANDARD_PACKAGES
|
|||||||
KIM
|
KIM
|
||||||
KSPACE
|
KSPACE
|
||||||
LATBOLTZ
|
LATBOLTZ
|
||||||
LATTE
|
LEPTON
|
||||||
MACHDYN
|
MACHDYN
|
||||||
MANIFOLD
|
MANIFOLD
|
||||||
MANYBODY
|
MANYBODY
|
||||||
@ -243,11 +267,10 @@ set(STANDARD_PACKAGES
|
|||||||
ML-QUIP
|
ML-QUIP
|
||||||
ML-RANN
|
ML-RANN
|
||||||
ML-SNAP
|
ML-SNAP
|
||||||
|
ML-POD
|
||||||
MOFFF
|
MOFFF
|
||||||
MOLECULE
|
MOLECULE
|
||||||
MOLFILE
|
MOLFILE
|
||||||
MPIIO
|
|
||||||
MSCG
|
|
||||||
NETCDF
|
NETCDF
|
||||||
ORIENT
|
ORIENT
|
||||||
PERI
|
PERI
|
||||||
@ -293,6 +316,15 @@ if(PKG_ADIOS)
|
|||||||
# script that defines the MPI::MPI_C target
|
# script that defines the MPI::MPI_C target
|
||||||
enable_language(C)
|
enable_language(C)
|
||||||
find_package(ADIOS2 REQUIRED)
|
find_package(ADIOS2 REQUIRED)
|
||||||
|
if(BUILD_MPI)
|
||||||
|
if(NOT ADIOS2_HAVE_MPI)
|
||||||
|
message(FATAL_ERROR "ADIOS2 must be built with MPI support when LAMMPS has MPI enabled")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if(ADIOS2_HAVE_MPI)
|
||||||
|
message(FATAL_ERROR "ADIOS2 must be built without MPI support when LAMMPS has MPI disabled")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
target_link_libraries(lammps PRIVATE adios2::adios2)
|
target_link_libraries(lammps PRIVATE adios2::adios2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -344,29 +376,26 @@ if(NOT ${LAMMPS_MEMALIGN} STREQUAL "0")
|
|||||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN})
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(LAMMPS_EXCEPTIONS "enable the use of C++ exceptions for error messages (useful for library interface)" ${ENABLE_TESTING})
|
|
||||||
if(LAMMPS_EXCEPTIONS)
|
|
||||||
target_compile_definitions(lammps PUBLIC -DLAMMPS_EXCEPTIONS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# "hard" dependencies between packages resulting
|
# "hard" dependencies between packages resulting
|
||||||
# in an error instead of skipping over files
|
# in an error instead of skipping over files
|
||||||
pkg_depends(ML-IAP ML-SNAP)
|
pkg_depends(ML-IAP ML-SNAP)
|
||||||
pkg_depends(MPIIO MPI)
|
|
||||||
pkg_depends(ATC MANYBODY)
|
pkg_depends(ATC MANYBODY)
|
||||||
pkg_depends(LATBOLTZ MPI)
|
pkg_depends(LATBOLTZ MPI)
|
||||||
pkg_depends(SCAFACOS MPI)
|
pkg_depends(SCAFACOS MPI)
|
||||||
|
pkg_depends(AMOEBA KSPACE)
|
||||||
pkg_depends(DIELECTRIC KSPACE)
|
pkg_depends(DIELECTRIC KSPACE)
|
||||||
pkg_depends(DIELECTRIC EXTRA-PAIR)
|
pkg_depends(DIELECTRIC EXTRA-PAIR)
|
||||||
pkg_depends(CG-DNA MOLECULE)
|
pkg_depends(CG-DNA MOLECULE)
|
||||||
pkg_depends(CG-DNA ASPHERE)
|
pkg_depends(CG-DNA ASPHERE)
|
||||||
pkg_depends(ELECTRODE KSPACE)
|
pkg_depends(ELECTRODE KSPACE)
|
||||||
|
pkg_depends(EXTRA-MOLECULE MOLECULE)
|
||||||
|
pkg_depends(MESONT MOLECULE)
|
||||||
|
|
||||||
# detect if we may enable OpenMP support by default
|
# detect if we may enable OpenMP support by default
|
||||||
set(BUILD_OMP_DEFAULT OFF)
|
set(BUILD_OMP_DEFAULT OFF)
|
||||||
find_package(OpenMP QUIET)
|
find_package(OpenMP COMPONENTS CXX QUIET)
|
||||||
if(OpenMP_FOUND)
|
if(OpenMP_CXX_FOUND)
|
||||||
check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
|
check_omp_h_include()
|
||||||
if(HAVE_OMP_H_INCLUDE)
|
if(HAVE_OMP_H_INCLUDE)
|
||||||
set(BUILD_OMP_DEFAULT ON)
|
set(BUILD_OMP_DEFAULT ON)
|
||||||
endif()
|
endif()
|
||||||
@ -375,8 +404,8 @@ endif()
|
|||||||
option(BUILD_OMP "Build with OpenMP support" ${BUILD_OMP_DEFAULT})
|
option(BUILD_OMP "Build with OpenMP support" ${BUILD_OMP_DEFAULT})
|
||||||
|
|
||||||
if(BUILD_OMP)
|
if(BUILD_OMP)
|
||||||
find_package(OpenMP REQUIRED)
|
find_package(OpenMP COMPONENTS CXX REQUIRED)
|
||||||
check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
|
check_omp_h_include()
|
||||||
if(NOT HAVE_OMP_H_INCLUDE)
|
if(NOT HAVE_OMP_H_INCLUDE)
|
||||||
message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support")
|
message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support")
|
||||||
endif()
|
endif()
|
||||||
@ -398,21 +427,31 @@ if(BUILD_OMP)
|
|||||||
target_link_libraries(lmp PRIVATE OpenMP::OpenMP_CXX)
|
target_link_libraries(lmp PRIVATE OpenMP::OpenMP_CXX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_LATTE OR PKG_ELECTRODE)
|
# lower C++ standard for fmtlib sources when using Intel classic compiler
|
||||||
|
if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_STANDARD GREATER_EQUAL 17)
|
||||||
|
AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2021.10))
|
||||||
|
message(STATUS "Lowering C++ standard for compiling fmtlib sources with Intel Classic compiler")
|
||||||
|
get_filename_component(LMP_UTILS_SRC "${LAMMPS_SOURCE_DIR}/utils.cpp" ABSOLUTE)
|
||||||
|
get_filename_component(LMP_VARIABLE_SRC "${LAMMPS_SOURCE_DIR}/variable.cpp" ABSOLUTE)
|
||||||
|
get_filename_component(FMT_FORMAT_SRC "${LAMMPS_SOURCE_DIR}/fmtlib_format.cpp" ABSOLUTE)
|
||||||
|
get_filename_component(FMT_OS_SRC "${LAMMPS_SOURCE_DIR}/fmtlib_os.cpp" ABSOLUTE)
|
||||||
|
set_source_files_properties("${FMT_FORMAT_SRC}" "${FMT_OS_SRC}" "${LMP_VARIABLE_SRC}" "${LMP_UTILS_SRC}"
|
||||||
|
PROPERTIES COMPILE_OPTIONS "-std=c++14")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_ELECTRODE OR BUILD_TOOLS)
|
||||||
enable_language(C)
|
enable_language(C)
|
||||||
|
if (NOT USE_INTERNAL_LINALG)
|
||||||
find_package(LAPACK)
|
find_package(LAPACK)
|
||||||
find_package(BLAS)
|
find_package(BLAS)
|
||||||
if(NOT LAPACK_FOUND OR NOT BLAS_FOUND)
|
|
||||||
include(CheckGeneratorSupport)
|
|
||||||
if(NOT CMAKE_GENERATOR_SUPPORT_FORTRAN)
|
|
||||||
status(FATAL_ERROR "Cannot build internal linear algebra library as CMake build tool lacks Fortran support")
|
|
||||||
endif()
|
endif()
|
||||||
enable_language(Fortran)
|
if(NOT LAPACK_FOUND OR NOT BLAS_FOUND OR USE_INTERNAL_LINALG)
|
||||||
file(GLOB LAPACK_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/linalg/[^.]*.[fF])
|
file(GLOB LINALG_SOURCES CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/linalg/[^.]*.cpp)
|
||||||
add_library(linalg STATIC ${LAPACK_SOURCES})
|
add_library(linalg STATIC ${LINALG_SOURCES})
|
||||||
set_target_properties(linalg PROPERTIES OUTPUT_NAME lammps_linalg${LAMMPS_MACHINE})
|
set_target_properties(linalg PROPERTIES OUTPUT_NAME lammps_linalg${LAMMPS_MACHINE})
|
||||||
set(BLAS_LIBRARIES "$<TARGET_FILE:linalg>")
|
set(BLAS_LIBRARIES "$<TARGET_FILE:linalg>")
|
||||||
set(LAPACK_LIBRARIES "$<TARGET_FILE:linalg>")
|
set(LAPACK_LIBRARIES "$<TARGET_FILE:linalg>")
|
||||||
|
target_link_libraries(lammps PRIVATE linalg)
|
||||||
else()
|
else()
|
||||||
list(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES})
|
list(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
@ -425,13 +464,8 @@ option(WITH_JPEG "Enable JPEG support" ${JPEG_FOUND})
|
|||||||
if(WITH_JPEG)
|
if(WITH_JPEG)
|
||||||
find_package(JPEG REQUIRED)
|
find_package(JPEG REQUIRED)
|
||||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG)
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
target_include_directories(lammps PRIVATE ${JPEG_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(lammps PRIVATE ${JPEG_LIBRARIES})
|
|
||||||
else()
|
|
||||||
target_link_libraries(lammps PRIVATE JPEG::JPEG)
|
target_link_libraries(lammps PRIVATE JPEG::JPEG)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(PNG QUIET)
|
find_package(PNG QUIET)
|
||||||
find_package(ZLIB QUIET)
|
find_package(ZLIB QUIET)
|
||||||
@ -480,7 +514,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(PKG_WITH_INCL KSPACE PYTHON ML-IAP VORONOI COLVARS ML-HDNNP MDI MOLFILE NETCDF
|
foreach(PKG_WITH_INCL KSPACE PYTHON ML-IAP VORONOI COLVARS ML-HDNNP MDI MOLFILE NETCDF
|
||||||
PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM LATTE MSCG COMPRESS ML-PACE)
|
PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM COMPRESS ML-PACE LEPTON)
|
||||||
if(PKG_${PKG_WITH_INCL})
|
if(PKG_${PKG_WITH_INCL})
|
||||||
include(Packages/${PKG_WITH_INCL})
|
include(Packages/${PKG_WITH_INCL})
|
||||||
endif()
|
endif()
|
||||||
@ -497,7 +531,10 @@ set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler and machine
|
|||||||
separate_arguments(CMAKE_TUNE_FLAGS)
|
separate_arguments(CMAKE_TUNE_FLAGS)
|
||||||
foreach(_FLAG ${CMAKE_TUNE_FLAGS})
|
foreach(_FLAG ${CMAKE_TUNE_FLAGS})
|
||||||
target_compile_options(lammps PRIVATE ${_FLAG})
|
target_compile_options(lammps PRIVATE ${_FLAG})
|
||||||
|
# skip these flags when linking the main executable
|
||||||
|
if(NOT (("${_FLAG}" STREQUAL "-Xcudafe") OR (("${_FLAG}" STREQUAL "--diag_suppress=unrecognized_pragma"))))
|
||||||
target_compile_options(lmp PRIVATE ${_FLAG})
|
target_compile_options(lmp PRIVATE ${_FLAG})
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
########################################################################
|
########################################################################
|
||||||
# Basic system tests (standard libraries, headers, functions, types) #
|
# Basic system tests (standard libraries, headers, functions, types) #
|
||||||
@ -525,6 +562,8 @@ RegisterStyles(${LAMMPS_SOURCE_DIR})
|
|||||||
########################################################
|
########################################################
|
||||||
# Fetch missing external files and archives for packages
|
# Fetch missing external files and archives for packages
|
||||||
########################################################
|
########################################################
|
||||||
|
option(DOWNLOAD_POTENTIALS "Automatically download large potential files" ON)
|
||||||
|
mark_as_advanced(DOWNLOAD_POTENTIALS)
|
||||||
foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
|
foreach(PKG ${STANDARD_PACKAGES} ${SUFFIX_PACKAGES})
|
||||||
if(PKG_${PKG})
|
if(PKG_${PKG})
|
||||||
FetchPotentials(${LAMMPS_SOURCE_DIR}/${PKG} ${LAMMPS_POTENTIALS_DIR})
|
FetchPotentials(${LAMMPS_SOURCE_DIR}/${PKG} ${LAMMPS_POTENTIALS_DIR})
|
||||||
@ -537,8 +576,8 @@ endforeach()
|
|||||||
foreach(PKG ${STANDARD_PACKAGES})
|
foreach(PKG ${STANDARD_PACKAGES})
|
||||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||||
|
|
||||||
file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
file(GLOB ${PKG}_SOURCES CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
||||||
file(GLOB ${PKG}_HEADERS ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
file(GLOB ${PKG}_HEADERS CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
||||||
|
|
||||||
# check for package files in src directory due to old make system
|
# check for package files in src directory due to old make system
|
||||||
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
||||||
@ -554,19 +593,12 @@ foreach(PKG ${STANDARD_PACKAGES})
|
|||||||
RegisterPackages(${${PKG}_SOURCES_DIR})
|
RegisterPackages(${${PKG}_SOURCES_DIR})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# packages that need defines set
|
|
||||||
foreach(PKG MPIIO)
|
|
||||||
if(PKG_${PKG})
|
|
||||||
target_compile_definitions(lammps PRIVATE -DLMP_${PKG})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
# dedicated check for entire contents of accelerator packages
|
# dedicated check for entire contents of accelerator packages
|
||||||
foreach(PKG ${SUFFIX_PACKAGES})
|
foreach(PKG ${SUFFIX_PACKAGES})
|
||||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||||
|
|
||||||
file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
file(GLOB ${PKG}_SOURCES CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.cpp)
|
||||||
file(GLOB ${PKG}_HEADERS ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
file(GLOB ${PKG}_HEADERS CONFIGURE_DEPENDS ${${PKG}_SOURCES_DIR}/[^.]*.h)
|
||||||
|
|
||||||
# check for package files in src directory due to old make system
|
# check for package files in src directory due to old make system
|
||||||
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})
|
||||||
@ -577,18 +609,11 @@ endforeach()
|
|||||||
##############################################
|
##############################################
|
||||||
# add lib sources of (simple) enabled packages
|
# add lib sources of (simple) enabled packages
|
||||||
############################################
|
############################################
|
||||||
foreach(PKG_LIB POEMS ATC AWPMD H5MD MESONT)
|
foreach(PKG_LIB POEMS ATC AWPMD H5MD)
|
||||||
if(PKG_${PKG_LIB})
|
if(PKG_${PKG_LIB})
|
||||||
string(TOLOWER "${PKG_LIB}" PKG_LIB)
|
string(TOLOWER "${PKG_LIB}" PKG_LIB)
|
||||||
if(PKG_LIB STREQUAL "mesont")
|
file(GLOB_RECURSE ${PKG_LIB}_SOURCES CONFIGURE_DEPENDS
|
||||||
enable_language(Fortran)
|
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.c ${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.cpp)
|
||||||
file(GLOB_RECURSE ${PKG_LIB}_SOURCES
|
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.f90)
|
|
||||||
else()
|
|
||||||
file(GLOB_RECURSE ${PKG_LIB}_SOURCES
|
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.c
|
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/${PKG_LIB}/[^.]*.cpp)
|
|
||||||
endif()
|
|
||||||
add_library(${PKG_LIB} STATIC ${${PKG_LIB}_SOURCES})
|
add_library(${PKG_LIB} STATIC ${${PKG_LIB}_SOURCES})
|
||||||
set_target_properties(${PKG_LIB} PROPERTIES OUTPUT_NAME lammps_${PKG_LIB}${LAMMPS_MACHINE})
|
set_target_properties(${PKG_LIB} PROPERTIES OUTPUT_NAME lammps_${PKG_LIB}${LAMMPS_MACHINE})
|
||||||
target_link_libraries(lammps PRIVATE ${PKG_LIB})
|
target_link_libraries(lammps PRIVATE ${PKG_LIB})
|
||||||
@ -602,7 +627,7 @@ foreach(PKG_LIB POEMS ATC AWPMD H5MD MESONT)
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(PKG_ELECTRODE)
|
if(PKG_ELECTRODE OR PKG_ML-POD)
|
||||||
target_link_libraries(lammps PRIVATE ${LAPACK_LIBRARIES})
|
target_link_libraries(lammps PRIVATE ${LAPACK_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -631,7 +656,7 @@ endif()
|
|||||||
# packages which selectively include variants based on enabled styles
|
# packages which selectively include variants based on enabled styles
|
||||||
# e.g. accelerator packages
|
# e.g. accelerator packages
|
||||||
######################################################################
|
######################################################################
|
||||||
foreach(PKG_WITH_INCL CORESHELL DPD-SMOOTH PHONON QEQ OPENMP KOKKOS OPT INTEL GPU)
|
foreach(PKG_WITH_INCL CORESHELL DPD-SMOOTH MC MISC PHONON QEQ OPENMP KOKKOS OPT INTEL GPU)
|
||||||
if(PKG_${PKG_WITH_INCL})
|
if(PKG_${PKG_WITH_INCL})
|
||||||
include(Packages/${PKG_WITH_INCL})
|
include(Packages/${PKG_WITH_INCL})
|
||||||
endif()
|
endif()
|
||||||
@ -704,18 +729,17 @@ list(FIND LANGUAGES "Fortran" _index)
|
|||||||
if(_index GREATER -1)
|
if(_index GREATER -1)
|
||||||
target_link_libraries(lammps PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
target_link_libraries(lammps PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
set(LAMMPS_CXX_HEADERS angle.h atom.h bond.h citeme.h comm.h compute.h dihedral.h domain.h error.h fix.h force.h group.h improper.h
|
set(LAMMPS_CXX_HEADERS angle.h atom.h bond.h citeme.h comm.h command.h compute.h dihedral.h domain.h
|
||||||
input.h info.h kspace.h lammps.h lattice.h library.h lmppython.h lmptype.h memory.h modify.h neighbor.h neigh_list.h output.h
|
error.h exceptions.h fix.h force.h group.h improper.h input.h info.h kspace.h lammps.h lattice.h
|
||||||
pair.h pointers.h region.h timer.h universe.h update.h utils.h variable.h)
|
library.h lmppython.h lmptype.h memory.h modify.h neighbor.h neigh_list.h output.h pair.h
|
||||||
if(LAMMPS_EXCEPTIONS)
|
platform.h pointers.h region.h timer.h universe.h update.h utils.h variable.h)
|
||||||
list(APPEND LAMMPS_CXX_HEADERS exceptions.h)
|
set(LAMMPS_FMT_HEADERS core.h format.h)
|
||||||
endif()
|
|
||||||
|
|
||||||
set_target_properties(lammps PROPERTIES OUTPUT_NAME lammps${LAMMPS_MACHINE})
|
set_target_properties(lammps PROPERTIES OUTPUT_NAME lammps${LAMMPS_MACHINE})
|
||||||
set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION})
|
set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION})
|
||||||
set_target_properties(lammps PROPERTIES PREFIX "lib")
|
set_target_properties(lammps PROPERTIES PREFIX "lib")
|
||||||
target_include_directories(lammps PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/lammps>)
|
target_include_directories(lammps PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/lammps>)
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/fmt)
|
||||||
foreach(_HEADER ${LAMMPS_CXX_HEADERS})
|
foreach(_HEADER ${LAMMPS_CXX_HEADERS})
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_SOURCE_DIR}/${_HEADER} ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER} DEPENDS ${LAMMPS_SOURCE_DIR}/${_HEADER})
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_SOURCE_DIR}/${_HEADER} ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER} DEPENDS ${LAMMPS_SOURCE_DIR}/${_HEADER})
|
||||||
add_custom_target(${_HEADER} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER})
|
add_custom_target(${_HEADER} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/${_HEADER})
|
||||||
@ -724,6 +748,14 @@ foreach(_HEADER ${LAMMPS_CXX_HEADERS})
|
|||||||
install(FILES ${LAMMPS_SOURCE_DIR}/${_HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lammps)
|
install(FILES ${LAMMPS_SOURCE_DIR}/${_HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lammps)
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
foreach(_HEADER ${LAMMPS_FMT_HEADERS})
|
||||||
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/fmt/${_HEADER} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_SOURCE_DIR}/fmt/${_HEADER} ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/fmt/${_HEADER} DEPENDS ${LAMMPS_SOURCE_DIR}/fmt/${_HEADER})
|
||||||
|
add_custom_target(fmt_${_HEADER} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/includes/lammps/fmt/${_HEADER})
|
||||||
|
add_dependencies(lammps fmt_${_HEADER})
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
install(FILES ${LAMMPS_SOURCE_DIR}/fmt/${_HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lammps/fmt)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
target_include_directories(lammps INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/includes>)
|
target_include_directories(lammps INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/includes>)
|
||||||
add_library(LAMMPS::lammps ALIAS lammps)
|
add_library(LAMMPS::lammps ALIAS lammps)
|
||||||
get_target_property(LAMMPS_DEFINES lammps INTERFACE_COMPILE_DEFINITIONS)
|
get_target_property(LAMMPS_DEFINES lammps INTERFACE_COMPILE_DEFINITIONS)
|
||||||
@ -750,9 +782,11 @@ include(Tools)
|
|||||||
include(Documentation)
|
include(Documentation)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Install potential and force field files in data directory
|
# Install bench, potential and force field files in data directory
|
||||||
###############################################################################
|
###############################################################################
|
||||||
set(LAMMPS_INSTALL_DATADIR ${CMAKE_INSTALL_FULL_DATADIR}/lammps)
|
set(LAMMPS_INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR}/lammps)
|
||||||
|
|
||||||
|
install(DIRECTORY ${LAMMPS_DIR}/bench DESTINATION ${LAMMPS_INSTALL_DATADIR})
|
||||||
install(DIRECTORY ${LAMMPS_POTENTIALS_DIR} DESTINATION ${LAMMPS_INSTALL_DATADIR})
|
install(DIRECTORY ${LAMMPS_POTENTIALS_DIR} DESTINATION ${LAMMPS_INSTALL_DATADIR})
|
||||||
if(BUILD_TOOLS)
|
if(BUILD_TOOLS)
|
||||||
install(DIRECTORY ${LAMMPS_TOOLS_DIR}/msi2lmp/frc_files DESTINATION ${LAMMPS_INSTALL_DATADIR})
|
install(DIRECTORY ${LAMMPS_TOOLS_DIR}/msi2lmp/frc_files DESTINATION ${LAMMPS_INSTALL_DATADIR})
|
||||||
@ -773,25 +807,18 @@ install(
|
|||||||
# This is primarily for people that only want to use the Python wrapper.
|
# This is primarily for people that only want to use the Python wrapper.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
# backward compatibility
|
||||||
# adjust so we find Python 3 versions before Python 2 on old systems with old CMake
|
|
||||||
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
|
|
||||||
find_package(PythonInterp) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
find_package(Python COMPONENTS Interpreter)
|
find_package(Python COMPONENTS Interpreter)
|
||||||
endif()
|
|
||||||
if(BUILD_IS_MULTI_CONFIG)
|
if(BUILD_IS_MULTI_CONFIG)
|
||||||
set(LIBLAMMPS_SHARED_BINARY ${CMAKE_BINARY_DIR}/$<CONFIG>/liblammps${LAMMPS_MACHINE}${CMAKE_SHARED_LIBRARY_SUFFIX})
|
set(MY_BUILD_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>)
|
||||||
else()
|
else()
|
||||||
set(LIBLAMMPS_SHARED_BINARY ${CMAKE_BINARY_DIR}/liblammps${LAMMPS_MACHINE}${CMAKE_SHARED_LIBRARY_SUFFIX})
|
set(MY_BUILD_DIR ${CMAKE_BINARY_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
set(LIBLAMMPS_SHARED_BINARY ${MY_BUILD_DIR}/liblammps${LAMMPS_MACHINE}${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
if(Python_EXECUTABLE)
|
if(Python_EXECUTABLE)
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
install-python ${CMAKE_COMMAND} -E remove_directory build
|
install-python ${Python_EXECUTABLE} ${LAMMPS_PYTHON_DIR}/install.py -p ${LAMMPS_PYTHON_DIR}/lammps
|
||||||
COMMAND ${Python_EXECUTABLE} ${LAMMPS_PYTHON_DIR}/install.py -p ${LAMMPS_PYTHON_DIR}/lammps -l ${LIBLAMMPS_SHARED_BINARY}
|
-l ${LIBLAMMPS_SHARED_BINARY} -w ${MY_BUILD_DIR} -v ${LAMMPS_SOURCE_DIR}/version.h
|
||||||
COMMENT "Installing LAMMPS Python module")
|
COMMENT "Installing LAMMPS Python module")
|
||||||
else()
|
else()
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
@ -804,26 +831,6 @@ else()
|
|||||||
${CMAKE_COMMAND} -E echo "Must build LAMMPS as a shared library to use the Python module")
|
${CMAKE_COMMAND} -E echo "Must build LAMMPS as a shared library to use the Python module")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Add LAMMPS python module to "install" target. This is taylored for building
|
|
||||||
# LAMMPS for package managers and with different prefix settings.
|
|
||||||
# This requires either a shared library or that the PYTHON package is included.
|
|
||||||
###############################################################################
|
|
||||||
if(BUILD_SHARED_LIBS OR PKG_PYTHON)
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
find_package(PythonInterp) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
find_package(Python COMPONENTS Interpreter)
|
|
||||||
endif()
|
|
||||||
if(Python_EXECUTABLE)
|
|
||||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/python)
|
|
||||||
install(CODE "execute_process(COMMAND ${Python_EXECUTABLE} setup.py build -b ${CMAKE_BINARY_DIR}/python install --prefix=${CMAKE_INSTALL_PREFIX} --root=\$ENV{DESTDIR}/ WORKING_DIRECTORY ${LAMMPS_PYTHON_DIR})")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(Testing)
|
include(Testing)
|
||||||
include(CodeCoverage)
|
include(CodeCoverage)
|
||||||
include(CodingStandard)
|
include(CodingStandard)
|
||||||
@ -835,6 +842,23 @@ if(ClangFormat_FOUND)
|
|||||||
WORKING_DIRECTORY ${LAMMPS_SOURCE_DIR})
|
WORKING_DIRECTORY ${LAMMPS_SOURCE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# extract Kokkos compilation settings
|
||||||
|
get_cmake_property(_allvars VARIABLES)
|
||||||
|
foreach(_var ${_allvars})
|
||||||
|
if(${_var})
|
||||||
|
string(REGEX MATCH "Kokkos_ENABLE_(SERIAL|THREADS|OPENMP|CUDA|HIP|SYCL|OPENMPTARGET|HPX)" _match ${_var})
|
||||||
|
if(_match)
|
||||||
|
string(REGEX REPLACE "Kokkos_ENABLE_(OPENMP|SERIAL|CUDA|HIP|SYCL)" "\\1" _match ${_var})
|
||||||
|
list(APPEND KOKKOS_DEVICE ${_match})
|
||||||
|
endif()
|
||||||
|
string(REGEX MATCH "Kokkos_ARCH" _match ${_var})
|
||||||
|
if(_match)
|
||||||
|
string(REGEX REPLACE "Kokkos_ARCH_(.*)" "\\1" _match ${_var})
|
||||||
|
list(APPEND KOKKOS_ARCH ${_match})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
get_target_property(DEFINES lammps COMPILE_DEFINITIONS)
|
get_target_property(DEFINES lammps COMPILE_DEFINITIONS)
|
||||||
if(BUILD_IS_MULTI_CONFIG)
|
if(BUILD_IS_MULTI_CONFIG)
|
||||||
set(LAMMPS_BUILD_TYPE "Multi-Config")
|
set(LAMMPS_BUILD_TYPE "Multi-Config")
|
||||||
@ -843,12 +867,23 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND)
|
feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND)
|
||||||
|
if(GIT_FOUND AND EXISTS ${LAMMPS_DIR}/.git)
|
||||||
|
execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty=-modified --always
|
||||||
|
OUTPUT_VARIABLE GIT_DESCRIBE
|
||||||
|
ERROR_QUIET
|
||||||
|
WORKING_DIRECTORY ${LAMMPS_DIR}
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
endif()
|
||||||
message(STATUS "<<< Build configuration >>>
|
message(STATUS "<<< Build configuration >>>
|
||||||
LAMMPS Version: ${PROJECT_VERSION}
|
LAMMPS Version: ${PROJECT_VERSION} ${GIT_DESCRIBE}
|
||||||
Operating System: ${CMAKE_SYSTEM_NAME} ${CMAKE_LINUX_DISTRO} ${CMAKE_DISTRO_VERSION}
|
Operating System: ${CMAKE_SYSTEM_NAME} ${CMAKE_LINUX_DISTRO} ${CMAKE_DISTRO_VERSION}
|
||||||
|
CMake Version: ${CMAKE_VERSION}
|
||||||
Build type: ${LAMMPS_BUILD_TYPE}
|
Build type: ${LAMMPS_BUILD_TYPE}
|
||||||
Install path: ${CMAKE_INSTALL_PREFIX}
|
Install path: ${CMAKE_INSTALL_PREFIX}
|
||||||
Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}")
|
Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}")
|
||||||
|
if(CMAKE_CROSSCOMPILING)
|
||||||
|
message(STATUS "Cross compiling on ${CMAKE_HOST_SYSTEM}")
|
||||||
|
endif()
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Print package summary
|
# Print package summary
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -892,12 +927,10 @@ if(_index GREATER -1)
|
|||||||
endif()
|
endif()
|
||||||
message(STATUS "<<< Linker flags: >>>")
|
message(STATUS "<<< Linker flags: >>>")
|
||||||
message(STATUS "Executable name: ${LAMMPS_BINARY}")
|
message(STATUS "Executable name: ${LAMMPS_BINARY}")
|
||||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
|
|
||||||
get_target_property(OPTIONS lammps LINK_OPTIONS)
|
get_target_property(OPTIONS lammps LINK_OPTIONS)
|
||||||
if(OPTIONS)
|
if(OPTIONS)
|
||||||
message(STATUS "Linker options: ${OPTIONS}")
|
message(STATUS "Linker options: ${OPTIONS}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
if(CMAKE_EXE_LINKER_FLAGS)
|
if(CMAKE_EXE_LINKER_FLAGS)
|
||||||
message(STATUS "Executable linker flags: ${CMAKE_EXE_LINKER_FLAGS}")
|
message(STATUS "Executable linker flags: ${CMAKE_EXE_LINKER_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
@ -932,9 +965,26 @@ if(PKG_GPU)
|
|||||||
message(STATUS "GPU precision: ${GPU_PREC}")
|
message(STATUS "GPU precision: ${GPU_PREC}")
|
||||||
endif()
|
endif()
|
||||||
if(PKG_KOKKOS)
|
if(PKG_KOKKOS)
|
||||||
message(STATUS "Kokkos Arch: ${KOKKOS_ARCH}")
|
message(STATUS "Kokkos Devices: ${KOKKOS_DEVICE}")
|
||||||
|
if(KOKKOS_ARCH)
|
||||||
|
message(STATUS "Kokkos Architecture: ${KOKKOS_ARCH}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(PKG_KSPACE)
|
if(PKG_KSPACE)
|
||||||
|
if (LMP_HEFFTE)
|
||||||
|
message(STATUS "<<< FFT settings >>>
|
||||||
|
-- Primary FFT lib: heFFTe")
|
||||||
|
if (HEFFTE_BACKEND)
|
||||||
|
message(STATUS "heFFTe backend: ${HEFFTE_BACKEND}")
|
||||||
|
else()
|
||||||
|
message(STATUS "heFFTe backend: stock (builtin FFT implementation, tested for corrected but not optimized for production)")
|
||||||
|
endif()
|
||||||
|
if(FFT_SINGLE)
|
||||||
|
message(STATUS "Using single precision FFTs")
|
||||||
|
else()
|
||||||
|
message(STATUS "Using double precision FFTs")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
message(STATUS "<<< FFT settings >>>
|
message(STATUS "<<< FFT settings >>>
|
||||||
-- Primary FFT lib: ${FFT}")
|
-- Primary FFT lib: ${FFT}")
|
||||||
if(FFT_SINGLE)
|
if(FFT_SINGLE)
|
||||||
@ -947,6 +997,11 @@ if(PKG_KSPACE)
|
|||||||
else()
|
else()
|
||||||
message(STATUS "Using non-threaded FFTs")
|
message(STATUS "Using non-threaded FFTs")
|
||||||
endif()
|
endif()
|
||||||
|
if (FFT_HEFFTE)
|
||||||
|
message(STATUS "Using distributed algorithms from heFTTe")
|
||||||
|
else()
|
||||||
|
message(STATUS "Using builtin distributed algorithms")
|
||||||
|
endif()
|
||||||
if(PKG_KOKKOS)
|
if(PKG_KOKKOS)
|
||||||
if(Kokkos_ENABLE_CUDA)
|
if(Kokkos_ENABLE_CUDA)
|
||||||
if(FFT STREQUAL "KISS")
|
if(FFT STREQUAL "KISS")
|
||||||
@ -965,6 +1020,7 @@ if(PKG_KSPACE)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
if(BUILD_DOC)
|
if(BUILD_DOC)
|
||||||
message(STATUS "<<< Building HTML Manual >>>")
|
message(STATUS "<<< Building HTML Manual >>>")
|
||||||
endif()
|
endif()
|
||||||
@ -974,6 +1030,14 @@ endif()
|
|||||||
if(BUILD_LAMMPS_SHELL)
|
if(BUILD_LAMMPS_SHELL)
|
||||||
message(STATUS "<<< Building LAMMPS Shell >>>")
|
message(STATUS "<<< Building LAMMPS Shell >>>")
|
||||||
endif()
|
endif()
|
||||||
|
if(BUILD_LAMMPS_GUI)
|
||||||
|
message(STATUS "<<< Building LAMMPS GUI >>>")
|
||||||
|
if(LAMMPS_GUI_USE_PLUGIN)
|
||||||
|
message(STATUS "Loading LAMMPS library as plugin at run time")
|
||||||
|
else()
|
||||||
|
message(STATUS "Linking LAMMPS library at compile time")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
if(ENABLE_TESTING)
|
if(ENABLE_TESTING)
|
||||||
message(STATUS "<<< Building Unit Tests >>>")
|
message(STATUS "<<< Building Unit Tests >>>")
|
||||||
if(ENABLE_COVERAGE)
|
if(ENABLE_COVERAGE)
|
||||||
|
|||||||
@ -1,195 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
|
||||||
# When using CMake 3.4 and later, don't export symbols from executables unless
|
|
||||||
# the CMAKE_ENABLE_EXPORTS variable is set.
|
|
||||||
if(POLICY CMP0065)
|
|
||||||
cmake_policy(SET CMP0065 NEW)
|
|
||||||
endif()
|
|
||||||
if (POLICY CMP0077)
|
|
||||||
cmake_policy(SET CMP0077 NEW)
|
|
||||||
endif()
|
|
||||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
|
|
||||||
|
|
||||||
project(zlib C)
|
|
||||||
|
|
||||||
set(VERSION "1.2.11")
|
|
||||||
|
|
||||||
option(ASM686 "Enable building i686 assembly implementation" OFF)
|
|
||||||
option(AMD64 "Enable building amd64 assembly implementation" OFF)
|
|
||||||
|
|
||||||
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
|
|
||||||
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
|
|
||||||
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
|
|
||||||
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
|
|
||||||
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
|
|
||||||
|
|
||||||
include(CheckTypeSize)
|
|
||||||
include(CheckFunctionExists)
|
|
||||||
include(CheckIncludeFile)
|
|
||||||
include(CheckCSourceCompiles)
|
|
||||||
|
|
||||||
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
|
||||||
check_include_file(stdint.h HAVE_STDINT_H)
|
|
||||||
check_include_file(stddef.h HAVE_STDDEF_H)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check to see if we have large file support
|
|
||||||
#
|
|
||||||
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
|
|
||||||
# We add these other definitions here because CheckTypeSize.cmake
|
|
||||||
# in CMake 2.4.x does not automatically do so and we want
|
|
||||||
# compatibility with CMake 2.4.x.
|
|
||||||
if(HAVE_SYS_TYPES_H)
|
|
||||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
|
|
||||||
endif()
|
|
||||||
if(HAVE_STDINT_H)
|
|
||||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
|
|
||||||
endif()
|
|
||||||
if(HAVE_STDDEF_H)
|
|
||||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
|
|
||||||
endif()
|
|
||||||
check_type_size(off64_t OFF64_T)
|
|
||||||
check_type_size(off64_t OFF64_T)
|
|
||||||
if(HAVE_OFF64_T)
|
|
||||||
add_definitions(-D_LARGEFILE64_SOURCE=1)
|
|
||||||
endif()
|
|
||||||
set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check for fseeko
|
|
||||||
#
|
|
||||||
check_function_exists(fseeko HAVE_FSEEKO)
|
|
||||||
if(NOT HAVE_FSEEKO)
|
|
||||||
add_definitions(-DNO_FSEEKO)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check for unistd.h
|
|
||||||
#
|
|
||||||
check_include_file(unistd.h Z_HAVE_UNISTD_H)
|
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
set(CMAKE_DEBUG_POSTFIX "d")
|
|
||||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
|
||||||
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
|
||||||
# If we're doing an out of source build and the user has a zconf.h
|
|
||||||
# in their source tree...
|
|
||||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h)
|
|
||||||
file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc)
|
|
||||||
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein
|
|
||||||
${ZLIB_PC} @ONLY)
|
|
||||||
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
|
|
||||||
|
|
||||||
|
|
||||||
#============================================================================
|
|
||||||
# zlib
|
|
||||||
#============================================================================
|
|
||||||
|
|
||||||
set(ZLIB_PUBLIC_HDRS
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/zconf.h
|
|
||||||
zlib.h
|
|
||||||
)
|
|
||||||
set(ZLIB_PRIVATE_HDRS
|
|
||||||
crc32.h
|
|
||||||
deflate.h
|
|
||||||
gzguts.h
|
|
||||||
inffast.h
|
|
||||||
inffixed.h
|
|
||||||
inflate.h
|
|
||||||
inftrees.h
|
|
||||||
trees.h
|
|
||||||
zutil.h
|
|
||||||
)
|
|
||||||
set(ZLIB_SRCS
|
|
||||||
adler32.c
|
|
||||||
compress.c
|
|
||||||
crc32.c
|
|
||||||
deflate.c
|
|
||||||
gzclose.c
|
|
||||||
gzlib.c
|
|
||||||
gzread.c
|
|
||||||
gzwrite.c
|
|
||||||
inflate.c
|
|
||||||
infback.c
|
|
||||||
inftrees.c
|
|
||||||
inffast.c
|
|
||||||
trees.c
|
|
||||||
uncompr.c
|
|
||||||
zutil.c
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT MINGW)
|
|
||||||
set(ZLIB_DLL_SRCS
|
|
||||||
win32/zlib1.rc # If present will override custom build rule below.
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
|
||||||
if(ASM686)
|
|
||||||
set(ZLIB_ASMS contrib/asm686/match.S)
|
|
||||||
elseif (AMD64)
|
|
||||||
set(ZLIB_ASMS contrib/amd64/amd64-match.S)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if(ZLIB_ASMS)
|
|
||||||
add_definitions(-DASMV)
|
|
||||||
set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
if(ASM686)
|
|
||||||
ENABLE_LANGUAGE(ASM_MASM)
|
|
||||||
set(ZLIB_ASMS
|
|
||||||
contrib/masmx86/inffas32.asm
|
|
||||||
contrib/masmx86/match686.asm
|
|
||||||
)
|
|
||||||
elseif (AMD64)
|
|
||||||
ENABLE_LANGUAGE(ASM_MASM)
|
|
||||||
set(ZLIB_ASMS
|
|
||||||
contrib/masmx64/gvmat64.asm
|
|
||||||
contrib/masmx64/inffasx64.asm
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ZLIB_ASMS)
|
|
||||||
add_definitions(-DASMV -DASMINF)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
|
|
||||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
|
|
||||||
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
|
|
||||||
"\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
|
|
||||||
|
|
||||||
if(MINGW)
|
|
||||||
# This gets us DLL resource information when compiling on MinGW.
|
|
||||||
if(NOT CMAKE_RC_COMPILER)
|
|
||||||
set(CMAKE_RC_COMPILER windres.exe)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
|
|
||||||
COMMAND ${CMAKE_RC_COMPILER}
|
|
||||||
-D GCC_WINDRES
|
|
||||||
-I ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
-I ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
|
|
||||||
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
|
|
||||||
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
|
|
||||||
endif(MINGW)
|
|
||||||
|
|
||||||
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
# On unix-like platforms the library is almost always called libz
|
|
||||||
set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME z)
|
|
||||||
endif()
|
|
||||||
@ -63,6 +63,11 @@
|
|||||||
"name": "ENABLE_TESTING",
|
"name": "ENABLE_TESTING",
|
||||||
"value": "True",
|
"value": "True",
|
||||||
"type": "BOOL"
|
"type": "BOOL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BUILD_LAMMPS_GUI",
|
||||||
|
"value": "False",
|
||||||
|
"type": "BOOL"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -72,7 +77,7 @@
|
|||||||
"configurationType": "Debug",
|
"configurationType": "Debug",
|
||||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe",
|
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe -DBUILD_MPI=off",
|
||||||
"buildCommandArgs": "",
|
"buildCommandArgs": "",
|
||||||
"ctestCommandArgs": "",
|
"ctestCommandArgs": "",
|
||||||
"inheritEnvironments": [ "clang_cl_x64" ],
|
"inheritEnvironments": [ "clang_cl_x64" ],
|
||||||
@ -105,7 +110,7 @@
|
|||||||
"configurationType": "Release",
|
"configurationType": "Release",
|
||||||
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||||
"installRoot": "${workspaceRoot}\\install\\${name}",
|
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||||
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe",
|
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe -DBUILD_MPI=off",
|
||||||
"buildCommandArgs": "",
|
"buildCommandArgs": "",
|
||||||
"ctestCommandArgs": "-V",
|
"ctestCommandArgs": "-V",
|
||||||
"inheritEnvironments": [ "clang_cl_x64" ],
|
"inheritEnvironments": [ "clang_cl_x64" ],
|
||||||
@ -303,6 +308,54 @@
|
|||||||
"type": "STRING"
|
"type": "STRING"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x64-GUI-MSVC",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"configurationType": "Release",
|
||||||
|
"buildRoot": "${workspaceRoot}\\build\\${name}",
|
||||||
|
"installRoot": "${workspaceRoot}\\install\\${name}",
|
||||||
|
"cmakeCommandArgs": "-C ${workspaceRoot}\\cmake\\presets\\windows.cmake -D QT_DIR=C:\\Qt\\5.15.2\\msvc2019_64\\lib\\cmake\\Qt5 -D Qt5_DIR=C:\\Qt\\5.15.2\\msvc2019_64\\lib\\cmake\\Qt5",
|
||||||
|
"buildCommandArgs": "",
|
||||||
|
"ctestCommandArgs": "-V",
|
||||||
|
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||||
|
"variables": [
|
||||||
|
{
|
||||||
|
"name": "BUILD_SHARED_LIBS",
|
||||||
|
"value": "True",
|
||||||
|
"type": "BOOL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BUILD_TOOLS",
|
||||||
|
"value": "True",
|
||||||
|
"type": "BOOL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "LAMMPS_EXCEPTIONS",
|
||||||
|
"value": "True",
|
||||||
|
"type": "BOOL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ENABLE_TESTING",
|
||||||
|
"value": "False",
|
||||||
|
"type": "BOOL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BUILD_MPI",
|
||||||
|
"value": "False",
|
||||||
|
"type": "BOOL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "WITH_PNG",
|
||||||
|
"value": "False",
|
||||||
|
"type": "BOOL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BUILD_LAMMPS_GUI",
|
||||||
|
"value": "True",
|
||||||
|
"type": "BOOL"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -1,15 +1,11 @@
|
|||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
# use default (or custom) Python executable, if version is sufficient
|
||||||
find_package(PythonInterp 3.5 QUIET) # Deprecated since version 3.12
|
if(Python_VERSION VERSION_GREATER_EQUAL 3.6)
|
||||||
if(PYTHONINTERP_FOUND)
|
set(Python3_EXECUTABLE ${Python_EXECUTABLE})
|
||||||
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
set(Python3_VERSION ${PYTHON_VERSION_STRING})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
find_package(Python3 COMPONENTS Interpreter QUIET)
|
|
||||||
endif()
|
endif()
|
||||||
|
find_package(Python3 COMPONENTS Interpreter)
|
||||||
|
|
||||||
if(Python3_EXECUTABLE)
|
if(Python3_EXECUTABLE)
|
||||||
if(Python3_VERSION VERSION_GREATER_EQUAL 3.5)
|
if(Python3_VERSION VERSION_GREATER_EQUAL 3.6)
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
check-whitespace
|
check-whitespace
|
||||||
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py .
|
${Python3_EXECUTABLE} ${LAMMPS_TOOLS_DIR}/coding_standard/whitespace.py .
|
||||||
|
|||||||
16
cmake/Modules/DetectHIPInstallation.cmake
Normal file
16
cmake/Modules/DetectHIPInstallation.cmake
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
if(NOT DEFINED HIP_PATH)
|
||||||
|
if(NOT DEFINED ENV{HIP_PATH})
|
||||||
|
message(FATAL_ERROR "HIP support requires HIP_PATH to be defined.\n"
|
||||||
|
"Either pass the HIP_PATH as a CMake option via -DHIP_PATH=... or set the HIP_PATH environment variable.")
|
||||||
|
else()
|
||||||
|
set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to HIP installation")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if(NOT DEFINED ROCM_PATH)
|
||||||
|
if(NOT DEFINED ENV{ROCM_PATH})
|
||||||
|
set(ROCM_PATH "/opt/rocm" CACHE PATH "Path to ROCm installation")
|
||||||
|
else()
|
||||||
|
set(ROCM_PATH $ENV{ROCM_PATH} CACHE PATH "Path to ROCm installation")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
list(APPEND CMAKE_PREFIX_PATH ${HIP_PATH} ${ROCM_PATH})
|
||||||
@ -4,21 +4,19 @@
|
|||||||
option(BUILD_DOC "Build LAMMPS HTML documentation" OFF)
|
option(BUILD_DOC "Build LAMMPS HTML documentation" OFF)
|
||||||
|
|
||||||
if(BUILD_DOC)
|
if(BUILD_DOC)
|
||||||
# Sphinx 3.x requires at least Python 3.5
|
# Current Sphinx versions require at least Python 3.8
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
# use default (or custom) Python executable, if version is sufficient
|
||||||
find_package(PythonInterp 3.5 REQUIRED)
|
if(Python_VERSION VERSION_GREATER_EQUAL 3.8)
|
||||||
set(VIRTUALENV ${PYTHON_EXECUTABLE} -m venv)
|
set(Python3_EXECUTABLE ${Python_EXECUTABLE})
|
||||||
else()
|
endif()
|
||||||
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||||
if(Python3_VERSION VERSION_LESS 3.5)
|
if(Python3_VERSION VERSION_LESS 3.8)
|
||||||
message(FATAL_ERROR "Python 3.5 and up is required to build the HTML documentation")
|
message(FATAL_ERROR "Python 3.8 and up is required to build the HTML documentation")
|
||||||
endif()
|
endif()
|
||||||
set(VIRTUALENV ${Python3_EXECUTABLE} -m venv)
|
set(VIRTUALENV ${Python3_EXECUTABLE} -m venv)
|
||||||
endif()
|
|
||||||
find_package(Doxygen 1.8.10 REQUIRED)
|
find_package(Doxygen 1.8.10 REQUIRED)
|
||||||
|
file(GLOB DOC_SOURCES CONFIGURE_DEPENDS ${LAMMPS_DOC_DIR}/src/[^.]*.rst)
|
||||||
file(GLOB DOC_SOURCES ${LAMMPS_DOC_DIR}/src/[^.]*.rst)
|
|
||||||
|
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT docenv
|
OUTPUT docenv
|
||||||
@ -56,16 +54,27 @@ if(BUILD_DOC)
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(MATHJAX_URL "https://github.com/mathjax/MathJax/archive/3.1.3.tar.gz" CACHE STRING "URL for MathJax tarball")
|
set(MATHJAX_URL "https://github.com/mathjax/MathJax/archive/3.1.3.tar.gz" CACHE STRING "URL for MathJax tarball")
|
||||||
set(MATHJAX_MD5 "d1c98c746888bfd52ca8ebc10704f92f" CACHE STRING "MD5 checksum of MathJax tarball")
|
set(MATHJAX_MD5 "b81661c6e6ba06278e6ae37b30b0c492" CACHE STRING "MD5 checksum of MathJax tarball")
|
||||||
mark_as_advanced(MATHJAX_URL)
|
mark_as_advanced(MATHJAX_URL)
|
||||||
|
GetFallbackURL(MATHJAX_URL MATHJAX_FALLBACK)
|
||||||
|
|
||||||
# download mathjax distribution and unpack to folder "mathjax"
|
# download mathjax distribution and unpack to folder "mathjax"
|
||||||
if(NOT EXISTS ${DOC_BUILD_STATIC_DIR}/mathjax/es5)
|
if(NOT EXISTS ${DOC_BUILD_STATIC_DIR}/mathjax/es5)
|
||||||
file(DOWNLOAD ${MATHJAX_URL}
|
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz)
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz"
|
file(MD5 ${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz)
|
||||||
EXPECTED_MD5 ${MATHJAX_MD5})
|
endif()
|
||||||
|
if(NOT "${DL_MD5}" STREQUAL "${MATHJAX_MD5}")
|
||||||
|
file(DOWNLOAD ${MATHJAX_URL} "${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz" STATUS DL_STATUS SHOW_PROGRESS)
|
||||||
|
file(MD5 ${CMAKE_CURRENT_BINARY_DIR}/mathjax.tar.gz DL_MD5)
|
||||||
|
if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${MATHJAX_MD5}"))
|
||||||
|
message(WARNING "Download from primary URL ${MATHJAX_URL} failed\nTrying fallback URL ${MATHJAX_FALLBACK}")
|
||||||
|
file(DOWNLOAD ${MATHJAX_FALLBACK} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${MATHJAX_MD5} SHOW_PROGRESS)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz")
|
||||||
|
endif()
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf mathjax.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf mathjax.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
file(GLOB MATHJAX_VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*)
|
file(GLOB MATHJAX_VERSION_DIR CONFIGURE_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/MathJax-*)
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${DOC_BUILD_STATIC_DIR}/mathjax)
|
execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${MATHJAX_VERSION_DIR} ${DOC_BUILD_STATIC_DIR}/mathjax)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,22 @@ function(ExternalCMakeProject target url hash basedir cmakedir cmakefile)
|
|||||||
|
|
||||||
get_filename_component(archive ${url} NAME)
|
get_filename_component(archive ${url} NAME)
|
||||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
|
||||||
|
if(EXISTS ${CMAKE_BINARY_DIR}/_deps/${archive})
|
||||||
|
file(MD5 ${CMAKE_BINARY_DIR}/_deps/${archive} DL_MD5)
|
||||||
|
endif()
|
||||||
|
if(NOT "${DL_MD5}" STREQUAL "${hash}")
|
||||||
message(STATUS "Downloading ${url}")
|
message(STATUS "Downloading ${url}")
|
||||||
file(DOWNLOAD ${url} ${CMAKE_BINARY_DIR}/_deps/${archive} EXPECTED_HASH MD5=${hash} SHOW_PROGRESS)
|
file(DOWNLOAD ${url} ${CMAKE_BINARY_DIR}/_deps/${archive} STATUS DL_STATUS SHOW_PROGRESS)
|
||||||
|
file(MD5 ${CMAKE_BINARY_DIR}/_deps/${archive} DL_MD5)
|
||||||
|
if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${hash}"))
|
||||||
|
set(${target}_URL ${url})
|
||||||
|
GetFallbackURL(${target}_URL fallback)
|
||||||
|
message(WARNING "Download from primary URL ${url} failed\nTrying fallback URL ${fallback}")
|
||||||
|
file(DOWNLOAD ${fallback} ${CMAKE_BINARY_DIR}/_deps/${archive} EXPECTED_HASH MD5=${hash} SHOW_PROGRESS)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/_deps/${archive}")
|
||||||
|
endif()
|
||||||
message(STATUS "Unpacking and configuring ${archive}")
|
message(STATUS "Unpacking and configuring ${archive}")
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_BINARY_DIR}/_deps/${archive}
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_BINARY_DIR}/_deps/${archive}
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
# Find clang-format
|
# Find clang-format
|
||||||
find_program(ClangFormat_EXECUTABLE NAMES clang-format
|
find_program(ClangFormat_EXECUTABLE NAMES clang-format
|
||||||
|
clang-format-17.0
|
||||||
|
clang-format-16.0
|
||||||
|
clang-format-15.0
|
||||||
|
clang-format-14.0
|
||||||
|
clang-format-13.0
|
||||||
|
clang-format-12.0
|
||||||
|
clang-format-11.0
|
||||||
clang-format-10.0
|
clang-format-10.0
|
||||||
clang-format-9.0
|
clang-format-9.0
|
||||||
clang-format-8.0
|
clang-format-8.0
|
||||||
@ -14,19 +21,33 @@ if(ClangFormat_EXECUTABLE)
|
|||||||
OUTPUT_VARIABLE clang_format_version
|
OUTPUT_VARIABLE clang_format_version
|
||||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
if(clang_format_version MATCHES "^(Ubuntu |Debian |)clang-format version .*")
|
||||||
if(clang_format_version MATCHES "^clang-format version .*")
|
# Arch Linux output:
|
||||||
# Arch Linux
|
|
||||||
# clang-format version 10.0.0
|
# clang-format version 10.0.0
|
||||||
|
#
|
||||||
# Ubuntu 18.04 LTS Output
|
# Ubuntu 18.04 LTS output:
|
||||||
# clang-format version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
|
# clang-format version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
|
||||||
string(REGEX REPLACE "clang-format version ([0-9.]+).*"
|
#
|
||||||
"\\1"
|
# Ubuntu 20.04 LTS output:
|
||||||
|
# clang-format version 10.0.0-4ubuntu1
|
||||||
|
#
|
||||||
|
# Ubuntu 22.04 LTS output:
|
||||||
|
# Ubuntu clang-format version 14.0.0-1ubuntu1
|
||||||
|
#
|
||||||
|
# Debian 11 output:
|
||||||
|
# Debian clang-format version 11.0.1-2
|
||||||
|
#
|
||||||
|
# Debian 12 output:
|
||||||
|
# Debian clang-format version 14.0.6
|
||||||
|
#
|
||||||
|
# Fedora 36 output:
|
||||||
|
# clang-format version 14.0.5 (Fedora 14.0.5-1.fc36)
|
||||||
|
string(REGEX REPLACE "^(Ubuntu |Debian |)clang-format version ([0-9.]+).*"
|
||||||
|
"\\2"
|
||||||
ClangFormat_VERSION
|
ClangFormat_VERSION
|
||||||
"${clang_format_version}")
|
"${clang_format_version}")
|
||||||
elseif(clang_format_version MATCHES ".*LLVM version .*")
|
elseif(clang_format_version MATCHES ".*LLVM version .*")
|
||||||
# CentOS 7 Output
|
# CentOS 7 output:
|
||||||
# LLVM (http://llvm.org/):
|
# LLVM (http://llvm.org/):
|
||||||
# LLVM version 3.4.2
|
# LLVM version 3.4.2
|
||||||
# Optimized build.
|
# Optimized build.
|
||||||
|
|||||||
@ -7,22 +7,14 @@
|
|||||||
# adapted from https://github.com/cmarshall108/cython-cmake-example/blob/master/cmake/FindCython.cmake
|
# adapted from https://github.com/cmarshall108/cython-cmake-example/blob/master/cmake/FindCython.cmake
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
|
|
||||||
find_package(PythonInterp 3.6 QUIET) # Deprecated since version 3.12
|
|
||||||
if(PYTHONINTERP_FOUND)
|
|
||||||
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
find_package(Python 3.6 COMPONENTS Interpreter QUIET)
|
find_package(Python 3.6 COMPONENTS Interpreter QUIET)
|
||||||
endif()
|
|
||||||
|
|
||||||
# Use the Cython executable that lives next to the Python executable
|
# Use the Cython executable that lives next to the Python executable
|
||||||
# if it is a local installation.
|
# if it is a local installation.
|
||||||
if(Python_EXECUTABLE)
|
if(Python_EXECUTABLE)
|
||||||
get_filename_component(_python_path ${Python_EXECUTABLE} PATH)
|
get_filename_component(_python_path ${Python_EXECUTABLE} PATH)
|
||||||
find_program(Cythonize_EXECUTABLE
|
find_program(Cythonize_EXECUTABLE
|
||||||
NAMES cythonize3 cythonize cythonize.bat
|
NAMES cythonize-${Python_VERSION_MAJOR}.${Python_VERSION_MINOR} cythonize3 cythonize cythonize.bat
|
||||||
HINTS ${_python_path})
|
HINTS ${_python_path})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
find_path(ZMQ_INCLUDE_DIR zmq.h)
|
|
||||||
find_library(ZMQ_LIBRARY NAMES zmq)
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
find_package_handle_standard_args(ZMQ DEFAULT_MSG ZMQ_LIBRARY ZMQ_INCLUDE_DIR)
|
|
||||||
|
|
||||||
# Copy the results to the output variables and target.
|
|
||||||
if(ZMQ_FOUND)
|
|
||||||
set(ZMQ_LIBRARIES ${ZMQ_LIBRARY})
|
|
||||||
set(ZMQ_INCLUDE_DIRS ${ZMQ_INCLUDE_DIR})
|
|
||||||
|
|
||||||
if(NOT TARGET ZMQ::ZMQ)
|
|
||||||
add_library(ZMQ::ZMQ UNKNOWN IMPORTED)
|
|
||||||
set_target_properties(ZMQ::ZMQ PROPERTIES
|
|
||||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
|
||||||
IMPORTED_LOCATION "${ZMQ_LIBRARY}"
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${ZMQ_INCLUDE_DIR}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
250
cmake/Modules/LAMMPSInterfacePlugin.cmake
Normal file
250
cmake/Modules/LAMMPSInterfacePlugin.cmake
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
# CMake script code to define LAMMPS settings required for building LAMMPS plugins
|
||||||
|
|
||||||
|
# enforce out-of-source build
|
||||||
|
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||||
|
message(FATAL_ERROR "In-source builds are not allowed. You must create and use a build directory. "
|
||||||
|
"Please remove CMakeCache.txt and CMakeFiles first.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(LAMMPS_THIRDPARTY_URL "https://download.lammps.org/thirdparty"
|
||||||
|
CACHE STRING "URL for thirdparty package downloads")
|
||||||
|
|
||||||
|
# global LAMMPS/plugin build settings
|
||||||
|
set(LAMMPS_SOURCE_DIR "" CACHE PATH "Location of LAMMPS sources folder")
|
||||||
|
if(NOT LAMMPS_SOURCE_DIR)
|
||||||
|
message(FATAL_ERROR "Must set LAMMPS_SOURCE_DIR")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# by default, install into $HOME/.local (not /usr/local),
|
||||||
|
# so that no root access (and sudo) is needed
|
||||||
|
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
|
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "Default install path" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
|
||||||
|
# and prints lots of pointless warnings about "unsafe" functions
|
||||||
|
if(MSVC)
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
|
add_compile_options(/Zc:__cplusplus)
|
||||||
|
add_compile_options(/wd4244)
|
||||||
|
add_compile_options(/wd4267)
|
||||||
|
add_compile_options(/wd4250)
|
||||||
|
add_compile_options(/EHsc)
|
||||||
|
endif()
|
||||||
|
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# C++11 is required
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
# Need -restrict with Intel compilers
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict")
|
||||||
|
endif()
|
||||||
|
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
||||||
|
|
||||||
|
#######
|
||||||
|
# helper functions from LAMMPSUtils.cmake
|
||||||
|
function(validate_option name values)
|
||||||
|
string(TOLOWER ${${name}} needle_lower)
|
||||||
|
string(TOUPPER ${${name}} needle_upper)
|
||||||
|
list(FIND ${values} ${needle_lower} IDX_LOWER)
|
||||||
|
list(FIND ${values} ${needle_upper} IDX_UPPER)
|
||||||
|
if(${IDX_LOWER} LESS 0 AND ${IDX_UPPER} LESS 0)
|
||||||
|
list_to_bulletpoints(POSSIBLE_VALUE_LIST ${${values}})
|
||||||
|
message(FATAL_ERROR "\n########################################################################\n"
|
||||||
|
"Invalid value '${${name}}' for option ${name}\n"
|
||||||
|
"\n"
|
||||||
|
"Possible values are:\n"
|
||||||
|
"${POSSIBLE_VALUE_LIST}"
|
||||||
|
"########################################################################")
|
||||||
|
endif()
|
||||||
|
endfunction(validate_option)
|
||||||
|
|
||||||
|
# helper function for getting the most recently modified file or folder from a glob pattern
|
||||||
|
function(get_newest_file path variable)
|
||||||
|
file(GLOB _dirs CONFIGURE_DEPENDS ${path})
|
||||||
|
set(_besttime 2000-01-01T00:00:00)
|
||||||
|
set(_bestfile "<unknown>")
|
||||||
|
foreach(_dir ${_dirs})
|
||||||
|
file(TIMESTAMP ${_dir} _newtime)
|
||||||
|
if(_newtime IS_NEWER_THAN _besttime)
|
||||||
|
set(_bestfile ${_dir})
|
||||||
|
set(_besttime ${_newtime})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if(_bestfile STREQUAL "<unknown>")
|
||||||
|
message(FATAL_ERROR "Could not find valid path at: ${path}")
|
||||||
|
endif()
|
||||||
|
set(${variable} ${_bestfile} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# get LAMMPS version date
|
||||||
|
function(get_lammps_version version_header variable)
|
||||||
|
file(STRINGS ${version_header} line REGEX LAMMPS_VERSION)
|
||||||
|
string(REGEX REPLACE "#define LAMMPS_VERSION \"([0-9]+) ([A-Za-z]+) ([0-9]+)\"" "\\1\\2\\3" date "${line}")
|
||||||
|
set(${variable} "${date}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# determine canonical URL for downloading backup copy from download.lammps.org/thirdparty
|
||||||
|
function(GetFallbackURL input output)
|
||||||
|
string(REPLACE "_URL" "" _tmp ${input})
|
||||||
|
string(TOLOWER ${_tmp} libname)
|
||||||
|
string(REGEX REPLACE "^https://.*/([^/]+gz)" "${LAMMPS_THIRDPARTY_URL}/${libname}-\\1" newurl "${${input}}")
|
||||||
|
if ("${newurl}" STREQUAL "${${input}}")
|
||||||
|
set(${output} "" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
set(${output} ${newurl} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction(GetFallbackURL)
|
||||||
|
|
||||||
|
#################################################################################
|
||||||
|
# LAMMPS C++ interface. We only need the header related parts except on windows.
|
||||||
|
add_library(lammps INTERFACE)
|
||||||
|
target_include_directories(lammps INTERFACE ${LAMMPS_SOURCE_DIR})
|
||||||
|
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
|
||||||
|
target_link_libraries(lammps INTERFACE ${CMAKE_BINARY_DIR}/../liblammps.dll.a)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# MPI configuration
|
||||||
|
if(NOT CMAKE_CROSSCOMPILING)
|
||||||
|
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||||
|
find_package(MPI QUIET)
|
||||||
|
option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
|
||||||
|
else()
|
||||||
|
option(BUILD_MPI "Build MPI version" OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_MPI)
|
||||||
|
# do not include the (obsolete) MPI C++ bindings which makes
|
||||||
|
# for leaner object files and avoids namespace conflicts
|
||||||
|
set(MPI_CXX_SKIP_MPICXX TRUE)
|
||||||
|
# We use a non-standard procedure to cross-compile with MPI on Windows
|
||||||
|
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
|
||||||
|
# Download and configure MinGW compatible MPICH development files for Windows
|
||||||
|
option(USE_MSMPI "Use Microsoft's MS-MPI SDK instead of MPICH2-1.4.1" OFF)
|
||||||
|
if(USE_MSMPI)
|
||||||
|
message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation")
|
||||||
|
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball")
|
||||||
|
set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball")
|
||||||
|
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||||
|
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||||
|
|
||||||
|
include(ExternalProject)
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||||
|
ExternalProject_Add(mpi4win_build
|
||||||
|
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||||
|
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||||
|
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||||
|
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmsmpi.a)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Only x86 64-bit builds are supported with MS-MPI")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||||
|
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||||
|
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmsmpi.a"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||||
|
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||||
|
|
||||||
|
# set variables for status reporting at the end of CMake run
|
||||||
|
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||||
|
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||||
|
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmsmpi.a")
|
||||||
|
else()
|
||||||
|
# Download and configure custom MPICH files for Windows
|
||||||
|
message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows")
|
||||||
|
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
|
||||||
|
set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball")
|
||||||
|
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||||
|
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||||
|
|
||||||
|
include(ExternalProject)
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||||
|
ExternalProject_Add(mpi4win_build
|
||||||
|
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||||
|
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||||
|
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||||
|
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||||
|
else()
|
||||||
|
ExternalProject_Add(mpi4win_build
|
||||||
|
URL ${MPICH2_WIN32_DEVEL_URL}
|
||||||
|
URL_MD5 ${MPICH2_WIN32_DEVEL_MD5}
|
||||||
|
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||||
|
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmpi.a)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||||
|
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||||
|
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmpi.a"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||||
|
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||||
|
|
||||||
|
# set variables for status reporting at the end of CMake run
|
||||||
|
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||||
|
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||||
|
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
find_package(MPI REQUIRED)
|
||||||
|
option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF)
|
||||||
|
if(LAMMPS_LONGLONG_TO_LONG)
|
||||||
|
target_compile_definitions(lammps INTERFACE -DLAMMPS_LONGLONG_TO_LONG)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
target_link_libraries(lammps INTERFACE MPI::MPI_CXX)
|
||||||
|
else()
|
||||||
|
add_library(mpi_stubs INTERFACE)
|
||||||
|
target_include_directories(mpi_stubs INTERFACE $<BUILD_INTERFACE:${LAMMPS_SOURCE_DIR}/STUBS>)
|
||||||
|
target_link_libraries(lammps INTERFACE mpi_stubs)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# detect if we may enable OpenMP support by default
|
||||||
|
set(BUILD_OMP_DEFAULT OFF)
|
||||||
|
find_package(OpenMP QUIET)
|
||||||
|
if(OpenMP_FOUND)
|
||||||
|
check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
|
||||||
|
if(HAVE_OMP_H_INCLUDE)
|
||||||
|
set(BUILD_OMP_DEFAULT ON)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(BUILD_OMP "Build with OpenMP support" ${BUILD_OMP_DEFAULT})
|
||||||
|
|
||||||
|
if(BUILD_OMP)
|
||||||
|
find_package(OpenMP REQUIRED)
|
||||||
|
check_include_file_cxx(omp.h HAVE_OMP_H_INCLUDE)
|
||||||
|
if(NOT HAVE_OMP_H_INCLUDE)
|
||||||
|
message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR
|
||||||
|
(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR
|
||||||
|
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR
|
||||||
|
((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0)))
|
||||||
|
# GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts.
|
||||||
|
# Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe.
|
||||||
|
target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=4)
|
||||||
|
else()
|
||||||
|
target_compile_definitions(lammps INTERFACE -DLAMMPS_OMP_COMPAT=3)
|
||||||
|
endif()
|
||||||
|
target_link_libraries(lammps INTERFACE OpenMP::OpenMP_CXX)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
################
|
||||||
|
# integer size selection
|
||||||
|
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
|
||||||
|
set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall)
|
||||||
|
set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES})
|
||||||
|
validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES)
|
||||||
|
string(TOUPPER ${LAMMPS_SIZES} LAMMPS_SIZES)
|
||||||
|
target_compile_definitions(lammps INTERFACE -DLAMMPS_${LAMMPS_SIZES})
|
||||||
@ -24,9 +24,24 @@ function(validate_option name values)
|
|||||||
endif()
|
endif()
|
||||||
endfunction(validate_option)
|
endfunction(validate_option)
|
||||||
|
|
||||||
|
# helper function to check for usable omp.h header
|
||||||
|
function(check_omp_h_include)
|
||||||
|
find_package(OpenMP COMPONENTS CXX QUIET)
|
||||||
|
if(OpenMP_CXX_FOUND)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS ${OpenMP_CXX_FLAGS})
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${OpenMP_CXX_INCLUDE_DIRS})
|
||||||
|
set(CMAKE_REQUIRED_LINK_OPTIONS ${OpenMP_CXX_FLAGS})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${OpenMP_CXX_LIBRARIES})
|
||||||
|
check_include_file_cxx(omp.h _have_omp_h)
|
||||||
|
else()
|
||||||
|
set(_have_omp_h FALSE)
|
||||||
|
endif()
|
||||||
|
set(HAVE_OMP_H_INCLUDE ${_have_omp_h} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
# helper function for getting the most recently modified file or folder from a glob pattern
|
# helper function for getting the most recently modified file or folder from a glob pattern
|
||||||
function(get_newest_file path variable)
|
function(get_newest_file path variable)
|
||||||
file(GLOB _dirs ${path})
|
file(GLOB _dirs CONFIGURE_DEPENDS ${path})
|
||||||
set(_besttime 2000-01-01T00:00:00)
|
set(_besttime 2000-01-01T00:00:00)
|
||||||
set(_bestfile "<unknown>")
|
set(_bestfile "<unknown>")
|
||||||
foreach(_dir ${_dirs})
|
foreach(_dir ${_dirs})
|
||||||
@ -65,15 +80,15 @@ endfunction()
|
|||||||
|
|
||||||
function(check_for_autogen_files source_dir)
|
function(check_for_autogen_files source_dir)
|
||||||
message(STATUS "Running check for auto-generated files from make-based build system")
|
message(STATUS "Running check for auto-generated files from make-based build system")
|
||||||
file(GLOB SRC_AUTOGEN_FILES ${source_dir}/style_*.h)
|
file(GLOB SRC_AUTOGEN_FILES CONFIGURE_DEPENDS ${source_dir}/style_*.h)
|
||||||
file(GLOB SRC_AUTOGEN_PACKAGES ${source_dir}/packages_*.h)
|
file(GLOB SRC_AUTOGEN_PACKAGES CONFIGURE_DEPENDS ${source_dir}/packages_*.h)
|
||||||
list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/lmpinstalledpkgs.h ${source_dir}/lmpgitversion.h)
|
list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/lmpinstalledpkgs.h ${source_dir}/lmpgitversion.h)
|
||||||
list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${source_dir}/mliap_model_python_couple.h ${source_dir}/mliap_model_python_couple.cpp)
|
list(APPEND SRC_AUTOGEN_FILES ${source_dir}/mliap_model_python_couple.h ${source_dir}/mliap_model_python_couple.cpp)
|
||||||
foreach(_SRC ${SRC_AUTOGEN_FILES})
|
foreach(_SRC ${SRC_AUTOGEN_FILES})
|
||||||
get_filename_component(FILENAME "${_SRC}" NAME)
|
get_filename_component(FILENAME "${_SRC}" NAME)
|
||||||
if(EXISTS ${source_dir}/${FILENAME})
|
if(EXISTS ${source_dir}/${FILENAME})
|
||||||
message(FATAL_ERROR "\n########################################################################\n"
|
message(FATAL_ERROR "\n########################################################################\n"
|
||||||
"Found header file(s) generated by the make-based build system\n"
|
"Found header file ${source_dir}/${FILENAME} generated by the make-based build system\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Please run\n"
|
"Please run\n"
|
||||||
"make -C ${source_dir} purge\n"
|
"make -C ${source_dir} purge\n"
|
||||||
@ -84,8 +99,15 @@ function(check_for_autogen_files source_dir)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
macro(pkg_depends PKG1 PKG2)
|
macro(pkg_depends PKG1 PKG2)
|
||||||
if(PKG_${PKG1} AND NOT (PKG_${PKG2} OR BUILD_${PKG2}))
|
if(DEFINED BUILD_${PKG2})
|
||||||
message(FATAL_ERROR "The ${PKG1} package needs LAMMPS to be build with the ${PKG2} package")
|
if(PKG_${PKG1} AND NOT BUILD_${PKG2})
|
||||||
|
message(FATAL_ERROR "The ${PKG1} package needs LAMMPS to be built with -D BUILD_${PKG2}=ON")
|
||||||
|
endif()
|
||||||
|
elseif(DEFINED PKG_${PKG2})
|
||||||
|
if(PKG_${PKG1} AND NOT PKG_${PKG2})
|
||||||
|
message(WARNING "The ${PKG1} package depends on the ${PKG2} package. Enabling it.")
|
||||||
|
set(PKG_${PKG2} ON CACHE BOOL "" FORCE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
@ -103,6 +125,7 @@ endfunction(GenerateBinaryHeader)
|
|||||||
|
|
||||||
# fetch missing potential files
|
# fetch missing potential files
|
||||||
function(FetchPotentials pkgfolder potfolder)
|
function(FetchPotentials pkgfolder potfolder)
|
||||||
|
if(DOWNLOAD_POTENTIALS)
|
||||||
if(EXISTS "${pkgfolder}/potentials.txt")
|
if(EXISTS "${pkgfolder}/potentials.txt")
|
||||||
file(STRINGS "${pkgfolder}/potentials.txt" linelist REGEX "^[^#].")
|
file(STRINGS "${pkgfolder}/potentials.txt" linelist REGEX "^[^#].")
|
||||||
foreach(line ${linelist})
|
foreach(line ${linelist})
|
||||||
@ -110,25 +133,40 @@ function(FetchPotentials pkgfolder potfolder)
|
|||||||
math(EXPR plusone "${blank}+1")
|
math(EXPR plusone "${blank}+1")
|
||||||
string(SUBSTRING ${line} 0 ${blank} pot)
|
string(SUBSTRING ${line} 0 ${blank} pot)
|
||||||
string(SUBSTRING ${line} ${plusone} -1 sum)
|
string(SUBSTRING ${line} ${plusone} -1 sum)
|
||||||
if(EXISTS ${LAMMPS_POTENTIALS_DIR}/${pot})
|
if(EXISTS "${LAMMPS_POTENTIALS_DIR}/${pot}")
|
||||||
file(MD5 "${LAMMPS_POTENTIALS_DIR}/${pot}" oldsum)
|
file(MD5 "${LAMMPS_POTENTIALS_DIR}/${pot}" oldsum)
|
||||||
endif()
|
endif()
|
||||||
if(NOT sum STREQUAL oldsum)
|
if(NOT sum STREQUAL oldsum)
|
||||||
message(STATUS "Checking external potential ${pot} from ${LAMMPS_POTENTIALS_URL}")
|
message(STATUS "Downloading external potential ${pot} from ${LAMMPS_POTENTIALS_URL}")
|
||||||
file(DOWNLOAD "${LAMMPS_POTENTIALS_URL}/${pot}.${sum}" "${CMAKE_BINARY_DIR}/${pot}"
|
string(RANDOM LENGTH 10 TMP_EXT)
|
||||||
|
file(DOWNLOAD "${LAMMPS_POTENTIALS_URL}/${pot}.${sum}" "${CMAKE_BINARY_DIR}/${pot}.${TMP_EXT}"
|
||||||
EXPECTED_HASH MD5=${sum} SHOW_PROGRESS)
|
EXPECTED_HASH MD5=${sum} SHOW_PROGRESS)
|
||||||
file(COPY "${CMAKE_BINARY_DIR}/${pot}" DESTINATION ${LAMMPS_POTENTIALS_DIR})
|
file(COPY "${CMAKE_BINARY_DIR}/${pot}.${TMP_EXT}" DESTINATION "${LAMMPS_POTENTIALS_DIR}")
|
||||||
|
file(RENAME "${LAMMPS_POTENTIALS_DIR}/${pot}.${TMP_EXT}" "${LAMMPS_POTENTIALS_DIR}/${pot}")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endfunction(FetchPotentials)
|
endfunction(FetchPotentials)
|
||||||
|
|
||||||
# set CMAKE_LINUX_DISTRO and CMAKE_DISTRO_VERSION on Linux
|
# set CMAKE_LINUX_DISTRO and CMAKE_DISTRO_VERSION on Linux
|
||||||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (EXISTS /etc/os-release))
|
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (EXISTS /etc/os-release))
|
||||||
file(STRINGS /etc/os-release distro REGEX "^NAME=")
|
file(STRINGS /etc/os-release distro REGEX "^NAME=")
|
||||||
string(REGEX REPLACE "NAME=\"?([^\"]*)\"?" "\\1" distro "${distro}")
|
string(REGEX REPLACE "NAME=\"?([^ ]+).*\"?" "\\1" distro "${distro}")
|
||||||
file(STRINGS /etc/os-release disversion REGEX "^VERSION_ID=")
|
file(STRINGS /etc/os-release disversion REGEX "^VERSION_ID=")
|
||||||
string(REGEX REPLACE "VERSION_ID=\"?([^\"]*)\"?" "\\1" disversion "${disversion}")
|
string(REGEX REPLACE "VERSION_ID=\"?([^\"]*)\"?" "\\1" disversion "${disversion}")
|
||||||
set(CMAKE_LINUX_DISTRO ${distro})
|
set(CMAKE_LINUX_DISTRO ${distro})
|
||||||
set(CMAKE_DISTRO_VERSION ${disversion})
|
set(CMAKE_DISTRO_VERSION ${disversion})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# determine canonical URL for downloading backup copy from download.lammps.org/thirdparty
|
||||||
|
function(GetFallbackURL input output)
|
||||||
|
string(REPLACE "_URL" "" _tmp ${input})
|
||||||
|
string(TOLOWER ${_tmp} libname)
|
||||||
|
string(REGEX REPLACE "^https://.*/([^/]+gz)" "${LAMMPS_THIRDPARTY_URL}/${libname}-\\1" newurl "${${input}}")
|
||||||
|
if ("${newurl}" STREQUAL "${${input}}")
|
||||||
|
set(${output} "" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
set(${output} ${newurl} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction(GetFallbackURL)
|
||||||
|
|||||||
@ -1,5 +1,39 @@
|
|||||||
# Download and configure custom MPICH files for Windows
|
# Download and configure MinGW compatible MPICH development files for Windows
|
||||||
message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows")
|
option(USE_MSMPI "Use Microsoft's MS-MPI SDK instead of MPICH2-1.4.1" OFF)
|
||||||
|
|
||||||
|
if(USE_MSMPI)
|
||||||
|
message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation")
|
||||||
|
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball")
|
||||||
|
set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball")
|
||||||
|
mark_as_advanced(MPICH2_WIN64_DEVEL_URL)
|
||||||
|
mark_as_advanced(MPICH2_WIN64_DEVEL_MD5)
|
||||||
|
|
||||||
|
include(ExternalProject)
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||||
|
ExternalProject_Add(mpi4win_build
|
||||||
|
URL ${MPICH2_WIN64_DEVEL_URL}
|
||||||
|
URL_MD5 ${MPICH2_WIN64_DEVEL_MD5}
|
||||||
|
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||||
|
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libmsmpi.a)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Only x86 64-bit builds are supported with MS-MPI")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
ExternalProject_get_property(mpi4win_build SOURCE_DIR)
|
||||||
|
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
|
||||||
|
add_library(MPI::MPI_CXX UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(MPI::MPI_CXX PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmsmpi.a"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include"
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||||
|
add_dependencies(MPI::MPI_CXX mpi4win_build)
|
||||||
|
|
||||||
|
# set variables for status reporting at the end of CMake run
|
||||||
|
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||||
|
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||||
|
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmsmpi.a")
|
||||||
|
else()
|
||||||
|
message(STATUS "Downloading and configuring MPICH2-1.4.1 for Windows cross-compilation")
|
||||||
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
|
set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball")
|
||||||
set(MPICH2_WIN32_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" CACHE STRING "URL for MPICH2 (win32) tarball")
|
set(MPICH2_WIN32_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" CACHE STRING "URL for MPICH2 (win32) tarball")
|
||||||
set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball")
|
set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball")
|
||||||
@ -37,3 +71,4 @@ add_dependencies(MPI::MPI_CXX mpi4win_build)
|
|||||||
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include")
|
||||||
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX")
|
||||||
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a")
|
set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a")
|
||||||
|
endif()
|
||||||
|
|||||||
@ -1,20 +1,15 @@
|
|||||||
set(COLVARS_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
set(COLVARS_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars)
|
||||||
|
|
||||||
file(GLOB COLVARS_SOURCES ${COLVARS_SOURCE_DIR}/[^.]*.cpp)
|
file(GLOB COLVARS_SOURCES CONFIGURE_DEPENDS ${COLVARS_SOURCE_DIR}/[^.]*.cpp)
|
||||||
|
|
||||||
option(COLVARS_DEBUG "Debugging messages for Colvars (quite verbose)" OFF)
|
option(COLVARS_DEBUG "Enable debugging messages for Colvars (quite verbose)" OFF)
|
||||||
|
|
||||||
# Build Lepton by default
|
option(COLVARS_LEPTON "Use the Lepton library for custom expressions" ON)
|
||||||
option(COLVARS_LEPTON "Build and link the Lepton library" ON)
|
|
||||||
|
|
||||||
if(COLVARS_LEPTON)
|
if(COLVARS_LEPTON)
|
||||||
set(LEPTON_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton)
|
if(NOT LEPTON_SOURCE_DIR)
|
||||||
file(GLOB LEPTON_SOURCES ${LEPTON_DIR}/src/[^.]*.cpp)
|
include(Packages/LEPTON)
|
||||||
add_library(lepton STATIC ${LEPTON_SOURCES})
|
endif()
|
||||||
# Change the define below to LEPTON_BUILDING_SHARED_LIBRARY when linking Lepton as a DLL with MSVC
|
|
||||||
target_compile_definitions(lepton PRIVATE -DLEPTON_BUILDING_STATIC_LIBRARY)
|
|
||||||
set_target_properties(lepton PROPERTIES OUTPUT_NAME lammps_lepton${LAMMPS_MACHINE})
|
|
||||||
target_include_directories(lepton PRIVATE ${LEPTON_DIR}/include)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(colvars STATIC ${COLVARS_SOURCES})
|
add_library(colvars STATIC ${COLVARS_SOURCES})
|
||||||
@ -30,14 +25,11 @@ target_include_directories(colvars PRIVATE ${LAMMPS_SOURCE_DIR})
|
|||||||
target_link_libraries(lammps PRIVATE colvars)
|
target_link_libraries(lammps PRIVATE colvars)
|
||||||
|
|
||||||
if(COLVARS_DEBUG)
|
if(COLVARS_DEBUG)
|
||||||
# Need to export the macro publicly to also affect the proxy
|
# Need to export the define publicly to be valid in interface code
|
||||||
target_compile_definitions(colvars PUBLIC -DCOLVARS_DEBUG)
|
target_compile_definitions(colvars PUBLIC -DCOLVARS_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(COLVARS_LEPTON)
|
if(COLVARS_LEPTON)
|
||||||
target_link_libraries(lammps PRIVATE lepton)
|
|
||||||
target_compile_definitions(colvars PRIVATE -DLEPTON)
|
target_compile_definitions(colvars PRIVATE -DLEPTON)
|
||||||
# Disable the line below when linking Lepton as a DLL with MSVC
|
target_link_libraries(colvars PUBLIC lepton)
|
||||||
target_compile_definitions(colvars PRIVATE -DLEPTON_USE_STATIC_LIBRARIES)
|
|
||||||
target_include_directories(colvars PUBLIC ${LEPTON_DIR}/include)
|
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,4 +1,9 @@
|
|||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB)
|
||||||
|
if(NOT ZLIB_FOUND)
|
||||||
|
message(WARNING "No Zlib development support found. Disabling COMPRESS package...")
|
||||||
|
set(PKG_COMPRESS OFF CACHE BOOL "" FORCE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
target_link_libraries(lammps PRIVATE ZLIB::ZLIB)
|
target_link_libraries(lammps PRIVATE ZLIB::ZLIB)
|
||||||
|
|
||||||
find_package(PkgConfig QUIET)
|
find_package(PkgConfig QUIET)
|
||||||
|
|||||||
@ -26,7 +26,20 @@ elseif(GPU_PREC STREQUAL "SINGLE")
|
|||||||
set(GPU_PREC_SETTING "SINGLE_SINGLE")
|
set(GPU_PREC_SETTING "SINGLE_SINGLE")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cpp)
|
option(GPU_DEBUG "Enable debugging code of the GPU package" OFF)
|
||||||
|
mark_as_advanced(GPU_DEBUG)
|
||||||
|
|
||||||
|
if(PKG_AMOEBA AND FFT_SINGLE)
|
||||||
|
message(FATAL_ERROR "GPU acceleration of AMOEBA is not (yet) compatible with single precision FFT")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (PKG_AMOEBA)
|
||||||
|
list(APPEND GPU_SOURCES
|
||||||
|
${GPU_SOURCES_DIR}/amoeba_convolution_gpu.h
|
||||||
|
${GPU_SOURCES_DIR}/amoeba_convolution_gpu.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(GLOB GPU_LIB_SOURCES CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cpp)
|
||||||
file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
||||||
|
|
||||||
if(GPU_API STREQUAL "CUDA")
|
if(GPU_API STREQUAL "CUDA")
|
||||||
@ -47,15 +60,17 @@ if(GPU_API STREQUAL "CUDA")
|
|||||||
option(CUDA_MPS_SUPPORT "Enable tweaks to support CUDA Multi-process service (MPS)" OFF)
|
option(CUDA_MPS_SUPPORT "Enable tweaks to support CUDA Multi-process service (MPS)" OFF)
|
||||||
if(CUDA_MPS_SUPPORT)
|
if(CUDA_MPS_SUPPORT)
|
||||||
if(CUDPP_OPT)
|
if(CUDPP_OPT)
|
||||||
message(FATAL_ERROR "Must use -DCUDPP_OPT=OFF with -DGPU_CUDA_MPS_SUPPORT=ON")
|
message(FATAL_ERROR "Must use -DCUDPP_OPT=OFF with -DCUDA_MPS_SUPPORT=ON")
|
||||||
endif()
|
endif()
|
||||||
set(GPU_CUDA_MPS_FLAGS "-DCUDA_PROXY")
|
set(GPU_CUDA_MPS_FLAGS "-DCUDA_MPS_SUPPORT")
|
||||||
endif()
|
endif()
|
||||||
|
option(CUDA_BUILD_MULTIARCH "Enable building CUDA kernels for all supported GPU architectures" ON)
|
||||||
|
mark_as_advanced(GPU_BUILD_MULTIARCH)
|
||||||
|
|
||||||
set(GPU_ARCH "sm_50" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)")
|
set(GPU_ARCH "sm_50" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)")
|
||||||
|
|
||||||
# ensure that no *cubin.h files exist from a compile in the lib/gpu folder
|
# ensure that no *cubin.h files exist from a compile in the lib/gpu folder
|
||||||
file(GLOB GPU_LIB_OLD_CUBIN_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/*_cubin.h)
|
file(GLOB GPU_LIB_OLD_CUBIN_HEADERS CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/*_cubin.h)
|
||||||
if(GPU_LIB_OLD_CUBIN_HEADERS)
|
if(GPU_LIB_OLD_CUBIN_HEADERS)
|
||||||
message(FATAL_ERROR "########################################################################\n"
|
message(FATAL_ERROR "########################################################################\n"
|
||||||
"Found file(s) generated by the make-based build system in lib/gpu\n"
|
"Found file(s) generated by the make-based build system in lib/gpu\n"
|
||||||
@ -65,28 +80,32 @@ if(GPU_API STREQUAL "CUDA")
|
|||||||
"########################################################################")
|
"########################################################################")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu)
|
file(GLOB GPU_LIB_CU CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu)
|
||||||
list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
|
list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
|
||||||
|
|
||||||
cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
||||||
|
|
||||||
if(CUDPP_OPT)
|
if(CUDPP_OPT)
|
||||||
cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
|
cuda_include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
|
||||||
file(GLOB GPU_LIB_CUDPP_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cpp)
|
file(GLOB GPU_LIB_CUDPP_SOURCES CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cpp)
|
||||||
file(GLOB GPU_LIB_CUDPP_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cu)
|
file(GLOB GPU_LIB_CUDPP_CU CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cu)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# build arch/gencode commands for nvcc based on CUDA toolkit version and use choice
|
# build arch/gencode commands for nvcc based on CUDA toolkit version and use choice
|
||||||
# --arch translates directly instead of JIT, so this should be for the preferred or most common architecture
|
# --arch translates directly instead of JIT, so this should be for the preferred or most common architecture
|
||||||
set(GPU_CUDA_GENCODE "-arch=${GPU_ARCH}")
|
set(GPU_CUDA_GENCODE "-arch=${GPU_ARCH}")
|
||||||
|
|
||||||
|
if(CUDA_BUILD_MULTIARCH)
|
||||||
# apply the following to build "fat" CUDA binaries only for known CUDA toolkits since version 8.0
|
# apply the following to build "fat" CUDA binaries only for known CUDA toolkits since version 8.0
|
||||||
# only the Kepler achitecture and beyond is supported
|
# only the Kepler achitecture and beyond is supported
|
||||||
|
# comparison chart according to: https://en.wikipedia.org/wiki/CUDA#GPUs_supported
|
||||||
if(CUDA_VERSION VERSION_LESS 8.0)
|
if(CUDA_VERSION VERSION_LESS 8.0)
|
||||||
message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required")
|
message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required")
|
||||||
elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
elseif(CUDA_VERSION VERSION_GREATER_EQUAL "13.0")
|
||||||
message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk")
|
message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk")
|
||||||
set(GPU_CUDA_GENCODE "-arch=all")
|
set(GPU_CUDA_GENCODE "-arch=all")
|
||||||
|
elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||||
|
set(GPU_CUDA_GENCODE "-arch=all")
|
||||||
else()
|
else()
|
||||||
# Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2
|
# Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2
|
||||||
if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0"))
|
if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0"))
|
||||||
@ -120,21 +139,22 @@ if(GPU_API STREQUAL "CUDA")
|
|||||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1")
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1")
|
||||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]")
|
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]")
|
||||||
endif()
|
endif()
|
||||||
# Hopper (GPU Arch 9.0) is supported by CUDA 12.0? and later
|
# Lovelace (GPU Arch 8.9) is supported by CUDA 11.8 and later
|
||||||
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.8")
|
||||||
|
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
||||||
|
endif()
|
||||||
|
# Hopper (GPU Arch 9.0) is supported by CUDA 12.0 and later
|
||||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
||||||
endif()
|
endif()
|
||||||
# # Lovelace (GPU Arch 9.x) is supported by CUDA 12.0? and later
|
endif()
|
||||||
#if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
|
||||||
# string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_9x,code=[sm_9x,compute_9x]")
|
|
||||||
#endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC}
|
cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC}
|
||||||
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})
|
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -allow-unsupported-compiler -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})
|
||||||
|
|
||||||
cuda_compile(GPU_OBJS ${GPU_LIB_CUDPP_CU} OPTIONS ${CUDA_REQUEST_PIC}
|
cuda_compile(GPU_OBJS ${GPU_LIB_CUDPP_CU} OPTIONS ${CUDA_REQUEST_PIC}
|
||||||
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})
|
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -allow-unsupported-compiler -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES})
|
||||||
|
|
||||||
foreach(CU_OBJ ${GPU_GEN_OBJS})
|
foreach(CU_OBJ ${GPU_GEN_OBJS})
|
||||||
get_filename_component(CU_NAME ${CU_OBJ} NAME_WE)
|
get_filename_component(CU_NAME ${CU_OBJ} NAME_WE)
|
||||||
@ -150,14 +170,17 @@ if(GPU_API STREQUAL "CUDA")
|
|||||||
add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS})
|
add_library(gpu STATIC ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS})
|
||||||
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||||
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS})
|
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu ${CUDA_INCLUDE_DIRS})
|
||||||
target_compile_definitions(gpu PRIVATE -DUSE_CUDA -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT ${GPU_CUDA_MPS_FLAGS})
|
target_compile_definitions(gpu PRIVATE -DUSE_CUDA -D_${GPU_PREC_SETTING} ${GPU_CUDA_MPS_FLAGS})
|
||||||
|
if(GPU_DEBUG)
|
||||||
|
target_compile_definitions(gpu PRIVATE -DUCL_DEBUG -DGERYON_KERNEL_DUMP)
|
||||||
|
else()
|
||||||
|
target_compile_definitions(gpu PRIVATE -DMPI_GERYON -DUCL_NO_EXIT)
|
||||||
|
endif()
|
||||||
if(CUDPP_OPT)
|
if(CUDPP_OPT)
|
||||||
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
|
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
|
||||||
target_compile_definitions(gpu PRIVATE -DUSE_CUDPP)
|
target_compile_definitions(gpu PRIVATE -DUSE_CUDPP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(lammps PRIVATE gpu)
|
|
||||||
|
|
||||||
add_executable(nvc_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
add_executable(nvc_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
||||||
target_compile_definitions(nvc_get_devices PRIVATE -DUCL_CUDADR)
|
target_compile_definitions(nvc_get_devices PRIVATE -DUCL_CUDADR)
|
||||||
target_link_libraries(nvc_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
target_link_libraries(nvc_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||||
@ -182,7 +205,7 @@ elseif(GPU_API STREQUAL "OPENCL")
|
|||||||
include(OpenCLUtils)
|
include(OpenCLUtils)
|
||||||
set(OCL_COMMON_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_preprocessor.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_aux_fun1.h)
|
set(OCL_COMMON_HEADERS ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_preprocessor.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_aux_fun1.h)
|
||||||
|
|
||||||
file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu)
|
file(GLOB GPU_LIB_CU CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu)
|
||||||
list(REMOVE_ITEM GPU_LIB_CU
|
list(REMOVE_ITEM GPU_LIB_CU
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne.cu
|
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne.cu
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne_lj.cu
|
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_gayberne_lj.cu
|
||||||
@ -191,6 +214,7 @@ elseif(GPU_API STREQUAL "OPENCL")
|
|||||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff.cu
|
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff.cu
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl.cu
|
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl.cu
|
||||||
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod.cu
|
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod.cu
|
||||||
|
${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_hippo.cu
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(GPU_KERNEL ${GPU_LIB_CU})
|
foreach(GPU_KERNEL ${GPU_LIB_CU})
|
||||||
@ -207,6 +231,7 @@ elseif(GPU_API STREQUAL "OPENCL")
|
|||||||
GenerateOpenCLHeader(tersoff ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff.cu)
|
GenerateOpenCLHeader(tersoff ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff.cu)
|
||||||
GenerateOpenCLHeader(tersoff_zbl ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_zbl_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl.cu)
|
GenerateOpenCLHeader(tersoff_zbl ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_zbl_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_zbl.cu)
|
||||||
GenerateOpenCLHeader(tersoff_mod ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_mod_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod.cu)
|
GenerateOpenCLHeader(tersoff_mod ${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_mod_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_tersoff_mod.cu)
|
||||||
|
GenerateOpenCLHeader(hippo ${CMAKE_CURRENT_BINARY_DIR}/gpu/hippo_cl.h ${OCL_COMMON_HEADERS} ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_hippo_extra.h ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_hippo.cu)
|
||||||
|
|
||||||
list(APPEND GPU_LIB_SOURCES
|
list(APPEND GPU_LIB_SOURCES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/gpu/gayberne_cl.h
|
${CMAKE_CURRENT_BINARY_DIR}/gpu/gayberne_cl.h
|
||||||
@ -216,36 +241,26 @@ elseif(GPU_API STREQUAL "OPENCL")
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_cl.h
|
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_cl.h
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_zbl_cl.h
|
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_zbl_cl.h
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_mod_cl.h
|
${CMAKE_CURRENT_BINARY_DIR}/gpu/tersoff_mod_cl.h
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/gpu/hippo_cl.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(gpu STATIC ${GPU_LIB_SOURCES})
|
add_library(gpu STATIC ${GPU_LIB_SOURCES})
|
||||||
target_link_libraries(gpu PRIVATE OpenCL::OpenCL)
|
target_link_libraries(gpu PRIVATE OpenCL::OpenCL)
|
||||||
target_include_directories(gpu PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gpu)
|
target_include_directories(gpu PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/gpu)
|
||||||
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DGERYON_NUMA_FISSION -DUCL_NO_EXIT)
|
target_compile_definitions(gpu PRIVATE -DUSE_OPENCL -D_${GPU_PREC_SETTING})
|
||||||
target_compile_definitions(gpu PRIVATE -DUSE_OPENCL)
|
if(GPU_DEBUG)
|
||||||
|
target_compile_definitions(gpu PRIVATE -DUCL_DEBUG -DGERYON_KERNEL_DUMP)
|
||||||
target_link_libraries(lammps PRIVATE gpu)
|
else()
|
||||||
|
target_compile_definitions(gpu PRIVATE -DMPI_GERYON -DGERYON_NUMA_FISSION -DUCL_NO_EXIT)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(ocl_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
add_executable(ocl_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
||||||
target_compile_definitions(ocl_get_devices PRIVATE -DUCL_OPENCL)
|
target_compile_definitions(ocl_get_devices PRIVATE -DUCL_OPENCL)
|
||||||
target_link_libraries(ocl_get_devices PRIVATE OpenCL::OpenCL)
|
target_link_libraries(ocl_get_devices PRIVATE OpenCL::OpenCL)
|
||||||
add_dependencies(ocl_get_devices OpenCL::OpenCL)
|
add_dependencies(ocl_get_devices OpenCL::OpenCL)
|
||||||
|
|
||||||
elseif(GPU_API STREQUAL "HIP")
|
elseif(GPU_API STREQUAL "HIP")
|
||||||
if(NOT DEFINED HIP_PATH)
|
include(DetectHIPInstallation)
|
||||||
if(NOT DEFINED ENV{HIP_PATH})
|
|
||||||
set(HIP_PATH "/opt/rocm/hip" CACHE PATH "Path to HIP installation")
|
|
||||||
else()
|
|
||||||
set(HIP_PATH $ENV{HIP_PATH} CACHE PATH "Path to HIP installation")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
if(NOT DEFINED ROCM_PATH)
|
|
||||||
if(NOT DEFINED ENV{ROCM_PATH})
|
|
||||||
set(ROCM_PATH "/opt/rocm" CACHE PATH "Path to ROCm installation")
|
|
||||||
else()
|
|
||||||
set(ROCM_PATH $ENV{ROCM_PATH} CACHE PATH "Path to ROCm installation")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
list(APPEND CMAKE_PREFIX_PATH ${HIP_PATH} ${ROCM_PATH})
|
|
||||||
find_package(hip REQUIRED)
|
find_package(hip REQUIRED)
|
||||||
option(HIP_USE_DEVICE_SORT "Use GPU sorting" ON)
|
option(HIP_USE_DEVICE_SORT "Use GPU sorting" ON)
|
||||||
|
|
||||||
@ -259,8 +274,10 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
|
|
||||||
set(ENV{HIP_PLATFORM} ${HIP_PLATFORM})
|
set(ENV{HIP_PLATFORM} ${HIP_PLATFORM})
|
||||||
|
|
||||||
if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd")
|
if(HIP_PLATFORM STREQUAL "amd")
|
||||||
set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture")
|
set(HIP_ARCH "gfx906" CACHE STRING "HIP target architecture")
|
||||||
|
elseif(HIP_PLATFORM STREQUAL "spirv")
|
||||||
|
set(HIP_ARCH "spirv" CACHE STRING "HIP target architecture")
|
||||||
elseif(HIP_PLATFORM STREQUAL "nvcc")
|
elseif(HIP_PLATFORM STREQUAL "nvcc")
|
||||||
find_package(CUDA REQUIRED)
|
find_package(CUDA REQUIRED)
|
||||||
set(HIP_ARCH "sm_50" CACHE STRING "HIP primary CUDA architecture (e.g. sm_60)")
|
set(HIP_ARCH "sm_50" CACHE STRING "HIP primary CUDA architecture (e.g. sm_60)")
|
||||||
@ -273,6 +290,7 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
else()
|
else()
|
||||||
# build arch/gencode commands for nvcc based on CUDA toolkit version and use choice
|
# build arch/gencode commands for nvcc based on CUDA toolkit version and use choice
|
||||||
# --arch translates directly instead of JIT, so this should be for the preferred or most common architecture
|
# --arch translates directly instead of JIT, so this should be for the preferred or most common architecture
|
||||||
|
# comparison chart according to: https://en.wikipedia.org/wiki/CUDA#GPUs_supported
|
||||||
set(HIP_CUDA_GENCODE "-arch=${HIP_ARCH}")
|
set(HIP_CUDA_GENCODE "-arch=${HIP_ARCH}")
|
||||||
# Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2
|
# Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2
|
||||||
if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0"))
|
if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0"))
|
||||||
@ -302,14 +320,22 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0")
|
||||||
string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]")
|
string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]")
|
||||||
endif()
|
endif()
|
||||||
# Hopper (GPU Arch 9.0) is supported by CUDA 12.0? and later
|
# Ampere (GPU Arch 8.6) is supported by CUDA 11.1 and later
|
||||||
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1")
|
||||||
|
string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]")
|
||||||
|
endif()
|
||||||
|
# Lovelace (GPU Arch 8.9) is supported by CUDA 11.8 and later
|
||||||
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.8")
|
||||||
|
string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
||||||
|
endif()
|
||||||
|
# Hopper (GPU Arch 9.0) is supported by CUDA 12.0 and later
|
||||||
if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
|
||||||
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu)
|
file(GLOB GPU_LIB_CU CONFIGURE_DEPENDS ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu)
|
||||||
list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
|
list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
|
||||||
|
|
||||||
set(GPU_LIB_CU_HIP "")
|
set(GPU_LIB_CU_HIP "")
|
||||||
@ -321,7 +347,7 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
set(CUBIN_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}.cubin")
|
set(CUBIN_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}.cubin")
|
||||||
set(CUBIN_H_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h")
|
set(CUBIN_H_FILE "${LAMMPS_LIB_BINARY_DIR}/gpu/${CU_NAME}_cubin.h")
|
||||||
|
|
||||||
if(HIP_PLATFORM STREQUAL "hcc" OR HIP_PLATFORM STREQUAL "amd")
|
if(HIP_PLATFORM STREQUAL "amd")
|
||||||
configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY)
|
configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY)
|
||||||
|
|
||||||
if(HIP_COMPILER STREQUAL "clang")
|
if(HIP_COMPILER STREQUAL "clang")
|
||||||
@ -340,6 +366,13 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --fatbin --use_fast_math -DUSE_HIP -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES} ${HIP_CUDA_GENCODE} -I${LAMMPS_LIB_SOURCE_DIR}/gpu -o ${CUBIN_FILE} ${CU_FILE}
|
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} --fatbin --use_fast_math -DUSE_HIP -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES} ${HIP_CUDA_GENCODE} -I${LAMMPS_LIB_SOURCE_DIR}/gpu -o ${CUBIN_FILE} ${CU_FILE}
|
||||||
DEPENDS ${CU_FILE}
|
DEPENDS ${CU_FILE}
|
||||||
COMMENT "Generating ${CU_NAME}.cubin")
|
COMMENT "Generating ${CU_NAME}.cubin")
|
||||||
|
elseif(HIP_PLATFORM STREQUAL "spirv")
|
||||||
|
configure_file(${CU_FILE} ${CU_CPP_FILE} COPYONLY)
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT ${CUBIN_FILE}
|
||||||
|
VERBATIM COMMAND ${HIP_HIPCC_EXECUTABLE} -c -O3 -DUSE_HIP -D_${GPU_PREC_SETTING} -DLAMMPS_${LAMMPS_SIZES} -I${LAMMPS_LIB_SOURCE_DIR}/gpu -o ${CUBIN_FILE} ${CU_CPP_FILE}
|
||||||
|
DEPENDS ${CU_CPP_FILE}
|
||||||
|
COMMENT "Gerating ${CU_NAME}.cubin")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${CUBIN_H_FILE}
|
add_custom_command(OUTPUT ${CUBIN_H_FILE}
|
||||||
@ -354,8 +387,12 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
|
|
||||||
add_library(gpu STATIC ${GPU_LIB_SOURCES})
|
add_library(gpu STATIC ${GPU_LIB_SOURCES})
|
||||||
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
target_include_directories(gpu PRIVATE ${LAMMPS_LIB_BINARY_DIR}/gpu)
|
||||||
target_compile_definitions(gpu PRIVATE -D_${GPU_PREC_SETTING} -DMPI_GERYON -DUCL_NO_EXIT)
|
target_compile_definitions(gpu PRIVATE -DUSE_HIP -D_${GPU_PREC_SETTING})
|
||||||
target_compile_definitions(gpu PRIVATE -DUSE_HIP)
|
if(GPU_DEBUG)
|
||||||
|
target_compile_definitions(gpu PRIVATE -DUCL_DEBUG -DGERYON_KERNEL_DUMP)
|
||||||
|
else()
|
||||||
|
target_compile_definitions(gpu PRIVATE -DMPI_GERYON -DUCL_NO_EXIT)
|
||||||
|
endif()
|
||||||
target_link_libraries(gpu PRIVATE hip::host)
|
target_link_libraries(gpu PRIVATE hip::host)
|
||||||
|
|
||||||
if(HIP_USE_DEVICE_SORT)
|
if(HIP_USE_DEVICE_SORT)
|
||||||
@ -364,7 +401,8 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
set_property(TARGET gpu PROPERTY CXX_STANDARD 14)
|
set_property(TARGET gpu PROPERTY CXX_STANDARD 14)
|
||||||
endif()
|
endif()
|
||||||
# add hipCUB
|
# add hipCUB
|
||||||
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
|
find_package(hipcub REQUIRED)
|
||||||
|
target_link_libraries(gpu PRIVATE hip::hipcub)
|
||||||
target_compile_definitions(gpu PRIVATE -DUSE_HIP_DEVICE_SORT)
|
target_compile_definitions(gpu PRIVATE -DUSE_HIP_DEVICE_SORT)
|
||||||
|
|
||||||
if(HIP_PLATFORM STREQUAL "nvcc")
|
if(HIP_PLATFORM STREQUAL "nvcc")
|
||||||
@ -380,15 +418,17 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
|
|
||||||
if(DOWNLOAD_CUB)
|
if(DOWNLOAD_CUB)
|
||||||
message(STATUS "CUB download requested")
|
message(STATUS "CUB download requested")
|
||||||
set(CUB_URL "https://github.com/NVlabs/cub/archive/1.12.0.tar.gz" CACHE STRING "URL for CUB tarball")
|
# TODO: test update to current version 1.17.2
|
||||||
|
set(CUB_URL "https://github.com/nvidia/cub/archive/1.12.0.tar.gz" CACHE STRING "URL for CUB tarball")
|
||||||
set(CUB_MD5 "1cf595beacafff104700921bac8519f3" CACHE STRING "MD5 checksum of CUB tarball")
|
set(CUB_MD5 "1cf595beacafff104700921bac8519f3" CACHE STRING "MD5 checksum of CUB tarball")
|
||||||
mark_as_advanced(CUB_URL)
|
mark_as_advanced(CUB_URL)
|
||||||
mark_as_advanced(CUB_MD5)
|
mark_as_advanced(CUB_MD5)
|
||||||
|
GetFallbackURL(CUB_URL CUB_FALLBACK)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
|
|
||||||
ExternalProject_Add(CUB
|
ExternalProject_Add(CUB
|
||||||
URL ${CUB_URL}
|
URL ${CUB_URL} ${CUB_FALLBACK}
|
||||||
URL_MD5 ${CUB_MD5}
|
URL_MD5 ${CUB_MD5}
|
||||||
PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
|
PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
@ -411,34 +451,24 @@ elseif(GPU_API STREQUAL "HIP")
|
|||||||
|
|
||||||
add_executable(hip_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
add_executable(hip_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp)
|
||||||
target_compile_definitions(hip_get_devices PRIVATE -DUCL_HIP)
|
target_compile_definitions(hip_get_devices PRIVATE -DUCL_HIP)
|
||||||
target_link_libraries(hip_get_devices hip::host)
|
target_link_libraries(hip_get_devices PRIVATE hip::host)
|
||||||
|
|
||||||
if(HIP_PLATFORM STREQUAL "nvcc")
|
if(HIP_PLATFORM STREQUAL "nvcc")
|
||||||
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_NVCC__)
|
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_NVCC__)
|
||||||
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
|
|
||||||
target_include_directories(gpu PRIVATE ${CUDA_INCLUDE_DIRS})
|
target_include_directories(gpu PRIVATE ${CUDA_INCLUDE_DIRS})
|
||||||
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
target_link_libraries(gpu PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||||
|
|
||||||
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_NVCC__)
|
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_NVCC__)
|
||||||
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/include)
|
|
||||||
target_include_directories(hip_get_devices PRIVATE ${CUDA_INCLUDE_DIRS})
|
target_include_directories(hip_get_devices PRIVATE ${CUDA_INCLUDE_DIRS})
|
||||||
target_link_libraries(hip_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
target_link_libraries(hip_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
|
||||||
elseif(HIP_PLATFORM STREQUAL "hcc")
|
endif()
|
||||||
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_HCC__)
|
|
||||||
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
|
|
||||||
|
|
||||||
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_HCC__)
|
|
||||||
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
|
|
||||||
elseif(HIP_PLATFORM STREQUAL "amd")
|
|
||||||
target_compile_definitions(gpu PRIVATE -D__HIP_PLATFORM_AMD__)
|
|
||||||
target_include_directories(gpu PRIVATE ${HIP_ROOT_DIR}/../include)
|
|
||||||
|
|
||||||
target_compile_definitions(hip_get_devices PRIVATE -D__HIP_PLATFORM_AMD__)
|
|
||||||
target_include_directories(hip_get_devices PRIVATE ${HIP_ROOT_DIR}/../include)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_OMP)
|
||||||
|
find_package(OpenMP COMPONENTS CXX REQUIRED)
|
||||||
|
target_link_libraries(gpu PRIVATE OpenMP::OpenMP_CXX)
|
||||||
|
endif()
|
||||||
target_link_libraries(lammps PRIVATE gpu)
|
target_link_libraries(lammps PRIVATE gpu)
|
||||||
endif()
|
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY "GPU_SOURCES" "${GPU_SOURCES}")
|
set_property(GLOBAL PROPERTY "GPU_SOURCES" "${GPU_SOURCES}")
|
||||||
# detect styles which have a GPU version
|
# detect styles which have a GPU version
|
||||||
|
|||||||
@ -112,9 +112,5 @@ if(PKG_KSPACE)
|
|||||||
RegisterIntegrateStyle(${INTEL_SOURCES_DIR}/verlet_lrt_intel.h)
|
RegisterIntegrateStyle(${INTEL_SOURCES_DIR}/verlet_lrt_intel.h)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PKG_ELECTRODE)
|
|
||||||
list(APPEND INTEL_SOURCES ${INTEL_SOURCES_DIR}/electrode_accel_intel.cpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_sources(lammps PRIVATE ${INTEL_SOURCES})
|
target_sources(lammps PRIVATE ${INTEL_SOURCES})
|
||||||
target_include_directories(lammps PRIVATE ${INTEL_SOURCES_DIR})
|
target_include_directories(lammps PRIVATE ${INTEL_SOURCES_DIR})
|
||||||
|
|||||||
@ -1,12 +1,7 @@
|
|||||||
set(KIM-API_MIN_VERSION 2.1.3)
|
set(KIM-API_MIN_VERSION 2.1.3)
|
||||||
find_package(CURL)
|
find_package(CURL)
|
||||||
if(CURL_FOUND)
|
if(CURL_FOUND)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
target_include_directories(lammps PRIVATE ${CURL_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(lammps PRIVATE ${CURL_LIBRARIES})
|
|
||||||
else()
|
|
||||||
target_link_libraries(lammps PRIVATE CURL::libcurl)
|
target_link_libraries(lammps PRIVATE CURL::libcurl)
|
||||||
endif()
|
|
||||||
target_compile_definitions(lammps PRIVATE -DLMP_KIM_CURL)
|
target_compile_definitions(lammps PRIVATE -DLMP_KIM_CURL)
|
||||||
set(LMP_DEBUG_CURL OFF CACHE STRING "Set libcurl verbose mode on/off. If on, it displays a lot of verbose information about its operations.")
|
set(LMP_DEBUG_CURL OFF CACHE STRING "Set libcurl verbose mode on/off. If on, it displays a lot of verbose information about its operations.")
|
||||||
mark_as_advanced(LMP_DEBUG_CURL)
|
mark_as_advanced(LMP_DEBUG_CURL)
|
||||||
@ -19,7 +14,7 @@ if(CURL_FOUND)
|
|||||||
target_compile_definitions(lammps PRIVATE -DLMP_NO_SSL_CHECK)
|
target_compile_definitions(lammps PRIVATE -DLMP_NO_SSL_CHECK)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
set(KIM_EXTRA_UNITTESTS OFF CACHE STRING "Set extra unit tests verbose mode on/off. If on, extra tests are included.")
|
option(KIM_EXTRA_UNITTESTS "Enable extra unit tests for the KIM package." OFF)
|
||||||
mark_as_advanced(KIM_EXTRA_UNITTESTS)
|
mark_as_advanced(KIM_EXTRA_UNITTESTS)
|
||||||
find_package(PkgConfig QUIET)
|
find_package(PkgConfig QUIET)
|
||||||
set(DOWNLOAD_KIM_DEFAULT ON)
|
set(DOWNLOAD_KIM_DEFAULT ON)
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
########################################################################
|
########################################################################
|
||||||
# As of version 3.3.0 Kokkos requires C++14
|
# As of version 4.0.0 Kokkos requires C++17
|
||||||
if(CMAKE_CXX_STANDARD LESS 14)
|
if(CMAKE_CXX_STANDARD LESS 17)
|
||||||
message(FATAL_ERROR "The KOKKOS package requires the C++ standard to be set to at least C++14")
|
message(FATAL_ERROR "The KOKKOS package requires the C++ standard to
|
||||||
|
be set to at least C++17")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# consistency checks and Kokkos options/settings required by LAMMPS
|
# consistency checks and Kokkos options/settings required by LAMMPS
|
||||||
if(Kokkos_ENABLE_CUDA)
|
if(Kokkos_ENABLE_CUDA)
|
||||||
@ -15,8 +17,9 @@ if(Kokkos_ENABLE_OPENMP)
|
|||||||
if(NOT BUILD_OMP)
|
if(NOT BUILD_OMP)
|
||||||
message(FATAL_ERROR "Must enable BUILD_OMP with Kokkos_ENABLE_OPENMP")
|
message(FATAL_ERROR "Must enable BUILD_OMP with Kokkos_ENABLE_OPENMP")
|
||||||
else()
|
else()
|
||||||
if(LAMMPS_OMP_COMPAT_LEVEL LESS 4)
|
# NVHPC/(AMD)Clang does not seem to provide a detectable OpenMP version, but is far beyond version 3.1
|
||||||
message(FATAL_ERROR "Compiler must support OpenMP 4.0 or later with Kokkos_ENABLE_OPENMP")
|
if((OpenMP_CXX_VERSION VERSION_LESS 3.1) AND NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
|
||||||
|
message(FATAL_ERROR "Compiler must support OpenMP 3.1 or later with Kokkos_ENABLE_OPENMP")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -47,12 +50,14 @@ if(DOWNLOAD_KOKKOS)
|
|||||||
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}")
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}")
|
||||||
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
|
list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.6.00.tar.gz" CACHE STRING "URL for KOKKOS tarball")
|
set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/4.2.00.tar.gz" CACHE STRING "URL for KOKKOS tarball")
|
||||||
set(KOKKOS_MD5 "b5c44ea961031795f434002cd7b31c20" CACHE STRING "MD5 checksum of KOKKOS tarball")
|
set(KOKKOS_MD5 "731647b61a4233f568d583702e9cd6d1" CACHE STRING "MD5 checksum of KOKKOS tarball")
|
||||||
mark_as_advanced(KOKKOS_URL)
|
mark_as_advanced(KOKKOS_URL)
|
||||||
mark_as_advanced(KOKKOS_MD5)
|
mark_as_advanced(KOKKOS_MD5)
|
||||||
|
GetFallbackURL(KOKKOS_URL KOKKOS_FALLBACK)
|
||||||
|
|
||||||
ExternalProject_Add(kokkos_build
|
ExternalProject_Add(kokkos_build
|
||||||
URL ${KOKKOS_URL}
|
URL ${KOKKOS_URL} ${KOKKOS_FALLBACK}
|
||||||
URL_MD5 ${KOKKOS_MD5}
|
URL_MD5 ${KOKKOS_MD5}
|
||||||
CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS}
|
CMAKE_ARGS ${KOKKOS_LIB_BUILD_ARGS}
|
||||||
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a <INSTALL_DIR>/lib/libkokkoscontainers.a
|
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libkokkoscore.a <INSTALL_DIR>/lib/libkokkoscontainers.a
|
||||||
@ -68,13 +73,11 @@ if(DOWNLOAD_KOKKOS)
|
|||||||
set_target_properties(LAMMPS::KOKKOSCONTAINERS PROPERTIES
|
set_target_properties(LAMMPS::KOKKOSCONTAINERS PROPERTIES
|
||||||
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkokkoscontainers.a")
|
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkokkoscontainers.a")
|
||||||
target_link_libraries(lammps PRIVATE LAMMPS::KOKKOSCORE LAMMPS::KOKKOSCONTAINERS)
|
target_link_libraries(lammps PRIVATE LAMMPS::KOKKOSCORE LAMMPS::KOKKOSCONTAINERS)
|
||||||
target_link_libraries(lmp PRIVATE LAMMPS::KOKKOSCORE LAMMPS::KOKKOSCONTAINERS)
|
|
||||||
add_dependencies(LAMMPS::KOKKOSCORE kokkos_build)
|
add_dependencies(LAMMPS::KOKKOSCORE kokkos_build)
|
||||||
add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build)
|
add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build)
|
||||||
elseif(EXTERNAL_KOKKOS)
|
elseif(EXTERNAL_KOKKOS)
|
||||||
find_package(Kokkos 3.6.00 REQUIRED CONFIG)
|
find_package(Kokkos 4.2.00 REQUIRED CONFIG)
|
||||||
target_link_libraries(lammps PRIVATE Kokkos::kokkos)
|
target_link_libraries(lammps PRIVATE Kokkos::kokkos)
|
||||||
target_link_libraries(lmp PRIVATE Kokkos::kokkos)
|
|
||||||
else()
|
else()
|
||||||
set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos)
|
set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos)
|
||||||
set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos)
|
set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos)
|
||||||
@ -86,8 +89,7 @@ else()
|
|||||||
if(CMAKE_REQUEST_PIC)
|
if(CMAKE_REQUEST_PIC)
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR} EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
|
|
||||||
set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src
|
set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src
|
||||||
${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src
|
${LAMMPS_LIB_KOKKOS_SRC_DIR}/containers/src
|
||||||
@ -95,7 +97,6 @@ else()
|
|||||||
${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
||||||
target_include_directories(lammps PRIVATE ${Kokkos_INCLUDE_DIRS})
|
target_include_directories(lammps PRIVATE ${Kokkos_INCLUDE_DIRS})
|
||||||
target_link_libraries(lammps PRIVATE kokkos)
|
target_link_libraries(lammps PRIVATE kokkos)
|
||||||
target_link_libraries(lmp PRIVATE kokkos)
|
|
||||||
if(BUILD_SHARED_LIBS_WAS_ON)
|
if(BUILD_SHARED_LIBS_WAS_ON)
|
||||||
set(BUILD_SHARED_LIBS ON)
|
set(BUILD_SHARED_LIBS ON)
|
||||||
endif()
|
endif()
|
||||||
@ -121,9 +122,14 @@ set(KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/kokkos.cpp
|
|||||||
${KOKKOS_PKG_SOURCES_DIR}/domain_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/domain_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/modify_kokkos.cpp)
|
${KOKKOS_PKG_SOURCES_DIR}/modify_kokkos.cpp)
|
||||||
|
|
||||||
|
# fix wall/gran has been refactored in an incompatible way. Use old version of base class for now
|
||||||
|
if(PKG_GRANULAR)
|
||||||
|
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/fix_wall_gran_old.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(PKG_KSPACE)
|
if(PKG_KSPACE)
|
||||||
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/fft3d_kokkos.cpp
|
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/fft3d_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/gridcomm_kokkos.cpp
|
${KOKKOS_PKG_SOURCES_DIR}/grid3d_kokkos.cpp
|
||||||
${KOKKOS_PKG_SOURCES_DIR}/remap_kokkos.cpp)
|
${KOKKOS_PKG_SOURCES_DIR}/remap_kokkos.cpp)
|
||||||
if(Kokkos_ENABLE_CUDA)
|
if(Kokkos_ENABLE_CUDA)
|
||||||
if(NOT (FFT STREQUAL "KISS"))
|
if(NOT (FFT STREQUAL "KISS"))
|
||||||
@ -132,12 +138,37 @@ if(PKG_KSPACE)
|
|||||||
endif()
|
endif()
|
||||||
elseif(Kokkos_ENABLE_HIP)
|
elseif(Kokkos_ENABLE_HIP)
|
||||||
if(NOT (FFT STREQUAL "KISS"))
|
if(NOT (FFT STREQUAL "KISS"))
|
||||||
|
include(DetectHIPInstallation)
|
||||||
|
find_package(hipfft REQUIRED)
|
||||||
target_compile_definitions(lammps PRIVATE -DFFT_HIPFFT)
|
target_compile_definitions(lammps PRIVATE -DFFT_HIPFFT)
|
||||||
target_link_libraries(lammps PRIVATE hipfft)
|
target_link_libraries(lammps PRIVATE hip::hipfft)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(PKG_ML-IAP)
|
||||||
|
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/mliap_data_kokkos.cpp
|
||||||
|
${KOKKOS_PKG_SOURCES_DIR}/mliap_descriptor_so3_kokkos.cpp
|
||||||
|
${KOKKOS_PKG_SOURCES_DIR}/mliap_model_linear_kokkos.cpp
|
||||||
|
${KOKKOS_PKG_SOURCES_DIR}/mliap_model_python_kokkos.cpp
|
||||||
|
${KOKKOS_PKG_SOURCES_DIR}/mliap_unified_kokkos.cpp
|
||||||
|
${KOKKOS_PKG_SOURCES_DIR}/mliap_so3_kokkos.cpp)
|
||||||
|
|
||||||
|
# Add KOKKOS version of ML-IAP Python coupling if non-KOKKOS version is included
|
||||||
|
if(MLIAP_ENABLE_PYTHON AND Cythonize_EXECUTABLE)
|
||||||
|
file(GLOB MLIAP_KOKKOS_CYTHON_SRC CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/KOKKOS/*.pyx)
|
||||||
|
foreach(MLIAP_CYTHON_FILE ${MLIAP_KOKKOS_CYTHON_SRC})
|
||||||
|
get_filename_component(MLIAP_CYTHON_BASE ${MLIAP_CYTHON_FILE} NAME_WE)
|
||||||
|
add_custom_command(OUTPUT ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.h
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MLIAP_CYTHON_FILE} ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
||||||
|
COMMAND ${Cythonize_EXECUTABLE} -3 ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
||||||
|
WORKING_DIRECTORY ${MLIAP_BINARY_DIR}
|
||||||
|
MAIN_DEPENDENCY ${MLIAP_CYTHON_FILE}
|
||||||
|
COMMENT "Generating C++ sources with cythonize...")
|
||||||
|
list(APPEND KOKKOS_PKG_SOURCES ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp)
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(PKG_PHONON)
|
if(PKG_PHONON)
|
||||||
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/dynamical_matrix_kokkos.cpp)
|
list(APPEND KOKKOS_PKG_SOURCES ${KOKKOS_PKG_SOURCES_DIR}/dynamical_matrix_kokkos.cpp)
|
||||||
|
|||||||
@ -46,6 +46,42 @@ else()
|
|||||||
target_compile_definitions(lammps PRIVATE -DFFT_KISS)
|
target_compile_definitions(lammps PRIVATE -DFFT_KISS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
option(FFT_USE_HEFFTE "Use heFFTe as the distributed FFT engine, overrides the FFT option." OFF)
|
||||||
|
if(FFT_USE_HEFFTE)
|
||||||
|
# if FFT_HEFFTE is enabled, switch the builtin FFT engine with Heffte
|
||||||
|
set(FFT_HEFFTE_BACKEND_VALUES FFTW MKL)
|
||||||
|
set(FFT_HEFFTE_BACKEND "" CACHE STRING "Select heFFTe backend, e.g., FFTW or MKL")
|
||||||
|
set_property(CACHE FFT_HEFFTE_BACKEND PROPERTY STRINGS ${FFT_HEFFTE_BACKEND_VALUES})
|
||||||
|
|
||||||
|
if(FFT_HEFFTE_BACKEND STREQUAL "FFTW") # respect the backend choice, FFTW or MKL
|
||||||
|
set(HEFFTE_COMPONENTS "FFTW")
|
||||||
|
set(Heffte_ENABLE_FFTW "ON" CACHE BOOL "Enables FFTW backend for heFFTe")
|
||||||
|
elseif(FFT_HEFFTE_BACKEND STREQUAL "MKL")
|
||||||
|
set(HEFFTE_COMPONENTS "MKL")
|
||||||
|
set(Heffte_ENABLE_MKL "ON" CACHE BOOL "Enables MKL backend for heFFTe")
|
||||||
|
else()
|
||||||
|
message(WARNING "FFT_HEFFTE_BACKEND not selected, defaulting to the builtin 'stock' backend, which is intended for testing and is not optimized for production runs")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(Heffte 2.4.0 QUIET COMPONENTS ${HEFFTE_COMPONENTS})
|
||||||
|
if (NOT Heffte_FOUND) # download and build
|
||||||
|
include(FetchContent)
|
||||||
|
FetchContent_Declare(HEFFTE_PROJECT # using v2.4.0
|
||||||
|
URL "https://github.com/icl-utk-edu/heffte/archive/refs/tags/v2.4.0.tar.gz"
|
||||||
|
URL_HASH SHA256=02310fb4f9688df02f7181667e61c3adb7e38baf79611d80919d47452ff7881d
|
||||||
|
)
|
||||||
|
FetchContent_Populate(HEFFTE_PROJECT)
|
||||||
|
add_subdirectory(${heffte_project_SOURCE_DIR} ${heffte_project_BINARY_DIR})
|
||||||
|
set_target_properties(lmp PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||||
|
set_target_properties(lammps PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||||
|
add_library(Heffte::Heffte INTERFACE IMPORTED GLOBAL)
|
||||||
|
target_link_libraries(Heffte::Heffte INTERFACE Heffte)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_compile_definitions(lammps PRIVATE -DFFT_HEFFTE "-DFFT_HEFFTE_${FFT_HEFFTE_BACKEND}")
|
||||||
|
target_link_libraries(lammps PRIVATE Heffte::Heffte)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(FFT_PACK "array" CACHE STRING "Optimization for FFT")
|
set(FFT_PACK "array" CACHE STRING "Optimization for FFT")
|
||||||
set(FFT_PACK_VALUES array pointer memcpy)
|
set(FFT_PACK_VALUES array pointer memcpy)
|
||||||
set_property(CACHE FFT_PACK PROPERTY STRINGS ${FFT_PACK_VALUES})
|
set_property(CACHE FFT_PACK PROPERTY STRINGS ${FFT_PACK_VALUES})
|
||||||
|
|||||||
@ -1,52 +0,0 @@
|
|||||||
enable_language(Fortran)
|
|
||||||
|
|
||||||
# using lammps in a super-build setting
|
|
||||||
if(TARGET LATTE::latte)
|
|
||||||
target_link_libraries(lammps PRIVATE LATTE::latte)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(LATTE 1.2.2 CONFIG)
|
|
||||||
if(LATTE_FOUND)
|
|
||||||
set(DOWNLOAD_LATTE_DEFAULT OFF)
|
|
||||||
else()
|
|
||||||
set(DOWNLOAD_LATTE_DEFAULT ON)
|
|
||||||
endif()
|
|
||||||
option(DOWNLOAD_LATTE "Download the LATTE library instead of using an already installed one" ${DOWNLOAD_LATTE_DEFAULT})
|
|
||||||
if(DOWNLOAD_LATTE)
|
|
||||||
message(STATUS "LATTE download requested - we will build our own")
|
|
||||||
set(LATTE_URL "https://github.com/lanl/LATTE/archive/v1.2.2.tar.gz" CACHE STRING "URL for LATTE tarball")
|
|
||||||
set(LATTE_MD5 "820e73a457ced178c08c71389a385de7" CACHE STRING "MD5 checksum of LATTE tarball")
|
|
||||||
mark_as_advanced(LATTE_URL)
|
|
||||||
mark_as_advanced(LATTE_MD5)
|
|
||||||
|
|
||||||
# CMake cannot pass BLAS or LAPACK library variable to external project if they are a list
|
|
||||||
list(LENGTH BLAS_LIBRARIES} NUM_BLAS)
|
|
||||||
list(LENGTH LAPACK_LIBRARIES NUM_LAPACK)
|
|
||||||
if((NUM_BLAS GREATER 1) OR (NUM_LAPACK GREATER 1))
|
|
||||||
message(FATAL_ERROR "Cannot compile downloaded LATTE library due to a technical limitation")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(ExternalProject)
|
|
||||||
ExternalProject_Add(latte_build
|
|
||||||
URL ${LATTE_URL}
|
|
||||||
URL_MD5 ${LATTE_MD5}
|
|
||||||
SOURCE_SUBDIR cmake
|
|
||||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC} -DCMAKE_INSTALL_LIBDIR=lib
|
|
||||||
-DBLAS_LIBRARIES=${BLAS_LIBRARIES} -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES}
|
|
||||||
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} -DCMAKE_Fortran_FLAGS=${CMAKE_Fortran_FLAGS}
|
|
||||||
-DCMAKE_Fortran_FLAGS_${BTYPE}=${CMAKE_Fortran_FLAGS_${BTYPE}} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
|
||||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
|
||||||
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/liblatte.a
|
|
||||||
)
|
|
||||||
ExternalProject_get_property(latte_build INSTALL_DIR)
|
|
||||||
add_library(LAMMPS::LATTE UNKNOWN IMPORTED)
|
|
||||||
set_target_properties(LAMMPS::LATTE PROPERTIES
|
|
||||||
IMPORTED_LOCATION "${INSTALL_DIR}/lib/liblatte.a"
|
|
||||||
INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}")
|
|
||||||
target_link_libraries(lammps PRIVATE LAMMPS::LATTE)
|
|
||||||
add_dependencies(LAMMPS::LATTE latte_build)
|
|
||||||
else()
|
|
||||||
find_package(LATTE 1.2.2 REQUIRED CONFIG)
|
|
||||||
target_link_libraries(lammps PRIVATE LATTE::latte)
|
|
||||||
endif()
|
|
||||||
35
cmake/Modules/Packages/LEPTON.cmake
Normal file
35
cmake/Modules/Packages/LEPTON.cmake
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# avoid including this file twice
|
||||||
|
if(LEPTON_SOURCE_DIR)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(LEPTON_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/lepton)
|
||||||
|
|
||||||
|
file(GLOB LEPTON_SOURCES CONFIGURE_DEPENDS ${LEPTON_SOURCE_DIR}/src/[^.]*.cpp)
|
||||||
|
|
||||||
|
if((CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "amd64") OR
|
||||||
|
(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64") OR
|
||||||
|
(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64"))
|
||||||
|
option(LEPTON_ENABLE_JIT "Enable Just-In-Time compiler for Lepton" ON)
|
||||||
|
else()
|
||||||
|
option(LEPTON_ENABLE_JIT "Enable Just-In-Time compiler for Lepton" OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(LEPTON_ENABLE_JIT)
|
||||||
|
file(GLOB ASMJIT_SOURCES CONFIGURE_DEPENDS ${LEPTON_SOURCE_DIR}/asmjit/*/[^.]*.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(lepton STATIC ${LEPTON_SOURCES} ${ASMJIT_SOURCES})
|
||||||
|
set_target_properties(lepton PROPERTIES OUTPUT_NAME lammps_lepton${LAMMPS_MACHINE})
|
||||||
|
target_compile_definitions(lepton PUBLIC LEPTON_BUILDING_STATIC_LIBRARY=1)
|
||||||
|
target_include_directories(lepton PUBLIC ${LEPTON_SOURCE_DIR}/include)
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
find_library(LIB_RT rt QUIET)
|
||||||
|
target_link_libraries(lepton PUBLIC ${LIB_RT})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(LEPTON_ENABLE_JIT)
|
||||||
|
target_compile_definitions(lepton PUBLIC "LEPTON_USE_JIT=1;ASMJIT_BUILD_X86=1;ASMJIT_STATIC=1;ASMJIT_BUILD_RELEASE=1")
|
||||||
|
target_include_directories(lepton PUBLIC ${LEPTON_SOURCE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(lammps PRIVATE lepton)
|
||||||
9
cmake/Modules/Packages/MC.cmake
Normal file
9
cmake/Modules/Packages/MC.cmake
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# fix sgcmc may only be installed if also the EAM pair style from MANYBODY is installed
|
||||||
|
if(NOT PKG_MANYBODY)
|
||||||
|
get_property(LAMMPS_FIX_HEADERS GLOBAL PROPERTY FIX)
|
||||||
|
list(REMOVE_ITEM LAMMPS_FIX_HEADERS ${LAMMPS_SOURCE_DIR}/MC/fix_sgcmc.h)
|
||||||
|
set_property(GLOBAL PROPERTY FIX "${LAMMPS_FIX_HEADERS}")
|
||||||
|
get_target_property(LAMMPS_SOURCES lammps SOURCES)
|
||||||
|
list(REMOVE_ITEM LAMMPS_SOURCES ${LAMMPS_SOURCE_DIR}/MC/fix_sgcmc.cpp)
|
||||||
|
set_property(TARGET lammps PROPERTY SOURCES "${LAMMPS_SOURCES}")
|
||||||
|
endif()
|
||||||
@ -8,10 +8,11 @@ option(DOWNLOAD_MDI "Download and compile the MDI library instead of using an al
|
|||||||
|
|
||||||
if(DOWNLOAD_MDI)
|
if(DOWNLOAD_MDI)
|
||||||
message(STATUS "MDI download requested - we will build our own")
|
message(STATUS "MDI download requested - we will build our own")
|
||||||
set(MDI_URL "https://github.com/MolSSI-MDI/MDI_Library/archive/v1.3.2.tar.gz" CACHE STRING "URL for MDI tarball")
|
set(MDI_URL "https://github.com/MolSSI-MDI/MDI_Library/archive/v1.4.16.tar.gz" CACHE STRING "URL for MDI tarball")
|
||||||
set(MDI_MD5 "836f5da400d8cff0f0e4435640f9454f" CACHE STRING "MD5 checksum for MDI tarball")
|
set(MDI_MD5 "407db44e2d79447ab5c1233af1965f65" CACHE STRING "MD5 checksum for MDI tarball")
|
||||||
mark_as_advanced(MDI_URL)
|
mark_as_advanced(MDI_URL)
|
||||||
mark_as_advanced(MDI_MD5)
|
mark_as_advanced(MDI_MD5)
|
||||||
|
GetFallbackURL(MDI_URL MDI_FALLBACK)
|
||||||
enable_language(C)
|
enable_language(C)
|
||||||
|
|
||||||
# only ON/OFF are allowed for "mpi" flag when building MDI library
|
# only ON/OFF are allowed for "mpi" flag when building MDI library
|
||||||
@ -25,16 +26,17 @@ if(DOWNLOAD_MDI)
|
|||||||
|
|
||||||
# detect if we have python development support and thus can enable python plugins
|
# detect if we have python development support and thus can enable python plugins
|
||||||
set(MDI_USE_PYTHON_PLUGINS OFF)
|
set(MDI_USE_PYTHON_PLUGINS OFF)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
find_package(PythonLibs QUIET) # Deprecated since version 3.12
|
|
||||||
if(PYTHONLIBS_FOUND)
|
|
||||||
set(MDI_USE_PYTHON_PLUGINS ON)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
find_package(Python QUIET COMPONENTS Development)
|
find_package(Python QUIET COMPONENTS Development)
|
||||||
if(Python_Development_FOUND)
|
if(Python_Development_FOUND)
|
||||||
set(MDI_USE_PYTHON_PLUGINS ON)
|
set(MDI_USE_PYTHON_PLUGINS ON)
|
||||||
endif()
|
endif()
|
||||||
|
# python plugins are not supported and thus must be always off on Windows
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
unset(Python_Development_FOUND)
|
||||||
|
set(MDI_USE_PYTHON_PLUGINS OFF)
|
||||||
|
if(CMAKE_CROSSCOMPILING)
|
||||||
|
set(CMAKE_INSTALL_LIBDIR lib)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# download/ build MDI library
|
# download/ build MDI library
|
||||||
@ -42,10 +44,11 @@ if(DOWNLOAD_MDI)
|
|||||||
# support cross-compilation and ninja-build
|
# support cross-compilation and ninja-build
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(mdi_build
|
ExternalProject_Add(mdi_build
|
||||||
URL ${MDI_URL}
|
URL ${MDI_URL} ${MDI_FALLBACK}
|
||||||
URL_MD5 ${MDI_MD5}
|
URL_MD5 ${MDI_MD5}
|
||||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC}
|
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mdi_build_ext
|
||||||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
CMAKE_ARGS
|
||||||
|
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/mdi_build_ext
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
||||||
@ -54,37 +57,34 @@ if(DOWNLOAD_MDI)
|
|||||||
-Dlanguage=C
|
-Dlanguage=C
|
||||||
-Dlibtype=STATIC
|
-Dlibtype=STATIC
|
||||||
-Dmpi=${MDI_USE_MPI}
|
-Dmpi=${MDI_USE_MPI}
|
||||||
|
-Dplugins=ON
|
||||||
-Dpython_plugins=${MDI_USE_PYTHON_PLUGINS}
|
-Dpython_plugins=${MDI_USE_PYTHON_PLUGINS}
|
||||||
UPDATE_COMMAND ""
|
UPDATE_COMMAND ""
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/mdi_build_ext/src/mdi_build-build --target install
|
||||||
BUILD_BYPRODUCTS "<BINARY_DIR>/MDI_Library/libmdi.a"
|
BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/mdi_build_ext/${CMAKE_INSTALL_LIBDIR}/mdi/${CMAKE_STATIC_LIBRARY_PREFIX}mdi${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# where is the compiled library?
|
# where is the compiled library?
|
||||||
ExternalProject_get_property(mdi_build BINARY_DIR)
|
ExternalProject_get_property(mdi_build PREFIX)
|
||||||
set(MDI_BINARY_DIR "${BINARY_DIR}/MDI_Library")
|
|
||||||
# workaround for older CMake versions
|
# workaround for older CMake versions
|
||||||
file(MAKE_DIRECTORY ${MDI_BINARY_DIR})
|
file(MAKE_DIRECTORY ${PREFIX}/${CMAKE_INSTALL_LIBDIR}/mdi)
|
||||||
|
file(MAKE_DIRECTORY ${PREFIX}/include/mdi)
|
||||||
|
|
||||||
# create imported target for the MDI library
|
# create imported target for the MDI library
|
||||||
add_library(LAMMPS::MDI UNKNOWN IMPORTED)
|
add_library(LAMMPS::MDI UNKNOWN IMPORTED)
|
||||||
add_dependencies(LAMMPS::MDI mdi_build)
|
add_dependencies(LAMMPS::MDI mdi_build)
|
||||||
set_target_properties(LAMMPS::MDI PROPERTIES
|
set_target_properties(LAMMPS::MDI PROPERTIES
|
||||||
IMPORTED_LOCATION "${MDI_BINARY_DIR}/libmdi.a"
|
IMPORTED_LOCATION "${PREFIX}/${CMAKE_INSTALL_LIBDIR}/mdi/${CMAKE_STATIC_LIBRARY_PREFIX}mdi${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||||
INTERFACE_INCLUDE_DIRECTORIES ${MDI_BINARY_DIR}
|
INTERFACE_INCLUDE_DIRECTORIES ${PREFIX}/include/mdi
|
||||||
)
|
)
|
||||||
|
|
||||||
set(MDI_DEP_LIBS "")
|
set(MDI_DEP_LIBS "")
|
||||||
# if compiling with python plugins we need
|
# if compiling with python plugins we need
|
||||||
# to add python libraries as dependency.
|
# to add python libraries as dependency.
|
||||||
if(MDI_USE_PYTHON_PLUGINS)
|
if(MDI_USE_PYTHON_PLUGINS)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
list(APPEND MDI_DEP_LIBS ${PYTHON_LIBRARIES})
|
|
||||||
else()
|
|
||||||
list(APPEND MDI_DEP_LIBS Python::Python)
|
list(APPEND MDI_DEP_LIBS Python::Python)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
|
||||||
# need to add support for dlopen/dlsym, except when compiling for Windows.
|
# need to add support for dlopen/dlsym, except when compiling for Windows.
|
||||||
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows"))
|
if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows"))
|
||||||
list(APPEND MDI_DEP_LIBS "${CMAKE_DL_LIBS}")
|
list(APPEND MDI_DEP_LIBS "${CMAKE_DL_LIBS}")
|
||||||
|
|||||||
13
cmake/Modules/Packages/MISC.cmake
Normal file
13
cmake/Modules/Packages/MISC.cmake
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# pair style and fix srp/react depend on the fixes bond/break and bond/create from the MC package
|
||||||
|
if(NOT PKG_MC)
|
||||||
|
get_property(LAMMPS_FIX_HEADERS GLOBAL PROPERTY FIX)
|
||||||
|
list(REMOVE_ITEM LAMMPS_FIX_HEADERS ${LAMMPS_SOURCE_DIR}/MISC/fix_srp_react.h)
|
||||||
|
set_property(GLOBAL PROPERTY FIX "${LAMMPS_FIX_HEADERS}")
|
||||||
|
get_property(LAMMPS_PAIR_HEADERS GLOBAL PROPERTY PAIR)
|
||||||
|
list(REMOVE_ITEM LAMMPS_PAIR_HEADERS ${LAMMPS_SOURCE_DIR}/MISC/pair_srp_react.h)
|
||||||
|
set_property(GLOBAL PROPERTY PAIR "${LAMMPS_PAIR_HEADERS}")
|
||||||
|
get_target_property(LAMMPS_SOURCES lammps SOURCES)
|
||||||
|
list(REMOVE_ITEM LAMMPS_SOURCES ${LAMMPS_SOURCE_DIR}/MISC/fix_srp_react.cpp)
|
||||||
|
list(REMOVE_ITEM LAMMPS_SOURCES ${LAMMPS_SOURCE_DIR}/MISC/pair_srp_react.cpp)
|
||||||
|
set_property(TARGET lammps PROPERTY SOURCES "${LAMMPS_SOURCES}")
|
||||||
|
endif()
|
||||||
@ -6,10 +6,11 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
option(DOWNLOAD_N2P2 "Download n2p2 library instead of using an already installed one)" ${DOWNLOAD_N2P2_DEFAULT})
|
option(DOWNLOAD_N2P2 "Download n2p2 library instead of using an already installed one)" ${DOWNLOAD_N2P2_DEFAULT})
|
||||||
if(DOWNLOAD_N2P2)
|
if(DOWNLOAD_N2P2)
|
||||||
set(N2P2_URL "https://github.com/CompPhysVienna/n2p2/archive/v2.1.4.tar.gz" CACHE STRING "URL for n2p2 tarball")
|
set(N2P2_URL "https://github.com/CompPhysVienna/n2p2/archive/v2.2.0.tar.gz" CACHE STRING "URL for n2p2 tarball")
|
||||||
set(N2P2_MD5 "9595b066636cd6b90b0fef93398297a5" CACHE STRING "MD5 checksum of N2P2 tarball")
|
set(N2P2_MD5 "a2d9ab7f676b3a74a324fc1eda0a911d" CACHE STRING "MD5 checksum of N2P2 tarball")
|
||||||
mark_as_advanced(N2P2_URL)
|
mark_as_advanced(N2P2_URL)
|
||||||
mark_as_advanced(N2P2_MD5)
|
mark_as_advanced(N2P2_MD5)
|
||||||
|
GetFallbackURL(N2P2_URL N2P2_FALLBACK)
|
||||||
|
|
||||||
# adjust settings from detected compiler to compiler platform in n2p2 library
|
# adjust settings from detected compiler to compiler platform in n2p2 library
|
||||||
# set compiler specific flag to turn on C++11 syntax (required on macOS and CentOS 7)
|
# set compiler specific flag to turn on C++11 syntax (required on macOS and CentOS 7)
|
||||||
@ -44,7 +45,9 @@ if(DOWNLOAD_N2P2)
|
|||||||
else()
|
else()
|
||||||
# get path to MPI include directory
|
# get path to MPI include directory
|
||||||
get_target_property(N2P2_MPI_INCLUDE MPI::MPI_CXX INTERFACE_INCLUDE_DIRECTORIES)
|
get_target_property(N2P2_MPI_INCLUDE MPI::MPI_CXX INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
set(N2P2_PROJECT_OPTIONS "-I${N2P2_MPI_INCLUDE}")
|
foreach (_INCL ${N2P2_MPI_INCLUDE})
|
||||||
|
set(N2P2_PROJECT_OPTIONS "${N2P2_PROJECT_OPTIONS} -I${_INCL}")
|
||||||
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# prefer GNU make, if available. N2P2 lib seems to need it.
|
# prefer GNU make, if available. N2P2 lib seems to need it.
|
||||||
@ -70,12 +73,12 @@ if(DOWNLOAD_N2P2)
|
|||||||
# download compile n2p2 library. much patch MPI calls in LAMMPS interface to accommodate MPI-2 (e.g. for cross-compiling)
|
# download compile n2p2 library. much patch MPI calls in LAMMPS interface to accommodate MPI-2 (e.g. for cross-compiling)
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(n2p2_build
|
ExternalProject_Add(n2p2_build
|
||||||
URL ${N2P2_URL}
|
URL ${N2P2_URL} ${N2P2_FALLBACK}
|
||||||
URL_MD5 ${N2P2_MD5}
|
URL_MD5 ${N2P2_MD5}
|
||||||
UPDATE_COMMAND ""
|
UPDATE_COMMAND ""
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
PATCH_COMMAND sed -i -e "s/\\(MPI_\\(P\\|Unp\\)ack(\\)/\\1(void *) /" src/libnnpif/LAMMPS/InterfaceLammps.cpp
|
PATCH_COMMAND sed -i -e "s/\\(MPI_\\(P\\|Unp\\)ack(\\)/\\1(void *) /" src/libnnpif/LAMMPS/InterfaceLammps.cpp
|
||||||
BUILD_COMMAND ${N2P2_MAKE} -f makefile libnnpif ${N2P2_BUILD_OPTIONS}
|
BUILD_COMMAND ${N2P2_MAKE} -C <SOURCE_DIR>/src -f makefile libnnpif ${N2P2_BUILD_OPTIONS}
|
||||||
BUILD_ALWAYS YES
|
BUILD_ALWAYS YES
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ""
|
||||||
BUILD_IN_SOURCE 1
|
BUILD_IN_SOURCE 1
|
||||||
|
|||||||
@ -2,7 +2,8 @@
|
|||||||
set(MLIAP_ENABLE_PYTHON_DEFAULT OFF)
|
set(MLIAP_ENABLE_PYTHON_DEFAULT OFF)
|
||||||
if(PKG_PYTHON)
|
if(PKG_PYTHON)
|
||||||
find_package(Cythonize QUIET)
|
find_package(Cythonize QUIET)
|
||||||
if(Cythonize_FOUND)
|
find_package(Python COMPONENTS NumPy QUIET)
|
||||||
|
if(Cythonize_FOUND AND Python_NumPy_FOUND)
|
||||||
set(MLIAP_ENABLE_PYTHON_DEFAULT ON)
|
set(MLIAP_ENABLE_PYTHON_DEFAULT ON)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -11,30 +12,27 @@ option(MLIAP_ENABLE_PYTHON "Build ML-IAP package with Python support" ${MLIAP_EN
|
|||||||
|
|
||||||
if(MLIAP_ENABLE_PYTHON)
|
if(MLIAP_ENABLE_PYTHON)
|
||||||
find_package(Cythonize REQUIRED)
|
find_package(Cythonize REQUIRED)
|
||||||
|
find_package(Python COMPONENTS NumPy REQUIRED)
|
||||||
if(NOT PKG_PYTHON)
|
if(NOT PKG_PYTHON)
|
||||||
message(FATAL_ERROR "Must enable PYTHON package for including Python support in ML-IAP")
|
message(FATAL_ERROR "Must enable PYTHON package for including Python support in ML-IAP")
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3.6)
|
|
||||||
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
if(Python_VERSION VERSION_LESS 3.6)
|
if(Python_VERSION VERSION_LESS 3.6)
|
||||||
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
|
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython)
|
set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython)
|
||||||
set(MLIAP_CYTHON_SRC ${LAMMPS_SOURCE_DIR}/ML-IAP/mliap_model_python_couple.pyx)
|
file(GLOB MLIAP_CYTHON_SRC CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/ML-IAP/*.pyx)
|
||||||
get_filename_component(MLIAP_CYTHON_BASE ${MLIAP_CYTHON_SRC} NAME_WE)
|
|
||||||
file(MAKE_DIRECTORY ${MLIAP_BINARY_DIR})
|
file(MAKE_DIRECTORY ${MLIAP_BINARY_DIR})
|
||||||
|
foreach(MLIAP_CYTHON_FILE ${MLIAP_CYTHON_SRC})
|
||||||
|
get_filename_component(MLIAP_CYTHON_BASE ${MLIAP_CYTHON_FILE} NAME_WE)
|
||||||
add_custom_command(OUTPUT ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.h
|
add_custom_command(OUTPUT ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.h
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MLIAP_CYTHON_SRC} ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MLIAP_CYTHON_FILE} ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
||||||
COMMAND ${Cythonize_EXECUTABLE} -3 ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
COMMAND ${Cythonize_EXECUTABLE} -3 ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.pyx
|
||||||
WORKING_DIRECTORY ${MLIAP_BINARY_DIR}
|
WORKING_DIRECTORY ${MLIAP_BINARY_DIR}
|
||||||
MAIN_DEPENDENCY ${MLIAP_CYTHON_SRC}
|
MAIN_DEPENDENCY ${MLIAP_CYTHON_FILE}
|
||||||
COMMENT "Generating C++ sources with cythonize...")
|
COMMENT "Generating C++ sources with cythonize...")
|
||||||
target_compile_definitions(lammps PRIVATE -DMLIAP_PYTHON)
|
|
||||||
target_sources(lammps PRIVATE ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp)
|
target_sources(lammps PRIVATE ${MLIAP_BINARY_DIR}/${MLIAP_CYTHON_BASE}.cpp)
|
||||||
|
endforeach()
|
||||||
|
target_compile_definitions(lammps PRIVATE -DMLIAP_PYTHON)
|
||||||
target_include_directories(lammps PRIVATE ${MLIAP_BINARY_DIR})
|
target_include_directories(lammps PRIVATE ${MLIAP_BINARY_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,11 +1,31 @@
|
|||||||
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.fix2.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
|
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2023.11.25.fix.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
|
||||||
|
|
||||||
set(PACELIB_MD5 "32394d799bc282bb57696c78c456e64f" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
set(PACELIB_MD5 "b45de9a633f42ed65422567e3ce56f9f" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
|
||||||
mark_as_advanced(PACELIB_URL)
|
mark_as_advanced(PACELIB_URL)
|
||||||
mark_as_advanced(PACELIB_MD5)
|
mark_as_advanced(PACELIB_MD5)
|
||||||
|
GetFallbackURL(PACELIB_URL PACELIB_FALLBACK)
|
||||||
|
|
||||||
|
# LOCAL_ML-PACE points to top-level dir with local lammps-user-pace repo,
|
||||||
|
# to make it easier to check local build without going through the public github releases
|
||||||
|
if(LOCAL_ML-PACE)
|
||||||
|
set(lib-pace "${LOCAL_ML-PACE}")
|
||||||
|
else()
|
||||||
# download library sources to build folder
|
# download library sources to build folder
|
||||||
file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5}) #SHOW_PROGRESS
|
if(EXISTS ${CMAKE_BINARY_DIR}/libpace.tar.gz)
|
||||||
|
file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5)
|
||||||
|
endif()
|
||||||
|
if(NOT "${DL_MD5}" STREQUAL "${PACELIB_MD5}")
|
||||||
|
message(STATUS "Downloading ${PACELIB_URL}")
|
||||||
|
file(DOWNLOAD ${PACELIB_URL} ${CMAKE_BINARY_DIR}/libpace.tar.gz STATUS DL_STATUS SHOW_PROGRESS)
|
||||||
|
file(MD5 ${CMAKE_BINARY_DIR}/libpace.tar.gz DL_MD5)
|
||||||
|
if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${PACELIB_MD5}"))
|
||||||
|
message(WARNING "Download from primary URL ${PACELIB_URL} failed\nTrying fallback URL ${PACELIB_FALLBACK}")
|
||||||
|
file(DOWNLOAD ${PACELIB_FALLBACK} ${CMAKE_BINARY_DIR}/libpace.tar.gz EXPECTED_HASH MD5=${PACELIB_MD5} SHOW_PROGRESS)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/libpace.tar.gz")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# uncompress downloaded sources
|
# uncompress downloaded sources
|
||||||
execute_process(
|
execute_process(
|
||||||
@ -14,23 +34,11 @@ execute_process(
|
|||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
)
|
)
|
||||||
get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-pace)
|
get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-pace)
|
||||||
|
endif()
|
||||||
|
|
||||||
# enforce building libyaml-cpp as static library and turn off optional features
|
add_subdirectory(${lib-pace} build-pace)
|
||||||
set(YAML_BUILD_SHARED_LIBS OFF)
|
|
||||||
set(YAML_CPP_BUILD_CONTRIB OFF)
|
|
||||||
set(YAML_CPP_BUILD_TOOLS OFF)
|
|
||||||
add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp)
|
|
||||||
set(YAML_CPP_INCLUDE_DIR ${lib-pace}/yaml-cpp/include)
|
|
||||||
|
|
||||||
file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${lib-pace}/ML-PACE)
|
|
||||||
file(GLOB PACE_EVALUATOR_SOURCES ${lib-pace}/ML-PACE/*.cpp)
|
|
||||||
list(FILTER PACE_EVALUATOR_SOURCES EXCLUDE REGEX pair_pace.cpp)
|
|
||||||
|
|
||||||
add_library(pace STATIC ${PACE_EVALUATOR_SOURCES})
|
|
||||||
set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE})
|
set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE})
|
||||||
target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR} ${YAML_CPP_INCLUDE_DIR})
|
|
||||||
|
|
||||||
|
|
||||||
target_link_libraries(pace PRIVATE yaml-cpp-pace)
|
|
||||||
|
|
||||||
|
if(CMAKE_PROJECT_NAME STREQUAL "lammps")
|
||||||
target_link_libraries(lammps PRIVATE pace)
|
target_link_libraries(lammps PRIVATE pace)
|
||||||
|
endif()
|
||||||
|
|||||||
@ -16,6 +16,7 @@ if(DOWNLOAD_QUIP)
|
|||||||
set(temp "${temp}DEFINES += -DGETARG_F2003 -DFORTRAN_UNDERSCORE\n")
|
set(temp "${temp}DEFINES += -DGETARG_F2003 -DFORTRAN_UNDERSCORE\n")
|
||||||
set(temp "${temp}F95FLAGS += -fpp -free -fPIC\n")
|
set(temp "${temp}F95FLAGS += -fpp -free -fPIC\n")
|
||||||
set(temp "${temp}F77FLAGS += -fpp -fixed -fPIC\n")
|
set(temp "${temp}F77FLAGS += -fpp -fixed -fPIC\n")
|
||||||
|
set(temp "${temp}F95_PRE_FILENAME_FLAG = -Tf\n")
|
||||||
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
|
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
|
||||||
set(temp "${temp}FPP=${CMAKE_Fortran_COMPILER} -E -x f95-cpp-input\nOPTIM=${CMAKE_Fortran_FLAGS_${BTYPE}}\n")
|
set(temp "${temp}FPP=${CMAKE_Fortran_COMPILER} -E -x f95-cpp-input\nOPTIM=${CMAKE_Fortran_FLAGS_${BTYPE}}\n")
|
||||||
set(temp "${temp}DEFINES += -DGETARG_F2003 -DGETENV_F2003 -DGFORTRAN -DFORTRAN_UNDERSCORE\n")
|
set(temp "${temp}DEFINES += -DGETARG_F2003 -DGETENV_F2003 -DGFORTRAN -DFORTRAN_UNDERSCORE\n")
|
||||||
@ -58,12 +59,12 @@ if(DOWNLOAD_QUIP)
|
|||||||
BUILD_COMMAND env QUIP_ARCH=lammps make libquip
|
BUILD_COMMAND env QUIP_ARCH=lammps make libquip
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ""
|
||||||
BUILD_IN_SOURCE YES
|
BUILD_IN_SOURCE YES
|
||||||
BUILD_BYPRODUCTS <SOURCE_DIR>/build/lammps/libquip.a
|
BUILD_BYPRODUCTS <SOURCE_DIR>/build/lammps/${CMAKE_STATIC_LIBRARY_PREFIX}quip${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||||
)
|
)
|
||||||
ExternalProject_get_property(quip_build SOURCE_DIR)
|
ExternalProject_get_property(quip_build SOURCE_DIR)
|
||||||
add_library(LAMMPS::QUIP UNKNOWN IMPORTED)
|
add_library(LAMMPS::QUIP UNKNOWN IMPORTED)
|
||||||
set_target_properties(LAMMPS::QUIP PROPERTIES
|
set_target_properties(LAMMPS::QUIP PROPERTIES
|
||||||
IMPORTED_LOCATION "${SOURCE_DIR}/build/lammps/libquip.a"
|
IMPORTED_LOCATION "${SOURCE_DIR}/build/lammps/${CMAKE_STATIC_LIBRARY_PREFIX}quip${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||||
INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}")
|
INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}")
|
||||||
target_link_libraries(lammps PRIVATE LAMMPS::QUIP)
|
target_link_libraries(lammps PRIVATE LAMMPS::QUIP)
|
||||||
add_dependencies(LAMMPS::QUIP quip_build)
|
add_dependencies(LAMMPS::QUIP quip_build)
|
||||||
|
|||||||
@ -1,28 +0,0 @@
|
|||||||
find_package(GSL REQUIRED)
|
|
||||||
find_package(MSCG QUIET)
|
|
||||||
if(MSGC_FOUND)
|
|
||||||
set(DOWNLOAD_MSCG_DEFAULT OFF)
|
|
||||||
else()
|
|
||||||
set(DOWNLOAD_MSCG_DEFAULT ON)
|
|
||||||
endif()
|
|
||||||
option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT})
|
|
||||||
if(DOWNLOAD_MSCG)
|
|
||||||
set(MSCG_URL "https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz" CACHE STRING "URL for MSCG tarball")
|
|
||||||
set(MSCG_MD5 "8c45e269ee13f60b303edd7823866a91" CACHE STRING "MD5 checksum of MSCG tarball")
|
|
||||||
mark_as_advanced(MSCG_URL)
|
|
||||||
mark_as_advanced(MSCG_MD5)
|
|
||||||
|
|
||||||
include(ExternalCMakeProject)
|
|
||||||
ExternalCMakeProject(mscg ${MSCG_URL} ${MSCG_MD5} MSCG-release src/CMake "")
|
|
||||||
|
|
||||||
# set include and link library
|
|
||||||
target_include_directories(lammps PRIVATE "${CMAKE_BINARY_DIR}/_deps/mscg-src/src")
|
|
||||||
target_link_libraries(lammps PRIVATE mscg)
|
|
||||||
else()
|
|
||||||
find_package(MSCG)
|
|
||||||
if(NOT MSCG_FOUND)
|
|
||||||
message(FATAL_ERROR "MSCG not found, help CMake to find it by setting MSCG_LIBRARY and MSCG_INCLUDE_DIR, or set DOWNLOAD_MSCG=ON to download it")
|
|
||||||
endif()
|
|
||||||
target_link_libraries(lammps PRIVATE MSCG::MSCG)
|
|
||||||
endif()
|
|
||||||
target_link_libraries(lammps PRIVATE GSL::gsl ${LAPACK_LIBRARIES})
|
|
||||||
@ -1,3 +1,83 @@
|
|||||||
|
# Plumed2 support for PLUMED package
|
||||||
|
|
||||||
|
if(BUILD_MPI)
|
||||||
|
set(PLUMED_CONFIG_MPI "--enable-mpi")
|
||||||
|
set(PLUMED_CONFIG_CC ${CMAKE_MPI_C_COMPILER})
|
||||||
|
set(PLUMED_CONFIG_CXX ${CMAKE_MPI_CXX_COMPILER})
|
||||||
|
set(PLUMED_CONFIG_CPP "-I ${MPI_CXX_INCLUDE_PATH}")
|
||||||
|
set(PLUMED_CONFIG_LIB "${MPI_CXX_LIBRARIES}")
|
||||||
|
set(PLUMED_CONFIG_DEP "mpi4win_build")
|
||||||
|
else()
|
||||||
|
set(PLUMED_CONFIG_MPI "--disable-mpi")
|
||||||
|
set(PLUMED_CONFIG_CC ${CMAKE_C_COMPILER})
|
||||||
|
set(PLUMED_CONFIG_CXX ${CMAKE_CXX_COMPILER})
|
||||||
|
set(PLUMED_CONFIG_CPP "")
|
||||||
|
set(PLUMED_CONFIG_LIB "")
|
||||||
|
set(PLUMED_CONFIG_DEP "")
|
||||||
|
endif()
|
||||||
|
if(BUILD_OMP)
|
||||||
|
set(PLUMED_CONFIG_OMP "--enable-openmp")
|
||||||
|
else()
|
||||||
|
set(PLUMED_CONFIG_OMP "--disable-openmp")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(PLUMED_URL "https://github.com/plumed/plumed2/releases/download/v2.8.2/plumed-src-2.8.2.tgz"
|
||||||
|
CACHE STRING "URL for PLUMED tarball")
|
||||||
|
set(PLUMED_MD5 "599092b6a0aa6fff992612537ad98994" CACHE STRING "MD5 checksum of PLUMED tarball")
|
||||||
|
|
||||||
|
mark_as_advanced(PLUMED_URL)
|
||||||
|
mark_as_advanced(PLUMED_MD5)
|
||||||
|
GetFallbackURL(PLUMED_URL PLUMED_FALLBACK)
|
||||||
|
|
||||||
|
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND (CMAKE_CROSSCOMPILING))
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||||
|
set(CROSS_CONFIGURE mingw64-configure)
|
||||||
|
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
|
||||||
|
set(CROSS_CONFIGURE mingw32-configure)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unsupported target system: ${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
|
endif()
|
||||||
|
message(STATUS "Downloading and cross-compiling Plumed2 for ${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR} with ${CROSS_CONFIGURE}")
|
||||||
|
include(ExternalProject)
|
||||||
|
ExternalProject_Add(plumed_build
|
||||||
|
URL ${PLUMED_URL} ${PLUMED_FALLBACK}
|
||||||
|
URL_MD5 ${PLUMED_MD5}
|
||||||
|
BUILD_IN_SOURCE 1
|
||||||
|
CONFIGURE_COMMAND ${CROSS_CONFIGURE} --disable-shared --disable-bsymbolic
|
||||||
|
--disable-python --enable-cxx=11
|
||||||
|
--enable-modules=-adjmat:+crystallization:-dimred:+drr:+eds:-fisst:+funnel:+logmfd:+manyrestraints:+maze:+opes:+multicolvar:-pamm:-piv:+s2cm:-sasa:-ves
|
||||||
|
${PLUMED_CONFIG_OMP}
|
||||||
|
${PLUMED_CONFIG_MPI}
|
||||||
|
CXX=${PLUMED_CONFIG_CXX}
|
||||||
|
CC=${PLUMED_CONFIG_CC}
|
||||||
|
CPPFLAGS=${PLUMED_CONFIG_CPP}
|
||||||
|
LIBS=${PLUMED_CONFIG_LIB}
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
BUILD_BYPRODUCTS "<SOURCE_DIR>/src/lib/install/libplumed.a" "<SOURCE_DIR>/src/lib/install/plumed.exe"
|
||||||
|
DEPENDS "${PLUMED_MPI_CONFIG_DEP}"
|
||||||
|
)
|
||||||
|
ExternalProject_Get_Property(plumed_build SOURCE_DIR)
|
||||||
|
set(PLUMED_BUILD_DIR ${SOURCE_DIR})
|
||||||
|
set(PLUMED_INSTALL_DIR ${PLUMED_BUILD_DIR}/src/lib/install)
|
||||||
|
file(MAKE_DIRECTORY ${PLUMED_BUILD_DIR}/src/include)
|
||||||
|
|
||||||
|
add_library(LAMMPS::PLUMED UNKNOWN IMPORTED)
|
||||||
|
add_dependencies(LAMMPS::PLUMED plumed_build)
|
||||||
|
set_target_properties(LAMMPS::PLUMED PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${PLUMED_INSTALL_DIR}/libplumed.a"
|
||||||
|
INTERFACE_LINK_LIBRARIES "-Wl,--image-base -Wl,0x10000000 -lfftw3 -lz -fstack-protector -lssp -fopenmp"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${PLUMED_BUILD_DIR}/src/include")
|
||||||
|
|
||||||
|
add_custom_target(plumed_copy ALL ${CMAKE_COMMAND} -E rm -rf ${CMAKE_BINARY_DIR}/plumed.exe ${CMAKE_BINARY_DIR}/plumed_patches
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${PLUMED_INSTALL_DIR}/plumed.exe ${CMAKE_BINARY_DIR}/plumed.exe
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PLUMED_BUILD_DIR}/patches ${CMAKE_BINARY_DIR}/patches
|
||||||
|
BYPRODUCTS ${CMAKE_BINARY_DIR}/plumed.exe ${CMAKE_BINARY_DIR}/patches
|
||||||
|
DEPENDS plumed_build
|
||||||
|
COMMENT "Copying Plumed files"
|
||||||
|
)
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
set(PLUMED_MODE "static" CACHE STRING "Linkage mode for Plumed2 library")
|
set(PLUMED_MODE "static" CACHE STRING "Linkage mode for Plumed2 library")
|
||||||
set(PLUMED_MODE_VALUES static shared runtime)
|
set(PLUMED_MODE_VALUES static shared runtime)
|
||||||
set_property(CACHE PLUMED_MODE PROPERTY STRINGS ${PLUMED_MODE_VALUES})
|
set_property(CACHE PLUMED_MODE PROPERTY STRINGS ${PLUMED_MODE_VALUES})
|
||||||
@ -31,43 +111,25 @@ endif()
|
|||||||
|
|
||||||
option(DOWNLOAD_PLUMED "Download Plumed package instead of using an already installed one" ${DOWNLOAD_PLUMED_DEFAULT})
|
option(DOWNLOAD_PLUMED "Download Plumed package instead of using an already installed one" ${DOWNLOAD_PLUMED_DEFAULT})
|
||||||
if(DOWNLOAD_PLUMED)
|
if(DOWNLOAD_PLUMED)
|
||||||
if(BUILD_MPI)
|
|
||||||
set(PLUMED_CONFIG_MPI "--enable-mpi")
|
|
||||||
set(PLUMED_CONFIG_CC ${CMAKE_MPI_C_COMPILER})
|
|
||||||
set(PLUMED_CONFIG_CXX ${CMAKE_MPI_CXX_COMPILER})
|
|
||||||
else()
|
|
||||||
set(PLUMED_CONFIG_MPI "--disable-mpi")
|
|
||||||
set(PLUMED_CONFIG_CC ${CMAKE_C_COMPILER})
|
|
||||||
set(PLUMED_CONFIG_CXX ${CMAKE_CXX_COMPILER})
|
|
||||||
endif()
|
|
||||||
if(BUILD_OMP)
|
|
||||||
set(PLUMED_CONFIG_OMP "--enable-openmp")
|
|
||||||
else()
|
|
||||||
set(PLUMED_CONFIG_OMP "--disable-openmp")
|
|
||||||
endif()
|
|
||||||
message(STATUS "PLUMED download requested - we will build our own")
|
message(STATUS "PLUMED download requested - we will build our own")
|
||||||
if(PLUMED_MODE STREQUAL "STATIC")
|
if(PLUMED_MODE STREQUAL "STATIC")
|
||||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libplumed.a")
|
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}plumed${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libplumed${CMAKE_SHARED_LIBRARY_SUFFIX};<INSTALL_DIR>/lib/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumed${CMAKE_SHARED_LIBRARY_SUFFIX};<INSTALL_DIR>/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||||
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libplumedWrapper.a")
|
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}plumedWrapper${CMAKE_STATIC_LIBRARY_PREFIX}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(PLUMED_URL "https://github.com/plumed/plumed2/releases/download/v2.7.4/plumed-src-2.7.4.tgz" CACHE STRING "URL for PLUMED tarball")
|
|
||||||
set(PLUMED_MD5 "858e0b6aed173748fc85b6bc8a9dcb3e" CACHE STRING "MD5 checksum of PLUMED tarball")
|
|
||||||
|
|
||||||
mark_as_advanced(PLUMED_URL)
|
|
||||||
mark_as_advanced(PLUMED_MD5)
|
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(plumed_build
|
ExternalProject_Add(plumed_build
|
||||||
URL ${PLUMED_URL}
|
URL ${PLUMED_URL} ${PLUMED_FALLBACK}
|
||||||
URL_MD5 ${PLUMED_MD5}
|
URL_MD5 ${PLUMED_MD5}
|
||||||
BUILD_IN_SOURCE 1
|
BUILD_IN_SOURCE 1
|
||||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||||
${CONFIGURE_REQUEST_PIC}
|
${CONFIGURE_REQUEST_PIC}
|
||||||
--enable-modules=all
|
--enable-modules=all
|
||||||
|
--enable-cxx=11
|
||||||
|
--disable-python
|
||||||
${PLUMED_CONFIG_MPI}
|
${PLUMED_CONFIG_MPI}
|
||||||
${PLUMED_CONFIG_OMP}
|
${PLUMED_CONFIG_OMP}
|
||||||
CXX=${PLUMED_CONFIG_CXX}
|
CXX=${PLUMED_CONFIG_CXX}
|
||||||
@ -78,12 +140,12 @@ if(DOWNLOAD_PLUMED)
|
|||||||
add_library(LAMMPS::PLUMED UNKNOWN IMPORTED)
|
add_library(LAMMPS::PLUMED UNKNOWN IMPORTED)
|
||||||
add_dependencies(LAMMPS::PLUMED plumed_build)
|
add_dependencies(LAMMPS::PLUMED plumed_build)
|
||||||
if(PLUMED_MODE STREQUAL "STATIC")
|
if(PLUMED_MODE STREQUAL "STATIC")
|
||||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/libplumed.a INTERFACE_LINK_LIBRARIES "${PLUMED_LINK_LIBS};${CMAKE_DL_LIBS}")
|
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}plumed${CMAKE_STATIC_LIBRARY_SUFFIX} INTERFACE_LINK_LIBRARIES "${PLUMED_LINK_LIBS};${CMAKE_DL_LIBS}")
|
||||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/libplumed${CMAKE_SHARED_LIBRARY_SUFFIX} INTERFACE_LINK_LIBRARIES "${INSTALL_DIR}/lib/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX};${CMAKE_DL_LIBS}")
|
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumed${CMAKE_SHARED_LIBRARY_SUFFIX} INTERFACE_LINK_LIBRARIES "${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX};${CMAKE_DL_LIBS}")
|
||||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_COMPILE_DEFINITIONS "__PLUMED_DEFAULT_KERNEL=${INSTALL_DIR}/lib/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_COMPILE_DEFINITIONS "__PLUMED_DEFAULT_KERNEL=${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}plumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||||
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/libplumedWrapper.a INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}")
|
set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}plumedWrapper${CMAKE_STATIC_LIBRARY_SUFFIX} INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}")
|
||||||
endif()
|
endif()
|
||||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
|
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
|
||||||
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
|
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
|
||||||
@ -96,10 +158,12 @@ else()
|
|||||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.shared)
|
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.shared)
|
||||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_COMPILE_DEFINITIONS "__PLUMED_DEFAULT_KERNEL=${PLUMED_LIBDIR}/libplumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_COMPILE_DEFINITIONS "__PLUMED_DEFAULT_KERNEL=${PLUMED_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}plumedKernel${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.runtime)
|
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.runtime)
|
||||||
endif()
|
endif()
|
||||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_LINK_LIBRARIES "${PLUMED_LOAD}")
|
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_LINK_LIBRARIES "${PLUMED_LOAD}")
|
||||||
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PLUMED_INCLUDE_DIRS}")
|
set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PLUMED_INCLUDE_DIRS}")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(lammps PRIVATE LAMMPS::PLUMED)
|
target_link_libraries(lammps PRIVATE LAMMPS::PLUMED)
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
|
||||||
find_package(PythonLibs REQUIRED) # Deprecated since version 3.12
|
if(NOT Python_INTERPRETER)
|
||||||
target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIRS})
|
# backward compatibility with CMake before 3.12 and older LAMMPS documentation
|
||||||
target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARIES})
|
if(PYTHON_EXECUTABLE)
|
||||||
else()
|
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||||
|
endif()
|
||||||
|
find_package(Python COMPONENTS Interpreter)
|
||||||
|
endif()
|
||||||
find_package(Python REQUIRED COMPONENTS Interpreter Development)
|
find_package(Python REQUIRED COMPONENTS Interpreter Development)
|
||||||
target_link_libraries(lammps PRIVATE Python::Python)
|
target_link_libraries(lammps PRIVATE Python::Python)
|
||||||
endif()
|
|
||||||
target_compile_definitions(lammps PRIVATE -DLMP_PYTHON)
|
target_compile_definitions(lammps PRIVATE -DLMP_PYTHON)
|
||||||
|
|||||||
@ -18,6 +18,8 @@ if(DOWNLOAD_SCAFACOS)
|
|||||||
set(SCAFACOS_MD5 "bd46d74e3296bd8a444d731bb10c1738" CACHE STRING "MD5 checksum of SCAFACOS tarball")
|
set(SCAFACOS_MD5 "bd46d74e3296bd8a444d731bb10c1738" CACHE STRING "MD5 checksum of SCAFACOS tarball")
|
||||||
mark_as_advanced(SCAFACOS_URL)
|
mark_as_advanced(SCAFACOS_URL)
|
||||||
mark_as_advanced(SCAFACOS_MD5)
|
mark_as_advanced(SCAFACOS_MD5)
|
||||||
|
GetFallbackURL(SCAFACOS_URL SCAFACOS_FALLBACK)
|
||||||
|
|
||||||
|
|
||||||
# version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later.
|
# version 1.0.1 needs a patch to compile and linke cleanly with GCC 10 and later.
|
||||||
file(DOWNLOAD ${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
file(DOWNLOAD ${LAMMPS_THIRDPARTY_URL}/scafacos-1.0.1-fix.diff ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||||
@ -30,7 +32,7 @@ if(DOWNLOAD_SCAFACOS)
|
|||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(scafacos_build
|
ExternalProject_Add(scafacos_build
|
||||||
URL ${SCAFACOS_URL}
|
URL ${SCAFACOS_URL} ${SCAFACOS_FALLBACK}
|
||||||
URL_MD5 ${SCAFACOS_MD5}
|
URL_MD5 ${SCAFACOS_MD5}
|
||||||
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_BINARY_DIR}/scafacos-1.0.1.fix.diff
|
||||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc
|
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-doc
|
||||||
|
|||||||
@ -1,4 +1,9 @@
|
|||||||
find_package(VTK REQUIRED NO_MODULE)
|
find_package(VTK REQUIRED NO_MODULE)
|
||||||
include(${VTK_USE_FILE})
|
|
||||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_VTK)
|
target_compile_definitions(lammps PRIVATE -DLAMMPS_VTK)
|
||||||
|
if (VTK_MAJOR_VERSION VERSION_LESS 9.0)
|
||||||
|
include(${VTK_USE_FILE})
|
||||||
target_link_libraries(lammps PRIVATE ${VTK_LIBRARIES})
|
target_link_libraries(lammps PRIVATE ${VTK_LIBRARIES})
|
||||||
|
else()
|
||||||
|
target_link_libraries(lammps PRIVATE VTK::CommonCore VTK::IOCore VTK::CommonDataModel VTK::IOXML VTK::IOLegacy VTK::IOParallelXML)
|
||||||
|
vtk_module_autoinit(TARGETS lammps MODULES VTK::CommonCore VTK::IOCore VTK::CommonDataModel VTK::IOXML VTK::IOLegacy VTK::IOParallelXML)
|
||||||
|
endif()
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
function(FindStyleHeaders path style_class file_pattern headers)
|
function(FindStyleHeaders path style_class file_pattern headers)
|
||||||
file(GLOB files "${path}/${file_pattern}*.h")
|
file(GLOB files CONFIGURE_DEPENDS "${path}/${file_pattern}*.h")
|
||||||
get_property(hlist GLOBAL PROPERTY ${headers})
|
get_property(hlist GLOBAL PROPERTY ${headers})
|
||||||
|
|
||||||
foreach(file_name ${files})
|
foreach(file_name ${files})
|
||||||
@ -104,6 +104,7 @@ function(RegisterStyles search_path)
|
|||||||
FindStyleHeaders(${search_path} DIHEDRAL_CLASS dihedral_ DIHEDRAL ) # dihedral ) # force
|
FindStyleHeaders(${search_path} DIHEDRAL_CLASS dihedral_ DIHEDRAL ) # dihedral ) # force
|
||||||
FindStyleHeaders(${search_path} DUMP_CLASS dump_ DUMP ) # dump ) # output write_dump
|
FindStyleHeaders(${search_path} DUMP_CLASS dump_ DUMP ) # dump ) # output write_dump
|
||||||
FindStyleHeaders(${search_path} FIX_CLASS fix_ FIX ) # fix ) # modify
|
FindStyleHeaders(${search_path} FIX_CLASS fix_ FIX ) # fix ) # modify
|
||||||
|
FindStyleHeaders(${search_path} GRAN_SUB_MOD_CLASS gran_sub_mod_ GRAN_SUB_MOD ) # gran_sub_mod ) # granular_model
|
||||||
FindStyleHeaders(${search_path} IMPROPER_CLASS improper_ IMPROPER ) # improper ) # force
|
FindStyleHeaders(${search_path} IMPROPER_CLASS improper_ IMPROPER ) # improper ) # force
|
||||||
FindStyleHeaders(${search_path} INTEGRATE_CLASS "[^.]" INTEGRATE ) # integrate ) # update
|
FindStyleHeaders(${search_path} INTEGRATE_CLASS "[^.]" INTEGRATE ) # integrate ) # update
|
||||||
FindStyleHeaders(${search_path} KSPACE_CLASS "[^.]" KSPACE ) # kspace ) # force
|
FindStyleHeaders(${search_path} KSPACE_CLASS "[^.]" KSPACE ) # kspace ) # force
|
||||||
@ -127,6 +128,7 @@ function(RegisterStylesExt search_path extension sources)
|
|||||||
FindStyleHeadersExt(${search_path} DIHEDRAL_CLASS ${extension} DIHEDRAL ${sources})
|
FindStyleHeadersExt(${search_path} DIHEDRAL_CLASS ${extension} DIHEDRAL ${sources})
|
||||||
FindStyleHeadersExt(${search_path} DUMP_CLASS ${extension} DUMP ${sources})
|
FindStyleHeadersExt(${search_path} DUMP_CLASS ${extension} DUMP ${sources})
|
||||||
FindStyleHeadersExt(${search_path} FIX_CLASS ${extension} FIX ${sources})
|
FindStyleHeadersExt(${search_path} FIX_CLASS ${extension} FIX ${sources})
|
||||||
|
FindStyleHeadersExt(${search_path} GRAN_SUB_MOD_CLASS ${extension} GRAN_SUB_MOD ${sources})
|
||||||
FindStyleHeadersExt(${search_path} IMPROPER_CLASS ${extension} IMPROPER ${sources})
|
FindStyleHeadersExt(${search_path} IMPROPER_CLASS ${extension} IMPROPER ${sources})
|
||||||
FindStyleHeadersExt(${search_path} INTEGRATE_CLASS ${extension} INTEGRATE ${sources})
|
FindStyleHeadersExt(${search_path} INTEGRATE_CLASS ${extension} INTEGRATE ${sources})
|
||||||
FindStyleHeadersExt(${search_path} KSPACE_CLASS ${extension} KSPACE ${sources})
|
FindStyleHeadersExt(${search_path} KSPACE_CLASS ${extension} KSPACE ${sources})
|
||||||
@ -151,6 +153,7 @@ function(GenerateStyleHeaders output_path)
|
|||||||
GenerateStyleHeader(${output_path} DIHEDRAL dihedral ) # force
|
GenerateStyleHeader(${output_path} DIHEDRAL dihedral ) # force
|
||||||
GenerateStyleHeader(${output_path} DUMP dump ) # output write_dump
|
GenerateStyleHeader(${output_path} DUMP dump ) # output write_dump
|
||||||
GenerateStyleHeader(${output_path} FIX fix ) # modify
|
GenerateStyleHeader(${output_path} FIX fix ) # modify
|
||||||
|
GenerateStyleHeader(${output_path} GRAN_SUB_MOD gran_sub_mod ) # granular_model
|
||||||
GenerateStyleHeader(${output_path} IMPROPER improper ) # force
|
GenerateStyleHeader(${output_path} IMPROPER improper ) # force
|
||||||
GenerateStyleHeader(${output_path} INTEGRATE integrate ) # update
|
GenerateStyleHeader(${output_path} INTEGRATE integrate ) # update
|
||||||
GenerateStyleHeader(${output_path} KSPACE kspace ) # force
|
GenerateStyleHeader(${output_path} KSPACE kspace ) # force
|
||||||
@ -184,7 +187,7 @@ endfunction(DetectBuildSystemConflict)
|
|||||||
|
|
||||||
|
|
||||||
function(FindPackagesHeaders path style_class file_pattern headers)
|
function(FindPackagesHeaders path style_class file_pattern headers)
|
||||||
file(GLOB files "${path}/${file_pattern}*.h")
|
file(GLOB files CONFIGURE_DEPENDS "${path}/${file_pattern}*.h")
|
||||||
get_property(plist GLOBAL PROPERTY ${headers})
|
get_property(plist GLOBAL PROPERTY ${headers})
|
||||||
|
|
||||||
foreach(file_name ${files})
|
foreach(file_name ${files})
|
||||||
|
|||||||
@ -6,7 +6,7 @@ if(ENABLE_TESTING)
|
|||||||
find_program(VALGRIND_BINARY NAMES valgrind)
|
find_program(VALGRIND_BINARY NAMES valgrind)
|
||||||
# generate custom suppression file
|
# generate custom suppression file
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "\n")
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "\n")
|
||||||
file(GLOB VALGRIND_SUPPRESSION_FILES ${LAMMPS_TOOLS_DIR}/valgrind/[^.]*.supp)
|
file(GLOB VALGRIND_SUPPRESSION_FILES CONFIGURE_DEPENDS ${LAMMPS_TOOLS_DIR}/valgrind/[^.]*.supp)
|
||||||
foreach(SUPP ${VALGRIND_SUPPRESSION_FILES})
|
foreach(SUPP ${VALGRIND_SUPPRESSION_FILES})
|
||||||
file(READ ${SUPP} SUPPRESSIONS)
|
file(READ ${SUPP} SUPPRESSIONS)
|
||||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "${SUPPRESSIONS}")
|
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "${SUPPRESSIONS}")
|
||||||
@ -18,29 +18,33 @@ if(ENABLE_TESTING)
|
|||||||
|
|
||||||
# we need to build and link a LOT of tester executables, so it is worth checking if
|
# we need to build and link a LOT of tester executables, so it is worth checking if
|
||||||
# a faster linker is available. requires GNU or Clang compiler, newer CMake.
|
# a faster linker is available. requires GNU or Clang compiler, newer CMake.
|
||||||
# also only verified with Fedora Linux > 30 and Ubuntu <= 18.04 (Ubuntu 20.04 fails)
|
# also only verified with Fedora Linux > 30 and Ubuntu 18.04 or 22.04+(Ubuntu 20.04 fails)
|
||||||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
|
if((CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
AND ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
AND ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
|
||||||
OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
|
if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND
|
||||||
if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND (CMAKE_DISTRO_VERSION VERSION_LESS_EQUAL 18.04))
|
((CMAKE_DISTRO_VERSION VERSION_LESS_EQUAL 18.04) OR (CMAKE_DISTRO_VERSION VERSION_GREATER_EQUAL 22.04)))
|
||||||
OR ((CMAKE_LINUX_DISTRO STREQUAL "Fedora") AND (CMAKE_DISTRO_VERSION VERSION_GREATER 30)))
|
OR ((CMAKE_LINUX_DISTRO STREQUAL "Fedora") AND (CMAKE_DISTRO_VERSION VERSION_GREATER 30)))
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
set(CMAKE_CUSTOM_LINKER_DEFAULT default)
|
set(CMAKE_CUSTOM_LINKER_DEFAULT default)
|
||||||
|
check_cxx_compiler_flag(-fuse-ld=mold HAVE_MOLD_LINKER_FLAG)
|
||||||
check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG)
|
check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG)
|
||||||
check_cxx_compiler_flag(-fuse-ld=gold HAVE_GOLD_LINKER_FLAG)
|
check_cxx_compiler_flag(-fuse-ld=gold HAVE_GOLD_LINKER_FLAG)
|
||||||
check_cxx_compiler_flag(-fuse-ld=bfd HAVE_BFD_LINKER_FLAG)
|
check_cxx_compiler_flag(-fuse-ld=bfd HAVE_BFD_LINKER_FLAG)
|
||||||
|
find_program(HAVE_MOLD_LINKER_BIN ld.mold)
|
||||||
find_program(HAVE_LLD_LINKER_BIN lld ld.lld)
|
find_program(HAVE_LLD_LINKER_BIN lld ld.lld)
|
||||||
find_program(HAVE_GOLD_LINKER_BIN ld.gold)
|
find_program(HAVE_GOLD_LINKER_BIN ld.gold)
|
||||||
find_program(HAVE_BFD_LINKER_BIN ld.bfd)
|
find_program(HAVE_BFD_LINKER_BIN ld.bfd)
|
||||||
if(HAVE_LLD_LINKER_FLAG AND HAVE_LLD_LINKER_BIN)
|
if(HAVE_MOLD_LINKER_FLAG AND HAVE_MOLD_LINKER_BIN)
|
||||||
|
set(CMAKE_CUSTOM_LINKER_DEFAULT mold)
|
||||||
|
elseif(HAVE_LLD_LINKER_FLAG AND HAVE_LLD_LINKER_BIN)
|
||||||
set(CMAKE_CUSTOM_LINKER_DEFAULT lld)
|
set(CMAKE_CUSTOM_LINKER_DEFAULT lld)
|
||||||
elseif(HAVE_GOLD_LINKER_FLAG AND HAVE_GOLD_LINKER_BIN)
|
elseif(HAVE_GOLD_LINKER_FLAG AND HAVE_GOLD_LINKER_BIN)
|
||||||
set(CMAKE_CUSTOM_LINKER_DEFAULT gold)
|
set(CMAKE_CUSTOM_LINKER_DEFAULT gold)
|
||||||
elseif(HAVE_BFD_LINKER_FLAG AND HAVE_BFD_LINKER_BIN)
|
elseif(HAVE_BFD_LINKER_FLAG AND HAVE_BFD_LINKER_BIN)
|
||||||
set(CMAKE_CUSTOM_LINKER_DEFAULT bfd)
|
set(CMAKE_CUSTOM_LINKER_DEFAULT bfd)
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_CUSTOM_LINKER_VALUES lld gold bfd default)
|
set(CMAKE_CUSTOM_LINKER_VALUES mold lld gold bfd default)
|
||||||
set(CMAKE_CUSTOM_LINKER ${CMAKE_CUSTOM_LINKER_DEFAULT} CACHE STRING "Choose a custom linker for faster linking (lld, gold, bfd, default)")
|
set(CMAKE_CUSTOM_LINKER ${CMAKE_CUSTOM_LINKER_DEFAULT} CACHE STRING "Choose a custom linker for faster linking (mold, lld, gold, bfd, default)")
|
||||||
validate_option(CMAKE_CUSTOM_LINKER CMAKE_CUSTOM_LINKER_VALUES)
|
validate_option(CMAKE_CUSTOM_LINKER CMAKE_CUSTOM_LINKER_VALUES)
|
||||||
mark_as_advanced(CMAKE_CUSTOM_LINKER)
|
mark_as_advanced(CMAKE_CUSTOM_LINKER)
|
||||||
if(NOT "${CMAKE_CUSTOM_LINKER}" STREQUAL "default")
|
if(NOT "${CMAKE_CUSTOM_LINKER}" STREQUAL "default")
|
||||||
@ -62,18 +66,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF)
|
option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF)
|
||||||
mark_as_advanced(ENABLE_COVERAGE)
|
mark_as_advanced(ENABLE_COVERAGE)
|
||||||
if(ENABLE_COVERAGE)
|
if(ENABLE_COVERAGE)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
|
||||||
if(CMAKE_CXX_FLAGS)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} --coverage")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
target_compile_options(lammps PUBLIC --coverage)
|
target_compile_options(lammps PUBLIC --coverage)
|
||||||
target_link_options(lammps PUBLIC --coverage)
|
target_link_options(lammps PUBLIC --coverage)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# add custom target for IWYU analysis
|
# add custom target for IWYU analysis
|
||||||
@ -114,16 +110,8 @@ validate_option(ENABLE_SANITIZER ENABLE_SANITIZER_VALUES)
|
|||||||
string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER)
|
string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER)
|
||||||
if(NOT ENABLE_SANITIZER STREQUAL "none")
|
if(NOT ENABLE_SANITIZER STREQUAL "none")
|
||||||
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
|
||||||
if(CMAKE_CXX_FLAGS)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_${CMAKE_BUILD_TYPE}_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
target_compile_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
target_compile_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||||
target_link_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
target_link_options(lammps PUBLIC -fsanitize=${ENABLE_SANITIZER})
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
message(WARNING "ENABLE_SANITIZER option not supported by ${CMAKE_CXX_COMPILER_ID} compilers. Ignoring.")
|
message(WARNING "ENABLE_SANITIZER option not supported by ${CMAKE_CXX_COMPILER_ID} compilers. Ignoring.")
|
||||||
set(ENABLE_SANITIZER "none")
|
set(ENABLE_SANITIZER "none")
|
||||||
|
|||||||
@ -26,21 +26,24 @@ if(BUILD_TOOLS)
|
|||||||
|
|
||||||
enable_language(C)
|
enable_language(C)
|
||||||
get_filename_component(MSI2LMP_SOURCE_DIR ${LAMMPS_TOOLS_DIR}/msi2lmp/src ABSOLUTE)
|
get_filename_component(MSI2LMP_SOURCE_DIR ${LAMMPS_TOOLS_DIR}/msi2lmp/src ABSOLUTE)
|
||||||
file(GLOB MSI2LMP_SOURCES ${MSI2LMP_SOURCE_DIR}/[^.]*.c)
|
file(GLOB MSI2LMP_SOURCES CONFIGURE_DEPENDS ${MSI2LMP_SOURCE_DIR}/[^.]*.c)
|
||||||
add_executable(msi2lmp ${MSI2LMP_SOURCES})
|
add_executable(msi2lmp ${MSI2LMP_SOURCES})
|
||||||
if(STANDARD_MATH_LIB)
|
if(STANDARD_MATH_LIB)
|
||||||
target_link_libraries(msi2lmp PRIVATE ${STANDARD_MATH_LIB})
|
target_link_libraries(msi2lmp PRIVATE ${STANDARD_MATH_LIB})
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS msi2lmp DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS msi2lmp DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
install(FILES ${LAMMPS_DOC_DIR}/msi2lmp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
install(FILES ${LAMMPS_DOC_DIR}/msi2lmp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||||
|
|
||||||
|
add_subdirectory(${LAMMPS_TOOLS_DIR}/phonon ${CMAKE_BINARY_DIR}/phana_build)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
if(BUILD_LAMMPS_SHELL)
|
if(BUILD_LAMMPS_SHELL)
|
||||||
|
if(NOT PkgConfig_FOUND)
|
||||||
|
message(FATAL_ERROR "Must have pkg-config installed for building LAMMPS shell")
|
||||||
|
endif()
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(READLINE IMPORTED_TARGET REQUIRED readline)
|
pkg_check_modules(READLINE IMPORTED_TARGET REQUIRED readline)
|
||||||
if(NOT LAMMPS_EXCEPTIONS)
|
|
||||||
message(WARNING "The LAMMPS shell needs LAMMPS_EXCEPTIONS enabled for full functionality")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# include resource compiler to embed icons into the executable on Windows
|
# include resource compiler to embed icons into the executable on Windows
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
@ -50,15 +53,23 @@ if(BUILD_LAMMPS_SHELL)
|
|||||||
|
|
||||||
add_executable(lammps-shell ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.cpp ${ICON_RC_FILE})
|
add_executable(lammps-shell ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.cpp ${ICON_RC_FILE})
|
||||||
target_include_directories(lammps-shell PRIVATE ${LAMMPS_TOOLS_DIR}/lammps-shell)
|
target_include_directories(lammps-shell PRIVATE ${LAMMPS_TOOLS_DIR}/lammps-shell)
|
||||||
|
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::READLINE)
|
||||||
|
|
||||||
# workaround for broken readline pkg-config file on FreeBSD
|
# workaround for broken readline pkg-config file on FreeBSD
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
target_include_directories(lammps-shell PRIVATE /usr/local/include)
|
target_include_directories(lammps-shell PRIVATE /usr/local/include)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::READLINE)
|
if(CMAKE_SYSTEM_NAME STREQUAL "LinuxMUSL")
|
||||||
|
pkg_check_modules(TERMCAP IMPORTED_TARGET REQUIRED termcap)
|
||||||
|
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::TERMCAP)
|
||||||
|
endif()
|
||||||
install(TARGETS lammps-shell EXPORT LAMMPS_Targets DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS lammps-shell EXPORT LAMMPS_Targets DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
install(DIRECTORY ${LAMMPS_TOOLS_DIR}/lammps-shell/icons DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/)
|
install(DIRECTORY ${LAMMPS_TOOLS_DIR}/lammps-shell/icons DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/)
|
||||||
install(FILES ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/)
|
install(FILES ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_LAMMPS_GUI)
|
||||||
|
get_filename_component(LAMMPS_GUI_DIR ${LAMMPS_SOURCE_DIR}/../tools/lammps-gui ABSOLUTE)
|
||||||
|
get_filename_component(LAMMPS_GUI_BIN ${CMAKE_BINARY_DIR}/lammps-gui-build ABSOLUTE)
|
||||||
|
add_subdirectory(${LAMMPS_GUI_DIR} ${LAMMPS_GUI_BIN})
|
||||||
|
endif()
|
||||||
|
|||||||
BIN
cmake/packaging/LAMMPS_DMG_Background.png
Normal file
BIN
cmake/packaging/LAMMPS_DMG_Background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
34
cmake/packaging/MacOSXBundleInfo.plist.in
Normal file
34
cmake/packaging/MacOSXBundleInfo.plist.in
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en-US</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>The LAMMPS Molecular Dynamics Software</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>lammps</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>org.lammps.gui</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleLongVersionString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>LAMMPS_GUI</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
69
cmake/packaging/README.macos
Normal file
69
cmake/packaging/README.macos
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
LAMMPS and LAMMPS GUI universal binaries for macOS (arm64/x86_64)
|
||||||
|
=================================================================
|
||||||
|
|
||||||
|
This package provides universal binaries of LAMMPS and LAMMPS GUI that should
|
||||||
|
run on macOS systems running running macOS version 11 (Big Sur) or newer. Note
|
||||||
|
the binaries are compiled without MPI support and contain a compatible subset
|
||||||
|
of the available packages.
|
||||||
|
|
||||||
|
The following individual commands are included:
|
||||||
|
binary2txt lammps-gui lmp msi2lmp phana stl_bin2txt
|
||||||
|
|
||||||
|
After copying the LAMMPS_GUI folder into your Applications folder, please follow
|
||||||
|
these steps:
|
||||||
|
|
||||||
|
1. Open the Terminal app
|
||||||
|
|
||||||
|
2. Type the following command and press ENTER:
|
||||||
|
|
||||||
|
open ~/.zprofile
|
||||||
|
|
||||||
|
This will open a text editor for modifying the .zprofile file in your home
|
||||||
|
directory.
|
||||||
|
|
||||||
|
3. Add the following lines to the end of the file, save it, and close the editor
|
||||||
|
|
||||||
|
LAMMPS_INSTALL_DIR=/Applications/LAMMPS_GUI.app/Contents
|
||||||
|
LAMMPS_POTENTIALS=${LAMMPS_INSTALL_DIR}/share/lammps/potentials
|
||||||
|
LAMMPS_BENCH_DIR=${LAMMPS_INSTALL_DIR}/share/lammps/bench
|
||||||
|
MSI2LMP_LIBRARY=${LAMMPS_INSTALL_DIR}/share/lammps/frc_files
|
||||||
|
PATH=${LAMMPS_INSTALL_DIR}/bin:$PATH
|
||||||
|
export LAMMPS_POTENTIALS LAMMPS_BENCH_DIR PATH
|
||||||
|
|
||||||
|
4. In your existing terminal, type the following command make the settings active
|
||||||
|
|
||||||
|
source ~/.zprofile
|
||||||
|
|
||||||
|
Note, you don't have to type this in new terminals, since they will apply
|
||||||
|
the changes from .zprofile automatically.
|
||||||
|
|
||||||
|
Note: the above assumes you use the default shell (zsh) that comes with
|
||||||
|
MacOS. If you customized MacOS to use a different shell, you'll need to
|
||||||
|
modify that shell's init file (.cshrc, .bashrc, etc.) instead with
|
||||||
|
appropiate commands to modify the same environment variables.
|
||||||
|
|
||||||
|
5. Try running LAMMPS (which might fail, see step 7)
|
||||||
|
|
||||||
|
lmp -in ${LAMMPS_BENCH_DIR}/in.lj
|
||||||
|
|
||||||
|
6. Try running the LAMMPS GUI
|
||||||
|
|
||||||
|
lammps-gui ${LAMMPS_BENCH_DIR}/in.rhodo
|
||||||
|
|
||||||
|
Depending on the size and resolution of your screen, the fonts may be too
|
||||||
|
small to read. This can be adjusted by setting the environment variable
|
||||||
|
QT_FONT_DPI. The default value would be 72, so to increase the fonts by a
|
||||||
|
third, one can add to the .zprofile file the line
|
||||||
|
|
||||||
|
export QT_FONT_DPI=96
|
||||||
|
|
||||||
|
and reload as shown above.
|
||||||
|
|
||||||
|
7. Give permission to execute the commands (lmp, lammps-gui, msi2lmp, binary2txt, phana, stl_bin2txt)
|
||||||
|
|
||||||
|
MacOS will likely block the initial run of the executables, since they were
|
||||||
|
downloaded from the internet and are missing a known signature from an
|
||||||
|
identified developer. Go to "Settings" and search for "Security settings".
|
||||||
|
It should display a message that an executable like "lmp" was blocked. Press
|
||||||
|
"Open anyway", which might prompt you for your admin credentials. Afterwards
|
||||||
|
"lmp" and the other executables should work as expected.
|
||||||
77
cmake/packaging/build_linux_tgz.sh
Executable file
77
cmake/packaging/build_linux_tgz.sh
Executable file
@ -0,0 +1,77 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
APP_NAME=lammps-gui
|
||||||
|
DESTDIR=${PWD}/../LAMMPS_GUI
|
||||||
|
|
||||||
|
echo "Delete old files, if they exist"
|
||||||
|
rm -rf ${DESTDIR} ../LAMMPS_GUI-Linux-amd64.tar.gz
|
||||||
|
|
||||||
|
echo "Create staging area for deployment and populate"
|
||||||
|
DESTDIR=${DESTDIR} cmake --install . --prefix "/"
|
||||||
|
|
||||||
|
echo "Remove debug info"
|
||||||
|
for s in ${DESTDIR}/bin/* ${DESTDIR}/lib/liblammps*
|
||||||
|
do \
|
||||||
|
test -f $s && strip --strip-debug $s
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Remove libc, gcc, and X11 related shared libs"
|
||||||
|
rm -f ${DESTDIR}/lib/ld*.so ${DESTDIR}/lib/ld*.so.[0-9]
|
||||||
|
rm -f ${DESTDIR}/lib/lib{c,dl,rt,m,pthread}.so.?
|
||||||
|
rm -f ${DESTDIR}/lib/lib{c,dl,rt,m,pthread}-[0-9].[0-9]*.so
|
||||||
|
rm -f ${DESTDIR}/lib/libX* ${DESTDIR}/lib/libxcb*
|
||||||
|
rm -f ${DESTDIR}/lib/libgcc_s*
|
||||||
|
rm -f ${DESTDIR}/lib/libstdc++*
|
||||||
|
|
||||||
|
# get qt dir
|
||||||
|
QTDIR=$(ldd ${DESTDIR}/bin/lammps-gui | grep libQt5Core | sed -e 's/^.*=> *//' -e 's/libQt5Core.so.*$/qt5/')
|
||||||
|
cat > ${DESTDIR}/bin/qt.conf <<EOF
|
||||||
|
[Paths]
|
||||||
|
Plugins = ../qt5plugins
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# platform plugin
|
||||||
|
mkdir -p ${DESTDIR}/qt5plugins/platforms
|
||||||
|
cp ${QTDIR}/plugins/platforms/libqxcb.so ${DESTDIR}/qt5plugins/platforms
|
||||||
|
|
||||||
|
# get platform plugin dependencies
|
||||||
|
QTDEPS=$(LD_LIBRARY_PATH=${DESTDIR}/lib ldd ${QTDIR}/plugins/platforms/libqxcb.so | grep -v ${DESTDIR} | grep libQt5 | sed -e 's/^.*=> *//' -e 's/\(libQt5.*.so.*\) .*$/\1/')
|
||||||
|
for dep in ${QTDEPS}
|
||||||
|
do \
|
||||||
|
cp ${dep} ${DESTDIR}/lib
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Add additional plugins for Qt"
|
||||||
|
for dir in styles imageformats
|
||||||
|
do \
|
||||||
|
cp -r ${QTDIR}/plugins/${dir} ${DESTDIR}/qt5plugins/
|
||||||
|
done
|
||||||
|
|
||||||
|
# get imageplugin dependencies
|
||||||
|
for s in ${DESTDIR}/qt5plugins/imageformats/*.so
|
||||||
|
do \
|
||||||
|
QTDEPS=$(LD_LIBRARY_PATH=${DESTDIR}/lib ldd $s | grep -v ${DESTDIR} | grep -E '(libQt5|jpeg)' | sed -e 's/^.*=> *//' -e 's/\(lib.*.so.*\) .*$/\1/')
|
||||||
|
for dep in ${QTDEPS}
|
||||||
|
do \
|
||||||
|
cp ${dep} ${DESTDIR}/lib
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Set up wrapper script"
|
||||||
|
MYDIR=$(dirname "$0")
|
||||||
|
cp ${MYDIR}/linux_wrapper.sh ${DESTDIR}/bin
|
||||||
|
for s in ${DESTDIR}/bin/*
|
||||||
|
do \
|
||||||
|
EXE=$(basename $s)
|
||||||
|
test ${EXE} = linux_wrapper.sh && continue
|
||||||
|
test ${EXE} = qt.conf && continue
|
||||||
|
ln -s bin/linux_wrapper.sh ${DESTDIR}/${EXE}
|
||||||
|
done
|
||||||
|
|
||||||
|
pushd ..
|
||||||
|
tar -czvvf LAMMPS_GUI-Linux-amd64.tar.gz LAMMPS_GUI
|
||||||
|
popd
|
||||||
|
|
||||||
|
echo "Cleanup dir"
|
||||||
|
rm -r ${DESTDIR}
|
||||||
|
exit 0
|
||||||
111
cmake/packaging/build_macos_dmg.sh
Executable file
111
cmake/packaging/build_macos_dmg.sh
Executable file
@ -0,0 +1,111 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
APP_NAME=lammps-gui
|
||||||
|
|
||||||
|
echo "Delete old files, if they exist"
|
||||||
|
rm -f ${APP_NAME}.dmg ${APP_NAME}-rw.dmg LAMMPS_GUI-macOS-multiarch.dmg
|
||||||
|
|
||||||
|
echo "Create initial dmg file with macdeployqt"
|
||||||
|
macdeployqt lammps-gui.app -dmg
|
||||||
|
echo "Create writable dmg file"
|
||||||
|
hdiutil convert ${APP_NAME}.dmg -format UDRW -o ${APP_NAME}-rw.dmg
|
||||||
|
|
||||||
|
echo "Mount writeable DMG file in read-write mode. Keep track of device and volume names"
|
||||||
|
DEVICE=$(hdiutil attach -readwrite -noverify ${APP_NAME}-rw.dmg | grep '^/dev/' | sed 1q | awk '{print $1}')
|
||||||
|
VOLUME=$(df | grep ${DEVICE} | sed -e 's/^.*\(\/Volumes\/\)/\1/')
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
echo "Create link to Application folder and move README and background image files"
|
||||||
|
|
||||||
|
pushd "${VOLUME}"
|
||||||
|
ln -s /Applications .
|
||||||
|
mv ${APP_NAME}.app/Contents/Resources/README.txt .
|
||||||
|
mkdir .background
|
||||||
|
mv ${APP_NAME}.app/Contents/Resources/LAMMPS_DMG_Background.png .background/background.png
|
||||||
|
mv ${APP_NAME}.app LAMMPS_GUI.app
|
||||||
|
cd LAMMPS_GUI.app/Contents
|
||||||
|
|
||||||
|
echo "Attach icons to LAMMPS console and GUI executables"
|
||||||
|
echo "read 'icns' (-16455) \"Resources/lammps.icns\";" > icon.rsrc
|
||||||
|
Rez -a icon.rsrc -o bin/lmp
|
||||||
|
SetFile -a C bin/lmp
|
||||||
|
Rez -a icon.rsrc -o MacOS/lammps-gui
|
||||||
|
SetFile -a C MacOS/lammps-gui
|
||||||
|
rm icon.rsrc
|
||||||
|
popd
|
||||||
|
|
||||||
|
echo 'Tell the Finder to resize the window, set the background,'
|
||||||
|
echo 'change the icon size, place the icons in the right position, etc.'
|
||||||
|
echo '
|
||||||
|
tell application "Finder"
|
||||||
|
tell disk "'${APP_NAME}'"
|
||||||
|
|
||||||
|
-- wait for the image to finish mounting
|
||||||
|
set open_attempts to 0
|
||||||
|
repeat while open_attempts < 4
|
||||||
|
try
|
||||||
|
open
|
||||||
|
delay 1
|
||||||
|
set open_attempts to 5
|
||||||
|
close
|
||||||
|
on error errStr number errorNumber
|
||||||
|
set open_attempts to open_attempts + 1
|
||||||
|
delay 10
|
||||||
|
end try
|
||||||
|
end repeat
|
||||||
|
delay 5
|
||||||
|
|
||||||
|
-- open the image the first time and save a .DS_Store
|
||||||
|
-- just the background and icon setup
|
||||||
|
open
|
||||||
|
set current view of container window to icon view
|
||||||
|
set theViewOptions to the icon view options of container window
|
||||||
|
set background picture of theViewOptions to file ".background:background.png"
|
||||||
|
set arrangement of theViewOptions to not arranged
|
||||||
|
set icon size of theViewOptions to 64
|
||||||
|
delay 5
|
||||||
|
close
|
||||||
|
|
||||||
|
-- next set up the position of the app and Applications symlink
|
||||||
|
-- plus hide all window decorations
|
||||||
|
open
|
||||||
|
update without registering applications
|
||||||
|
tell container window
|
||||||
|
set sidebar width to 0
|
||||||
|
set statusbar visible to false
|
||||||
|
set toolbar visible to false
|
||||||
|
set the bounds to { 100, 40, 868, 640 }
|
||||||
|
set position of item "'LAMMPS_GUI'.app" to { 190, 216 }
|
||||||
|
set position of item "Applications" to { 576, 216 }
|
||||||
|
set position of item "README.txt" to { 190, 400 }
|
||||||
|
end tell
|
||||||
|
update without registering applications
|
||||||
|
delay 5
|
||||||
|
close
|
||||||
|
|
||||||
|
-- one last open and close to check the results
|
||||||
|
open
|
||||||
|
delay 5
|
||||||
|
close
|
||||||
|
end tell
|
||||||
|
delay 1
|
||||||
|
end tell
|
||||||
|
' | osascript
|
||||||
|
|
||||||
|
sync
|
||||||
|
|
||||||
|
echo "Unmount modified disk image and convert to compressed read-only image"
|
||||||
|
hdiutil detach "${DEVICE}"
|
||||||
|
hdiutil convert "${APP_NAME}-rw.dmg" -format UDZO -o "LAMMPS_GUI-macOS-multiarch.dmg"
|
||||||
|
|
||||||
|
echo "Attach icon to .dmg file"
|
||||||
|
echo "read 'icns' (-16455) \"lammps-gui.app/Contents/Resources/lammps.icns\";" > icon.rsrc
|
||||||
|
Rez -a icon.rsrc -o LAMMPS_GUI-macOS-multiarch.dmg
|
||||||
|
SetFile -a C LAMMPS_GUI-macOS-multiarch.dmg
|
||||||
|
rm icon.rsrc
|
||||||
|
|
||||||
|
echo "Delete temporary disk images"
|
||||||
|
rm -f "${APP_NAME}-rw.dmg"
|
||||||
|
rm -f "${APP_NAME}.dmg"
|
||||||
|
|
||||||
|
exit 0
|
||||||
64
cmake/packaging/build_windows_cross_zip.sh
Executable file
64
cmake/packaging/build_windows_cross_zip.sh
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
APP_NAME=lammps-gui
|
||||||
|
DESTDIR=${PWD}/LAMMPS_GUI
|
||||||
|
SYSROOT="$1"
|
||||||
|
|
||||||
|
echo "Delete old files, if they exist"
|
||||||
|
rm -rvf ${DESTDIR}/LAMMPS_GUI ${DESTDIR}/LAMMPS-Win10-amd64.zip
|
||||||
|
|
||||||
|
echo "Create staging area for deployment and populate"
|
||||||
|
DESTDIR=${DESTDIR} cmake --install . --prefix "/"
|
||||||
|
|
||||||
|
# no static libs needed
|
||||||
|
rm -rvf ${DESTDIR}/lib
|
||||||
|
# but the LAMMPS lib
|
||||||
|
|
||||||
|
echo "Copying required DLL files"
|
||||||
|
for dll in $(objdump -p *.exe *.dll | sed -n -e '/DLL Name:/s/^.*DLL Name: *//p' | sort | uniq)
|
||||||
|
do \
|
||||||
|
doskip=0
|
||||||
|
for skip in ADVAPI32 CFGMGR32 GDI32 KERNEL32 MPR NETAPI32 PSAPI SHELL32 USER32 USERENV UxTheme VERSION WS2_32 WSOCK32 d3d11 dwmapi liblammps msvcrt_ole32
|
||||||
|
do \
|
||||||
|
test ${dll} = ${skip}.dll && doskip=1
|
||||||
|
done
|
||||||
|
test ${doskip} -eq 1 && continue
|
||||||
|
test -f ${DESTDIR}/bin/${dll} || cp -v ${SYSROOT}/bin/${dll} ${DESTDIR}/bin
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Copy required Qt plugins"
|
||||||
|
mkdir -p ${DESTDIR}/qt5plugins
|
||||||
|
for plugin in imageformats platforms styles
|
||||||
|
do \
|
||||||
|
cp -r ${SYSROOT}/lib/qt5/plugins/${plugin} ${DESTDIR}/qt5plugins/
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Check dependencies of DLL files"
|
||||||
|
for dll in $(objdump -p ${DESTDIR}/bin/*.dll ${DESTDIR}/qt5plugins/*/*.dll | sed -n -e '/DLL Name:/s/^.*DLL Name: *//p' | sort | uniq)
|
||||||
|
do \
|
||||||
|
doskip=0
|
||||||
|
for skip in ADVAPI32 CFGMGR32 GDI32 KERNEL32 MPR NETAPI32 PSAPI SHELL32 USER32 USERENV UxTheme VERSION WS2_32 WSOCK32 d3d11 dwmapi liblammps msvcrt_ole32
|
||||||
|
do \
|
||||||
|
test ${dll} = ${skip}.dll && doskip=1
|
||||||
|
done
|
||||||
|
test ${doskip} -eq 1 && continue
|
||||||
|
test -f ${DESTDIR}/bin/${dll} || cp -v ${SYSROOT}/bin/${dll} ${DESTDIR}/bin
|
||||||
|
done
|
||||||
|
|
||||||
|
for dll in $(objdump -p ${DESTDIR}/bin/*.dll ${DESTDIR}/qt5plugins/*/*.dll | sed -n -e '/DLL Name:/s/^.*DLL Name: *//p' | sort | uniq)
|
||||||
|
do \
|
||||||
|
doskip=0
|
||||||
|
for skip in ADVAPI32 CFGMGR32 GDI32 KERNEL32 MPR NETAPI32 PSAPI SHELL32 USER32 USERENV UxTheme VERSION WS2_32 WSOCK32 d3d11 dwmapi liblammps msvcrt_ole32
|
||||||
|
do \
|
||||||
|
test ${dll} = ${skip}.dll && doskip=1
|
||||||
|
done
|
||||||
|
test ${doskip} -eq 1 && continue
|
||||||
|
test -f ${DESTDIR}/bin/${dll} || cp -v ${SYSROOT}/bin/${dll} ${DESTDIR}/bin
|
||||||
|
done
|
||||||
|
|
||||||
|
cat > ${DESTDIR}/bin/qt.conf <<EOF
|
||||||
|
[Paths]
|
||||||
|
Plugins = ../qt5plugins
|
||||||
|
EOF
|
||||||
|
zip -9rvD LAMMPS-Win10-amd64.zip LAMMPS_GUI
|
||||||
|
|
||||||
35
cmake/packaging/build_windows_vs.cmake
Normal file
35
cmake/packaging/build_windows_vs.cmake
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# CMake script to be run post installation to build zipped package
|
||||||
|
|
||||||
|
# clean up old zipfile and deployment tree
|
||||||
|
file(REMOVE LAMMPS_GUI-Win10-amd64.zip)
|
||||||
|
file(REMOVE_RECURSE LAMMPS_GUI)
|
||||||
|
file(RENAME ${INSTNAME} LAMMPS_GUI)
|
||||||
|
|
||||||
|
# move all executables and dlls to main folder and delete bin folder
|
||||||
|
file(GLOB BINFILES LIST_DIRECTORIES FALSE LAMMPS_GUI/bin/*.exe LAMMPS_GUI/bin/*.dll)
|
||||||
|
foreach(bin ${BINFILES})
|
||||||
|
get_filename_component(exe ${bin} NAME)
|
||||||
|
file(RENAME ${bin} LAMMPS_GUI/${exe})
|
||||||
|
endforeach()
|
||||||
|
file(REMOVE_RECURSE LAMMPS_GUI/bin)
|
||||||
|
|
||||||
|
# create qt.conf so Qt will find its plugins
|
||||||
|
file(WRITE LAMMPS_GUI/qt.conf "[Paths]\r\nPlugins = qt5plugins\r\n")
|
||||||
|
|
||||||
|
# initialize environment and then run windeployqt to populate folder with missing dependencies and Qt plugins
|
||||||
|
file(WRITE qtdeploy.bat "@ECHO OFF\r\nset VSCMD_DEBUG=0\r\nCALL ${VC_INIT} x64\r\nset PATH=${QT5_BIN_DIR};%PATH%\r\nwindeployqt --plugindir LAMMPS_GUI/qt5plugins --release LAMMPS_GUI/lammps-gui.exe --no-quick-import --no-webkit2 --no-translations --no-system-d3d-compiler --no-angle --no-opengl-sw\r\n")
|
||||||
|
execute_process(COMMAND cmd.exe /c qtdeploy.bat COMMAND_ECHO STDERR)
|
||||||
|
file(REMOVE qtdeploy.bat)
|
||||||
|
|
||||||
|
# download and uncompress static FFMpeg and gzip binaries
|
||||||
|
file(DOWNLOAD "https://download.lammps.org/thirdparty/ffmpeg-gzip.zip" ffmpeg-gzip.zip)
|
||||||
|
file(WRITE unpackzip.ps1 "Expand-Archive -Path ffmpeg-gzip.zip -DestinationPath LAMMPS_GUI")
|
||||||
|
execute_process(COMMAND powershell -ExecutionPolicy Bypass -File unpackzip.ps1)
|
||||||
|
file(REMOVE unpackzip.ps1)
|
||||||
|
file(REMOVE ffmpeg-gzip.zip)
|
||||||
|
|
||||||
|
# create zip archive
|
||||||
|
file(WRITE makearchive.ps1 "Compress-Archive -Path LAMMPS_GUI -CompressionLevel Optimal -DestinationPath LAMMPS_GUI-Win10-amd64.zip")
|
||||||
|
execute_process(COMMAND powershell -ExecutionPolicy Bypass -File makearchive.ps1)
|
||||||
|
file(REMOVE makearchive.ps1)
|
||||||
|
file(REMOVE_RECURSE LAMMPS_GUI)
|
||||||
BIN
cmake/packaging/lammps-icon-1024x1024.png
Normal file
BIN
cmake/packaging/lammps-icon-1024x1024.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 598 KiB |
BIN
cmake/packaging/lammps.icns
Normal file
BIN
cmake/packaging/lammps.icns
Normal file
Binary file not shown.
18
cmake/packaging/linux_wrapper.sh
Executable file
18
cmake/packaging/linux_wrapper.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# wrapper for bundled executables
|
||||||
|
|
||||||
|
# reset locale to avoid problems with decimal numbers
|
||||||
|
export LC_ALL=C
|
||||||
|
|
||||||
|
BASEDIR=$(dirname "$0")
|
||||||
|
EXENAME=$(basename "$0")
|
||||||
|
|
||||||
|
# append to LD_LIBRARY_PATH to prefer local (newer) libs
|
||||||
|
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${BASEDIR}/lib
|
||||||
|
|
||||||
|
# set some environment variables for LAMMPS etc.
|
||||||
|
LAMMPS_POTENTIALS=${BASEDIR}/share/lammps/potentials
|
||||||
|
MSI2LMP_LIBRARY=${BASEDIR}/share/lammps/frc_files
|
||||||
|
export LD_LIBRARY_PATH LAMMPS_POTENTIALS MSI2LMP_LIBRARY
|
||||||
|
|
||||||
|
exec "${BASEDIR}/bin/${EXENAME}" "$@"
|
||||||
30
cmake/packaging/png2iconset.sh
Executable file
30
cmake/packaging/png2iconset.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ $# != 2 ]
|
||||||
|
then
|
||||||
|
echo "usage: $0 <pngfile> <iconset name>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
png="$1"
|
||||||
|
ico="$2"
|
||||||
|
|
||||||
|
if [ ! -f ${png} ]
|
||||||
|
then
|
||||||
|
echo "PNG Image $1 not found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf ${ico}.iconset
|
||||||
|
mkdir ${ico}.iconset
|
||||||
|
sips -z 16 16 ${png} --out ${ico}.iconset/icon_16x16.png
|
||||||
|
sips -z 32 32 ${png} --out ${ico}.iconset/icon_16x16@2x.png
|
||||||
|
sips -z 32 32 ${png} --out ${ico}.iconset/icon_32x32.png
|
||||||
|
sips -z 64 64 ${png} --out ${ico}.iconset/icon_32x32@2x.png
|
||||||
|
sips -z 128 128 ${png} --out ${ico}.iconset/icon_128x128.png
|
||||||
|
sips -z 256 256 ${png} --out ${ico}.iconset/icon_128x128@2x.png
|
||||||
|
sips -z 256 256 ${png} --out ${ico}.iconset/icon_256x256.png
|
||||||
|
sips -z 512 512 ${png} --out ${ico}.iconset/icon_256x256@2x.png
|
||||||
|
sips -z 512 512 ${png} --out ${ico}.iconset/icon_512x512.png
|
||||||
|
sips -z 1024 1024 ${png} --out ${ico}.iconset/icon_512x512@2x.png
|
||||||
|
iconutil -c icns ${ico}.iconset
|
||||||
|
rm -rf ${ico}.iconset
|
||||||
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
set(ALL_PACKAGES
|
set(ALL_PACKAGES
|
||||||
ADIOS
|
ADIOS
|
||||||
|
AMOEBA
|
||||||
ASPHERE
|
ASPHERE
|
||||||
ATC
|
ATC
|
||||||
AWPMD
|
AWPMD
|
||||||
@ -11,7 +12,7 @@ set(ALL_PACKAGES
|
|||||||
BPM
|
BPM
|
||||||
BROWNIAN
|
BROWNIAN
|
||||||
CG-DNA
|
CG-DNA
|
||||||
CG-SDK
|
CG-SPICA
|
||||||
CLASS2
|
CLASS2
|
||||||
COLLOID
|
COLLOID
|
||||||
COLVARS
|
COLVARS
|
||||||
@ -42,7 +43,7 @@ set(ALL_PACKAGES
|
|||||||
KOKKOS
|
KOKKOS
|
||||||
KSPACE
|
KSPACE
|
||||||
LATBOLTZ
|
LATBOLTZ
|
||||||
LATTE
|
LEPTON
|
||||||
MACHDYN
|
MACHDYN
|
||||||
MANIFOLD
|
MANIFOLD
|
||||||
MANYBODY
|
MANYBODY
|
||||||
@ -55,14 +56,13 @@ set(ALL_PACKAGES
|
|||||||
ML-HDNNP
|
ML-HDNNP
|
||||||
ML-IAP
|
ML-IAP
|
||||||
ML-PACE
|
ML-PACE
|
||||||
|
ML-POD
|
||||||
ML-QUIP
|
ML-QUIP
|
||||||
ML-RANN
|
ML-RANN
|
||||||
ML-SNAP
|
ML-SNAP
|
||||||
MOFFF
|
MOFFF
|
||||||
MOLECULE
|
MOLECULE
|
||||||
MOLFILE
|
MOLFILE
|
||||||
MPIIO
|
|
||||||
MSCG
|
|
||||||
NETCDF
|
NETCDF
|
||||||
OPENMP
|
OPENMP
|
||||||
OPT
|
OPT
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
set(ALL_PACKAGES
|
set(ALL_PACKAGES
|
||||||
ADIOS
|
ADIOS
|
||||||
|
AMOEBA
|
||||||
ASPHERE
|
ASPHERE
|
||||||
ATC
|
ATC
|
||||||
AWPMD
|
AWPMD
|
||||||
@ -13,7 +14,7 @@ set(ALL_PACKAGES
|
|||||||
BPM
|
BPM
|
||||||
BROWNIAN
|
BROWNIAN
|
||||||
CG-DNA
|
CG-DNA
|
||||||
CG-SDK
|
CG-SPICA
|
||||||
CLASS2
|
CLASS2
|
||||||
COLLOID
|
COLLOID
|
||||||
COLVARS
|
COLVARS
|
||||||
@ -44,7 +45,7 @@ set(ALL_PACKAGES
|
|||||||
KOKKOS
|
KOKKOS
|
||||||
KSPACE
|
KSPACE
|
||||||
LATBOLTZ
|
LATBOLTZ
|
||||||
LATTE
|
LEPTON
|
||||||
MACHDYN
|
MACHDYN
|
||||||
MANIFOLD
|
MANIFOLD
|
||||||
MANYBODY
|
MANYBODY
|
||||||
@ -57,14 +58,13 @@ set(ALL_PACKAGES
|
|||||||
ML-HDNNP
|
ML-HDNNP
|
||||||
ML-IAP
|
ML-IAP
|
||||||
ML-PACE
|
ML-PACE
|
||||||
|
ML-POD
|
||||||
ML-QUIP
|
ML-QUIP
|
||||||
ML-RANN
|
ML-RANN
|
||||||
ML-SNAP
|
ML-SNAP
|
||||||
MOFFF
|
MOFFF
|
||||||
MOLECULE
|
MOLECULE
|
||||||
MOLFILE
|
MOLFILE
|
||||||
MPIIO
|
|
||||||
MSCG
|
|
||||||
NETCDF
|
NETCDF
|
||||||
OPENMP
|
OPENMP
|
||||||
OPT
|
OPT
|
||||||
|
|||||||
@ -3,6 +3,13 @@
|
|||||||
# prefer flang over gfortran, if available
|
# prefer flang over gfortran, if available
|
||||||
find_program(CLANG_FORTRAN NAMES flang gfortran f95)
|
find_program(CLANG_FORTRAN NAMES flang gfortran f95)
|
||||||
set(ENV{OMPI_FC} ${CLANG_FORTRAN})
|
set(ENV{OMPI_FC} ${CLANG_FORTRAN})
|
||||||
|
get_filename_component(_tmp_fc ${CLANG_FORTRAN} NAME)
|
||||||
|
if (_tmp_fc STREQUAL "flang")
|
||||||
|
set(FC_STD_VERSION "-std=f2018")
|
||||||
|
set(BUILD_MPI OFF)
|
||||||
|
else()
|
||||||
|
set(FC_STD_VERSION "-std=f2003")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE)
|
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
|
set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
|
||||||
@ -10,9 +17,9 @@ set(CMAKE_Fortran_COMPILER ${CLANG_FORTRAN} CACHE STRING "" FORCE)
|
|||||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Wextra -g -std=f2003" CACHE STRING "" FORCE)
|
set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Wextra -g ${FC_STD_VERSION}" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG ${FC_STD_VERSION}" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG ${FC_STD_VERSION}" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||||
@ -21,10 +28,3 @@ set(MPI_CXX "clang++" CACHE STRING "" FORCE)
|
|||||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||||
set(OpenMP_C "clang" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_CXX "clang++" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_omp_LIBRARY "libomp.so" CACHE PATH "" FORCE)
|
|
||||||
|
|||||||
@ -1,16 +1,14 @@
|
|||||||
# Preset that turns on packages with automatic downloads of sources or potentials.
|
# Preset that turns on packages with automatic downloads of sources or potentials.
|
||||||
# Compilation of libraries like Plumed or ScaFaCoS can take a considerable amount of time.
|
# Compilation of libraries like Plumed or ScaFaCoS can take a considerable amount of time.
|
||||||
|
|
||||||
set(ALL_PACKAGES KIM LATTE MSCG VORONOI PLUMED SCAFACOS MACHDYN MESONT MDI ML-PACE)
|
set(ALL_PACKAGES KIM MSCG VORONOI PLUMED SCAFACOS MACHDYN MESONT MDI ML-PACE)
|
||||||
|
|
||||||
foreach(PKG ${ALL_PACKAGES})
|
foreach(PKG ${ALL_PACKAGES})
|
||||||
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
|
set(PKG_${PKG} ON CACHE BOOL "" FORCE)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(DOWNLOAD_KIM ON CACHE BOOL "" FORCE)
|
set(DOWNLOAD_KIM ON CACHE BOOL "" FORCE)
|
||||||
set(DOWNLOAD_LATTE ON CACHE BOOL "" FORCE)
|
|
||||||
set(DOWNLOAD_MDI ON CACHE BOOL "" FORCE)
|
set(DOWNLOAD_MDI ON CACHE BOOL "" FORCE)
|
||||||
set(DOWNLOAD_MSCG ON CACHE BOOL "" FORCE)
|
|
||||||
set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE)
|
set(DOWNLOAD_VORO ON CACHE BOOL "" FORCE)
|
||||||
set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE)
|
set(DOWNLOAD_EIGEN3 ON CACHE BOOL "" FORCE)
|
||||||
set(DOWNLOAD_PACE ON CACHE BOOL "" FORCE)
|
set(DOWNLOAD_PACE ON CACHE BOOL "" FORCE)
|
||||||
|
|||||||
@ -19,11 +19,3 @@ set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Og -g -std=f2003" CACHE STRING "" FORCE)
|
|||||||
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -std=f2003" CACHE STRING "" FORCE)
|
||||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||||
|
|
||||||
set(OpenMP_C "gcc" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_C_LIB_NAMES "gomp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_CXX "g++" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_CXX_LIB_NAMES "gomp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_omp_LIBRARY "libgomp.so" CACHE PATH "" FORCE)
|
|
||||||
|
|||||||
11
cmake/presets/gpu-cuda.cmake
Normal file
11
cmake/presets/gpu-cuda.cmake
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# preset that enables GPU and selects CUDA API
|
||||||
|
|
||||||
|
set(PKG_GPU ON CACHE BOOL "Build GPU package" FORCE)
|
||||||
|
set(GPU_API "cuda" CACHE STRING "APU used by GPU package" FORCE)
|
||||||
|
set(GPU_PREC "mixed" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
|
set(CUDA_NVCC_FLAGS "-allow-unsupported-compiler" CACHE STRING "" FORCE)
|
||||||
|
set(CUDA_NVCC_FLAGS_DEBUG "-allow-unsupported-compiler" CACHE STRING "" FORCE)
|
||||||
|
set(CUDA_NVCC_FLAGS_MINSIZEREL "-allow-unsupported-compiler" CACHE STRING "" FORCE)
|
||||||
|
set(CUDA_NVCC_FLAGS_RELWITHDEBINFO "-allow-unsupported-compiler" CACHE STRING "" FORCE)
|
||||||
|
set(CUDA_NVCC_FLAGS_RELEASE "-allow-unsupported-compiler" CACHE STRING "" FORCE)
|
||||||
@ -1,4 +1,4 @@
|
|||||||
# preset that will enable Intel compilers with support for MPI and OpenMP (on Linux boxes)
|
# preset that will enable the classic Intel compilers with support for MPI and OpenMP (on Linux boxes)
|
||||||
|
|
||||||
set(CMAKE_CXX_COMPILER "icpc" CACHE STRING "" FORCE)
|
set(CMAKE_CXX_COMPILER "icpc" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_C_COMPILER "icc" CACHE STRING "" FORCE)
|
set(CMAKE_C_COMPILER "icc" CACHE STRING "" FORCE)
|
||||||
@ -18,11 +18,11 @@ set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
|||||||
|
|
||||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||||
set(OpenMP_C "icc" CACHE STRING "" FORCE)
|
set(OpenMP_C "icc" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_C_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
set(OpenMP_C_FLAGS "-qopenmp -qopenmp-simd" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_CXX "icpc" CACHE STRING "" FORCE)
|
set(OpenMP_CXX "icpc" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_CXX_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
set(OpenMP_CXX_FLAGS "-qopenmp -qopenmp-simd" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_Fortran_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
set(OpenMP_Fortran_FLAGS "-qopenmp -qopenmp-simd" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE)
|
set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE)
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,8 @@ set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE)
|
|||||||
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "" FORCE)
|
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "" FORCE)
|
||||||
set(Kokkos_ARCH_PASCAL60 ON CACHE BOOL "" FORCE)
|
set(Kokkos_ARCH_PASCAL60 ON CACHE BOOL "" FORCE)
|
||||||
set(BUILD_OMP ON CACHE BOOL "" FORCE)
|
set(BUILD_OMP ON CACHE BOOL "" FORCE)
|
||||||
|
get_filename_component(NVCC_WRAPPER_CMD ${CMAKE_CURRENT_SOURCE_DIR}/../lib/kokkos/bin/nvcc_wrapper ABSOLUTE)
|
||||||
|
set(CMAKE_CXX_COMPILER ${NVCC_WRAPPER_CMD} CACHE FILEPATH "" FORCE)
|
||||||
|
|
||||||
# hide deprecation warnings temporarily for stable release
|
# hide deprecation warnings temporarily for stable release
|
||||||
set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE)
|
set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE)
|
||||||
|
|||||||
12
cmake/presets/macos-multiarch.cmake
Normal file
12
cmake/presets/macos-multiarch.cmake
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# preset that will build portable multi-arch binaries on macOS without MPI
|
||||||
|
|
||||||
|
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
||||||
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 11.0 CACHE STRING "" FORCE)
|
||||||
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE)
|
||||||
|
set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
|
set(BUILD_MPI FALSE CACHE BOOL "" FORCE)
|
||||||
@ -1,4 +1,5 @@
|
|||||||
set(WIN_PACKAGES
|
set(WIN_PACKAGES
|
||||||
|
AMOEBA
|
||||||
ASPHERE
|
ASPHERE
|
||||||
ATC
|
ATC
|
||||||
AWPMD
|
AWPMD
|
||||||
@ -7,7 +8,7 @@ set(WIN_PACKAGES
|
|||||||
BPM
|
BPM
|
||||||
BROWNIAN
|
BROWNIAN
|
||||||
CG-DNA
|
CG-DNA
|
||||||
CG-SDK
|
CG-SPICA
|
||||||
CLASS2
|
CLASS2
|
||||||
COLLOID
|
COLLOID
|
||||||
COLVARS
|
COLVARS
|
||||||
@ -34,7 +35,7 @@ set(WIN_PACKAGES
|
|||||||
INTEL
|
INTEL
|
||||||
INTERLAYER
|
INTERLAYER
|
||||||
KSPACE
|
KSPACE
|
||||||
LATTE
|
LEPTON
|
||||||
MACHDYN
|
MACHDYN
|
||||||
MANIFOLD
|
MANIFOLD
|
||||||
MANYBODY
|
MANYBODY
|
||||||
@ -46,8 +47,9 @@ set(WIN_PACKAGES
|
|||||||
MISC
|
MISC
|
||||||
ML-HDNNP
|
ML-HDNNP
|
||||||
ML-IAP
|
ML-IAP
|
||||||
ML-SNAP
|
ML-POD
|
||||||
ML-RANN
|
ML-RANN
|
||||||
|
ML-SNAP
|
||||||
MOFFF
|
MOFFF
|
||||||
MOLECULE
|
MOLECULE
|
||||||
MOLFILE
|
MOLFILE
|
||||||
@ -56,6 +58,7 @@ set(WIN_PACKAGES
|
|||||||
ORIENT
|
ORIENT
|
||||||
PERI
|
PERI
|
||||||
PHONON
|
PHONON
|
||||||
|
PLUGIN
|
||||||
POEMS
|
POEMS
|
||||||
PTM
|
PTM
|
||||||
QEQ
|
QEQ
|
||||||
@ -80,7 +83,6 @@ endforeach()
|
|||||||
|
|
||||||
# these two packages require a full MPI implementation
|
# these two packages require a full MPI implementation
|
||||||
if(BUILD_MPI)
|
if(BUILD_MPI)
|
||||||
set(PKG_MPIIO ON CACHE BOOL "" FORCE)
|
|
||||||
set(PKG_LATBOLTZ ON CACHE BOOL "" FORCE)
|
set(PKG_LATBOLTZ ON CACHE BOOL "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -3,13 +3,14 @@
|
|||||||
# are removed. The resulting binary should be able to run most inputs.
|
# are removed. The resulting binary should be able to run most inputs.
|
||||||
|
|
||||||
set(ALL_PACKAGES
|
set(ALL_PACKAGES
|
||||||
|
AMOEBA
|
||||||
ASPHERE
|
ASPHERE
|
||||||
BOCS
|
BOCS
|
||||||
BODY
|
BODY
|
||||||
BPM
|
BPM
|
||||||
BROWNIAN
|
BROWNIAN
|
||||||
CG-DNA
|
CG-DNA
|
||||||
CG-SDK
|
CG-SPICA
|
||||||
CLASS2
|
CLASS2
|
||||||
COLLOID
|
COLLOID
|
||||||
COLVARS
|
COLVARS
|
||||||
@ -23,8 +24,8 @@ set(ALL_PACKAGES
|
|||||||
DPD-REACT
|
DPD-REACT
|
||||||
DPD-SMOOTH
|
DPD-SMOOTH
|
||||||
DRUDE
|
DRUDE
|
||||||
ELECTRODE
|
|
||||||
EFF
|
EFF
|
||||||
|
ELECTRODE
|
||||||
EXTRA-COMPUTE
|
EXTRA-COMPUTE
|
||||||
EXTRA-DUMP
|
EXTRA-DUMP
|
||||||
EXTRA-FIX
|
EXTRA-FIX
|
||||||
@ -34,12 +35,15 @@ set(ALL_PACKAGES
|
|||||||
GRANULAR
|
GRANULAR
|
||||||
INTERLAYER
|
INTERLAYER
|
||||||
KSPACE
|
KSPACE
|
||||||
|
LEPTON
|
||||||
MACHDYN
|
MACHDYN
|
||||||
MANYBODY
|
MANYBODY
|
||||||
MC
|
MC
|
||||||
MEAM
|
MEAM
|
||||||
|
MESONT
|
||||||
MISC
|
MISC
|
||||||
ML-IAP
|
ML-IAP
|
||||||
|
ML-POD
|
||||||
ML-SNAP
|
ML-SNAP
|
||||||
MOFFF
|
MOFFF
|
||||||
MOLECULE
|
MOLECULE
|
||||||
|
|||||||
@ -12,16 +12,13 @@ set(PACKAGES_WITH_LIB
|
|||||||
KIM
|
KIM
|
||||||
KOKKOS
|
KOKKOS
|
||||||
LATBOLTZ
|
LATBOLTZ
|
||||||
LATTE
|
LEPTON
|
||||||
MACHDYN
|
MACHDYN
|
||||||
MDI
|
MDI
|
||||||
MESONT
|
|
||||||
ML-HDNNP
|
ML-HDNNP
|
||||||
ML-PACE
|
ML-PACE
|
||||||
ML-QUIP
|
ML-QUIP
|
||||||
MOLFILE
|
MOLFILE
|
||||||
MPIIO
|
|
||||||
MSCG
|
|
||||||
NETCDF
|
NETCDF
|
||||||
PLUMED
|
PLUMED
|
||||||
PYTHON
|
PYTHON
|
||||||
|
|||||||
9
cmake/presets/nvhpc.cmake
Normal file
9
cmake/presets/nvhpc.cmake
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# preset that will enable Nvidia HPC SDK compilers with support for MPI and OpenMP (on Linux boxes)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_COMPILER "nvc++" CACHE STRING "" FORCE)
|
||||||
|
set(CMAKE_C_COMPILER "nvc" CACHE STRING "" FORCE)
|
||||||
|
set(CMAKE_Fortran_COMPILER "nvfortran" CACHE STRING "" FORCE)
|
||||||
|
set(MPI_CXX "nvc++" CACHE STRING "" FORCE)
|
||||||
|
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||||
|
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||||
|
|
||||||
@ -18,11 +18,11 @@ set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
|||||||
|
|
||||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||||
set(OpenMP_C "icx" CACHE STRING "" FORCE)
|
set(OpenMP_C "icx" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_C_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
set(OpenMP_C_FLAGS "-qopenmp;-qopenmp-simd" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_CXX "icpx" CACHE STRING "" FORCE)
|
set(OpenMP_CXX "icpx" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_CXX_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
set(OpenMP_CXX_FLAGS "-qopenmp;-qopenmp-simd" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_Fortran_FLAGS "-qopenmp" CACHE STRING "" FORCE)
|
set(OpenMP_Fortran_FLAGS "-qopenmp;-qopenmp-simd" CACHE STRING "" FORCE)
|
||||||
set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE)
|
set(OpenMP_omp_LIBRARY "libiomp5.so" CACHE PATH "" FORCE)
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# preset that will restore gcc/g++ with support for MPI and OpenMP (on Linux boxes)
|
# preset that will set gcc/g++ with extra warnings enabled and support for MPI and OpenMP (on Linux boxes)
|
||||||
|
|
||||||
set(CMAKE_CXX_COMPILER "g++" CACHE STRING "" FORCE)
|
set(CMAKE_CXX_COMPILER "g++" CACHE STRING "" FORCE)
|
||||||
set(CMAKE_C_COMPILER "gcc" CACHE STRING "" FORCE)
|
set(CMAKE_C_COMPILER "gcc" CACHE STRING "" FORCE)
|
||||||
@ -17,10 +17,3 @@ set(MPI_Fortran "gfortran" CACHE STRING "" FORCE)
|
|||||||
set(MPI_Fortran_COMPILER "mpifort" CACHE STRING "" FORCE)
|
set(MPI_Fortran_COMPILER "mpifort" CACHE STRING "" FORCE)
|
||||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||||
|
|
||||||
set(OpenMP_C "gcc" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_C_LIB_NAMES "gomp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_CXX "g++" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_CXX_LIB_NAMES "gomp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_omp_LIBRARY "libgomp.so" CACHE PATH "" FORCE)
|
|
||||||
|
|||||||
@ -7,10 +7,3 @@ set(MPI_CXX "pgc++" CACHE STRING "" FORCE)
|
|||||||
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE)
|
||||||
unset(HAVE_OMP_H_INCLUDE CACHE)
|
unset(HAVE_OMP_H_INCLUDE CACHE)
|
||||||
|
|
||||||
set(OpenMP_C "pgcc" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_C_FLAGS "-mp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_CXX "pgc++" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_CXX_FLAGS "-mp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE)
|
|
||||||
set(OpenMP_omp_LIBRARY "libomp.so" CACHE PATH "" FORCE)
|
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
set(WIN_PACKAGES
|
set(WIN_PACKAGES
|
||||||
|
AMOEBA
|
||||||
ASPHERE
|
ASPHERE
|
||||||
|
AWPMD
|
||||||
BOCS
|
BOCS
|
||||||
BODY
|
BODY
|
||||||
BPM
|
BPM
|
||||||
BROWNIAN
|
BROWNIAN
|
||||||
CG-DNA
|
CG-DNA
|
||||||
CG-SDK
|
CG-SPICA
|
||||||
CLASS2
|
CLASS2
|
||||||
COLLOID
|
COLLOID
|
||||||
COLVARS
|
COLVARS
|
||||||
@ -19,6 +21,7 @@ set(WIN_PACKAGES
|
|||||||
DPD-SMOOTH
|
DPD-SMOOTH
|
||||||
DRUDE
|
DRUDE
|
||||||
EFF
|
EFF
|
||||||
|
ELECTRODE
|
||||||
EXTRA-COMPUTE
|
EXTRA-COMPUTE
|
||||||
EXTRA-DUMP
|
EXTRA-DUMP
|
||||||
EXTRA-FIX
|
EXTRA-FIX
|
||||||
@ -28,17 +31,22 @@ set(WIN_PACKAGES
|
|||||||
GRANULAR
|
GRANULAR
|
||||||
INTERLAYER
|
INTERLAYER
|
||||||
KSPACE
|
KSPACE
|
||||||
|
LEPTON
|
||||||
|
MACHDYN
|
||||||
MANIFOLD
|
MANIFOLD
|
||||||
MANYBODY
|
MANYBODY
|
||||||
MC
|
MC
|
||||||
MEAM
|
MEAM
|
||||||
|
MESONT
|
||||||
MISC
|
MISC
|
||||||
ML-IAP
|
ML-IAP
|
||||||
|
ML-POD
|
||||||
ML-SNAP
|
ML-SNAP
|
||||||
MOFFF
|
MOFFF
|
||||||
MOLECULE
|
MOLECULE
|
||||||
MOLFILE
|
MOLFILE
|
||||||
OPENMP
|
OPENMP
|
||||||
|
OPT
|
||||||
ORIENT
|
ORIENT
|
||||||
PERI
|
PERI
|
||||||
PHONON
|
PHONON
|
||||||
|
|||||||
76
doc/Makefile
76
doc/Makefile
@ -13,7 +13,7 @@ VENV = $(BUILDDIR)/docenv
|
|||||||
ANCHORCHECK = $(VENV)/bin/rst_anchor_check
|
ANCHORCHECK = $(VENV)/bin/rst_anchor_check
|
||||||
SPHINXCONFIG = $(BUILDDIR)/utils/sphinx-config
|
SPHINXCONFIG = $(BUILDDIR)/utils/sphinx-config
|
||||||
MATHJAX = $(SPHINXCONFIG)/_static/mathjax
|
MATHJAX = $(SPHINXCONFIG)/_static/mathjax
|
||||||
MATHJAXTAG = 3.2.1
|
MATHJAXTAG = 3.2.2
|
||||||
|
|
||||||
PYTHON = $(word 3,$(shell type python3))
|
PYTHON = $(word 3,$(shell type python3))
|
||||||
DOXYGEN = $(word 3,$(shell type doxygen))
|
DOXYGEN = $(word 3,$(shell type doxygen))
|
||||||
@ -38,16 +38,14 @@ endif
|
|||||||
# override settings for PIP commands
|
# override settings for PIP commands
|
||||||
# PIP_OPTIONS = --cert /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt --proxy http://proxy.mydomain.org
|
# PIP_OPTIONS = --cert /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt --proxy http://proxy.mydomain.org
|
||||||
|
|
||||||
#SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocessing.cpu_count())') $(shell test -f $(BUILDDIR)/doxygen/xml/run.stamp && printf -- "-E")
|
|
||||||
|
|
||||||
# temporarily disable caching so that the hack for the sphinx-tabs extensions to get proper non-html output works
|
# temporarily disable caching so that the hack for the sphinx-tabs extensions to get proper non-html output works
|
||||||
SPHINXEXTRA = -E -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocessing.cpu_count())')
|
SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocessing.cpu_count())')
|
||||||
|
|
||||||
# grab list of sources from doxygen config file.
|
# grab list of sources from doxygen config file.
|
||||||
# we only want to use explicitly listed files.
|
# we only want to use explicitly listed files.
|
||||||
DOXYFILES = $(shell sed -n -e 's/\#.*$$//' -e '/^ *INPUT \+=/,/^[A-Z_]\+ \+=/p' doxygen/Doxyfile.in | sed -e 's/@LAMMPS_SOURCE_DIR@/..\/src/g' -e 's/\\//g' -e 's/ \+/ /' -e 's/[A-Z_]\+ \+= *\(YES\|NO\|\)//')
|
DOXYFILES = $(shell sed -n -e 's/\#.*$$//' -e '/^ *INPUT \+=/,/^[A-Z_]\+ \+=/p' doxygen/Doxyfile.in | sed -e 's/@LAMMPS_SOURCE_DIR@/..\/src/g' -e 's/\\//g' -e 's/ \+/ /' -e 's/[A-Z_]\+ \+= *\(YES\|NO\|\)//')
|
||||||
|
|
||||||
.PHONY: help clean-all clean clean-spelling epub mobi rst html pdf spelling anchor_check style_check char_check xmlgen fasthtml
|
.PHONY: help clean-all clean clean-spelling epub mobi html pdf spelling anchor_check style_check char_check role_check xmlgen fasthtml
|
||||||
|
|
||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
|
|
||||||
@ -65,6 +63,7 @@ help:
|
|||||||
@echo " anchor_check scan for duplicate anchor labels"
|
@echo " anchor_check scan for duplicate anchor labels"
|
||||||
@echo " style_check check for complete and consistent style lists"
|
@echo " style_check check for complete and consistent style lists"
|
||||||
@echo " package_check check for complete and consistent package lists"
|
@echo " package_check check for complete and consistent package lists"
|
||||||
|
@echo " role_check check for misformatted role keywords"
|
||||||
@echo " spelling spell-check the manual"
|
@echo " spelling spell-check the manual"
|
||||||
|
|
||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
@ -88,15 +87,20 @@ html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
|
|||||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||||
@$(MAKE) $(MFLAGS) -C graphviz all
|
@$(MAKE) $(MFLAGS) -C graphviz all
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \
|
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
sphinx-build -E $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\
|
||||||
|
touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\
|
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\
|
||||||
ln -sf Manual.html html/index.html;\
|
ln -sf Manual.html html/index.html;\
|
||||||
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
||||||
echo "############################################" ;\
|
echo "############################################" ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
rst_anchor_check src/*.rst ;\
|
rst_anchor_check src/*.rst ;\
|
||||||
python $(BUILDDIR)/utils/check-packages.py -s ../src -d src ;\
|
$(PYTHON) $(BUILDDIR)/utils/check-packages.py -s ../src -d src ;\
|
||||||
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
|
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
|
||||||
python $(BUILDDIR)/utils/check-styles.py -s ../src -d src ;\
|
env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst ;\
|
||||||
|
env LC_ALL=C grep -n ' `[^`]\+<[a-z][^`]\+`[^_]' $(RSTDIR)/*.rst ;\
|
||||||
|
env LC_ALL=C grep -n ':\(ref\|doc\):[^`]' $(RSTDIR)/*.rst ;\
|
||||||
|
$(PYTHON) $(BUILDDIR)/utils/check-styles.py -s ../src -d src ;\
|
||||||
echo "############################################" ;\
|
echo "############################################" ;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
)
|
)
|
||||||
@ -113,8 +117,10 @@ fasthtml: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
|
|||||||
@$(MAKE) $(MFLAGS) -C graphviz all
|
@$(MAKE) $(MFLAGS) -C graphviz all
|
||||||
@mkdir -p fasthtml
|
@mkdir -p fasthtml
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \
|
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
sphinx-build -j 4 -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\
|
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\
|
||||||
|
touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
sphinx-build $(SPHINXEXTRA) -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
)
|
)
|
||||||
@rm -rf fasthtml/_sources
|
@rm -rf fasthtml/_sources
|
||||||
@ -128,8 +134,8 @@ fasthtml: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
|
|||||||
spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt
|
spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt
|
||||||
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \
|
. $(VENV)/bin/activate ; \
|
||||||
cp $(SPHINXCONFIG)/false_positives.txt $(RSTDIR)/ ; env PYTHONWARNINGS= \
|
cp $(SPHINXCONFIG)/false_positives.txt $(RSTDIR)/; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
sphinx-build -b spelling -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) spelling ;\
|
sphinx-build -b spelling -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) spelling ;\
|
||||||
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
@ -143,7 +149,9 @@ epub: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
|||||||
@rm -f LAMMPS.epub
|
@rm -f LAMMPS.epub
|
||||||
@cp src/JPG/*.* epub/JPG
|
@cp src/JPG/*.* epub/JPG
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ;\
|
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
sphinx-build -E $(SPHINXEXTRA) -b epub -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
|
||||||
|
touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
sphinx-build $(SPHINXEXTRA) -b epub -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
|
sphinx-build $(SPHINXEXTRA) -b epub -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
|
||||||
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
@ -162,14 +170,19 @@ pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
|||||||
@$(MAKE) $(MFLAGS) -C graphviz all
|
@$(MAKE) $(MFLAGS) -C graphviz all
|
||||||
@if [ "$(HAS_PDFLATEX)" == "NO" ] ; then echo "PDFLaTeX or latexmk were not found! Please check README for further instructions" 1>&2; exit 1; fi
|
@if [ "$(HAS_PDFLATEX)" == "NO" ] ; then echo "PDFLaTeX or latexmk were not found! Please check README for further instructions" 1>&2; exit 1; fi
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \
|
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
sphinx-build -E $(SPHINXEXTRA) -b latex -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\
|
||||||
|
touch $(RSTDIR)/Fortran.rst ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
sphinx-build $(SPHINXEXTRA) -b latex -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\
|
sphinx-build $(SPHINXEXTRA) -b latex -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\
|
||||||
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
rm -f $(BUILDDIR)/doxygen/xml/run.stamp;\
|
||||||
echo "############################################" ;\
|
echo "############################################" ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
rst_anchor_check src/*.rst ;\
|
rst_anchor_check src/*.rst ;\
|
||||||
python utils/check-packages.py -s ../src -d src ;\
|
$(PYTHON) utils/check-packages.py -s ../src -d src ;\
|
||||||
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
|
env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst ;\
|
||||||
python utils/check-styles.py -s ../src -d src ;\
|
env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst ;\
|
||||||
|
env LC_ALL=C grep -n ' `[^`]\+<[a-z][^`]\+`[^_]' $(RSTDIR)/*.rst ;\
|
||||||
|
env LC_ALL=C grep -n ':\(ref\|doc\):[^`]' $(RSTDIR)/*.rst ;\
|
||||||
|
$(PYTHON) utils/check-styles.py -s ../src -d src ;\
|
||||||
echo "############################################" ;\
|
echo "############################################" ;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
)
|
)
|
||||||
@ -192,28 +205,40 @@ pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK)
|
|||||||
|
|
||||||
anchor_check : $(ANCHORCHECK)
|
anchor_check : $(ANCHORCHECK)
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ;\
|
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
rst_anchor_check src/*.rst ;\
|
rst_anchor_check src/*.rst ;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
)
|
)
|
||||||
|
|
||||||
style_check : $(VENV)
|
style_check : $(VENV)
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ;\
|
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
python utils/check-styles.py -s ../src -d src ;\
|
$(PYTHON) utils/check-styles.py -s ../src -d src ;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
)
|
)
|
||||||
|
|
||||||
package_check : $(VENV)
|
package_check : $(VENV)
|
||||||
@(\
|
@(\
|
||||||
. $(VENV)/bin/activate ;\
|
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
python utils/check-packages.py -s ../src -d src ;\
|
$(PYTHON) utils/check-packages.py -s ../src -d src ;\
|
||||||
deactivate ;\
|
deactivate ;\
|
||||||
)
|
)
|
||||||
|
|
||||||
char_check :
|
char_check :
|
||||||
@( env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst && exit 1 || : )
|
@( env LC_ALL=C grep -n '[^ -~]' $(RSTDIR)/*.rst && exit 1 || : )
|
||||||
|
|
||||||
|
role_check :
|
||||||
|
@( env LC_ALL=C grep -n ' :[a-z]\+`' $(RSTDIR)/*.rst && exit 1 || : )
|
||||||
|
@( env LC_ALL=C grep -n ' `[^`]\+<[a-z][^`]\+`[^_]' $(RSTDIR)/*.rst && exit 1 || : )
|
||||||
|
@( env LC_ALL=C grep -n ':\(ref\|doc\):[^`]' $(RSTDIR)/*.rst && exit 1 || : )
|
||||||
|
|
||||||
|
link_check : $(VENV) html
|
||||||
|
@(\
|
||||||
|
. $(VENV)/bin/activate ; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
linkchecker -F html --check-extern html/Manual.html ;\
|
||||||
|
deactivate ;\
|
||||||
|
)
|
||||||
|
|
||||||
xmlgen : doxygen/xml/index.xml
|
xmlgen : doxygen/xml/index.xml
|
||||||
|
|
||||||
doxygen/Doxyfile: doxygen/Doxyfile.in
|
doxygen/Doxyfile: doxygen/Doxyfile.in
|
||||||
@ -241,8 +266,7 @@ $(MATHJAX):
|
|||||||
|
|
||||||
$(ANCHORCHECK): $(VENV)
|
$(ANCHORCHECK): $(VENV)
|
||||||
@( \
|
@( \
|
||||||
. $(VENV)/bin/activate; \
|
. $(VENV)/bin/activate; env PYTHONWARNINGS= PYTHONDONTWRITEBYTECODE=1 \
|
||||||
(cd utils/converters;\
|
pip $(PIP_OPTIONS) install -e utils/converters;\
|
||||||
python setup.py develop);\
|
|
||||||
deactivate;\
|
deactivate;\
|
||||||
)
|
)
|
||||||
|
|||||||
@ -40,8 +40,9 @@ environment and local folders.
|
|||||||
Installing prerequisites for the documentation build
|
Installing prerequisites for the documentation build
|
||||||
|
|
||||||
To run the HTML documention build toolchain, python 3.x, doxygen, git,
|
To run the HTML documention build toolchain, python 3.x, doxygen, git,
|
||||||
and virtualenv have to be installed. Also internet access is initially
|
and the venv python module have to be installed if not already available.
|
||||||
required to download external files and tools.
|
Also internet access is initially required to download external files
|
||||||
|
and tools.
|
||||||
|
|
||||||
Building the PDF format manual requires in addition a compatible LaTeX
|
Building the PDF format manual requires in addition a compatible LaTeX
|
||||||
installation with support for PDFLaTeX and several add-on LaTeX packages
|
installation with support for PDFLaTeX and several add-on LaTeX packages
|
||||||
|
|||||||
@ -4,45 +4,44 @@ This purpose of this document is to provide a point of reference
|
|||||||
for LAMMPS developers and contributors as to what conventions
|
for LAMMPS developers and contributors as to what conventions
|
||||||
should be used to structure and format files in the LAMMPS manual.
|
should be used to structure and format files in the LAMMPS manual.
|
||||||
|
|
||||||
Last change: 2020-04-23
|
Last change: 2022-12-30
|
||||||
|
|
||||||
## File format and tools
|
## File format and tools
|
||||||
|
|
||||||
In fall 2019, the LAMMPS documentation file format has changed from
|
In fall 2019, the LAMMPS documentation file format has changed from a
|
||||||
a home grown minimal markup designed to generate HTML format files
|
home grown markup designed to generate HTML format files only, to
|
||||||
from a mostly plain text format to using the reStructuredText file
|
[reStructuredText](https://docutils.sourceforge.io/rst.html>. For a
|
||||||
format. For a transition period all files in the old .txt format
|
transition period all files in the old .txt format were transparently
|
||||||
were transparently converted to .rst and then processed. The txt2rst
|
converted to .rst and then processed. The `txt2rst tool` is still
|
||||||
tool is still included in the distribution to obtain an initial .rst
|
included in the distribution to obtain an initial .rst file for legacy
|
||||||
file for integration into the manual. Since the transition to
|
integration into the manual. Since that transition to reStructured
|
||||||
reStructured text as source format, many of the artifacts or the
|
text, many of the artifacts of the translation have been removed though,
|
||||||
translation have been removed though and parts of the documentation
|
and parts of the documentation refactored and expanded to take advantage
|
||||||
refactored and expanded to take advantage of the capabilities
|
of the capabilities reStructuredText and associated tools. The
|
||||||
reStructuredText and associated tools. The conversion from the
|
conversion from the source to the final formats (HTML, PDF, and
|
||||||
source to the final formats (HTML, PDF, and optionally e-book
|
optionally e-book reader formats ePUB and MOBI) is mostly automated and
|
||||||
reader formats ePUB and MOBI) is mostly automated and controlled
|
controlled by a Makefile in the `doc` folder. This makefile assumes that
|
||||||
by a Makefile in the `doc` folder. This makefile assumes that the
|
the processing is done on a Unix-like machine and Python 3.5 or later
|
||||||
processing is done on a Unix-like machine and Python 3.5 or later
|
and a matching venv module are available. Additional Python
|
||||||
and a matching virtualenv module are available. Additional Python
|
packages (like the Sphinx tool and several extensions) are transparently
|
||||||
packages (like the Sphinx tool and several extensions) are
|
installed into a virtual environment over the internet using the `pip`
|
||||||
transparently installed into a virtual environment over the
|
package manager. Further requirements and details are discussed in the
|
||||||
internet using the `pip` package manager. Further requirements
|
manual.
|
||||||
and details are discussed in the manual.
|
|
||||||
|
|
||||||
## Work in progress
|
## Work in progress
|
||||||
|
|
||||||
The refactoring and improving of the documentation is an ongoing
|
The refactoring and improving of the documentation is an ongoing
|
||||||
process, so statements in this document may not always be fully
|
process, so statements in this document may not always be fully
|
||||||
up-to-date. If in doubt, contact the LAMMPS developers.
|
up-to-date. When in doubt, contact the LAMMPS developers.
|
||||||
|
|
||||||
## General structure
|
## General structure
|
||||||
|
|
||||||
The layout and formatting of added files should follow the example
|
The layout and formatting of added files should follow the example of
|
||||||
of the existing files. Since those are directly derived from their
|
the existing files. Since many of those were initially derived from
|
||||||
former .txt format versions and the manual has been maintained in
|
their former .txt format versions and the manual has been maintained in
|
||||||
that format for many years, there is a large degree of consistency
|
that format for many years, there is a large degree of consistency
|
||||||
already, so comparison with similar files should give you a good
|
already, so comparison with similar files should give you a good idea
|
||||||
idea what kind of information and sections are needed.
|
what kind of information and sections are needed.
|
||||||
|
|
||||||
## Formatting conventions
|
## Formatting conventions
|
||||||
|
|
||||||
@ -59,14 +58,20 @@ double backward quotes bracketing the item: \`\`path/to/some/file\`\`
|
|||||||
Keywords and options are formatted in italics: \*option\*
|
Keywords and options are formatted in italics: \*option\*
|
||||||
|
|
||||||
Mathematical expressions, equations, symbols are typeset using
|
Mathematical expressions, equations, symbols are typeset using
|
||||||
either a `.. math:`` block or the `:math:` role.
|
either a `.. math:` block or the `:math:` role.
|
||||||
|
|
||||||
Groups of shell commands or LAMMPS input script or C/C++ source
|
Groups of shell commands or LAMMPS input script or C/C++/Python source
|
||||||
code should be typeset into a `.. code-block::` section. A syntax
|
code should be typeset into a `.. code-block::` section. A syntax
|
||||||
highlighting extension for LAMMPS input scripts is provided, so
|
highlighting extension for LAMMPS input scripts is provided, so `LAMMPS`
|
||||||
`LAMMPS` can be used to indicate the language in the code block
|
can be used to indicate the language in the code block in addition to
|
||||||
in addition to `bash`, `c`, or `python`. When no syntax style
|
`bash`, `c`, `c++`, `console`, `csh`, `diff', `fortran`, `json`, `make`,
|
||||||
is indicated, no syntax highlighting is performed.
|
`perl`, `powershell`, `python`, `sh`, or `tcl`, `text`, or `yaml`. When
|
||||||
|
no syntax style is indicated, no syntax highlighting is performed. When
|
||||||
|
typesetting commands executed on the shell, please do not prefix
|
||||||
|
commands with a shell prompt and use `bash` highlighting, except when
|
||||||
|
the block also shows the output from that command. In the latter case,
|
||||||
|
please use a dollar sign as the shell prompt and `console` for syntax
|
||||||
|
highlighting.
|
||||||
|
|
||||||
As an alternative, e.g. to typeset the syntax of file formats
|
As an alternative, e.g. to typeset the syntax of file formats
|
||||||
a `.. parsed-literal::` block can be used, which allows some
|
a `.. parsed-literal::` block can be used, which allows some
|
||||||
@ -89,22 +94,30 @@ by ` :class: note`.
|
|||||||
|
|
||||||
## Required steps when adding a custom style to LAMMPS
|
## Required steps when adding a custom style to LAMMPS
|
||||||
|
|
||||||
When adding a new style (e.g. pair style or a compute or a fix)
|
When adding a new style (e.g. pair style or a compute or a fix) or a new
|
||||||
or a new command, it is **required** to include the corresponding
|
command, it is **required** to include the **corresponding documentation**
|
||||||
documentation. Those are often new files that need to be added.
|
in [reStructuredText format](https://docutils.sourceforge.io/rst.html).
|
||||||
In order to be included in the documentation, those new files
|
Those are often new files that need to be added. In order to be
|
||||||
need to be reference in a `.. toctree::` block. Most of those
|
included in the documentation, those new files need to be referenced in a
|
||||||
use patterns with wildcards, so the addition will be automatic.
|
`.. toctree::` block. Most of those use patterns with wild cards, so the
|
||||||
However, those additions also need to be added to some lists of
|
addition will be automatic. However, those additions also need to be
|
||||||
styles or commands. The `make style\_check` command will perform
|
added to some lists of styles or commands. The `make style\_check`
|
||||||
a test and report any missing entries and list the affected files.
|
command when executed in the `doc` folder will perform a test and report
|
||||||
Any references defined with `.. \_refname:` have to be unique
|
any missing entries and list the affected files. Any references defined
|
||||||
across all documentation files and this can be checked for with
|
with `.. \_refname:` have to be unique across all documentation files
|
||||||
`make anchor\_check`. Finally, a spell-check should be done,
|
and this can be checked for with `make anchor\_check`. Finally, a
|
||||||
which is triggered via `make spelling`. Any offenses need to
|
spell-check should be done, which is triggered via `make spelling`. Any
|
||||||
be corrected and false positives should be added to the file
|
offenses need to be corrected and false positives should be added to the
|
||||||
`utils/sphinx-config/false\_positives.txt`.
|
file `utils/sphinx-config/false\_positives.txt`.
|
||||||
|
|
||||||
## Required additional steps when adding a new package to LAMMPS
|
## Required additional steps when adding a new package to LAMMPS
|
||||||
|
|
||||||
TODO
|
When adding a new package, the package must be added to the list of
|
||||||
|
packages in the `Packages_list.rst` file. If additional build instructions
|
||||||
|
need to be followed, a corresponding section should be added to the
|
||||||
|
`Build_extras.rst` file and linked from the list at the top of the
|
||||||
|
file as well as the equivalent list in the `Build_packages.rst` file.
|
||||||
|
|
||||||
|
A detailed description of the package and pointers to configuration,
|
||||||
|
included commands and examples, external pages, author information and
|
||||||
|
more should be added to the `Packages_details.rst` file.
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
# Outline of the GitHub Development Workflow
|
# Outline of the GitHub Development Workflow
|
||||||
|
|
||||||
This purpose of this document is to provide a point of reference for the
|
The purpose of this document is to provide a point of reference for the
|
||||||
core LAMMPS developers and other LAMMPS contributors to understand the
|
core LAMMPS developers and other LAMMPS contributors to understand the
|
||||||
choices the LAMMPS developers have agreed on. Git and GitHub provide the
|
choices the LAMMPS developers have agreed on. Git and GitHub provide the
|
||||||
tools, but do not set policies, so it is up to the developers to come to
|
tools, but do not set policies, so it is up to the developers to come to
|
||||||
an agreement as to how to define and interpret policies. This document
|
an agreement as to how to define and interpret policies. This document
|
||||||
is likely to change as our experiences and needs change and we try to
|
is likely to change as our experiences and needs change, and we try to
|
||||||
adapt accordingly. Last change 2021-09-02.
|
adapt it accordingly. Last change 2023-02-10.
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
@ -22,47 +22,50 @@ adapt accordingly. Last change 2021-09-02.
|
|||||||
## GitHub Merge Management
|
## GitHub Merge Management
|
||||||
|
|
||||||
In the interest of consistency, ONLY ONE of the core LAMMPS developers
|
In the interest of consistency, ONLY ONE of the core LAMMPS developers
|
||||||
should doing the merging itself. This is currently
|
should do the merging. This is currently
|
||||||
[@akohlmey](https://github.com/akohlmey) (Axel Kohlmeyer). If this
|
[@akohlmey](https://github.com/akohlmey) (Axel Kohlmeyer). If this
|
||||||
assignment needs to be changed, it shall be done right after a stable
|
assignment needs to be changed, it shall be done right after a stable
|
||||||
release. If the currently assigned developer cannot merge outstanding
|
release. If the currently assigned developer cannot merge outstanding
|
||||||
pull requests in a timely manner, or in other extenuating circumstances,
|
pull requests in a timely manner, or in other extenuating circumstances,
|
||||||
other core LAMMPS developers with merge rights can merge pull requests,
|
other core LAMMPS developers with merge permission may merge pull
|
||||||
when necessary.
|
requests.
|
||||||
|
|
||||||
## Pull Requests
|
## Pull Requests
|
||||||
|
|
||||||
ALL changes to the LAMMPS code and documentation, however trivial, MUST
|
*ALL* changes to the LAMMPS code and documentation, however trivial,
|
||||||
be submitted as a pull request to GitHub. All changes to the "develop"
|
MUST be submitted as a pull request to GitHub. All changes to the
|
||||||
branch must be made exclusively through merging pull requests. The
|
"develop" branch must be made exclusively through merging pull requests.
|
||||||
"release" and "stable" branches, respectively are only to be updated
|
The "release" and "stable" branches, respectively, are only to be
|
||||||
upon patch or stable releases with fast-forward merges based on the
|
updated upon "feature releases" or "stable releases" based on the
|
||||||
associated tags. Pull requests may also be submitted to (long-running)
|
associated tags. Updates to the stable release in between stable releases
|
||||||
feature branches created by LAMMPS developers inside the LAMMPS project,
|
(for example, back-ported bug fixes) are first merged into the "maintenance"
|
||||||
if needed. Those are not subject to the merge and review restrictions
|
branch and then into the "stable" branch as "stable update releases".
|
||||||
discussed in this document, though, but get managed as needed on a
|
|
||||||
case-by-case basis.
|
Pull requests may also be submitted to (long-running) feature branches
|
||||||
|
created by LAMMPS developers inside the LAMMPS project, if needed. Those
|
||||||
|
are not subject to the merge and review restrictions discussed in this
|
||||||
|
document, though, but get managed as needed on a case-by-case basis.
|
||||||
|
|
||||||
### Pull Request Assignments
|
### Pull Request Assignments
|
||||||
|
|
||||||
Pull requests can be "chaperoned" by one of the LAMMPS core developers.
|
Pull requests can be "chaperoned" by one of the LAMMPS core developers.
|
||||||
This is indicated by who the pull request is assigned to. LAMMPS core
|
This is indicated by whom the pull request is assigned to. LAMMPS core
|
||||||
developers can self-assign or they can decide to assign a pull request
|
developers can self-assign, or they can decide to assign a pull request
|
||||||
to a different LAMMPS developer. Being assigned to a pull request means,
|
to a different LAMMPS developer. Being assigned to a pull request means,
|
||||||
that this pull request may need some work and the assignee is tasked to
|
that this pull request may need some work and the assignee is tasked to
|
||||||
determine whether this might be needed or not, and may either implement
|
determine whether this might be needed or not. The assignee may either
|
||||||
the required changes or ask the submitter of the pull request to implement
|
choose to implement required changes or ask the submitter of the pull
|
||||||
them. Even though, all LAMMPS developers may have write access to pull
|
request to implement them. Even though, all LAMMPS developers may have
|
||||||
requests (if enabled by the submitter, which is the default), only the
|
write access to pull requests (if enabled by the submitter, which is the
|
||||||
submitter or the assignee of a pull request may do so. During this
|
default), only the submitter or the assignee of a pull request should do
|
||||||
period the `work_in_progress` label may be applied to the pull
|
so. During this period, the `work_in_progress` label may be applied to
|
||||||
request. The assignee gets to decide what happens to the pull request
|
the pull request. The assignee gets to decide what happens to the pull
|
||||||
next, e.g. whether it should be assigned to a different developer for
|
request next, e.g. whether it should be assigned to a different
|
||||||
additional checks and changes, or is recommended to be merged. Removing
|
developer for additional checks and changes, or is recommended to be
|
||||||
the `work_in_progress` label and assigning the pull request to the
|
merged. Removing the `work_in_progress` label and assigning the pull
|
||||||
developer tasked with merging signals that a pull request is ready to be
|
request to the developer tasked with merging signals that a pull request
|
||||||
merged. In addition, a `ready_for_merge` label may also be assigned
|
is ready to be merged. In addition, a `ready_for_merge` label may also
|
||||||
to signal urgency to merge this pull request quickly.
|
be assigned to signal urgency to merge this pull request quickly.
|
||||||
|
|
||||||
### Pull Request Reviews
|
### Pull Request Reviews
|
||||||
|
|
||||||
@ -70,32 +73,33 @@ People can be assigned to review a pull request in two ways:
|
|||||||
|
|
||||||
* They can be assigned manually to review a pull request
|
* They can be assigned manually to review a pull request
|
||||||
by the submitter or a LAMMPS developer
|
by the submitter or a LAMMPS developer
|
||||||
* They can be automatically assigned, because a developers matches
|
* They can be automatically assigned, because a developer's GitHub
|
||||||
a file pattern in the `.github/CODEOWNERS` file, which associates
|
handle matches a file pattern in the `.github/CODEOWNERS` file,
|
||||||
developers with the code they contributed and maintain.
|
which associates developers with the code they contributed and
|
||||||
|
maintain.
|
||||||
|
|
||||||
Reviewers are requested to state their appraisal of the proposed changes
|
Reviewers are requested to state their appraisal of the proposed changes
|
||||||
and either approve or request changes. People may unassign themselves
|
and either approve or request changes. People may unassign themselves
|
||||||
from review, if they feel not competent about the changes proposed. At
|
from review, if they feel not competent about the changes proposed. At
|
||||||
least two approvals from LAMMPS developers with write access are required
|
least two approvals from LAMMPS developers with write access are
|
||||||
before merging in addition to the automated compilation tests.
|
required before merging, in addition to passing all automated
|
||||||
Merging counts as implicit approval, so does submission of a pull request
|
compilation and unit tests. Merging counts as implicit approval, so
|
||||||
(by a LAMMPS developer). So the person doing the merge may not also submit
|
does submission of a pull request (by a LAMMPS developer). So the person
|
||||||
an approving review. The feature, that reviews from code owners are "hard"
|
doing the merge may not also submit an approving review. The GitHub
|
||||||
reviews (i.e. they must all be approved before merging is allowed), is
|
feature, that reviews from code owners are "hard" reviews (i.e. they
|
||||||
currently disabled and it is in the discretion of the merge maintainer to
|
must all approve before merging is allowed), is currently disabled.
|
||||||
assess when a sufficient degree of approval, especially from external
|
It is in the discretion of the merge maintainer to assess when a
|
||||||
contributors, has been reached in these cases. Reviews may be
|
sufficient degree of approval has been reached, especially from external
|
||||||
(automatically) dismissed, when the reviewed code has been changed,
|
collaborators. Reviews may be (automatically) dismissed, when the
|
||||||
and then approval is required a second time.
|
reviewed code has been changed. Review may be requested a second time.
|
||||||
|
|
||||||
### Pull Request Discussions
|
### Pull Request Discussions
|
||||||
|
|
||||||
All discussions about a pull request should be kept as much as possible
|
All discussions about a pull request should be kept as much as possible
|
||||||
on the pull request discussion page on GitHub, so that other developers
|
on the pull request discussion page on GitHub, so that other developers
|
||||||
can later review the entire discussion after the fact and understand the
|
can later review the entire discussion after the fact and understand the
|
||||||
rationale behind choices made. Exceptions to this policy are technical
|
rationale behind choices that were made. Exceptions to this policy are
|
||||||
discussions, that are centered on tools or policies themselves
|
technical discussions, that are centered on tools or policies themselves
|
||||||
(git, GitHub, c++) rather than on the content of the pull request.
|
(git, GitHub, c++) rather than on the content of the pull request.
|
||||||
|
|
||||||
## GitHub Issues
|
## GitHub Issues
|
||||||
@ -109,39 +113,47 @@ marker in the subject. This is automatically done when using the
|
|||||||
corresponding template for submitting an issue. Issues may be assigned
|
corresponding template for submitting an issue. Issues may be assigned
|
||||||
to one or more developers, if they are working on this feature or
|
to one or more developers, if they are working on this feature or
|
||||||
working to resolve an issue. Issues that have nobody working
|
working to resolve an issue. Issues that have nobody working
|
||||||
on them at the moment or in the near future, have the label
|
on them at the moment, or in the near future, have the label
|
||||||
`volunteer needed` attached.
|
`volunteer needed` attached.
|
||||||
|
|
||||||
When an issue, say `#125` is resolved by a specific pull request,
|
When an issue, say `#125` is resolved by a specific pull request, the
|
||||||
the comment for the pull request shall contain the text `closes #125`
|
comment for the pull request shall contain the text `closes #125` or
|
||||||
or `fixes #125`, so that the issue is automatically deleted when
|
`fixes #125`, so that the issue is automatically deleted when the pull
|
||||||
the pull request is merged. The template for pull requests includes
|
request is merged. The template for pull requests includes a header
|
||||||
a header where connections between pull requests and issues can be listed
|
where connections between pull requests and issues can be listed, and
|
||||||
and thus were this comment should be placed.
|
thus where this comment should be placed.
|
||||||
|
|
||||||
## Milestones and Release Planning
|
## Release Planning
|
||||||
|
|
||||||
LAMMPS uses a continuous release development model with incremental
|
LAMMPS uses a continuous release development model with incremental
|
||||||
changes, i.e. significant effort is made - including automated pre-merge
|
changes, i.e. significant effort is made -- including automated pre-merge
|
||||||
testing - that the code in the branch "develop" does not get easily
|
testing -- that the code in the branch "develop" does not get easily
|
||||||
broken. These tests are run after every update to a pull request. More
|
broken. These tests are run after every update to a pull request. More
|
||||||
extensive and time consuming tests (including regression testing) are
|
extensive and time-consuming tests (including regression testing) are
|
||||||
performed after code is merged to the "develop" branch. There are patch
|
performed after code is merged to the "develop" branch. There are feature
|
||||||
releases of LAMMPS every 3-5 weeks at a point, when the LAMMPS
|
releases of LAMMPS made about every 4-8 weeks at a point, when the LAMMPS
|
||||||
developers feel, that a sufficient amount of changes have happened, and
|
developers feel, that a sufficient number of changes have been included
|
||||||
the post-merge testing has been successful. These patch releases are
|
and all post-merge testing has been successful. These feature releases are
|
||||||
marked with a `patch_<version date>` tag and the "release" branch
|
marked with a `patch_<version date>` tag and the "release" branch
|
||||||
follows only these versions (and thus is always supposed to be of
|
follows only these versions with fast-forward merges. While "develop" may
|
||||||
production quality, unlike "develop", which may be temporary broken, in
|
be temporarily broken through issues only detected by the post-merge tests,
|
||||||
the case of larger change sets or unexpected incompatibilities or side
|
The "release" branch is always supposed to be of production quality.
|
||||||
effects.
|
|
||||||
|
|
||||||
About 1-2 times each year, there are going to be "stable" releases of
|
About once each year, there is a "stable" release of LAMMPS. These have
|
||||||
LAMMPS. These have seen additional, manual testing and review of
|
seen additional, manual testing and review of results from testing with
|
||||||
results from testing with instrumented code and static code analysis.
|
instrumented code and static code analysis. Also, the last few feature
|
||||||
Also, the last 1-3 patch releases before a stable release are "release
|
releases before a stable release are "release candidate" versions which
|
||||||
candidate" versions which only contain bugfixes and documentation
|
only contain bug fixes, feature additions to peripheral functionality,
|
||||||
updates. For release planning and the information of code contributors,
|
and documentation updates. In between stable releases, bug fixes and
|
||||||
issues and pull requests being actively worked on are assigned a
|
infrastructure updates are back-ported from the "develop" branch to the
|
||||||
"milestone", which corresponds to the next stable release or the stable
|
"maintenance" branch and occasionally merged into "stable" and published
|
||||||
release after that, with a tentative release date.
|
as update releases.
|
||||||
|
|
||||||
|
## Project Management
|
||||||
|
|
||||||
|
For release planning and the information of code contributors, issues
|
||||||
|
and pull requests are being managed with GitHub Project Boards. There
|
||||||
|
are currently three boards: LAMMPS Feature Requests, LAMMPS Bug Reports,
|
||||||
|
and LAMMPS Pull Requests. Each board is organized in columns where
|
||||||
|
submissions are categorized. Within each column the entries are
|
||||||
|
(manually) sorted according their priority.
|
||||||
|
|||||||
@ -16,8 +16,11 @@ clean:
|
|||||||
rm -f $(IMGSVG) $(IMGPDF) $(IMGPNG) *~
|
rm -f $(IMGSVG) $(IMGPDF) $(IMGPNG) *~
|
||||||
|
|
||||||
ifeq ($(HAS_DOT),YES)
|
ifeq ($(HAS_DOT),YES)
|
||||||
$(IMGDIR)/%.png: %.dot
|
$(IMGDIR)/lammps-classes.png : lammps-classes.dot
|
||||||
dot -Tpng -Kneato -o $@ $<
|
dot -Tpng -Kneato -o $@ $<
|
||||||
|
|
||||||
|
$(IMGDIR)/%.png: %.dot
|
||||||
|
dot -Tpng -Kdot -o $@ $<
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(HAS_DOT),NO)
|
ifeq ($(HAS_DOT),NO)
|
||||||
|
|||||||
34
doc/graphviz/lammps-releases.dot
Normal file
34
doc/graphviz/lammps-releases.dot
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// LAMMPS branches and releases
|
||||||
|
digraph releases {
|
||||||
|
rankdir="LR";
|
||||||
|
github [shape="box" label="Pull Requests\non GitHub" height=0.75];
|
||||||
|
github -> develop [label="Merge commits"];
|
||||||
|
{
|
||||||
|
rank = "same";
|
||||||
|
work [shape="none" label="Development branches:"]
|
||||||
|
develop [label="'develop' branch" height=0.75];
|
||||||
|
maintenance [label="'maintenance' branch" height=0.75];
|
||||||
|
};
|
||||||
|
{
|
||||||
|
rank = "same";
|
||||||
|
upload [shape="none" label="Release branches:"]
|
||||||
|
release [label="'release' branch" height=0.75];
|
||||||
|
stable [label="'stable' branch" height=0.75];
|
||||||
|
};
|
||||||
|
develop -> release [label="Feature release\n(every 4-8 weeks)"];
|
||||||
|
release -> stable [label="Stable release\n(once per year)"];
|
||||||
|
stable -> maintenance [label="Reset on stable release" style="setlinewidth(2)"];
|
||||||
|
develop -> maintenance [label="Backports of bugfixes" style="dashed"];
|
||||||
|
maintenance -> stable [label="Updates to stable release"];
|
||||||
|
{
|
||||||
|
rank = "same";
|
||||||
|
tag [shape="none" label="Applied tags:"];
|
||||||
|
patchtag [shape="box" label="patch_<date>"];
|
||||||
|
stabletag [shape="box" label="stable_<date>"];
|
||||||
|
updatetag [shape="box" label="stable_<date>_update<num>"];
|
||||||
|
};
|
||||||
|
release -> patchtag [label="feature release" style="dotted"];
|
||||||
|
stable -> stabletag [label="stable release" style="dotted"];
|
||||||
|
stable -> updatetag [label="update release" style="dotted"];
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
.TH LAMMPS "1" "2 June 2022" "2022-6-2"
|
.TH LAMMPS "1" "21 November 2023" "2023-11-21"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.B LAMMPS
|
.B LAMMPS
|
||||||
\- Molecular Dynamics Simulator. Version 2 June 2022
|
\- Molecular Dynamics Simulator. Version 21 November 2023
|
||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B lmp
|
.B lmp
|
||||||
@ -161,7 +161,7 @@ list references for specific cite-able features used during a
|
|||||||
run.
|
run.
|
||||||
.TP
|
.TP
|
||||||
\fB\-pk <style> [options]\fR or \fB\-package <style> [options]\fR
|
\fB\-pk <style> [options]\fR or \fB\-package <style> [options]\fR
|
||||||
Invoke the \fBpackage\R command with <style> and optional arguments.
|
Invoke the \fBpackage\fR command with <style> and optional arguments.
|
||||||
The syntax is the same as if the command appeared in an input script.
|
The syntax is the same as if the command appeared in an input script.
|
||||||
For example "-pk gpu 2" is the same as "package gpu 2" in the input
|
For example "-pk gpu 2" is the same as "package gpu 2" in the input
|
||||||
script. The possible styles and options are discussed in the
|
script. The possible styles and options are discussed in the
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
.TH MSI2LMP "1" "v3.9.9" "2018-11-05"
|
.TH MSI2LMP "1" "v3.9.10" "2023-03-10"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.B MSI2LMP
|
.B MSI2LMP
|
||||||
\- Converter for Materials Studio files to LAMMPS
|
\- Converter for Materials Studio files to LAMMPS
|
||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B msi2lmp
|
.B msi2lmp
|
||||||
<ROOTNAME> [-class <I|1|II|2|O|0>] [-frc <path to frc file>] [-print #] [-ignore] [-nocenter] [-oldstyle] [-shift <x> <y> <z>]
|
[-help] <ROOTNAME> [-class <I|1|II|2|O|0>] [-frc <path to frc file>] [-print #] [-ignore] [-nocenter] [-oldstyle] [-shift <x> <y> <z>]
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -22,6 +22,9 @@ needed between .frc and .car/.mdf files are the atom types.
|
|||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-h\fR, \fB\-help\fR,
|
||||||
|
Print detailed help message to the screen and stop.
|
||||||
|
.TP
|
||||||
\fB\<ROOTNAME>\fR
|
\fB\<ROOTNAME>\fR
|
||||||
This has to be the first argument and is a
|
This has to be the first argument and is a
|
||||||
.B mandatory
|
.B mandatory
|
||||||
|
|||||||
@ -63,7 +63,7 @@ In the src directory, there is one top-level Makefile and several
|
|||||||
low-level machine-specific files named Makefile.xxx where xxx = the
|
low-level machine-specific files named Makefile.xxx where xxx = the
|
||||||
machine name. If a low-level Makefile exists for your platform, you do
|
machine name. If a low-level Makefile exists for your platform, you do
|
||||||
not need to edit the top-level Makefile. However you should check the
|
not need to edit the top-level Makefile. However you should check the
|
||||||
system-specific section of the low-level Makefile to insure the
|
system-specific section of the low-level Makefile to ensure the
|
||||||
various paths are correct for your environment. If a low-level
|
various paths are correct for your environment. If a low-level
|
||||||
Makefile does not exist for your platform, you will need to add a
|
Makefile does not exist for your platform, you will need to add a
|
||||||
suitable target to the top-level Makefile. You will also need to
|
suitable target to the top-level Makefile. You will also need to
|
||||||
|
|||||||
@ -1206,7 +1206,7 @@ this command is not typically needed if the "nonbond style" and "
|
|||||||
an exception to this is if a short cutoff is used initially,
|
an exception to this is if a short cutoff is used initially,
|
||||||
but a longer cutoff will be used for a subsequent run (in the same
|
but a longer cutoff will be used for a subsequent run (in the same
|
||||||
input script), in this case the "maximum cutoff" command should be
|
input script), in this case the "maximum cutoff" command should be
|
||||||
used to insure enough memory is allocated for the later run
|
used to ensure enough memory is allocated for the later run
|
||||||
note that a restart file contains nonbond cutoffs (so it is not necessary
|
note that a restart file contains nonbond cutoffs (so it is not necessary
|
||||||
to use a "nonbond style" command before "read restart"), but LAMMPS
|
to use a "nonbond style" command before "read restart"), but LAMMPS
|
||||||
still needs to know what the maximum cutoff will be before the
|
still needs to know what the maximum cutoff will be before the
|
||||||
|
|||||||
@ -203,7 +203,7 @@ Bibliography
|
|||||||
A Caro, DA Crowson, M Caro; Phys Rev Lett, 95, 075702 (2005)
|
A Caro, DA Crowson, M Caro; Phys Rev Lett, 95, 075702 (2005)
|
||||||
|
|
||||||
**(CasP)**
|
**(CasP)**
|
||||||
CasP webpage: https://www.helmholtz-berlin.de/people/gregor-schiwietz/casp_en.html
|
CasP webpage: http://www.casp-program.org/
|
||||||
|
|
||||||
**(Cawkwell2012)**
|
**(Cawkwell2012)**
|
||||||
A.\ M. N. Niklasson, M. J. Cawkwell, Phys. Rev. B, 86 (17), 174308 (2012).
|
A.\ M. N. Niklasson, M. J. Cawkwell, Phys. Rev. B, 86 (17), 174308 (2012).
|
||||||
@ -368,7 +368,7 @@ Bibliography
|
|||||||
Frenkel and Smit, Understanding Molecular Simulation, Academic Press, London, 2002.
|
Frenkel and Smit, Understanding Molecular Simulation, Academic Press, London, 2002.
|
||||||
|
|
||||||
**(GLE4MD)**
|
**(GLE4MD)**
|
||||||
`http://gle4md.org/ <http://gle4md.org/>`_
|
`https://gle4md.org/ <https://gle4md.org/>`_
|
||||||
|
|
||||||
**(Gao)**
|
**(Gao)**
|
||||||
Gao and Weber, Nuclear Instruments and Methods in Physics Research B 191 (2012) 504.
|
Gao and Weber, Nuclear Instruments and Methods in Physics Research B 191 (2012) 504.
|
||||||
@ -407,7 +407,7 @@ Bibliography
|
|||||||
Guenole, Noehring, Vaid, Houlle, Xie, Prakash, Bitzek, Comput Mater Sci, 175, 109584 (2020).
|
Guenole, Noehring, Vaid, Houlle, Xie, Prakash, Bitzek, Comput Mater Sci, 175, 109584 (2020).
|
||||||
|
|
||||||
**(Gullet)**
|
**(Gullet)**
|
||||||
Gullet, Wagner, Slepoy, SANDIA Report 2003-8782 (2003).
|
Gullet, Wagner, Slepoy, SANDIA Report 2003-8782 (2003). DOI:10.2172/918395
|
||||||
|
|
||||||
**(Guo)**
|
**(Guo)**
|
||||||
Guo and Thirumalai, Journal of Molecular Biology, 263, 323-43 (1996).
|
Guo and Thirumalai, Journal of Molecular Biology, 263, 323-43 (1996).
|
||||||
@ -461,7 +461,7 @@ Bibliography
|
|||||||
Hunt, Mol Simul, 42, 347 (2016).
|
Hunt, Mol Simul, 42, 347 (2016).
|
||||||
|
|
||||||
**(IPI)**
|
**(IPI)**
|
||||||
`http://epfl-cosmo.github.io/gle4md/index.html?page=ipi <http://epfl-cosmo.github.io/gle4md/index.html?page=ipi>`_
|
`https://ipi-code.org/ <https://ipi-code.org/>`
|
||||||
|
|
||||||
**(IPI-CPC)**
|
**(IPI-CPC)**
|
||||||
Ceriotti, More and Manolopoulos, Comp Phys Comm, 185, 1019-1026 (2014).
|
Ceriotti, More and Manolopoulos, Comp Phys Comm, 185, 1019-1026 (2014).
|
||||||
@ -562,6 +562,9 @@ Bibliography
|
|||||||
**(Kumar)**
|
**(Kumar)**
|
||||||
Kumar and Skinner, J. Phys. Chem. B, 112, 8311 (2008)
|
Kumar and Skinner, J. Phys. Chem. B, 112, 8311 (2008)
|
||||||
|
|
||||||
|
**(Lafourcade)**
|
||||||
|
Lafourcade, Maillet, Denoual, Duval, Allera, Goryaeva, and Marinica, `Comp. Mat. Science, 230, 112534 (2023) <https://doi.org/10.1016/j.commatsci.2023.112534>`_
|
||||||
|
|
||||||
**(Lamoureux and Roux)**
|
**(Lamoureux and Roux)**
|
||||||
G.\ Lamoureux, B. Roux, J. Chem. Phys 119, 3025 (2003)
|
G.\ Lamoureux, B. Roux, J. Chem. Phys 119, 3025 (2003)
|
||||||
|
|
||||||
@ -733,8 +736,8 @@ Bibliography
|
|||||||
**(Mishin)**
|
**(Mishin)**
|
||||||
Mishin, Mehl, and Papaconstantopoulos, Acta Mater, 53, 4029 (2005).
|
Mishin, Mehl, and Papaconstantopoulos, Acta Mater, 53, 4029 (2005).
|
||||||
|
|
||||||
**(Mitchell and Finchham)**
|
**(Mitchell and Fincham)**
|
||||||
Mitchell, Finchham, J Phys Condensed Matter, 5, 1031-1038 (1993).
|
Mitchell, Fincham, J Phys Condensed Matter, 5, 1031-1038 (1993).
|
||||||
|
|
||||||
**(Mitchell2011)**
|
**(Mitchell2011)**
|
||||||
Mitchell. A non-local, ordinary-state-based viscoelasticity model for peridynamics. Sandia National Lab Report, 8064:1-28 (2011).
|
Mitchell. A non-local, ordinary-state-based viscoelasticity model for peridynamics. Sandia National Lab Report, 8064:1-28 (2011).
|
||||||
@ -875,7 +878,7 @@ Bibliography
|
|||||||
G.A. Tribello, M. Bonomi, D. Branduardi, C. Camilloni and G. Bussi, Comp. Phys. Comm 185, 604 (2014)
|
G.A. Tribello, M. Bonomi, D. Branduardi, C. Camilloni and G. Bussi, Comp. Phys. Comm 185, 604 (2014)
|
||||||
|
|
||||||
**(Paquay)**
|
**(Paquay)**
|
||||||
Paquay and Kusters, Biophys. J., 110, 6, (2016). preprint available at `arXiv:1411.3019 <http://arxiv.org/abs/1411.3019/>`_.
|
Paquay and Kusters, Biophys. J., 110, 6, (2016). preprint available at `arXiv:1411.3019 <https://arxiv.org/abs/1411.3019/>`_.
|
||||||
|
|
||||||
**(Park)**
|
**(Park)**
|
||||||
Park, Schulten, J. Chem. Phys. 120 (13), 5946 (2004)
|
Park, Schulten, J. Chem. Phys. 120 (13), 5946 (2004)
|
||||||
@ -1373,7 +1376,7 @@ Bibliography
|
|||||||
Zhu, Tajkhorshid, and Schulten, Biophys. J. 83, 154 (2002).
|
Zhu, Tajkhorshid, and Schulten, Biophys. J. 83, 154 (2002).
|
||||||
|
|
||||||
**(Ziegler)**
|
**(Ziegler)**
|
||||||
J.F. Ziegler, J. P. Biersack and U. Littmark, "The Stopping and Range of Ions in Matter," Volume 1, Pergamon, 1985.
|
J.F. Ziegler, J. P. Biersack and U. Littmark, "The Stopping and Range of Ions in Matter", Volume 1, Pergamon, 1985.
|
||||||
|
|
||||||
**(Zimmerman2004)**
|
**(Zimmerman2004)**
|
||||||
Zimmerman, JA; Webb, EB; Hoyt, JJ;. Jones, RE; Klein, PA; Bammann, DJ, "Calculation of stress in atomistic simulation." Special Issue of Modelling and Simulation in Materials Science and Engineering (2004),12:S319.
|
Zimmerman, JA; Webb, EB; Hoyt, JJ;. Jones, RE; Klein, PA; Bammann, DJ, "Calculation of stress in atomistic simulation." Special Issue of Modelling and Simulation in Materials Science and Engineering (2004),12:S319.
|
||||||
|
|||||||
@ -6,9 +6,9 @@ either traditional makefiles for use with GNU make (which may require
|
|||||||
manual editing), or using a build environment generated by CMake (Unix
|
manual editing), or using a build environment generated by CMake (Unix
|
||||||
Makefiles, Ninja, Xcode, Visual Studio, KDevelop, CodeBlocks and more).
|
Makefiles, Ninja, Xcode, Visual Studio, KDevelop, CodeBlocks and more).
|
||||||
|
|
||||||
As an alternative you can download a package with pre-built executables
|
As an alternative, you can download a package with pre-built executables
|
||||||
or automated build trees as described on the :doc:`Install <Install>`
|
or automated build trees, as described in the :doc:`Install <Install>`
|
||||||
page.
|
section of the manual.
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|||||||
@ -44,7 +44,7 @@ standard. A more detailed discussion of that is below.
|
|||||||
|
|
||||||
The executable created by CMake (after running make) is named
|
The executable created by CMake (after running make) is named
|
||||||
``lmp`` unless the ``LAMMPS_MACHINE`` option is set. When setting
|
``lmp`` unless the ``LAMMPS_MACHINE`` option is set. When setting
|
||||||
``LAMMPS_MACHINE=name`` the executable will be called
|
``LAMMPS_MACHINE=name``, the executable will be called
|
||||||
``lmp_name``. Using ``BUILD_MPI=no`` will enforce building a
|
``lmp_name``. Using ``BUILD_MPI=no`` will enforce building a
|
||||||
serial executable using the MPI STUBS library.
|
serial executable using the MPI STUBS library.
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ standard. A more detailed discussion of that is below.
|
|||||||
|
|
||||||
Any ``make machine`` command will look up the make settings from a
|
Any ``make machine`` command will look up the make settings from a
|
||||||
file ``Makefile.machine`` in the folder ``src/MAKE`` or one of its
|
file ``Makefile.machine`` in the folder ``src/MAKE`` or one of its
|
||||||
sub-directories ``MINE``, ``MACHINES``, or ``OPTIONS``, create a
|
subdirectories ``MINE``, ``MACHINES``, or ``OPTIONS``, create a
|
||||||
folder ``Obj_machine`` with all objects and generated files and an
|
folder ``Obj_machine`` with all objects and generated files and an
|
||||||
executable called ``lmp_machine``\ . The standard parallel build
|
executable called ``lmp_machine``\ . The standard parallel build
|
||||||
with ``make mpi`` assumes a standard MPI installation with MPI
|
with ``make mpi`` assumes a standard MPI installation with MPI
|
||||||
@ -90,7 +90,7 @@ standard. A more detailed discussion of that is below.
|
|||||||
directory, or ``make`` from the ``src/STUBS`` dir. If the build
|
directory, or ``make`` from the ``src/STUBS`` dir. If the build
|
||||||
fails, you may need to edit the ``STUBS/Makefile`` for your
|
fails, you may need to edit the ``STUBS/Makefile`` for your
|
||||||
platform. The stubs library does not provide MPI/IO functions
|
platform. The stubs library does not provide MPI/IO functions
|
||||||
required by some LAMMPS packages, e.g. ``MPIIO`` or ``LATBOLTZ``,
|
required by some LAMMPS packages, e.g. ``LATBOLTZ``,
|
||||||
and thus is not compatible with those packages.
|
and thus is not compatible with those packages.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
@ -107,9 +107,9 @@ MPI and OpenMP support in LAMMPS
|
|||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
If you are installing MPI yourself to build a parallel LAMMPS
|
If you are installing MPI yourself to build a parallel LAMMPS
|
||||||
executable, we recommend either MPICH or OpenMPI which are regularly
|
executable, we recommend either MPICH or OpenMPI, which are regularly
|
||||||
used and tested with LAMMPS by the LAMMPS developers. MPICH can be
|
used and tested with LAMMPS by the LAMMPS developers. MPICH can be
|
||||||
downloaded from the `MPICH home page <https://www.mpich.org>`_ and
|
downloaded from the `MPICH home page <https://www.mpich.org>`_, and
|
||||||
OpenMPI can be downloaded correspondingly from the `OpenMPI home page
|
OpenMPI can be downloaded correspondingly from the `OpenMPI home page
|
||||||
<https://www.open-mpi.org>`_. Other MPI packages should also work. No
|
<https://www.open-mpi.org>`_. Other MPI packages should also work. No
|
||||||
specific vendor provided and standard compliant MPI library is currently
|
specific vendor provided and standard compliant MPI library is currently
|
||||||
@ -129,13 +129,12 @@ in particular the Intel compilers on top of OpenMP. Also, the ``KOKKOS``
|
|||||||
package can be compiled to include OpenMP threading.
|
package can be compiled to include OpenMP threading.
|
||||||
|
|
||||||
In addition, there are a few commands in LAMMPS that have native OpenMP
|
In addition, there are a few commands in LAMMPS that have native OpenMP
|
||||||
support included as well. These are commands in the ``MPIIO``,
|
support included as well. These are commands in the ``ML-SNAP``,
|
||||||
``ML-SNAP``, ``DIFFRACTION``, and ``DPD-REACT`` packages. In addition
|
``DIFFRACTION``, and ``DPD-REACT`` packages. Furthermore, some packages
|
||||||
some packages support OpenMP threading indirectly through the libraries
|
support OpenMP threading indirectly through the libraries they interface
|
||||||
they interface to: e.g. ``LATTE``, ``KSPACE``, and ``COLVARS``.
|
to: e.g. ``KSPACE``, and ``COLVARS``. See the :doc:`Packages details
|
||||||
See the :doc:`Packages details <Packages_details>` page for more
|
<Packages_details>` page for more info on these packages, and the pages
|
||||||
info on these packages and the pages for their respective commands
|
for their respective commands for OpenMP threading info.
|
||||||
for OpenMP threading info.
|
|
||||||
|
|
||||||
For CMake, if you use ``BUILD_OMP=yes``, you can use these packages
|
For CMake, if you use ``BUILD_OMP=yes``, you can use these packages
|
||||||
and turn on their native OpenMP support and turn on their native OpenMP
|
and turn on their native OpenMP support and turn on their native OpenMP
|
||||||
@ -144,9 +143,9 @@ variable before you launch LAMMPS.
|
|||||||
|
|
||||||
For building via conventional make, the ``CCFLAGS`` and ``LINKFLAGS``
|
For building via conventional make, the ``CCFLAGS`` and ``LINKFLAGS``
|
||||||
variables in Makefile.machine need to include the compiler flag that
|
variables in Makefile.machine need to include the compiler flag that
|
||||||
enables OpenMP. For GNU compilers it is ``-fopenmp``\ . For (recent) Intel
|
enables OpenMP. For the GNU compilers or Clang, it is ``-fopenmp``\ .
|
||||||
compilers it is ``-qopenmp``\ . If you are using a different compiler,
|
For (recent) Intel compilers, it is ``-qopenmp``\ . If you are using a
|
||||||
please refer to its documentation.
|
different compiler, please refer to its documentation.
|
||||||
|
|
||||||
.. _default-none-issues:
|
.. _default-none-issues:
|
||||||
|
|
||||||
@ -174,15 +173,16 @@ Choice of compiler and compile/link options
|
|||||||
The choice of compiler and compiler flags can be important for maximum
|
The choice of compiler and compiler flags can be important for maximum
|
||||||
performance. Vendor provided compilers for a specific hardware can
|
performance. Vendor provided compilers for a specific hardware can
|
||||||
produce faster code than open-source compilers like the GNU compilers.
|
produce faster code than open-source compilers like the GNU compilers.
|
||||||
On the most common x86 hardware most popular C++ compilers are quite
|
On the most common x86 hardware, the most popular C++ compilers are
|
||||||
similar in performance of C/C++ code at high optimization levels. When
|
quite similar in their ability to optimize regular C/C++ source code at
|
||||||
using the ``INTEL`` package, there is a distinct advantage in using
|
high optimization levels. When using the ``INTEL`` package, there is a
|
||||||
the `Intel C++ compiler <intel_>`_ due to much improved vectorization
|
distinct advantage in using the `Intel C++ compiler <intel_>`_ due to
|
||||||
through SSE and AVX instructions on compatible hardware as the source
|
much improved vectorization through SSE and AVX instructions on
|
||||||
code includes changes and Intel compiler specific directives to enable
|
compatible hardware. The source code in that package conditionally
|
||||||
high degrees of vectorization. This may change over time as equivalent
|
includes compiler specific directives to enable these high degrees of
|
||||||
vectorization directives are included into OpenMP standard revisions and
|
vectorization. This may change over time as equivalent vectorization
|
||||||
other compilers adopt them.
|
directives are included into the OpenMP standard and other compilers
|
||||||
|
adopt them.
|
||||||
|
|
||||||
.. _intel: https://software.intel.com/en-us/intel-compilers
|
.. _intel: https://software.intel.com/en-us/intel-compilers
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ LAMMPS.
|
|||||||
.. tab:: CMake build
|
.. tab:: CMake build
|
||||||
|
|
||||||
By default CMake will use the compiler it finds according to
|
By default CMake will use the compiler it finds according to
|
||||||
internal preferences and it will add optimization flags
|
internal preferences, and it will add optimization flags
|
||||||
appropriate to that compiler and any :doc:`accelerator packages
|
appropriate to that compiler and any :doc:`accelerator packages
|
||||||
<Speed_packages>` you have included in the build. CMake will
|
<Speed_packages>` you have included in the build. CMake will
|
||||||
check if the detected or selected compiler is compatible with the
|
check if the detected or selected compiler is compatible with the
|
||||||
@ -250,9 +250,9 @@ LAMMPS.
|
|||||||
and `-C ../cmake/presets/pgi.cmake`
|
and `-C ../cmake/presets/pgi.cmake`
|
||||||
will switch the compiler to the PGI compilers.
|
will switch the compiler to the PGI compilers.
|
||||||
|
|
||||||
In addition you can set ``CMAKE_TUNE_FLAGS`` to specifically add
|
Furthermore, you can set ``CMAKE_TUNE_FLAGS`` to specifically add
|
||||||
compiler flags to tune for optimal performance on given hosts. By
|
compiler flags to tune for optimal performance on given hosts.
|
||||||
default this variable is empty.
|
This variable is empty by default.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ LAMMPS.
|
|||||||
|
|
||||||
Parallel build (see ``src/MAKE/Makefile.mpi``):
|
Parallel build (see ``src/MAKE/Makefile.mpi``):
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: make
|
||||||
|
|
||||||
CC = mpicxx
|
CC = mpicxx
|
||||||
CCFLAGS = -g -O3
|
CCFLAGS = -g -O3
|
||||||
@ -296,7 +296,7 @@ LAMMPS.
|
|||||||
|
|
||||||
If compilation stops with a message like the following:
|
If compilation stops with a message like the following:
|
||||||
|
|
||||||
.. code-block::
|
.. code-block:: output
|
||||||
|
|
||||||
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I../STUBS -c ../main.cpp
|
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I../STUBS -c ../main.cpp
|
||||||
In file included from ../pointers.h:24:0,
|
In file included from ../pointers.h:24:0,
|
||||||
@ -368,10 +368,10 @@ running LAMMPS from Python via its library interface.
|
|||||||
# no default value
|
# no default value
|
||||||
|
|
||||||
The compilation will always produce a LAMMPS library and an
|
The compilation will always produce a LAMMPS library and an
|
||||||
executable linked to it. By default this will be a static library
|
executable linked to it. By default, this will be a static
|
||||||
named ``liblammps.a`` and an executable named ``lmp`` Setting
|
library named ``liblammps.a`` and an executable named ``lmp``
|
||||||
``BUILD_SHARED_LIBS=yes`` will instead produce a shared library
|
Setting ``BUILD_SHARED_LIBS=yes`` will instead produce a shared
|
||||||
called ``liblammps.so`` (or ``liblammps.dylib`` or
|
library called ``liblammps.so`` (or ``liblammps.dylib`` or
|
||||||
``liblammps.dll`` depending on the platform) If
|
``liblammps.dll`` depending on the platform) If
|
||||||
``LAMMPS_MACHINE=name`` is set in addition, the name of the
|
``LAMMPS_MACHINE=name`` is set in addition, the name of the
|
||||||
generated libraries will be changed to either ``liblammps_name.a``
|
generated libraries will be changed to either ``liblammps_name.a``
|
||||||
@ -429,7 +429,7 @@ You may need to use ``sudo make install`` in place of the last line if
|
|||||||
you do not have write privileges for ``/usr/local/lib`` or use the
|
you do not have write privileges for ``/usr/local/lib`` or use the
|
||||||
``--prefix`` configuration option to select an installation folder,
|
``--prefix`` configuration option to select an installation folder,
|
||||||
where you do have write access. The end result should be the file
|
where you do have write access. The end result should be the file
|
||||||
``/usr/local/lib/libmpich.so``. On many Linux installations the folder
|
``/usr/local/lib/libmpich.so``. On many Linux installations, the folder
|
||||||
``${HOME}/.local`` is an alternative to using ``/usr/local`` and does
|
``${HOME}/.local`` is an alternative to using ``/usr/local`` and does
|
||||||
not require superuser or sudo access. In that case the configuration
|
not require superuser or sudo access. In that case the configuration
|
||||||
step becomes:
|
step becomes:
|
||||||
@ -438,9 +438,10 @@ step becomes:
|
|||||||
|
|
||||||
./configure --enable-shared --prefix=${HOME}/.local
|
./configure --enable-shared --prefix=${HOME}/.local
|
||||||
|
|
||||||
Avoiding to use "sudo" for custom software installation (i.e. from source
|
Avoiding the use of "sudo" for custom software installation (i.e. from
|
||||||
and not through a package manager tool provided by the OS) is generally
|
source and not through a package manager tool provided by the OS) is
|
||||||
recommended to ensure the integrity of the system software installation.
|
generally recommended to ensure the integrity of the system software
|
||||||
|
installation.
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
@ -487,8 +488,9 @@ using CMake or Make.
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
-D BUILD_TOOLS=value # yes or no (default)
|
-D BUILD_TOOLS=value # yes or no (default). Build binary2txt, chain.x, micelle2d.x, msi2lmp, phana, stl_bin2txt
|
||||||
-D BUILD_LAMMPS_SHELL=value # yes or no (default)
|
-D BUILD_LAMMPS_SHELL=value # yes or no (default). Build lammps-shell
|
||||||
|
-D BUILD_LAMMPS_GUI=value # yes or no (default). Build lammps-gui
|
||||||
|
|
||||||
The generated binaries will also become part of the LAMMPS installation
|
The generated binaries will also become part of the LAMMPS installation
|
||||||
(see below).
|
(see below).
|
||||||
@ -502,7 +504,6 @@ using CMake or Make.
|
|||||||
make binary2txt # build only binary2txt tool
|
make binary2txt # build only binary2txt tool
|
||||||
make chain # build only chain tool
|
make chain # build only chain tool
|
||||||
make micelle2d # build only micelle2d tool
|
make micelle2d # build only micelle2d tool
|
||||||
make thermo_extract # build only thermo_extract tool
|
|
||||||
|
|
||||||
cd lammps/tools/lammps-shell
|
cd lammps/tools/lammps-shell
|
||||||
make # build LAMMPS shell
|
make # build LAMMPS shell
|
||||||
@ -514,11 +515,11 @@ using CMake or Make.
|
|||||||
Install LAMMPS after a build
|
Install LAMMPS after a build
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
|
|
||||||
After building LAMMPS, you may wish to copy the LAMMPS executable of
|
After building LAMMPS, you may wish to copy the LAMMPS executable or
|
||||||
library, along with other LAMMPS files (library header, doc files) to
|
library, along with other LAMMPS files (library header, doc files), to a
|
||||||
a globally visible place on your system, for others to access. Note
|
globally visible place on your system, for others to access. Note that
|
||||||
that you may need super-user privileges (e.g. sudo) if the directory
|
you may need super-user privileges (e.g. sudo) if the directory you want
|
||||||
you want to copy files to is protected.
|
to copy files to is protected.
|
||||||
|
|
||||||
.. tabs::
|
.. tabs::
|
||||||
|
|
||||||
@ -536,7 +537,7 @@ you want to copy files to is protected.
|
|||||||
environment variable, if you are installing LAMMPS into a non-system
|
environment variable, if you are installing LAMMPS into a non-system
|
||||||
location and/or are linking to libraries in a non-system location that
|
location and/or are linking to libraries in a non-system location that
|
||||||
depend on such runtime path settings.
|
depend on such runtime path settings.
|
||||||
As an alternative you may set the CMake variable ``LAMMPS_INSTALL_RPATH``
|
As an alternative, you may set the CMake variable ``LAMMPS_INSTALL_RPATH``
|
||||||
to ``on`` and then the runtime paths for any linked shared libraries
|
to ``on`` and then the runtime paths for any linked shared libraries
|
||||||
and the library installation folder for the LAMMPS library will be
|
and the library installation folder for the LAMMPS library will be
|
||||||
embedded and thus the requirement to set environment variables is avoided.
|
embedded and thus the requirement to set environment variables is avoided.
|
||||||
|
|||||||
@ -9,44 +9,42 @@ page.
|
|||||||
|
|
||||||
The following text assumes some familiarity with CMake and focuses on
|
The following text assumes some familiarity with CMake and focuses on
|
||||||
using the command line tool ``cmake`` and what settings are supported
|
using the command line tool ``cmake`` and what settings are supported
|
||||||
for building LAMMPS. A more detailed tutorial on how to use ``cmake``
|
for building LAMMPS. A more detailed tutorial on how to use CMake
|
||||||
itself, the text mode or graphical user interface, change the generated
|
itself, the text mode or graphical user interface, to change the
|
||||||
output files for different build tools and development environments is
|
generated output files for different build tools and development
|
||||||
on a :doc:`separate page <Howto_cmake>`.
|
environments is on a :doc:`separate page <Howto_cmake>`.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
LAMMPS currently requires that CMake version 3.10 or later is available;
|
LAMMPS currently requires that CMake version 3.16 or later is available.
|
||||||
version 3.12 or later is preferred.
|
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
You must not mix the :doc:`traditional make based <Build_make>`
|
You must not mix the :doc:`traditional make based <Build_make>`
|
||||||
LAMMPS build procedure with using CMake. Thus no packages may be
|
LAMMPS build procedure with using CMake. No packages may be
|
||||||
installed or a build been previously attempted in the LAMMPS source
|
installed or a build been previously attempted in the LAMMPS source
|
||||||
directory by using ``make <machine>``. CMake will detect if this is
|
directory by using ``make <machine>``. CMake will detect if this is
|
||||||
the case and generate an error. To remove conflicting files from the
|
the case and generate an error. To remove conflicting files from the
|
||||||
``src`` you can use the command ``make no-all purge`` which will
|
``src`` you can use the command ``make no-all purge`` which will
|
||||||
un-install all packages and delete all auto-generated files.
|
uninstall all packages and delete all auto-generated files.
|
||||||
|
|
||||||
|
|
||||||
Advantages of using CMake
|
Advantages of using CMake
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
CMake is an alternative to compiling LAMMPS in the traditional way
|
CMake is an alternative to compiling LAMMPS in the traditional way
|
||||||
through :doc:`(manually customized) makefiles <Build_make>` and a recent
|
through :doc:`(manually customized) makefiles <Build_make>`. Using
|
||||||
addition to LAMMPS thanks to the efforts of Christoph Junghans (LANL)
|
CMake has multiple advantages that are specifically helpful for
|
||||||
and Richard Berger (Temple U). Using CMake has multiple advantages that
|
people with limited experience in compiling software or for people
|
||||||
are specifically helpful for people with limited experience in compiling
|
that want to modify or extend LAMMPS.
|
||||||
software or for people that want to modify or extend LAMMPS.
|
|
||||||
|
|
||||||
- CMake can detect available hardware, tools, features, and libraries
|
- CMake can detect available hardware, tools, features, and libraries
|
||||||
and adapt the LAMMPS default build configuration accordingly.
|
and adapt the LAMMPS default build configuration accordingly.
|
||||||
- CMake can generate files for different build tools and integrated
|
- CMake can generate files for different build tools and integrated
|
||||||
development environments (IDE).
|
development environments (IDE).
|
||||||
- CMake supports customization of settings with a text mode or graphical
|
- CMake supports customization of settings with a command line, text
|
||||||
user interface. No knowledge of file formats or and complex command
|
mode, or graphical user interface. No manual editing of files,
|
||||||
line syntax required.
|
knowledge of file formats or complex command line syntax is required.
|
||||||
- All enabled components are compiled in a single build operation.
|
- All enabled components are compiled in a single build operation.
|
||||||
- Automated dependency tracking for all files and configuration options.
|
- Automated dependency tracking for all files and configuration options.
|
||||||
- Support for true out-of-source compilation. Multiple configurations
|
- Support for true out-of-source compilation. Multiple configurations
|
||||||
@ -55,23 +53,23 @@ software or for people that want to modify or extend LAMMPS.
|
|||||||
source tree.
|
source tree.
|
||||||
- Simplified packaging of LAMMPS for Linux distributions, environment
|
- Simplified packaging of LAMMPS for Linux distributions, environment
|
||||||
modules, or automated build tools like `Homebrew <https://brew.sh/>`_.
|
modules, or automated build tools like `Homebrew <https://brew.sh/>`_.
|
||||||
- Integration of automated regression testing (the LAMMPS side for that
|
- Integration of automated unit and regression testing (the LAMMPS side
|
||||||
is still under development).
|
of this is still under active development).
|
||||||
|
|
||||||
.. _cmake_build:
|
.. _cmake_build:
|
||||||
|
|
||||||
Getting started
|
Getting started
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Building LAMMPS with CMake is a two-step process. First you use CMake
|
Building LAMMPS with CMake is a two-step process. In the first step,
|
||||||
to generate a build environment in a new directory. For that purpose
|
you use CMake to generate a build environment in a new directory. For
|
||||||
you can use either the command-line utility ``cmake`` (or ``cmake3``),
|
that purpose you can use either the command-line utility ``cmake`` (or
|
||||||
the text-mode UI utility ``ccmake`` (or ``ccmake3``) or the graphical
|
``cmake3``), the text-mode UI utility ``ccmake`` (or ``ccmake3``) or the
|
||||||
utility ``cmake-gui``, or use them interchangeably. The second step is
|
graphical utility ``cmake-gui``, or use them interchangeably. The
|
||||||
then the compilation and linking of all objects, libraries, and
|
second step is then the compilation and linking of all objects,
|
||||||
executables. Here is a minimal example using the command line version of
|
libraries, and executables using the selected build tool. Here is a
|
||||||
CMake to build LAMMPS with no add-on packages enabled and no
|
minimal example using the command line version of CMake to build LAMMPS
|
||||||
customization:
|
with no add-on packages enabled and no customization:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -96,17 +94,17 @@ Compilation can take a long time, since LAMMPS is a large project with
|
|||||||
many features. If your machine has multiple CPU cores (most do these
|
many features. If your machine has multiple CPU cores (most do these
|
||||||
days), you can speed this up by compiling sources in parallel with
|
days), you can speed this up by compiling sources in parallel with
|
||||||
``make -j N`` (with N being the maximum number of concurrently executed
|
``make -j N`` (with N being the maximum number of concurrently executed
|
||||||
tasks). Also installation of the `ccache <https://ccache.dev/>`_ (=
|
tasks). Installation of the `ccache <https://ccache.dev/>`_ (= Compiler
|
||||||
Compiler Cache) software may speed up repeated compilation even more,
|
Cache) software may speed up repeated compilation even more, e.g. during
|
||||||
e.g. during code development.
|
code development, especially when repeatedly switching between branches.
|
||||||
|
|
||||||
After the initial build, whenever you edit LAMMPS source files, enable
|
After the initial build, whenever you edit LAMMPS source files, enable
|
||||||
or disable packages, change compiler flags or build options, you must
|
or disable packages, change compiler flags or build options, you must
|
||||||
re-compile and relink the LAMMPS executable with ``cmake --build .`` (or
|
re-compile and relink the LAMMPS executable with ``cmake --build .`` (or
|
||||||
``make``). If the compilation fails for some reason, try running
|
``make``). If the compilation fails for some reason, try running
|
||||||
``cmake .`` and then compile again. The included dependency tracking
|
``cmake .`` and then compile again. The included dependency tracking
|
||||||
should make certain that only the necessary subset of files are
|
should make certain that only the necessary subset of files is
|
||||||
re-compiled. You can also delete compiled objects, libraries and
|
re-compiled. You can also delete compiled objects, libraries, and
|
||||||
executables with ``cmake --build . --target clean`` (or ``make clean``).
|
executables with ``cmake --build . --target clean`` (or ``make clean``).
|
||||||
|
|
||||||
After compilation, you may optionally install the LAMMPS executable into
|
After compilation, you may optionally install the LAMMPS executable into
|
||||||
@ -132,12 +130,12 @@ file called ``CMakeLists.txt`` (for LAMMPS it is located in the
|
|||||||
``CMakeCache.txt``, which is generated at the end of the CMake
|
``CMakeCache.txt``, which is generated at the end of the CMake
|
||||||
configuration step. The cache file contains all current CMake settings.
|
configuration step. The cache file contains all current CMake settings.
|
||||||
|
|
||||||
To modify settings, enable or disable features, you need to set *variables*
|
To modify settings, enable or disable features, you need to set
|
||||||
with either the *-D* command line flag (``-D VARIABLE1_NAME=value``) or
|
*variables* with either the *-D* command line flag (``-D
|
||||||
change them in the text mode of graphical user interface. The *-D* flag
|
VARIABLE1_NAME=value``) or change them in the text mode of the graphical
|
||||||
can be used several times in one command.
|
user interface. The *-D* flag can be used several times in one command.
|
||||||
|
|
||||||
For your convenience we provide :ref:`CMake presets <cmake_presets>`
|
For your convenience, we provide :ref:`CMake presets <cmake_presets>`
|
||||||
that combine multiple settings to enable optional LAMMPS packages or use
|
that combine multiple settings to enable optional LAMMPS packages or use
|
||||||
a different compiler tool chain. Those are loaded with the *-C* flag
|
a different compiler tool chain. Those are loaded with the *-C* flag
|
||||||
(``-C ../cmake/presets/basic.cmake``). This step would only be needed
|
(``-C ../cmake/presets/basic.cmake``). This step would only be needed
|
||||||
@ -155,22 +153,23 @@ specific CMake version is given when running ``cmake --help``.
|
|||||||
Multi-configuration build systems
|
Multi-configuration build systems
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Throughout this manual it is mostly assumed that LAMMPS is being built
|
Throughout this manual, it is mostly assumed that LAMMPS is being built
|
||||||
on a Unix-like operating system with "make" as the underlying "builder",
|
on a Unix-like operating system with "make" as the underlying "builder",
|
||||||
since this is the most common case. In this case the build "configuration"
|
since this is the most common case. In this case the build
|
||||||
is chose using ``-D CMAKE_BUILD_TYPE=<configuration>`` with ``<configuration>``
|
"configuration" is chose using ``-D CMAKE_BUILD_TYPE=<configuration>``
|
||||||
being one of "Release", "Debug", "RelWithDebInfo", or "MinSizeRel".
|
with ``<configuration>`` being one of "Release", "Debug",
|
||||||
Some build tools, however, can also use or even require to have a so-called
|
"RelWithDebInfo", or "MinSizeRel". Some build tools, however, can also
|
||||||
multi-configuration build system setup. For those the built type (or
|
use or even require having a so-called multi-configuration build system
|
||||||
configuration) is chosen at compile time using the same build files. E.g.
|
setup. For a multi-configuration build, the built type (or
|
||||||
with:
|
configuration) is selected at compile time using the same build
|
||||||
|
files. E.g. with:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
cmake --build build-multi --config Release
|
cmake --build build-multi --config Release
|
||||||
|
|
||||||
In that case the resulting binaries are not in the build folder directly
|
In that case the resulting binaries are not in the build folder directly
|
||||||
but in sub-directories corresponding to the build type (i.e. Release in
|
but in subdirectories corresponding to the build type (i.e. Release in
|
||||||
the example from above). Similarly, for running unit tests the
|
the example from above). Similarly, for running unit tests the
|
||||||
configuration is selected with the *-C* flag:
|
configuration is selected with the *-C* flag:
|
||||||
|
|
||||||
@ -178,13 +177,13 @@ configuration is selected with the *-C* flag:
|
|||||||
|
|
||||||
ctest -C Debug
|
ctest -C Debug
|
||||||
|
|
||||||
The CMake scripts in LAMMPS have basic support for being compiled using a
|
The CMake scripts in LAMMPS have basic support for being compiled using
|
||||||
multi-config build system, but not all of it has been ported. This is in
|
a multi-config build system, but not all of it has been ported. This is
|
||||||
particular applicable to compiling packages that require additional libraries
|
in particular applicable to compiling packages that require additional
|
||||||
that would be downloaded and compiled by CMake. The "windows" preset file
|
libraries that would be downloaded and compiled by CMake. The
|
||||||
tries to keep track of which packages can be compiled natively with the
|
``windows.cmake`` preset file tries to keep track of which packages can
|
||||||
MSVC compilers out-of-the box. Not all of those external libraries are
|
be compiled natively with the MSVC compilers out-of-the box. Not all of
|
||||||
portable to Windows either.
|
the external libraries are portable to Windows, either.
|
||||||
|
|
||||||
|
|
||||||
Installing CMake
|
Installing CMake
|
||||||
|
|||||||
@ -46,7 +46,7 @@ It can be enabled for all C++ code with the following CMake flag
|
|||||||
|
|
||||||
With this flag enabled all source files will be processed twice, first to
|
With this flag enabled all source files will be processed twice, first to
|
||||||
be compiled and then to be analyzed. Please note that the analysis can be
|
be compiled and then to be analyzed. Please note that the analysis can be
|
||||||
significantly more time consuming than the compilation itself.
|
significantly more time-consuming than the compilation itself.
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
@ -140,36 +140,62 @@ of the LAMMPS project on GitHub.
|
|||||||
The unit testing facility is integrated into the CMake build process
|
The unit testing facility is integrated into the CMake build process
|
||||||
of the LAMMPS source code distribution itself. It can be enabled by
|
of the LAMMPS source code distribution itself. It can be enabled by
|
||||||
setting ``-D ENABLE_TESTING=on`` during the CMake configuration step.
|
setting ``-D ENABLE_TESTING=on`` during the CMake configuration step.
|
||||||
It requires the `YAML <http://pyyaml.org/>`_ library and development
|
It requires the `YAML <https://pyyaml.org/>`_ library and development
|
||||||
headers (if those are not found locally a recent version will be
|
headers (if those are not found locally a recent version will be
|
||||||
downloaded and compiled along with LAMMPS and the test program) to
|
downloaded and compiled along with LAMMPS and the test program) to
|
||||||
compile and will download and compile a specific recent version of the
|
compile and will download and compile a specific recent version of the
|
||||||
`Googletest <https://github.com/google/googletest/>`_ C++ test framework
|
`Googletest <https://github.com/google/googletest/>`_ C++ test framework
|
||||||
for implementing the tests.
|
for implementing the tests.
|
||||||
|
|
||||||
|
.. admonition:: Software version requirements for testing
|
||||||
|
:class: note
|
||||||
|
|
||||||
|
The compiler and library version requirements for the testing
|
||||||
|
framework are more strict than for the main part of LAMMPS. For
|
||||||
|
example the default GNU C++ and Fortran compilers of RHEL/CentOS 7.x
|
||||||
|
(version 4.8.x) are not sufficient. The CMake configuration will try
|
||||||
|
to detect incompatible versions and either skip incompatible tests or
|
||||||
|
stop with an error. Also the number of tests will depend on
|
||||||
|
installed LAMMPS packages, development environment, operating system,
|
||||||
|
and configuration settings.
|
||||||
|
|
||||||
After compilation is complete, the unit testing is started in the build
|
After compilation is complete, the unit testing is started in the build
|
||||||
folder using the ``ctest`` command, which is part of the CMake software.
|
folder using the ``ctest`` command, which is part of the CMake software.
|
||||||
The output of this command will be looking something like this::
|
The output of this command will be looking something like this:
|
||||||
|
|
||||||
[...]$ ctest
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ ctest
|
||||||
Test project /home/akohlmey/compile/lammps/build-testing
|
Test project /home/akohlmey/compile/lammps/build-testing
|
||||||
Start 1: MolPairStyle:hybrid-overlay
|
Start 1: RunLammps
|
||||||
1/109 Test #1: MolPairStyle:hybrid-overlay ......... Passed 0.02 sec
|
1/563 Test #1: RunLammps .......................................... Passed 0.28 sec
|
||||||
Start 2: MolPairStyle:hybrid
|
Start 2: HelpMessage
|
||||||
2/109 Test #2: MolPairStyle:hybrid ................. Passed 0.01 sec
|
2/563 Test #2: HelpMessage ........................................ Passed 0.06 sec
|
||||||
Start 3: MolPairStyle:lj_class2
|
Start 3: InvalidFlag
|
||||||
|
3/563 Test #3: InvalidFlag ........................................ Passed 0.06 sec
|
||||||
|
Start 4: Tokenizer
|
||||||
|
4/563 Test #4: Tokenizer .......................................... Passed 0.05 sec
|
||||||
|
Start 5: MemPool
|
||||||
|
5/563 Test #5: MemPool ............................................ Passed 0.05 sec
|
||||||
|
Start 6: ArgUtils
|
||||||
|
6/563 Test #6: ArgUtils ........................................... Passed 0.05 sec
|
||||||
[...]
|
[...]
|
||||||
Start 107: PotentialFileReader
|
Start 561: ImproperStyle:zero
|
||||||
107/109 Test #107: PotentialFileReader ................ Passed 0.04 sec
|
561/563 Test #561: ImproperStyle:zero ................................. Passed 0.07 sec
|
||||||
Start 108: EIMPotentialFileReader
|
Start 562: TestMliapPyUnified
|
||||||
108/109 Test #108: EIMPotentialFileReader ............. Passed 0.03 sec
|
562/563 Test #562: TestMliapPyUnified ................................. Passed 0.16 sec
|
||||||
Start 109: TestSimpleCommands
|
Start 563: TestPairList
|
||||||
109/109 Test #109: TestSimpleCommands ................. Passed 0.02 sec
|
563/563 Test #563: TestPairList ....................................... Passed 0.06 sec
|
||||||
|
|
||||||
100% tests passed, 0 tests failed out of 26
|
100% tests passed, 0 tests failed out of 563
|
||||||
|
|
||||||
Total Test time (real) = 25.57 sec
|
Label Time Summary:
|
||||||
|
generated = 0.85 sec*proc (3 tests)
|
||||||
|
noWindows = 4.16 sec*proc (2 tests)
|
||||||
|
slow = 78.33 sec*proc (67 tests)
|
||||||
|
unstable = 28.23 sec*proc (34 tests)
|
||||||
|
|
||||||
|
Total Test time (real) = 132.34 sec
|
||||||
|
|
||||||
The ``ctest`` command has many options, the most important ones are:
|
The ``ctest`` command has many options, the most important ones are:
|
||||||
|
|
||||||
@ -200,11 +226,13 @@ Fortran) and testing different aspects of the LAMMPS software and its features.
|
|||||||
The tests will adapt to the compilation settings of LAMMPS, so that tests
|
The tests will adapt to the compilation settings of LAMMPS, so that tests
|
||||||
will be skipped if prerequisite features are not available in LAMMPS.
|
will be skipped if prerequisite features are not available in LAMMPS.
|
||||||
|
|
||||||
.. note::
|
.. admonition:: Work in Progress
|
||||||
|
:class: note
|
||||||
|
|
||||||
The unit test framework was added in spring 2020 and is under active
|
The unit test framework was added in spring 2020 and is under active
|
||||||
development. The coverage is not complete and will be expanded over
|
development. The coverage is not complete and will be expanded over
|
||||||
time.
|
time. Preference is given to parts of the code base that are easy to
|
||||||
|
test or commonly used.
|
||||||
|
|
||||||
Tests for styles of the same kind of style (e.g. pair styles or bond
|
Tests for styles of the same kind of style (e.g. pair styles or bond
|
||||||
styles) are performed with the same test executable using different
|
styles) are performed with the same test executable using different
|
||||||
@ -227,20 +255,22 @@ A test run is then a a collection multiple individual test runs each
|
|||||||
with many comparisons to reference results based on template input
|
with many comparisons to reference results based on template input
|
||||||
files, individual command settings, relative error margins, and
|
files, individual command settings, relative error margins, and
|
||||||
reference data stored in a YAML format file with ``.yaml``
|
reference data stored in a YAML format file with ``.yaml``
|
||||||
suffix. Currently the programs ``test_pair_style``, ``test_bond_style``, and
|
suffix. Currently the programs ``test_pair_style``, ``test_bond_style``,
|
||||||
``test_angle_style`` are implemented. They will compare forces, energies and
|
``test_angle_style``, ``test_dihedral_style``, and
|
||||||
(global) stress for all atoms after a ``run 0`` calculation and after a
|
``test_improper_style`` are implemented. They will compare forces,
|
||||||
few steps of MD with :doc:`fix nve <fix_nve>`, each in multiple variants
|
energies and (global) stress for all atoms after a ``run 0`` calculation
|
||||||
with different settings and also for multiple accelerated styles. If a
|
and after a few steps of MD with :doc:`fix nve <fix_nve>`, each in
|
||||||
prerequisite style or package is missing, the individual tests are
|
multiple variants with different settings and also for multiple
|
||||||
skipped. All tests will be executed on a single MPI process, so using
|
accelerated styles. If a prerequisite style or package is missing, the
|
||||||
the CMake option ``-D BUILD_MPI=off`` can significantly speed up testing,
|
individual tests are skipped. All force style tests will be executed on
|
||||||
since this will skip the MPI initialization for each test run.
|
a single MPI process, so using the CMake option ``-D BUILD_MPI=off`` can
|
||||||
Below is an example command and output:
|
significantly speed up testing, since this will skip the MPI
|
||||||
|
initialization for each test run. Below is an example command and
|
||||||
|
output:
|
||||||
|
|
||||||
.. parsed-literal::
|
.. code-block:: console
|
||||||
|
|
||||||
[tests]$ test_pair_style mol-pair-lj_cut.yaml
|
$ test_pair_style mol-pair-lj_cut.yaml
|
||||||
[==========] Running 6 tests from 1 test suite.
|
[==========] Running 6 tests from 1 test suite.
|
||||||
[----------] Global test environment set-up.
|
[----------] Global test environment set-up.
|
||||||
[----------] 6 tests from PairStyle
|
[----------] 6 tests from PairStyle
|
||||||
@ -388,15 +418,16 @@ When compiling LAMMPS with enabled tests, most test executables will
|
|||||||
need to be linked against the LAMMPS library. Since this can be a very
|
need to be linked against the LAMMPS library. Since this can be a very
|
||||||
large library with many C++ objects when many packages are enabled, link
|
large library with many C++ objects when many packages are enabled, link
|
||||||
times can become very long on machines that use the GNU BFD linker (e.g.
|
times can become very long on machines that use the GNU BFD linker (e.g.
|
||||||
Linux systems). Alternatives like the ``lld`` linker of the LLVM project
|
Linux systems). Alternatives like the ``mold`` linker, the ``lld``
|
||||||
or the ``gold`` linker available with GNU binutils can speed up this step
|
linker of the LLVM project, or the ``gold`` linker available with GNU
|
||||||
substantially. CMake will by default test if any of the two can be
|
binutils can speed up this step substantially (in this order). CMake
|
||||||
enabled and use it when ``ENABLE_TESTING`` is active. It can also be
|
will by default test if any of the three can be enabled and use it when
|
||||||
selected manually through the ``CMAKE_CUSTOM_LINKER`` CMake variable.
|
``ENABLE_TESTING`` is active. It can also be selected manually through
|
||||||
Allowed values are ``lld``, ``gold``, ``bfd``, or ``default``. The
|
the ``CMAKE_CUSTOM_LINKER`` CMake variable. Allowed values are
|
||||||
``default`` option will use the system default linker otherwise, the
|
``mold``, ``lld``, ``gold``, ``bfd``, or ``default``. The ``default``
|
||||||
linker is chosen explicitly. This option is only available for the
|
option will use the system default linker otherwise, the linker is
|
||||||
GNU or Clang C++ compiler.
|
chosen explicitly. This option is only available for the GNU or Clang
|
||||||
|
C++ compilers.
|
||||||
|
|
||||||
Tests for other components and utility functions
|
Tests for other components and utility functions
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -490,11 +521,15 @@ The following options are available.
|
|||||||
make fix-errordocs # remove error docs in header files
|
make fix-errordocs # remove error docs in header files
|
||||||
make check-permissions # search for files with permissions issues
|
make check-permissions # search for files with permissions issues
|
||||||
make fix-permissions # correct permissions issues in files
|
make fix-permissions # correct permissions issues in files
|
||||||
|
make check-docs # search for several issues in the manual
|
||||||
|
make check-version # list files with pending release version tags
|
||||||
make check # run all check targets from above
|
make check # run all check targets from above
|
||||||
|
|
||||||
These should help to make source and documentation files conforming
|
These should help to make source and documentation files conforming
|
||||||
to some the coding style preferences of the LAMMPS developers.
|
to some the coding style preferences of the LAMMPS developers.
|
||||||
|
|
||||||
|
.. _clang-format:
|
||||||
|
|
||||||
Clang-format support
|
Clang-format support
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
@ -520,7 +555,7 @@ commands like the following:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ clang-format -i some_file.cpp
|
clang-format -i some_file.cpp
|
||||||
|
|
||||||
|
|
||||||
The following target are available for both, GNU make and CMake:
|
The following target are available for both, GNU make and CMake:
|
||||||
@ -529,3 +564,19 @@ The following target are available for both, GNU make and CMake:
|
|||||||
|
|
||||||
make format-src # apply clang-format to all files in src and the package folders
|
make format-src # apply clang-format to all files in src and the package folders
|
||||||
make format-tests # apply clang-format to all files in the unittest tree
|
make format-tests # apply clang-format to all files in the unittest tree
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. _gh-cli:
|
||||||
|
|
||||||
|
GitHub command line interface
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
GitHub is developing a `tool for the command line
|
||||||
|
<https://cli.github.com>`_ that interacts with the GitHub website via a
|
||||||
|
command called ``gh``. This can be extremely convenient when working
|
||||||
|
with a Git repository hosted on GitHub (like LAMMPS). It is thus highly
|
||||||
|
recommended to install it when doing LAMMPS development.
|
||||||
|
|
||||||
|
The capabilities of the ``gh`` command is continually expanding, so
|
||||||
|
please see the documentation at https://cli.github.com/manual/
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,33 +1,32 @@
|
|||||||
Link LAMMPS as a library to another code
|
Link LAMMPS as a library to another code
|
||||||
========================================
|
========================================
|
||||||
|
|
||||||
LAMMPS is designed as a library of C++ objects that can be
|
LAMMPS is designed as a library of C++ objects that can be integrated
|
||||||
integrated into other applications including Python scripts.
|
into other applications, including Python scripts. The files
|
||||||
The files ``src/library.cpp`` and ``src/library.h`` define a
|
``src/library.cpp`` and ``src/library.h`` define a C-style API for using
|
||||||
C-style API for using LAMMPS as a library. See the
|
LAMMPS as a library. See the :doc:`Howto_library` page for a
|
||||||
:doc:`Howto_library` page
|
description of the interface and how to use it for your needs.
|
||||||
for a description of the interface and how to use it for your needs.
|
|
||||||
|
|
||||||
The :doc:`Build_basics` page explains how to build
|
The :doc:`Build_basics` page explains how to build LAMMPS as either a
|
||||||
LAMMPS as either a shared or static library. This results in a file
|
shared or static library. This results in a file in the compilation
|
||||||
in the compilation folder called ``liblammps.a`` or ``liblammps_<name>.a``
|
folder called ``liblammps.a`` or ``liblammps_<name>.a`` in case of
|
||||||
in case of building a static library. In case of a shared library
|
building a static library. In case of a shared library, the name is the
|
||||||
the name is the same only that the suffix is going to be either ``.so``
|
same only that the suffix is going to be either ``.so`` or ``.dylib`` or
|
||||||
or ``.dylib`` or ``.dll`` instead of ``.a`` depending on the OS.
|
``.dll`` instead of ``.a`` depending on the OS. In some cases, the
|
||||||
In some cases the ``.so`` file may be a symbolic link to a file with
|
``.so`` file may be a symbolic link to a file with the suffix ``.so.0``
|
||||||
the suffix ``.so.0`` (or some other number).
|
(or some other number).
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Care should be taken to use the same MPI library for the calling code
|
Care should be taken to use the same MPI library for the calling code
|
||||||
and the LAMMPS library unless LAMMPS is to be compiled without (real)
|
and the LAMMPS library, unless LAMMPS is to be compiled without (real)
|
||||||
MPI support using the include STUBS MPI library.
|
MPI support using the included STUBS MPI library.
|
||||||
|
|
||||||
Link with LAMMPS as a static library
|
Link with LAMMPS as a static library
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
||||||
The calling application can link to LAMMPS as a static library with
|
The calling application can link to LAMMPS as a static library with
|
||||||
compilation and link commands as in the examples shown below. These
|
compilation and link commands, as in the examples shown below. These
|
||||||
are examples for a code written in C in the file ``caller.c``.
|
are examples for a code written in C in the file ``caller.c``.
|
||||||
The benefit of linking to a static library is, that the resulting
|
The benefit of linking to a static library is, that the resulting
|
||||||
executable is independent of that library since all required
|
executable is independent of that library since all required
|
||||||
@ -142,10 +141,10 @@ Link with LAMMPS as a shared library
|
|||||||
When linking to LAMMPS built as a shared library, the situation becomes
|
When linking to LAMMPS built as a shared library, the situation becomes
|
||||||
much simpler, as all dependent libraries and objects are either included
|
much simpler, as all dependent libraries and objects are either included
|
||||||
in the shared library or registered as a dependent library in the shared
|
in the shared library or registered as a dependent library in the shared
|
||||||
library file. Thus those libraries need not to be specified when
|
library file. Thus, those libraries need not be specified when linking
|
||||||
linking the calling executable. Only the *-I* flags are needed. So the
|
the calling executable. Only the *-I* flags are needed. So the example
|
||||||
example case from above of the serial version static LAMMPS library with
|
case from above of the serial version static LAMMPS library with the
|
||||||
the POEMS package installed becomes:
|
POEMS package installed becomes:
|
||||||
|
|
||||||
.. tabs::
|
.. tabs::
|
||||||
|
|
||||||
@ -209,7 +208,7 @@ You can verify whether all required shared libraries are found with the
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ LD_LIBRARY_PATH=/home/user/lammps/src ldd caller
|
LD_LIBRARY_PATH=/home/user/lammps/src ldd caller
|
||||||
linux-vdso.so.1 (0x00007ffe729e0000)
|
linux-vdso.so.1 (0x00007ffe729e0000)
|
||||||
liblammps.so => /home/user/lammps/src/liblammps.so (0x00007fc91bb9e000)
|
liblammps.so => /home/user/lammps/src/liblammps.so (0x00007fc91bb9e000)
|
||||||
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fc91b984000)
|
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fc91b984000)
|
||||||
@ -222,7 +221,7 @@ If a required library is missing, you would get a 'not found' entry:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ ldd caller
|
ldd caller
|
||||||
linux-vdso.so.1 (0x00007ffd672fe000)
|
linux-vdso.so.1 (0x00007ffd672fe000)
|
||||||
liblammps.so => not found
|
liblammps.so => not found
|
||||||
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007fb7c7e86000)
|
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007fb7c7e86000)
|
||||||
|
|||||||
@ -20,21 +20,22 @@ with :doc:`CMake <Build_cmake>`. The makefiles of the traditional
|
|||||||
make based build process and the scripts they are calling expect a few
|
make based build process and the scripts they are calling expect a few
|
||||||
additional tools to be available and functioning.
|
additional tools to be available and functioning.
|
||||||
|
|
||||||
* a working C/C++ compiler toolchain supporting the C++11 standard; on
|
* A working C/C++ compiler toolchain supporting the C++11 standard; on
|
||||||
Linux these are often the GNU compilers. Some older compilers
|
Linux, these are often the GNU compilers. Some older compiler versions
|
||||||
require adding flags like ``-std=c++11`` to enable the C++11 mode.
|
require adding flags like ``-std=c++11`` to enable the C++11 mode.
|
||||||
* a Bourne shell compatible "Unix" shell program (often this is ``bash``)
|
* A Bourne shell compatible "Unix" shell program (frequently this is ``bash``)
|
||||||
* a few shell utilities: ``ls``, ``mv``, ``ln``, ``rm``, ``grep``, ``sed``, ``tr``, ``cat``, ``touch``, ``diff``, ``dirname``
|
* A few shell utilities: ``ls``, ``mv``, ``ln``, ``rm``, ``grep``, ``sed``, ``tr``, ``cat``, ``touch``, ``diff``, ``dirname``
|
||||||
* python (optional, required for ``make lib-<pkg>`` in the src folder).
|
* Python (optional, required for ``make lib-<pkg>`` in the src
|
||||||
python scripts are currently tested with python 2.7 and 3.6. The procedure
|
folder). Python scripts are currently tested with python 2.7 and
|
||||||
for :doc:`building the documentation <Build_manual>` requires python 3.5 or later.
|
3.6 to 3.11. The procedure for :doc:`building the documentation
|
||||||
|
<Build_manual>` *requires* Python 3.5 or later.
|
||||||
|
|
||||||
Getting started
|
Getting started
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
To include LAMMPS packages (i.e. optional commands and styles) you must
|
To include LAMMPS packages (i.e. optional commands and styles) you must
|
||||||
enable (or "install") them first, as discussed on the :doc:`Build
|
enable (or "install") them first, as discussed on the :doc:`Build
|
||||||
package <Build_package>` page. If a packages requires (provided or
|
package <Build_package>` page. If a package requires (provided or
|
||||||
external) libraries, you must configure and build those libraries
|
external) libraries, you must configure and build those libraries
|
||||||
**before** building LAMMPS itself and especially **before** enabling
|
**before** building LAMMPS itself and especially **before** enabling
|
||||||
such a package with ``make yes-<package>``. :doc:`Building LAMMPS with
|
such a package with ``make yes-<package>``. :doc:`Building LAMMPS with
|
||||||
@ -56,36 +57,36 @@ Compilation can take a long time, since LAMMPS is a large project with
|
|||||||
many features. If your machine has multiple CPU cores (most do these
|
many features. If your machine has multiple CPU cores (most do these
|
||||||
days), you can speed this up by compiling sources in parallel with
|
days), you can speed this up by compiling sources in parallel with
|
||||||
``make -j N`` (with N being the maximum number of concurrently executed
|
``make -j N`` (with N being the maximum number of concurrently executed
|
||||||
tasks). Also installation of the `ccache <https://ccache.dev/>`_ (=
|
tasks). Installation of the `ccache <https://ccache.dev/>`_ (= Compiler
|
||||||
Compiler Cache) software may speed up repeated compilation even more,
|
Cache) software may speed up repeated compilation even more, e.g. during
|
||||||
e.g. during code development.
|
code development, especially when repeatedly switching between branches.
|
||||||
|
|
||||||
After the initial build, whenever you edit LAMMPS source files, or add
|
After the initial build, whenever you edit LAMMPS source files, or add
|
||||||
or remove new files to the source directory (e.g. by installing or
|
or remove new files to the source directory (e.g. by installing or
|
||||||
uninstalling packages), you must re-compile and relink the LAMMPS
|
uninstalling packages), you must re-compile and relink the LAMMPS
|
||||||
executable with the same ``make <machine>`` command. The makefile's
|
executable with the same ``make <machine>`` command. The makefile's
|
||||||
dependency tracking should insure that only the necessary subset of
|
dependency tracking should ensure that only the necessary subset of
|
||||||
files are re-compiled. If you change settings in the makefile, you have
|
files is re-compiled. If you change settings in the makefile, you have
|
||||||
to recompile *everything*. To delete all objects you can use ``make
|
to recompile *everything*. To delete all objects, you can use ``make
|
||||||
clean-<machine>``.
|
clean-<machine>``.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Before the actual compilation starts, LAMMPS will perform several
|
Before the actual compilation starts, LAMMPS will perform several
|
||||||
steps to collect information from the configuration and setup that
|
steps to collect information from the configuration and setup that is
|
||||||
is then embedded into the executable. When you build LAMMPS for
|
then embedded into the executable. When you build LAMMPS for the
|
||||||
the first time, it will also compile a tool to quickly assemble
|
first time, it will also compile a tool to quickly determine a list
|
||||||
a list of dependencies, that are required for the make program to
|
of dependencies. Those are required for the make program to
|
||||||
correctly detect which parts need to be recompiled after changes
|
correctly detect, which files need to be recompiled or relinked
|
||||||
were made to the sources.
|
after changes were made to the sources.
|
||||||
|
|
||||||
Customized builds and alternate makefiles
|
Customized builds and alternate makefiles
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The ``src/MAKE`` directory tree contains the ``Makefile.<machine>``
|
The ``src/MAKE`` directory tree contains the ``Makefile.<machine>``
|
||||||
files included in the LAMMPS distribution. Typing ``make example`` uses
|
files included in the LAMMPS distribution. Typing ``make example`` uses
|
||||||
``Makefile.example`` from one of those folders, if available. Thus the
|
``Makefile.example`` from one of those folders, if available. The
|
||||||
``make serial`` and ``make mpi`` lines above use
|
``make serial`` and ``make mpi`` lines above, for example, use
|
||||||
``src/MAKE/Makefile.serial`` and ``src/MAKE/Makefile.mpi``,
|
``src/MAKE/Makefile.serial`` and ``src/MAKE/Makefile.mpi``,
|
||||||
respectively. Other makefiles are in these directories:
|
respectively. Other makefiles are in these directories:
|
||||||
|
|
||||||
@ -106,17 +107,18 @@ a new name, please edit the first line with the description and machine
|
|||||||
name, so you will not confuse yourself, when looking at the machine
|
name, so you will not confuse yourself, when looking at the machine
|
||||||
summary.
|
summary.
|
||||||
|
|
||||||
Makefiles you may wish to try include these (some require a package
|
Makefiles you may wish to try out, include those listed below (some
|
||||||
first be installed). Many of these include specific compiler flags
|
require a package first be installed). Many of these include specific
|
||||||
for optimized performance. Please note, however, that some of these
|
compiler flags for optimized performance. Please note, however, that
|
||||||
customized machine Makefile are contributed by users. Since both
|
some of these customized machine Makefile are contributed by users, and
|
||||||
compilers, OS configurations, and LAMMPS itself keep changing, their
|
thus may have modifications specific to the systems of those users.
|
||||||
settings may become outdated:
|
Since compilers, OS configurations, and LAMMPS itself keep changing,
|
||||||
|
their settings may become outdated, too:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
make mac # build serial LAMMPS on a Mac
|
make mac # build serial LAMMPS on macOS
|
||||||
make mac_mpi # build parallel LAMMPS on a Mac
|
make mac_mpi # build parallel LAMMPS on macOS
|
||||||
make intel_cpu # build with the INTEL package optimized for CPUs
|
make intel_cpu # build with the INTEL package optimized for CPUs
|
||||||
make knl # build with the INTEL package optimized for KNLs
|
make knl # build with the INTEL package optimized for KNLs
|
||||||
make opt # build with the OPT package optimized for CPUs
|
make opt # build with the OPT package optimized for CPUs
|
||||||
|
|||||||
@ -2,7 +2,7 @@ Build the LAMMPS documentation
|
|||||||
==============================
|
==============================
|
||||||
|
|
||||||
Depending on how you obtained LAMMPS and whether you have built the
|
Depending on how you obtained LAMMPS and whether you have built the
|
||||||
manual yourself, this directory has a number of sub-directories and
|
manual yourself, this directory has a number of subdirectories and
|
||||||
files. Here is a list with descriptions:
|
files. Here is a list with descriptions:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
@ -33,7 +33,7 @@ various tools and files. Some of them have to be installed (see below). For
|
|||||||
the rest the build process will attempt to download and install them into
|
the rest the build process will attempt to download and install them into
|
||||||
a python virtual environment and local folders.
|
a python virtual environment and local folders.
|
||||||
|
|
||||||
A current version of the manual (latest patch release, that is the state
|
A current version of the manual (latest feature release, that is the state
|
||||||
of the *release* branch) is is available online at:
|
of the *release* branch) is is available online at:
|
||||||
`https://docs.lammps.org/ <https://docs.lammps.org/>`_.
|
`https://docs.lammps.org/ <https://docs.lammps.org/>`_.
|
||||||
A version of the manual corresponding to the ongoing development (that is
|
A version of the manual corresponding to the ongoing development (that is
|
||||||
@ -48,18 +48,15 @@ Build using GNU make
|
|||||||
|
|
||||||
The LAMMPS manual is written in `reStructuredText <rst_>`_ format which
|
The LAMMPS manual is written in `reStructuredText <rst_>`_ format which
|
||||||
can be translated to different output format using the `Sphinx
|
can be translated to different output format using the `Sphinx
|
||||||
<sphinx_>`_ document generator tool. It also incorporates programmer
|
<https://www.sphinx-doc.org/>`_ document generator tool. It also
|
||||||
documentation extracted from the LAMMPS C++ sources through the `Doxygen
|
incorporates programmer documentation extracted from the LAMMPS C++
|
||||||
<https://doxygen.nl>`_ program. Currently the translation to HTML, PDF
|
sources through the `Doxygen <https://doxygen.nl/>`_ program. Currently
|
||||||
(via LaTeX), ePUB (for many e-book readers) and MOBI (for Amazon Kindle
|
the translation to HTML, PDF (via LaTeX), ePUB (for many e-book readers)
|
||||||
readers) are supported. For that to work a Python 3 interpreter, the
|
and MOBI (for Amazon Kindle readers) are supported. For that to work a
|
||||||
``doxygen`` tools and internet access to download additional files and
|
Python interpreter version 3.8 or later, the ``doxygen`` tools and
|
||||||
tools are required. This download is usually only required once or
|
internet access to download additional files and tools are required.
|
||||||
after the documentation folder is returned to a pristine state with
|
This download is usually only required once or after the documentation
|
||||||
``make clean-all``.
|
folder is returned to a pristine state with ``make clean-all``.
|
||||||
|
|
||||||
.. _rst: https://docutils.readthedocs.io/en/sphinx-docs/user/rst/quickstart.html
|
|
||||||
.. _sphinx: https://www.sphinx-doc.org
|
|
||||||
|
|
||||||
For the documentation build a python virtual environment is set up in
|
For the documentation build a python virtual environment is set up in
|
||||||
the folder ``doc/docenv`` and various python packages are installed into
|
the folder ``doc/docenv`` and various python packages are installed into
|
||||||
@ -90,6 +87,7 @@ folder. The following ``make`` commands are available:
|
|||||||
make anchor_check # check for duplicate anchor labels
|
make anchor_check # check for duplicate anchor labels
|
||||||
make style_check # check for complete and consistent style lists
|
make style_check # check for complete and consistent style lists
|
||||||
make package_check # check for complete and consistent package lists
|
make package_check # check for complete and consistent package lists
|
||||||
|
make link_check # check for broken or outdated URLs
|
||||||
make spelling # spell-check the manual
|
make spelling # spell-check the manual
|
||||||
|
|
||||||
----------
|
----------
|
||||||
@ -128,38 +126,29 @@ common setups:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
sudo apt-get install python-virtualenv git doxygen
|
sudo apt-get install git doxygen
|
||||||
|
|
||||||
.. tab:: RHEL or CentOS (Version 7.x)
|
.. tab:: RHEL or CentOS (Version 7.x)
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
sudo yum install python3-virtualenv git doxygen
|
sudo yum install git doxygen
|
||||||
|
|
||||||
.. tab:: Fedora or RHEL/CentOS (8.x or later)
|
.. tab:: Fedora or RHEL/CentOS (8.x or later)
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
sudo dnf install python3-virtualenv git doxygen
|
sudo dnf install git doxygen
|
||||||
|
|
||||||
.. tab:: MacOS X
|
.. tab:: macOS
|
||||||
|
|
||||||
*Python 3*
|
*Python 3*
|
||||||
|
|
||||||
Download the latest Python 3 MacOS X package from
|
If Python 3 is not available on your macOS system, you can
|
||||||
|
download the latest Python 3 macOS package from
|
||||||
`https://www.python.org <https://www.python.org>`_ and install it.
|
`https://www.python.org <https://www.python.org>`_ and install it.
|
||||||
This will install both Python 3 and pip3.
|
This will install both Python 3 and pip3.
|
||||||
|
|
||||||
*virtualenv*
|
|
||||||
|
|
||||||
Once Python 3 is installed, open a Terminal and type
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
pip3 install virtualenv
|
|
||||||
|
|
||||||
This will install virtualenv from the Python Package Index.
|
|
||||||
|
|
||||||
Prerequisites for PDF
|
Prerequisites for PDF
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
@ -179,7 +168,7 @@ math expressions transparently into embedded images.
|
|||||||
For converting the generated ePUB file to a MOBI format file (for e-book
|
For converting the generated ePUB file to a MOBI format file (for e-book
|
||||||
readers, like Kindle, that cannot read ePUB), you also need to have the
|
readers, like Kindle, that cannot read ePUB), you also need to have the
|
||||||
``ebook-convert`` tool from the "calibre" software
|
``ebook-convert`` tool from the "calibre" software
|
||||||
installed. `http://calibre-ebook.com/ <http://calibre-ebook.com/>`_
|
installed. `https://calibre-ebook.com/ <https://calibre-ebook.com/>`_
|
||||||
Typing ``make mobi`` will first create the ePUB file and then convert
|
Typing ``make mobi`` will first create the ePUB file and then convert
|
||||||
it. On the Kindle readers in particular, you also have support for PDF
|
it. On the Kindle readers in particular, you also have support for PDF
|
||||||
files, so you could download and view the PDF version as an alternative.
|
files, so you could download and view the PDF version as an alternative.
|
||||||
@ -219,9 +208,20 @@ be multiple tests run automatically:
|
|||||||
- A test that only standard, printable ASCII text characters are used.
|
- A test that only standard, printable ASCII text characters are used.
|
||||||
This runs the command ``env LC_ALL=C grep -n '[^ -~]' src/*.rst`` and
|
This runs the command ``env LC_ALL=C grep -n '[^ -~]' src/*.rst`` and
|
||||||
thus prints all offending lines with filename and line number
|
thus prints all offending lines with filename and line number
|
||||||
prepended to the screen. Special characters like the Angstrom
|
prepended to the screen. Special characters like Greek letters
|
||||||
:math:`\mathrm{\mathring{A}}` should be typeset with embedded math
|
(:math:`\alpha~~\sigma~~\epsilon`), super- or subscripts
|
||||||
(like this ``:math:`\mathrm{\mathring{A}}```\ ).
|
(:math:`x^2~~\mathrm{U}_{LJ}`), mathematical expressions
|
||||||
|
(:math:`\frac{1}{2}\mathrm{N}~~x\to\infty`), or the Angstrom symbol
|
||||||
|
(:math:`\AA`) should be typeset with embedded LaTeX (like this
|
||||||
|
``:math:`\alpha \sigma \epsilon```, ``:math:`x^2 \mathrm{E}_{LJ}```,
|
||||||
|
``:math:`\frac{1}{2}\mathrm{N} x\to\infty```, or ``:math:`\AA```\ ).
|
||||||
|
|
||||||
|
- Embedded LaTeX is rendered in HTML output with `MathJax
|
||||||
|
<https://www.mathjax.org/>`_ and in PDF output by passing the embedded
|
||||||
|
text to LaTeX. Some care has to be taken, though, since there are
|
||||||
|
limitations which macros and features can be used in either mode, so
|
||||||
|
it is recommended to always check whether any new or changed
|
||||||
|
documentation does translate and render correctly with either output.
|
||||||
|
|
||||||
- A test whether all styles are documented and listed in their
|
- A test whether all styles are documented and listed in their
|
||||||
respective overview pages. A typical output with warnings looks like this:
|
respective overview pages. A typical output with warnings looks like this:
|
||||||
@ -252,6 +252,5 @@ manual with ``make spelling``. This requires `a library called enchant
|
|||||||
positives* (e.g. keywords, names, abbreviations) those can be added to
|
positives* (e.g. keywords, names, abbreviations) those can be added to
|
||||||
the file ``lammps/doc/utils/sphinx-config/false_positives.txt``.
|
the file ``lammps/doc/utils/sphinx-config/false_positives.txt``.
|
||||||
|
|
||||||
.. _rst: https://docutils.readthedocs.io/en/sphinx-docs/user/rst/quickstart.html
|
|
||||||
|
|
||||||
.. _lws: https://www.lammps.org
|
.. _lws: https://www.lammps.org
|
||||||
|
.. _rst: https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user