From 11341a5b6651cbdab242a6ea1a195fc3357fe55b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 10 Feb 2021 08:57:14 -0500 Subject: [PATCH] enforce documented Python version requirement for MLIAP with Python --- cmake/Modules/Packages/MLIAP.cmake | 11 ++++++++++- doc/src/Packages_details.rst | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/Packages/MLIAP.cmake b/cmake/Modules/Packages/MLIAP.cmake index d3f601a1e1..81bb10cb8f 100644 --- a/cmake/Modules/Packages/MLIAP.cmake +++ b/cmake/Modules/Packages/MLIAP.cmake @@ -1,7 +1,7 @@ # if PYTHON package is included we may also include Python support in MLIAP set(MLIAP_ENABLE_PYTHON_DEFAULT OFF) if(PKG_PYTHON) - find_package(Cythonize) + find_package(Cythonize QUIET) if(Cythonize_FOUND) set(MLIAP_ENABLE_PYTHON_DEFAULT ON) endif() @@ -14,6 +14,15 @@ if(MLIAP_ENABLE_PYTHON) if(NOT PKG_PYTHON) message(FATAL_ERROR "Must enable PYTHON package for including Python support in MLIAP") endif() + if(CMAKE_VERSION VERSION_LESS 3.12) + if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3.6) + message(FATAL_ERROR "Python support in MLIAP requires Python 3.6 or later") + endif() + else() + if(Python_VERSION VERSION_LESS 3.6) + message(FATAL_ERROR "Python support in MLIAP requires Python 3.6 or later") + endif() + endif() set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython) set(MLIAP_CYTHON_SRC ${LAMMPS_SOURCE_DIR}/MLIAP/mliap_model_python_couple.pyx) diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index e044adfcb3..455df083e4 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -668,8 +668,8 @@ A general interface for machine-learning interatomic potentials, including PyTor To use this package, also the :ref:`SNAP package ` package needs to be installed. To make the *mliappy* model available, also the -:ref:`PYTHON package ` package needs to be installed, the version of -Python must be 3.6 or later, and the `cython `_ software +:ref:`PYTHON package ` package needs to be installed, the version +of Python must be 3.6 or later, and the `cython `_ software must be installed. **Author:** Aidan Thompson (Sandia), Nicholas Lubbers (LANL).