ef2ace7d19a30b4bd0a653694a8d6648cef10fd3
[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     CPP_SOURCE_FILES
56     # files with code for tests
57         box.cpp
58         interactions.cpp
59         particletype.cpp
60         pbcholder.cpp
61         molecules.cpp
62         nbnxmsetup.cpp
63         topology.cpp
64         tpr.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(testname "NbLibIntegrationTests")
74 set(exename "nblib-integration-test")
75
76 gmx_add_gtest_executable(
77     ${exename}
78     CPP_SOURCE_FILES
79     # files with code for tests
80         gmxcalculator.cpp
81         nbkernelsystem.cpp
82         simstate.cpp
83     )
84 target_link_libraries(${exename} PRIVATE nblib_test_infrastructure nblib)
85 target_include_directories(${exename} PRIVATE ${PROJECT_SOURCE_DIR}/api)
86 gmx_register_gtest_test(${testname} ${exename} INTEGRATION_TEST)
87 add_dependencies(nblib-tests ${exename})
88
89 # The integrator sometimes times out on TSAN so it gets its own test harness
90 set(testname "NbLibIntegratorTests")
91 set(exename "nblib-integrator-test")
92
93 gmx_add_gtest_executable(
94         ${exename}
95         CPP_SOURCE_FILES
96         integrator.cpp
97 )
98 target_link_libraries(${exename} PRIVATE nblib_test_infrastructure nblib)
99 target_include_directories(${exename} PRIVATE ${PROJECT_SOURCE_DIR}/api)
100 gmx_register_gtest_test(${testname} ${exename} INTEGRATION_TEST)
101 add_dependencies(nblib-tests ${exename})
102