status.cpp
system.cpp
version.cpp
- # pseudo-library for code for testing mdrun
- $<TARGET_OBJECTS:mdrun_test_objlib>
# pseudo-library for code for mdrun
$<TARGET_OBJECTS:mdrun_objlib>
)
${CMAKE_CURRENT_SOURCE_DIR})
# Link against the gmxapi libraries and get access to its public (installed) headers.
-target_link_libraries(gmxapi-test Gromacs::gmxapi)
+target_link_libraries(gmxapi-test PRIVATE Gromacs::gmxapi mdrun_test_infrastructure)
gmx_register_gtest_test(GmxapiExternalInterfaceTests gmxapi-test OPENMP_THREADS 2 INTEGRATION_TEST)
status.cpp
system.cpp
version.cpp
- # pseudo-library for code for testing mdrun
- $<TARGET_OBJECTS:mdrun_test_objlib>
# pseudo-library for code for mdrun
$<TARGET_OBJECTS:mdrun_objlib>
)
target_include_directories(gmxapi-mpi-test PRIVATE
${CMAKE_CURRENT_SOURCE_DIR})
-target_link_libraries(gmxapi-mpi-test Gromacs::gmxapi)
+target_link_libraries(gmxapi-mpi-test PRIVATE Gromacs::gmxapi mdrun_test_infrastructure)
gmx_register_gtest_test(GmxapiMpiTests gmxapi-mpi-test MPI_RANKS 2 OPENMP_THREADS 2 INTEGRATION_TEST)
gmx_add_gtest_executable(
workflow-details-test
workflow.cpp
- # pseudo-library for code for testing mdrun
- $<TARGET_OBJECTS:mdrun_test_objlib>
# pseudo-library for code for mdrun
$<TARGET_OBJECTS:mdrun_objlib>
)
-target_link_libraries(workflow-details-test Gromacs::gmxapi gmxapi-detail)
+target_link_libraries(workflow-details-test PRIVATE Gromacs::gmxapi gmxapi-detail mdrun_test_infrastructure)
gmx_register_gtest_test(GmxapiInternalInterfaceTests workflow-details-test OPENMP_THREADS 2 INTEGRATION_TEST)
gmx_add_gtest_executable(
workflow-details-mpi-test MPI
workflow.cpp
- # pseudo-library for code for testing mdrun
- $<TARGET_OBJECTS:mdrun_test_objlib>
# pseudo-library for code for mdrun
$<TARGET_OBJECTS:mdrun_objlib>
)
-target_link_libraries(workflow-details-mpi-test Gromacs::gmxapi gmxapi-detail)
+target_link_libraries(workflow-details-mpi-test PRIVATE Gromacs::gmxapi gmxapi-detail mdrun_test_infrastructure)
gmx_register_gtest_test(GmxapiInternalsMpiTests workflow-details-mpi-test MPI_RANKS 2 OPENMP_THREADS 2 INTEGRATION_TEST)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2011,2012,2013,2014, by the GROMACS development team, led by
+# Copyright (c) 2011,2012,2013,2014,2019, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-gmx_add_unit_test_object_library(analysisdata-test-shared
- datatest.cpp
- mock_datamodule.cpp)
+gmx_add_unit_test_library(analysisdata-test-shared
+ datatest.cpp
+ mock_datamodule.cpp)
gmx_add_unit_test(AnalysisDataUnitTests analysisdata-test
analysisdata.cpp
arraydata.cpp
average.cpp
histogram.cpp
- lifetime.cpp
- $<TARGET_OBJECTS:analysisdata-test-shared>)
+ lifetime.cpp)
+target_link_libraries(analysisdata-test PRIVATE analysisdata-test-shared)
cmdlineparser.cpp
cmdlineprogramcontext.cpp
filenm.cpp
- pargs.cpp
- $<TARGET_OBJECTS:onlinehelp-test-shared>)
+ pargs.cpp)
+target_link_libraries(commandline-test PRIVATE onlinehelp-test-shared)
)
if(GMX_USE_CUDA)
- target_link_libraries(gpu_utils-test gpu_utilstest_cuda)
+ target_link_libraries(gpu_utils-test PRIVATE gpu_utilstest_cuda)
endif()
if(GMX_USE_OPENCL)
- target_link_libraries(gpu_utils-test ${OpenCL_LIBRARIES})
+ target_link_libraries(gpu_utils-test PRIVATE ${OpenCL_LIBRARIES})
endif()
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-gmx_add_unit_test_object_library(mdrunutility-test-shared
- threadaffinitytest.cpp)
+gmx_add_unit_test_library(mdrunutility-test-shared
+ threadaffinitytest.cpp)
gmx_add_unit_test(MdrunUtilityUnitTests mdrunutility-test
- threadaffinity.cpp
- $<TARGET_OBJECTS:mdrunutility-test-shared>)
+ threadaffinity.cpp)
+target_link_libraries(mdrunutility-test PRIVATE mdrunutility-test-shared)
gmx_add_mpi_unit_test(MdrunUtilityMpiUnitTests mdrunutility-mpi-test 4
- threadaffinity_mpi.cpp
- $<TARGET_OBJECTS:mdrunutility-test-shared>)
+ threadaffinity_mpi.cpp)
+# TODO This target does not exist in a non-MPI build. It would be preferable
+# to change functions like gmx_add_mpi_unit_test to add link-time dependencies
+# as well as source files.
+if (GMX_MPI OR (GMX_THREAD_MPI AND GTEST_IS_THREADSAFE))
+ target_link_libraries(mdrunutility-mpi-test PRIVATE mdrunutility-test-shared)
+endif()
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2014,2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2012,2014,2015,2016,2019, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-gmx_add_unit_test_object_library(onlinehelp-test-shared
- mock_helptopic.cpp)
+gmx_add_unit_test_library(onlinehelp-test-shared
+ mock_helptopic.cpp)
gmx_add_unit_test(OnlineHelpUnitTests onlinehelp-test
helpformat.cpp
helpmanager.cpp
- helpwritercontext.cpp
- $<TARGET_OBJECTS:onlinehelp-test-shared>)
+ helpwritercontext.cpp)
+target_link_libraries(onlinehelp-test PRIVATE onlinehelp-test-shared)
surfacearea.cpp
topologyinformation.cpp
trajectory.cpp
- unionfind.cpp
- $<TARGET_OBJECTS:analysisdata-test-shared>)
+ unionfind.cpp)
+target_link_libraries(trajectoryanalysis-test PRIVATE analysisdata-test-shared)
add_executable(test_selection ${UNITTEST_TARGET_OPTIONS} test_selection.cpp)
-target_link_libraries(test_selection libgromacs ${GMX_EXE_LINKER_FLAGS})
+target_link_libraries(test_selection PRIVATE libgromacs ${GMX_EXE_LINKER_FLAGS})
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-# Make an "object library" for test infrastructure code that we re-use
-# in multiple test executables.
-add_library(mdrun_test_objlib OBJECT
+# Make a static library for test infrastructure code that we re-use
+# in multiple test executables across the repository.
+gmx_add_unit_test_library(mdrun_test_infrastructure
energyreader.cpp
energycomparison.cpp
moduletest.cpp
trajectorycomparison.cpp
trajectoryreader.cpp
)
-gmx_target_compile_options(mdrun_test_objlib)
-target_compile_definitions(mdrun_test_objlib PRIVATE HAVE_CONFIG_H)
-target_include_directories(mdrun_test_objlib SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
set(testname "MdrunTests")
set(exename "mdrun-test")
termination.cpp
trajectory_writing.cpp
mimic.cpp
- # pseudo-library for code for testing mdrun
- $<TARGET_OBJECTS:mdrun_test_objlib>
# pseudo-library for code for mdrun
$<TARGET_OBJECTS:mdrun_objlib>
)
+target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST)
# To avoid running into test timeouts, some end-to-end tests of mdrun
rerun.cpp
simple_mdrun.cpp
tpitest.cpp
- # pseudo-library for code for testing mdrun
- $<TARGET_OBJECTS:mdrun_test_objlib>
# pseudo-library for code for mdrun
$<TARGET_OBJECTS:mdrun_objlib>
)
+target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST)
# Tests that only make sense to run with multiple ranks and/or real
multisimtest.cpp
pmetest.cpp
replicaexchange.cpp
- # pseudo-library for code for testing mdrun
- $<TARGET_OBJECTS:mdrun_test_objlib>
# pseudo-library for code for mdrun
$<TARGET_OBJECTS:mdrun_objlib>
)
+target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST)
gmx_target_compile_options(testutils)
target_compile_definitions(testutils PRIVATE HAVE_CONFIG_H)
target_include_directories(testutils SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
-set(TESTUTILS_LIBS testutils)
set_property(TARGET testutils APPEND PROPERTY COMPILE_DEFINITIONS "${GMOCK_COMPILE_DEFINITIONS}")
set_property(TARGET testutils APPEND PROPERTY COMPILE_FLAGS "${GMOCK_COMPILE_FLAGS}")
target_link_libraries(testutils libgromacs ${GMX_COMMON_LIBRARIES} ${GMOCK_LIBRARIES})
set(TESTUTILS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(TESTUTILS_DIR ${TESTUTILS_DIR} PARENT_SCOPE)
-set(TESTUTILS_LIBS ${TESTUTILS_LIBS} PARENT_SCOPE)
set(GMX_CAN_RUN_MPI_TESTS ${GMX_CAN_RUN_MPI_TESTS} PARENT_SCOPE)
add_subdirectory(tests)
include(CMakeParseArguments)
-function (gmx_add_unit_test_object_library NAME)
+function (gmx_add_unit_test_library NAME)
if (GMX_BUILD_UNITTESTS AND BUILD_TESTING)
- add_library(${NAME} OBJECT ${UNITTEST_TARGET_OPTIONS} ${ARGN})
+ add_library(${NAME} STATIC ${UNITTEST_TARGET_OPTIONS} ${ARGN})
gmx_target_compile_options(${NAME})
- target_compile_options(${NAME} PRIVATE "${GMOCK_COMPILE_FLAGS}")
- target_compile_definitions(${NAME} PRIVATE HAVE_CONFIG_H "${GMOCK_COMPILE_DEFINITIONS}")
+ target_compile_options(${NAME} PUBLIC "${GMOCK_COMPILE_FLAGS}")
+ target_compile_definitions(${NAME} PRIVATE HAVE_CONFIG_H)
+ target_compile_definitions(${NAME} PUBLIC "${GMOCK_COMPILE_DEFINITIONS}")
target_include_directories(${NAME} SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include ${GMOCK_INCLUDE_DIRS})
+ target_link_libraries(${NAME} PUBLIC testutils)
endif()
endfunction ()
# headers so that no warnings are issued from them.
target_include_directories(${EXENAME} SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
- target_link_libraries(${EXENAME}
- ${TESTUTILS_LIBS} libgromacs ${GMOCK_LIBRARIES}
+ target_link_libraries(${EXENAME} PRIVATE
+ testutils libgromacs ${GMOCK_LIBRARIES}
${GMX_COMMON_LIBRARIES} ${GMX_EXE_LINKER_FLAGS})
if(GMX_CLANG_TIDY)