update build system to make it auto-adapt to include python support or not into MLIAP

This commit is contained in:
Axel Kohlmeyer
2020-12-07 17:35:10 -05:00
parent 3ed41295cd
commit 3f5a896aab
13 changed files with 112 additions and 28 deletions

View File

@ -26,7 +26,7 @@
#include <cstring>
#include <Python.h> // IWYU pragma: export
#ifdef LMP_MLIAPPY
#ifdef MLIAP_PYTHON
#include "mliap_model_python.h"
// The above should somehow really be included in the next file.
// We could get around this with cython --capi-reexport-cincludes
@ -58,14 +58,14 @@ PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp)
// one-time initialization of Python interpreter
// pyMain stores pointer to main module
external_interpreter = Py_IsInitialized();
#ifdef LMP_MLIAPPY
#ifdef MLIAP_PYTHON
// Inform python intialization scheme of the mliappy module.
// This -must- happen before python is initialized.
int err = PyImport_AppendInittab("mliap_model_python_couple", PyInit_mliap_model_python_couple);
if (err) error->all(FLERR,"Could not register MLIAPPY embedded python module.");
#endif
#endif
Py_Initialize();
PyEval_InitThreads();