Normalize sample_restraint target names.
authorM. Eric Irrgang <ericirrgang@gmail.com>
Wed, 16 Oct 2019 15:03:03 +0000 (18:03 +0300)
committerPaul Bauer <paul.bauer.q@gmail.com>
Fri, 1 Nov 2019 10:54:06 +0000 (11:54 +0100)
In the python_packaging/sample_restraint directory, add a uniform prefix
to help identify CMake targets related to the sample_restraint subproject
(configured with a GROMACS build when GMX_PYTHON_PACKAGING=ON). The
primary shared object library target is now named "gmxapi_extension".
Support and testing targets are now prefixed by "gmxapi_extension_".

Change-Id: Ie07caeb8c83e9ed754b96c6ce97099b8114d7fd4

python_packaging/sample_restraint/src/cpp/CMakeLists.txt
python_packaging/sample_restraint/src/pythonmodule/CMakeLists.txt
python_packaging/sample_restraint/tests/CMakeGROMACS.txt
python_packaging/sample_restraint/tests/CMakeLists.txt

index f550d4e6ac0905c36bfa6d3122a4141fcafdb0dd..9fac443fd75ae37d22d40b062cb347e9410130e1 100644 (file)
@@ -2,22 +2,22 @@
 # 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)
index 246e7e6770005e1b3056ec2988765527b7e58bbc..376b473e6e25ffee79161f913fc56a5299d64d24 100644 (file)
@@ -1,28 +1,28 @@
 # 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}
index 92ffe7e4464e2f0f4e889f60d278342e5f18d173..a12dedbaef12e4ba6322bc9798c7a2da973877c7 100644 (file)
@@ -20,11 +20,11 @@ endif()
 # 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)
index 7d915f3d0072fbc5bd3376a0801ac8d7202b6222..24446d74132c155ed71a92d2862d2b874952fbce 100644 (file)
@@ -64,7 +64,7 @@ if (GMXAPI_EXTENSION_MASTER_PROJECT)
         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
                       )
@@ -79,7 +79,7 @@ else()
     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}
@@ -94,31 +94,31 @@ endif ()
 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)