Salome HOME
Initiating medtool
[modules/med.git] / src / medtool / src / MEDPartitioner / CMakeLists.txt
1 # Copyright (C) 2012-2015  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(${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${LIBXML2_DEFINITIONS})
21
22 INCLUDE_DIRECTORIES(
23   ${LIBXML2_INCLUDE_DIR}
24   ${MEDFILE_INCLUDE_DIRS}
25   ${HDF5_INCLUDE_DIRS}
26   ${PTHREAD_INCLUDE_DIR}
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_METIS)
37   ADD_DEFINITIONS(${METIS_DEFINITIONS})
38   IF(MEDTOOL_METIS_V5)
39     ADD_DEFINITIONS("-DMED_ENABLE_METIS_V5")
40   ENDIF(MEDTOOL_METIS_V5)
41   INCLUDE_DIRECTORIES(${METIS_INCLUDE_DIRS})
42 ENDIF(SALOME_MED_PARTITIONER_METIS)
43
44
45 ########
46 # VERY IMPORTANT PUT METIS BEFORE SCOTCH because
47 # metis.h is also in SCOTCH install dir !!!
48 ########
49 IF(SALOME_MED_PARTITIONER_SCOTCH)
50   ADD_DEFINITIONS(${SCOTCH_DEFINITIONS})
51   INCLUDE_DIRECTORIES(${SCOTCH_INCLUDE_DIRS})
52 ENDIF(SALOME_MED_PARTITIONER_SCOTCH)
53
54 IF(SALOME_MED_PARTITIONER_PARMETIS)
55   ADD_DEFINITIONS(${PARMETIS_DEFINITIONS})
56   INCLUDE_DIRECTORIES(${PARMETIS_INCLUDE_DIRS})
57 ENDIF(SALOME_MED_PARTITIONER_PARMETIS)
58
59 IF(SALOME_USE_MPI)
60   ADD_DEFINITIONS(${MPI_DEFINITIONS})
61   INCLUDE_DIRECTORIES(${MPI_INCLUDE_DIRS})
62 ENDIF(SALOME_USE_MPI)
63
64 IF(SALOME_BUILD_TESTS)
65   ADD_SUBDIRECTORY(Test)
66 ENDIF(SALOME_BUILD_TESTS)
67
68 SET(medpartitionercpp_HEADERS_HXX
69   MEDPARTITIONER_MeshCollection.hxx
70   MEDPARTITIONER_MeshCollectionDriver.hxx
71   MEDPARTITIONER_MeshCollectionMedXmlDriver.hxx
72   MEDPARTITIONER_MeshCollectionMedAsciiDriver.hxx
73   MEDPARTITIONER_ParallelTopology.hxx
74   MEDPARTITIONER_JointFinder.hxx
75   MEDPARTITIONER_Graph.hxx
76   MEDPARTITIONER_UserGraph.hxx
77   MEDPARTITIONER_Utils.hxx
78   MEDPARTITIONER.hxx
79   MEDPARTITIONER_ParaDomainSelector.hxx
80   MEDPARTITIONER_ConnectZone.hxx
81   MEDPARTITIONER_Topology.hxx
82   MEDPARTITIONER_MEDPartitioner.hxx
83   )
84
85 SET(medpartitionercpp_SOURCES
86   MEDPARTITIONER_MeshCollection.cxx
87   MEDPARTITIONER_MeshCollectionDriver.cxx
88   MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx
89   MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx
90   MEDPARTITIONER_ParallelTopology.cxx
91   MEDPARTITIONER_Graph.cxx
92   MEDPARTITIONER_UserGraph.cxx
93   MEDPARTITIONER_Utils.cxx
94   MEDPARTITIONER_ParaDomainSelector.cxx
95   MEDPARTITIONER_ConnectZone.cxx
96   MEDPARTITIONER_metis.c
97   MEDPARTITIONER_MEDPartitioner.cxx
98   )
99
100 SET(medpartitionercpp_LDFLAGS
101   ${MEDFILE_C_LIBRARIES}
102   ${HDF5_LIBRARIES}
103   ${STDLIB}
104   ${LIBXML2_LIBRARIES}
105   interpkernel
106   medcoupling
107   medloader
108 )
109 IF(SALOME_MED_PARTITIONER_PARMETIS)
110   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_ParMetisGraph.hxx)
111   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_ParMetisGraph.cxx MEDPARTITIONER_MetisGraph.cxx)
112   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${PARMETIS_DEFINITIONS}")
113   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${PARMETIS_LIBRARIES})
114 ENDIF(SALOME_MED_PARTITIONER_PARMETIS)
115 IF(SALOME_MED_PARTITIONER_METIS)
116   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_MetisGraph.hxx)
117   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_MetisGraph.cxx)
118   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${METIS_DEFINITIONS}")
119   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${METIS_LIBRARIES})
120 ENDIF(SALOME_MED_PARTITIONER_METIS)
121 IF(SALOME_MED_PARTITIONER_SCOTCH)
122   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_ScotchGraph.hxx)
123   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_ScotchGraph.cxx)
124   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${SCOTCH_DEFINITIONS}")
125   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${SCOTCH_LIBRARIES})
126 ENDIF(SALOME_MED_PARTITIONER_SCOTCH)
127
128 IF(${SALOME_USE_MPI})
129   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_UtilsPara.cxx MEDPARTITIONER_JointFinder.cxx)
130   ADD_EXECUTABLE(medpartitioner_para medpartitioner_para.cxx)
131   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${MPI_LIBRARIES})
132   SET_TARGET_PROPERTIES(medpartitioner_para PROPERTIES COMPILE_FLAGS "${medpartitionercpp_DEFINITIONS}")
133   TARGET_LINK_LIBRARIES(medpartitioner_para medpartitionercpp ${medpartitionercpp_LDFLAGS})
134   INSTALL(TARGETS medpartitioner_para DESTINATION ${SALOME_INSTALL_BINS})
135 ENDIF(${SALOME_USE_MPI})
136
137 ADD_DEFINITIONS(${medpartitionercpp_DEFINITIONS})
138
139 ADD_LIBRARY(medpartitionercpp SHARED ${medpartitionercpp_SOURCES})
140 TARGET_LINK_LIBRARIES(medpartitionercpp ${medpartitionercpp_LDFLAGS} ${PLATFORM_LIBS} ${PTHREAD_LIBS})
141 INSTALL(TARGETS medpartitionercpp DESTINATION ${MEDTOOL_INSTALL_LIBS})
142
143 ADD_EXECUTABLE(medpartitioner medpartitioner.cxx)
144 TARGET_LINK_LIBRARIES(medpartitioner medpartitionercpp ${medpartitionercpp_LDFLAGS})
145 INSTALL(TARGETS medpartitioner DESTINATION ${MEDTOOL_INSTALL_BINS})
146
147 INSTALL(FILES ${medpartitionercpp_HEADERS_HXX} DESTINATION ${MEDTOOL_INSTALL_HEADERS})