1 # The first argument sets the name of the target for CMake bookkeeping purposes. It is the default name of the
2 # shared object library that is produced, but we can override that. There is no particular reason to
3 # change "gmxapi_extension" here unless you need different CMake target names to build several modules in
5 pybind11_add_module(gmxapi_extension MODULE export_plugin.cpp)
7 # Set the name of the shared object library (and the name of the Python module) to "myplugin".
8 # If you change "myplugin" you must also change the argument to the macro ``PYBIND11_MODULE(myplugin, m)`` in
10 set_target_properties(gmxapi_extension PROPERTIES OUTPUT_NAME myplugin)
12 # We can't easily/reliably let a debug build of a Python module have a "d" suffix and still be importable with the same
14 set_target_properties(gmxapi_extension PROPERTIES DEBUG_POSTFIX "")
16 # We expect to be building against an installed GROMACS that we will continue to dynamically link against at runtime.
17 set_target_properties(gmxapi_extension PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
18 set_target_properties(gmxapi_extension PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
20 # The Python module requires the new library we wrote as well as the gmxapi that we found in the top-level
22 target_link_libraries(gmxapi_extension PRIVATE Gromacs::gmxapi gmxapi_extension_ensemblepotential)
24 if(GMXAPI_EXTENSION_MASTER_PROJECT)
25 install(TARGETS gmxapi_extension
26 LIBRARY DESTINATION ${GMXPLUGIN_INSTALL_PATH}
27 ARCHIVE DESTINATION ${GMXPLUGIN_INSTALL_PATH}
28 RUNTIME DESTINATION ${GMXPLUGIN_INSTALL_PATH}