]> SALOME platform Git repositories - tools/medcoupling.git/blob - src/ParaMEDMEMTest/CMakeLists.txt
Salome HOME
119dce22c04f55600a4b8e93b3b29567f5746b65
[tools/medcoupling.git] / src / ParaMEDMEMTest / CMakeLists.txt
1 # Copyright (C) 2012-2020  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 ADD_DEFINITIONS(${MPI_DEFINITIONS} ${CPPUNIT_DEFINITIONS})
21
22 INCLUDE_DIRECTORIES(
23   ${MPI_INCLUDE_DIRS}
24   ${CPPUNIT_INCLUDE_DIRS}
25   ${CMAKE_CURRENT_SOURCE_DIR}/../ParaMEDLoader
26   ${CMAKE_CURRENT_SOURCE_DIR}/../ParaMEDMEM
27   ${CMAKE_CURRENT_SOURCE_DIR}/../MEDLoader
28   ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling
29   ${CMAKE_CURRENT_SOURCE_DIR}/../ICoCo
30   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL
31   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Bases
32   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNELTest   # for TestIKUtils.hxx
33   )
34
35 SET(ParaMEDMEMTest_SOURCES
36   ParaMEDMEMTest.cxx
37   ParaMEDMEMTest_MPIProcessorGroup.cxx
38   ParaMEDMEMTest_BlockTopology.cxx
39   ParaMEDMEMTest_InterpKernelDEC.cxx
40   ParaMEDMEMTest_StructuredCoincidentDEC.cxx
41   ParaMEDMEMTest_ICoco.cxx
42   ParaMEDMEMTest_Gauthier1.cxx
43   ParaMEDMEMTest_FabienAPI.cxx
44   ParaMEDMEMTest_NonCoincidentDEC.cxx
45   ParaMEDMEMTest_OverlapDEC.cxx
46   MPIAccessDECTest.cxx
47   test_AllToAllDEC.cxx
48   test_AllToAllvDEC.cxx
49   test_AllToAllTimeDEC.cxx
50   test_AllToAllvTimeDEC.cxx
51   test_AllToAllvTimeDoubleDEC.cxx
52   MPIAccessTest.cxx
53   test_MPI_Access_Send_Recv.cxx
54   test_MPI_Access_Cyclic_Send_Recv.cxx
55   test_MPI_Access_SendRecv.cxx
56   test_MPI_Access_ISend_IRecv.cxx
57   test_MPI_Access_Cyclic_ISend_IRecv.cxx
58   test_MPI_Access_ISendRecv.cxx
59   test_MPI_Access_Probe.cxx
60   test_MPI_Access_IProbe.cxx
61   test_MPI_Access_Cancel.cxx
62   test_MPI_Access_Send_Recv_Length.cxx
63   test_MPI_Access_ISend_IRecv_Length.cxx
64   test_MPI_Access_ISend_IRecv_Length_1.cxx
65   test_MPI_Access_Time.cxx
66   test_MPI_Access_Time_0.cxx
67   test_MPI_Access_ISend_IRecv_BottleNeck.cxx
68   )
69
70 ADD_LIBRARY(ParaMEDMEMTest ${ParaMEDMEMTest_SOURCES})
71 SET_TARGET_PROPERTIES(ParaMEDMEMTest PROPERTIES COMPILE_FLAGS "")
72 TARGET_LINK_LIBRARIES(ParaMEDMEMTest paramedmem paramedloader medcouplingremapper InterpKernelTestUtils ${CPPUNIT_LIBRARIES})
73 INSTALL(TARGETS ParaMEDMEMTest DESTINATION ${MEDCOUPLING_INSTALL_LIBS})
74
75 SET(TESTSParaMEDMEM)
76 SET(TestParaMEDMEM_SOURCES
77   TestParaMEDMEM.cxx
78   )
79 SET(TESTSParaMEDMEM ${TESTSParaMEDMEM} TestParaMEDMEM)
80
81 SET(TestMPIAccessDEC_SOURCES
82   TestMPIAccessDEC.cxx
83   )
84 SET(TESTSParaMEDMEM ${TESTSParaMEDMEM} TestMPIAccessDEC)
85
86 SET(TestMPIAccess_SOURCES
87   TestMPIAccess.cxx
88   )
89 SET(TESTSParaMEDMEM ${TESTSParaMEDMEM} TestMPIAccess)
90
91 SET(test_perf_SOURCES
92   test_perf.cxx
93   )
94 SET(TESTSParaMEDMEM ${TESTSParaMEDMEM} test_perf)
95
96 IF(MPI2_IS_OK)
97   SET(ParaMEDMEMTestMPI2_1_SOURCES
98     MPI2Connector.cxx
99     ParaMEDMEMTestMPI2_1.cxx
100     )
101   SET(TESTSParaMEDMEM ${TESTSParaMEDMEM} ParaMEDMEMTestMPI2_1)
102
103   SET(ParaMEDMEMTestMPI2_2_SOURCES
104     MPI2Connector.cxx
105     ParaMEDMEMTestMPI2_2.cxx
106     )
107   SET(TESTSParaMEDMEM ${TESTSParaMEDMEM} ParaMEDMEMTestMPI2_2)
108 ENDIF(MPI2_IS_OK)
109
110 FOREACH(bintestparamem ${TESTSParaMEDMEM})
111   ADD_EXECUTABLE(${bintestparamem} ${${bintestparamem}_SOURCES})
112   TARGET_LINK_LIBRARIES(${bintestparamem} ParaMEDMEMTest)
113 ENDFOREACH(bintestparamem ${TESTSParaMEDMEM})
114
115 # Now add CMake tests - test_perf, ParaMEDMEMTestMPI2_1 and ParaMEDMEMTestMPI2_2
116 # are left aside, as they are too specific
117 #
118 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
119
120 #  -- some tests require 2, 3, 4 or 5 procs --
121 # MPICH does not support --oversubscribe:
122 IF(NOT ${MPIEXEC_EXECUTABLE} MATCHES "mpich")
123     SET(_oversub_opt "--oversubscribe")
124 ENDIF()
125
126 ADD_TEST(NAME TestParaMEDMEM_Proc2 COMMAND ${MPIEXEC} -np 2  ${_oversub_opt} $<TARGET_FILE:TestParaMEDMEM>)
127 SET_TESTS_PROPERTIES(TestParaMEDMEM_Proc2 PROPERTIES ENVIRONMENT "${tests_env}")
128 ADD_TEST(NAME TestParaMEDMEM_Proc3 COMMAND ${MPIEXEC} -np 3 ${_oversub_opt} $<TARGET_FILE:TestParaMEDMEM>)
129 SET_TESTS_PROPERTIES(TestParaMEDMEM_Proc3 PROPERTIES ENVIRONMENT "${tests_env}")
130 ADD_TEST(NAME TestParaMEDMEM_Proc4 COMMAND ${MPIEXEC} -np 4 ${_oversub_opt} $<TARGET_FILE:TestParaMEDMEM>)
131 SET_TESTS_PROPERTIES(TestParaMEDMEM_Proc4 PROPERTIES ENVIRONMENT "${tests_env}")
132 ADD_TEST(NAME TestParaMEDMEM_Proc5 COMMAND ${MPIEXEC} -np 5 ${_oversub_opt} $<TARGET_FILE:TestParaMEDMEM>)
133 SET_TESTS_PROPERTIES(TestParaMEDMEM_Proc5 PROPERTIES ENVIRONMENT "${tests_env}")
134
135 ADD_TEST(NAME TestMPIAccess_Proc2 COMMAND ${MPIEXEC} -np 2 ${_oversub_opt} $<TARGET_FILE:TestMPIAccess>)
136 SET_TESTS_PROPERTIES(TestMPIAccess_Proc2 PROPERTIES ENVIRONMENT "${tests_env}")
137 ADD_TEST(NAME TestMPIAccess_Proc3 COMMAND ${MPIEXEC} -np 3 ${_oversub_opt} $<TARGET_FILE:TestMPIAccess>)
138 SET_TESTS_PROPERTIES(TestMPIAccess_Proc3 PROPERTIES ENVIRONMENT "${tests_env}")
139
140 ADD_TEST(NAME TestMPIAccessDEC_Proc4 COMMAND ${MPIEXEC} -np 4 ${_oversub_opt} $<TARGET_FILE:TestMPIAccessDEC>)
141 SET_TESTS_PROPERTIES(TestMPIAccessDEC_Proc4 PROPERTIES ENVIRONMENT "${tests_env}")
142
143 # Installation rules
144 INSTALL(TARGETS ${TESTSParaMEDMEM} DESTINATION ${MEDCOUPLING_INSTALL_BINS})
145 SET(COMMON_HEADERS_HXX
146   MPIMainTest.hxx
147   MPIAccessDECTest.hxx
148   MPIAccessTest.hxx
149   ParaMEDMEMTest.hxx
150   MPI2Connector.hxx
151 )
152 INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
153
154 # Application tests
155
156 SET(TEST_INSTALL_DIRECTORY ${MEDCOUPLING_INSTALL_TESTS}/ParaMEDMEMTest)
157 INSTALL(TARGETS ${TESTSParaMEDMEM} DESTINATION ${TEST_INSTALL_DIRECTORY})
158
159 # export MPIEXEC and _oversub_opt to CTestTestfile.cmake of salome test mechanism
160 CONFIGURE_FILE(CTestTestfileInstall.cmake.in "CTestTestfileST.cmake" @ONLY)
161 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfileST.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake)