Add helper functions for setting up Nbnxm gpu object in nblib
[alexxy/gromacs.git] / api / nblib / tests / CMakeLists.txt
1 #
2 # This file is part of the GROMACS molecular simulation package.
3 #
4 # Copyright (c) 2020,2021, by the GROMACS development team, led by
5 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 # and including many others, as listed in the AUTHORS file in the
7 # top-level source directory and at http://www.gromacs.org.
8 #
9 # GROMACS is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public License
11 # as published by the Free Software Foundation; either version 2.1
12 # of the License, or (at your option) any later version.
13 #
14 # GROMACS is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # Lesser General Public License for more details.
18 #
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with GROMACS; if not, see
21 # http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23 #
24 # If you want to redistribute modifications to GROMACS, please
25 # consider that scientific software is very special. Version
26 # control is crucial - bugs must be traceable. We will be happy to
27 # consider code for inclusion in the official distribution, but
28 # derived work must not be called official GROMACS. Details are found
29 # in the README & COPYING files - if they are missing, get the
30 # official version at http://www.gromacs.org.
31 #
32 # To help us fund GROMACS development, we humbly ask that you cite
33 # the research papers on the package. Check out http://www.gromacs.org.
34
35 # \author Victor Holanda <victor.holanda@cscs.ch>
36 # \author Joe Jordan <ejjordan@kth.se>
37 # \author Prashanth Kanduri <kanduri@cscs.ch>
38 # \author Sebastian Keller <keller@cscs.ch>
39 #
40
41 # Make a static library for test infrastructure code that we re-use
42 # in multiple test executables across the repository.
43 gmx_add_unit_test_library(nblib_test_infrastructure
44         testsystems.cpp
45     )
46 target_include_directories(nblib_test_infrastructure PRIVATE ${PROJECT_SOURCE_DIR}/api)
47 target_include_directories(nblib_test_infrastructure SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
48 target_link_libraries(nblib_test_infrastructure PUBLIC legacy_api)
49
50 set(testname "NbLibSetupTests")
51 set(exename "nblib-setup-test")
52
53 gmx_add_gtest_executable(
54     ${exename}
55     HARDWARE_DETECTION
56     CPP_SOURCE_FILES
57     # files with code for tests
58         box.cpp
59         interactions.cpp
60         particletype.cpp
61         pbcholder.cpp
62         molecules.cpp
63         nbnxmsetup.cpp
64         topology.cpp
65         virials.cpp
66     )
67 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
68 target_link_libraries(${exename} PRIVATE nblib_test_infrastructure nblib)
69 target_include_directories(${exename} PRIVATE ${PROJECT_SOURCE_DIR}/api)
70 gmx_register_gtest_test(${testname} ${exename} INTEGRATION_TEST)
71 add_dependencies(nblib-tests ${exename})
72
73 set(exename "nblib-tpr-test")
74
75 gmx_add_unit_test(
76         NbLibTprTests
77         ${exename}
78         CPP_SOURCE_FILES
79         # files with code for tests
80         tpr.cpp
81 )
82 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
83 target_link_libraries(${exename} PRIVATE nblib_test_infrastructure nblib)
84 add_dependencies(nblib-tests ${exename})
85
86 set(testname "NbLibIntegrationTests")
87 set(exename "nblib-integration-test")
88
89 gmx_add_gtest_executable(
90     ${exename}
91     CPP_SOURCE_FILES
92     # files with code for tests
93         gmxcalculator.cpp
94         nbkernelsystem.cpp
95         simstate.cpp
96     )
97 target_link_libraries(${exename} PRIVATE nblib_test_infrastructure nblib)
98 target_include_directories(${exename} PRIVATE ${PROJECT_SOURCE_DIR}/api)
99 gmx_register_gtest_test(${testname} ${exename} INTEGRATION_TEST)
100 add_dependencies(nblib-tests ${exename})
101
102 # The integrator sometimes times out on TSAN so it gets its own test harness
103 set(testname "NbLibIntegratorTests")
104 set(exename "nblib-integrator-test")
105
106 gmx_add_gtest_executable(
107         ${exename}
108         CPP_SOURCE_FILES
109         integrator.cpp
110 )
111 target_link_libraries(${exename} PRIVATE nblib_test_infrastructure nblib)
112 target_include_directories(${exename} PRIVATE ${PROJECT_SOURCE_DIR}/api)
113 gmx_register_gtest_test(${testname} ${exename} INTEGRATION_TEST)
114 add_dependencies(nblib-tests ${exename})
115