# unit tests and by the Python module target defined in ../pythonmodule/CMakeLists.txt
# Create a shared object library for our restrained ensemble plugin.
-add_library(ensemblepotential STATIC
+add_library(gmxapi_extension_ensemblepotential STATIC
ensemblepotential.h
ensemblepotential.cpp
sessionresources.cpp)
-set_target_properties(ensemblepotential PROPERTIES POSITION_INDEPENDENT_CODE ON)
+set_target_properties(gmxapi_extension_ensemblepotential PROPERTIES POSITION_INDEPENDENT_CODE ON)
-target_include_directories(ensemblepotential PUBLIC
+target_include_directories(gmxapi_extension_ensemblepotential PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
# RPATH management
# don't skip the full RPATH for the build tree
-set_target_properties(ensemblepotential PROPERTIES SKIP_BUILD_RPATH FALSE)
+set_target_properties(gmxapi_extension_ensemblepotential PROPERTIES SKIP_BUILD_RPATH FALSE)
# (but later on when installing)
# If building with setuptools, CMake will not be performing the install
-set_target_properties(ensemblepotential PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
+set_target_properties(gmxapi_extension_ensemblepotential PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
-target_link_libraries(ensemblepotential PRIVATE Gromacs::gmxapi)
+target_link_libraries(gmxapi_extension_ensemblepotential PRIVATE Gromacs::gmxapi)
# The first argument sets the name of the target for CMake bookkeeping purposes. It is the default name of the
# shared object library that is produced, but we can override that. There is no particular reason to
-# change "sampleplugin" here unless you need different CMake target names to build several modules in
+# change "gmxapi_extension" here unless you need different CMake target names to build several modules in
# a single project.
-pybind11_add_module(sampleplugin MODULE export_plugin.cpp)
+pybind11_add_module(gmxapi_extension MODULE export_plugin.cpp)
# Set the name of the shared object library (and the name of the Python module) to "myplugin".
# If you change "myplugin" you must also change the argument to the macro ``PYBIND11_MODULE(myplugin, m)`` in
# export_plugin.cpp
-set_target_properties(sampleplugin PROPERTIES OUTPUT_NAME myplugin)
+set_target_properties(gmxapi_extension PROPERTIES OUTPUT_NAME myplugin)
# We can't easily/reliably let a debug build of a Python module have a "d" suffix and still be importable with the same
# name.
-set_target_properties(sampleplugin PROPERTIES DEBUG_POSTFIX "")
+set_target_properties(gmxapi_extension PROPERTIES DEBUG_POSTFIX "")
# We expect to be building against an installed GROMACS that we will continue to dynamically link against at runtime.
-set_target_properties(sampleplugin PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
-set_target_properties(sampleplugin PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+set_target_properties(gmxapi_extension PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
+set_target_properties(gmxapi_extension PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
# The Python module requires the new library we wrote as well as the gmxapi that we found in the top-level
# CMakeLists.txt
-target_link_libraries(sampleplugin PRIVATE Gromacs::gmxapi ensemblepotential)
+target_link_libraries(gmxapi_extension PRIVATE Gromacs::gmxapi gmxapi_extension_ensemblepotential)
if(GMXAPI_EXTENSION_MASTER_PROJECT)
- install(TARGETS sampleplugin
+ install(TARGETS gmxapi_extension
LIBRARY DESTINATION ${GMXPLUGIN_INSTALL_PATH}
ARCHIVE DESTINATION ${GMXPLUGIN_INSTALL_PATH}
RUNTIME DESTINATION ${GMXPLUGIN_INSTALL_PATH}
# TODO: (#2961) Let the Python package discover required resources instead of passing GMXBIN
get_target_property(GMXBIN gmx RUNTIME_OUTPUT_DIRECTORY)
get_target_property(GMXAPI_PYTHON_STAGING_DIR _gmxapi staging_dir)
-get_target_property(PLUGINPATH sampleplugin LIBRARY_OUTPUT_DIRECTORY)
+get_target_property(PLUGINPATH gmxapi_extension LIBRARY_OUTPUT_DIRECTORY)
add_custom_target(gmxapi_extension_pytest
COMMAND ${CMAKE_COMMAND} -E env GMXBIN=${GMXBIN} PYTHONPATH=${GMXAPI_PYTHON_STAGING_DIR}
${PYTHON_EXECUTABLE} -m pytest --log-cli-level ERROR ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS sampleplugin _gmxapi
+ DEPENDS gmxapi_extension _gmxapi
WORKING_DIRECTORY ${PLUGINPATH})
# The current test fixtures require the `gmx` tool-wrapper executable.
add_dependencies(gmxapi_extension_pytest gmx)
message(WARNING "Could not download test data: ${_download_log}")
endif()
unset(_status)
- add_custom_target(spc2_water_box
+ add_custom_target(gmxapi_extension_spc2_water_box
COMMAND cmake -E echo
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/topol.tpr
)
file(APPEND ${_mdp} "nsteps = 6")
set(_gro ${CMAKE_SOURCE_DIR}/src/testutils/simulationdatabase/spc2.gro)
set(_top ${CMAKE_SOURCE_DIR}/src/testutils/simulationdatabase/spc2.top)
- add_custom_target(spc2_water_box
+ add_custom_target(gmxapi_extension_spc2_water_box
BYPRODUCTS topol.tpr
COMMAND gmx -quiet grompp -f ${_mdp} -c ${_gro} -p ${_top}
DEPENDS gmx ${_mdp}
configure_file(testingconfiguration.in.h testingconfiguration.h)
# Test that the library can access its dependencies and build.
-add_executable(library-test test_binding.cpp)
-add_dependencies(library-test spc2_water_box)
-target_include_directories(library-test PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
-target_link_libraries(library-test Gromacs::gmxapi GTest::Main)
-gtest_add_tests(TARGET library-test
+add_executable(gmxapi_extension_library-test test_binding.cpp)
+add_dependencies(gmxapi_extension_library-test gmxapi_extension_spc2_water_box)
+target_include_directories(gmxapi_extension_library-test PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+target_link_libraries(gmxapi_extension_library-test Gromacs::gmxapi GTest::Main)
+gtest_add_tests(TARGET gmxapi_extension_library-test
TEST_LIST BasicPlugin)
# Test the C++ force evaluation for the restrained-ensemble biasing potential.
-add_executable(histogram-test test_histogram.cpp)
-add_dependencies(histogram-test spc2_water_box)
-target_include_directories(histogram-test PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
-set_target_properties(histogram-test PROPERTIES SKIP_BUILD_RPATH FALSE)
-target_link_libraries(histogram-test ensemblepotential Gromacs::gmxapi
+add_executable(gmxapi_extension_histogram-test test_histogram.cpp)
+add_dependencies(gmxapi_extension_histogram-test gmxapi_extension_spc2_water_box)
+target_include_directories(gmxapi_extension_histogram-test PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+set_target_properties(gmxapi_extension_histogram-test PROPERTIES SKIP_BUILD_RPATH FALSE)
+target_link_libraries(gmxapi_extension_histogram-test gmxapi_extension_ensemblepotential Gromacs::gmxapi
GTest::Main)
-gtest_add_tests(TARGET histogram-test
+gtest_add_tests(TARGET gmxapi_extension_histogram-test
TEST_LIST EnsembleHistogramPotentialPlugin)
# Test the flat-bottom bounding potential built in to the ensemble restraint.
-add_executable(bounding-test test_bounding_restraint.cpp)
-add_dependencies(bounding-test spc2_water_box)
-target_include_directories(bounding-test PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
-set_target_properties(bounding-test PROPERTIES SKIP_BUILD_RPATH FALSE)
-target_link_libraries(bounding-test ensemblepotential Gromacs::gmxapi
+add_executable(gmxapi_extension_bounding-test test_bounding_restraint.cpp)
+add_dependencies(gmxapi_extension_bounding-test gmxapi_extension_spc2_water_box)
+target_include_directories(gmxapi_extension_bounding-test PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+set_target_properties(gmxapi_extension_bounding-test PROPERTIES SKIP_BUILD_RPATH FALSE)
+target_link_libraries(gmxapi_extension_bounding-test gmxapi_extension_ensemblepotential Gromacs::gmxapi
GTest::Main)
-gtest_add_tests(TARGET bounding-test
+gtest_add_tests(TARGET gmxapi_extension_bounding-test
TEST_LIST EnsembleBoundingPotentialPlugin)
if (NOT GMXAPI_EXTENSION_MASTER_PROJECT)