Salome HOME
Addition of SCOTCH in MEDPartitioner.
[tools/medcoupling.git] / src / MEDPartitioner / CMakeLists.txt
1 # Copyright (C) 2012-2013  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.
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(${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${LIBXML2_DEFINITIONS})
21
22 INCLUDE_DIRECTORIES(
23   ${LIBXML2_INCLUDE_DIR}
24   ${MEDFILE_INCLUDE_DIRS}
25   ${HDF5_INCLUDE_DIRS}
26   ${PTHREADS_INCLUDE_DIRS}
27   ${CMAKE_CURRENT_SOURCE_DIR}/../MEDLoader
28   ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling
29   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL
30   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Bases
31   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Geometric2D
32   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/ExprEval
33   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/GaussPoints
34   )
35
36 IF(SALOME_MED_PARTITIONER_SCOTCH)
37   ADD_DEFINITIONS(${SCOTCH_DEFINITIONS})
38   ADD_DEFINITIONS("-DMED_ENABLE_SCOTCH")
39   INCLUDE_DIRECTORIES(${SCOTCH_INCLUDE_DIRS})
40 ENDIF(SALOME_MED_PARTITIONER_SCOTCH)
41
42 IF(SALOME_MED_PARTITIONER_METIS)
43   ADD_DEFINITIONS(${METIS_DEFINITIONS})
44   ADD_DEFINITIONS("-DMED_ENABLE_METIS")
45   INCLUDE_DIRECTORIES(${METIS_INCLUDE_DIRS})
46 ENDIF(SALOME_MED_PARTITIONER_METIS)
47
48 IF(MED_ENABLE_PARMETIS)
49   ADD_DEFINITIONS(${PARMETIS_DEFINITIONS})
50   INCLUDE_DIRECTORIES(${PARMETIS_INCLUDE_DIRS})
51 ENDIF(MED_ENABLE_PARMETIS)
52
53 IF(SALOME_USE_MPI)
54   ADD_DEFINITIONS(${MPI_DEFINITIONS})
55   ADD_DEFINITIONS("-DHAVE_MPI2")
56   INCLUDE_DIRECTORIES(${MPI_INCLUDE_DIRS})
57 ENDIF(SALOME_USE_MPI)
58
59 IF(SALOME_BUILD_TESTS)
60   ADD_SUBDIRECTORY(Test)
61 ENDIF(SALOME_BUILD_TESTS)
62
63 SET(medpartitionercpp_HEADERS_HXX
64   MEDPARTITIONER_MeshCollection.hxx
65   MEDPARTITIONER_MeshCollectionDriver.hxx
66   MEDPARTITIONER_MeshCollectionMedXmlDriver.hxx
67   MEDPARTITIONER_MeshCollectionMedAsciiDriver.hxx
68   MEDPARTITIONER_ParallelTopology.hxx
69   MEDPARTITIONER_JointFinder.hxx
70   MEDPARTITIONER_Graph.hxx
71   MEDPARTITIONER_UserGraph.hxx
72   MEDPARTITIONER_Utils.hxx
73   MEDPARTITIONER.hxx
74   MEDPARTITIONER_ParaDomainSelector.hxx
75   MEDPARTITIONER_ConnectZone.hxx
76   MEDPARTITIONER_SkyLineArray.hxx
77   MEDPARTITIONER_Topology.hxx
78   )
79
80 SET(medpartitionercpp_SOURCES
81   MEDPARTITIONER_MeshCollection.cxx
82   MEDPARTITIONER_MeshCollectionDriver.cxx
83   MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx
84   MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx
85   MEDPARTITIONER_ParallelTopology.cxx
86   MEDPARTITIONER_Graph.cxx
87   MEDPARTITIONER_UserGraph.cxx
88   MEDPARTITIONER_Utils.cxx
89   MEDPARTITIONER_ParaDomainSelector.cxx
90   MEDPARTITIONER_ConnectZone.cxx
91   MEDPARTITIONER_SkyLineArray.cxx
92   MEDPARTITIONER_metis.c
93   )
94
95 SET(medpartitionercpp_LDFLAGS
96   ${MEDFILE_C_LIBRARIES}
97   ${HDF5_LIBRARIES}
98   ${STDLIB}
99   ${LIBXML2_LIBRARIES}
100   ${MPI_LIBRARIES}
101   interpkernel
102   medcoupling
103   medloader
104 )
105 IF(MED_ENABLE_PARMETIS)
106   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_ParMetisGraph.hxx)
107   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_ParMetisGraph.cxx)
108   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${PARMETIS_DEFINITIONS}")
109   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${PARMETIS_LIBS})
110 ENDIF(MED_ENABLE_PARMETIS)
111 IF(SALOME_MED_PARTITIONER_METIS)
112   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_MetisGraph.hxx)
113   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_MetisGraph.cxx)
114   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${METIS_DEFINITIONS}")
115   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${METIS_LIBRARIES})
116 ENDIF(SALOME_MED_PARTITIONER_METIS)
117 IF(SALOME_MED_PARTITIONER_SCOTCH)
118   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_ScotchGraph.hxx)
119   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_ScotchGraph.cxx)
120   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${SCOTCH_DEFINITIONS}")
121   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${SCOTCH_LIBRARIES})
122 ENDIF(SALOME_MED_PARTITIONER_SCOTCH)
123
124 IF(SALOME_USE_MPI)
125   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES}
126     MEDPARTITIONER_UtilsPara.cxx
127     MEDPARTITIONER_JointFinder.cxx
128   )
129 ADD_EXECUTABLE(medpartitioner_para medpartitioner_para.cxx)
130   SET_TARGET_PROPERTIES(medpartitioner_para PROPERTIES COMPILE_FLAGS "${medpartitionercpp_DEFINITIONS}")
131   TARGET_LINK_LIBRARIES(medpartitioner_para medpartitionercpp ${medpartitionercpp_LDFLAGS})
132   INSTALL(TARGETS medpartitioner_para DESTINATION ${SALOME_INSTALL_BINS})
133 ENDIF(SALOME_USE_MPI)                     
134   
135 ADD_LIBRARY(medpartitionercpp SHARED ${medpartitionercpp_SOURCES})
136 SET_TARGET_PROPERTIES(medpartitionercpp PROPERTIES COMPILE_FLAGS "${PLATFORM_DEFINITIONS} ${medpartitionercpp_DEFINITIONS}")
137 TARGET_LINK_LIBRARIES(medpartitionercpp ${medpartitionercpp_LDFLAGS} ${PLATFORM_LIBS} ${PTHREAD_LIBS})
138 INSTALL(TARGETS medpartitionercpp DESTINATION ${SALOME_INSTALL_LIBS})
139
140 ADD_EXECUTABLE(medpartitioner medpartitioner.cxx)
141 SET_TARGET_PROPERTIES(medpartitioner PROPERTIES COMPILE_FLAGS "${PLATFORM_DEFINITIONS} ${medpartitionercpp_DEFINITIONS}")
142 TARGET_LINK_LIBRARIES(medpartitioner medpartitionercpp ${medpartitionercpp_LDFLAGS})
143 INSTALL(TARGETS medpartitioner DESTINATION ${SALOME_INSTALL_BINS})
144
145 INSTALL(FILES ${medpartitionercpp_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})