Salome HOME
0e13e49f118480418fb7bec8fe4566d011bf8df1
[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   interpkernel
101   medcoupling
102   medloader
103 )
104 IF(MED_ENABLE_PARMETIS)
105   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_ParMetisGraph.hxx)
106   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_ParMetisGraph.cxx)
107   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${PARMETIS_DEFINITIONS}")
108   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${PARMETIS_LIBS})
109 ENDIF(MED_ENABLE_PARMETIS)
110 IF(SALOME_MED_PARTITIONER_METIS)
111   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_MetisGraph.hxx)
112   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_MetisGraph.cxx)
113   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${METIS_DEFINITIONS}")
114   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${METIS_LIBRARIES})
115 ENDIF(SALOME_MED_PARTITIONER_METIS)
116 IF(SALOME_MED_PARTITIONER_SCOTCH)
117   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_ScotchGraph.hxx)
118   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_ScotchGraph.cxx)
119   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${SCOTCH_DEFINITIONS}")
120   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${SCOTCH_LIBRARIES})
121 ENDIF(SALOME_MED_PARTITIONER_SCOTCH)
122
123 IF(${SALOME_USE_MPI})
124   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_UtilsPara.cxx MEDPARTITIONER_JointFinder.cxx)
125   ADD_EXECUTABLE(medpartitioner_para medpartitioner_para.cxx)
126   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${MPI_LIBRARIES})
127   SET_TARGET_PROPERTIES(medpartitioner_para PROPERTIES COMPILE_FLAGS "${medpartitionercpp_DEFINITIONS}")
128   TARGET_LINK_LIBRARIES(medpartitioner_para medpartitionercpp ${medpartitionercpp_LDFLAGS})
129   INSTALL(TARGETS medpartitioner_para DESTINATION ${SALOME_INSTALL_BINS})
130 ENDIF(${SALOME_USE_MPI})                          
131   
132 ADD_LIBRARY(medpartitionercpp SHARED ${medpartitionercpp_SOURCES})
133 SET_TARGET_PROPERTIES(medpartitionercpp PROPERTIES COMPILE_FLAGS "${PLATFORM_DEFINITIONS} ${medpartitionercpp_DEFINITIONS}")
134 TARGET_LINK_LIBRARIES(medpartitionercpp ${medpartitionercpp_LDFLAGS} ${PLATFORM_LIBS} ${PTHREAD_LIBS})
135 INSTALL(TARGETS medpartitionercpp DESTINATION ${SALOME_INSTALL_LIBS})
136
137 ADD_EXECUTABLE(medpartitioner medpartitioner.cxx)
138 SET_TARGET_PROPERTIES(medpartitioner PROPERTIES COMPILE_FLAGS "${PLATFORM_DEFINITIONS} ${medpartitionercpp_DEFINITIONS}")
139 TARGET_LINK_LIBRARIES(medpartitioner medpartitionercpp ${medpartitionercpp_LDFLAGS})
140 INSTALL(TARGETS medpartitioner DESTINATION ${SALOME_INSTALL_BINS})
141
142 INSTALL(FILES ${medpartitionercpp_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})