Salome HOME
Merge from V7_3_BR branch 18/12/2013
[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   ${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   ADD_DEFINITIONS("-DMED_ENABLE_METIS")
39   IF(SALOME_MED_METIS_V5)
40     ADD_DEFINITIONS("-DMED_ENABLE_METIS_V5")
41   ENDIF(SALOME_MED_METIS_V5)
42   INCLUDE_DIRECTORIES(${METIS_INCLUDE_DIRS})
43 ENDIF(SALOME_MED_PARTITIONER_METIS)
44
45
46 ########
47 # VERY IMPORTANT PUT METIS BEFORE SCOTCH because 
48 # metis.h is also in SCOTCH install dir !!!
49 ########
50 IF(SALOME_MED_PARTITIONER_SCOTCH)
51   ADD_DEFINITIONS(${SCOTCH_DEFINITIONS})
52   ADD_DEFINITIONS("-DMED_ENABLE_SCOTCH")
53   INCLUDE_DIRECTORIES(${SCOTCH_INCLUDE_DIRS})
54 ENDIF(SALOME_MED_PARTITIONER_SCOTCH)
55
56 IF(SALOME_MED_PARTITIONER_PARMETIS)
57   ADD_DEFINITIONS(${PARMETIS_DEFINITIONS})
58   ADD_DEFINITIONS("-DMED_ENABLE_PARMETIS")
59   ADD_DEFINITIONS("-DMED_ENABLE_METIS")
60   INCLUDE_DIRECTORIES(${PARMETIS_INCLUDE_DIRS})
61 ENDIF(SALOME_MED_PARTITIONER_PARMETIS)
62
63 IF(SALOME_USE_MPI)
64   ADD_DEFINITIONS(${MPI_DEFINITIONS})
65   ADD_DEFINITIONS("-DHAVE_MPI2")
66   INCLUDE_DIRECTORIES(${MPI_INCLUDE_DIRS})
67 ENDIF(SALOME_USE_MPI)
68
69 IF(SALOME_BUILD_TESTS)
70   ADD_SUBDIRECTORY(Test)
71 ENDIF(SALOME_BUILD_TESTS)
72
73 SET(medpartitionercpp_HEADERS_HXX
74   MEDPARTITIONER_MeshCollection.hxx
75   MEDPARTITIONER_MeshCollectionDriver.hxx
76   MEDPARTITIONER_MeshCollectionMedXmlDriver.hxx
77   MEDPARTITIONER_MeshCollectionMedAsciiDriver.hxx
78   MEDPARTITIONER_ParallelTopology.hxx
79   MEDPARTITIONER_JointFinder.hxx
80   MEDPARTITIONER_Graph.hxx
81   MEDPARTITIONER_UserGraph.hxx
82   MEDPARTITIONER_Utils.hxx
83   MEDPARTITIONER.hxx
84   MEDPARTITIONER_ParaDomainSelector.hxx
85   MEDPARTITIONER_ConnectZone.hxx
86   MEDPARTITIONER_SkyLineArray.hxx
87   MEDPARTITIONER_Topology.hxx
88   )
89
90 SET(medpartitionercpp_SOURCES
91   MEDPARTITIONER_MeshCollection.cxx
92   MEDPARTITIONER_MeshCollectionDriver.cxx
93   MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx
94   MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx
95   MEDPARTITIONER_ParallelTopology.cxx
96   MEDPARTITIONER_Graph.cxx
97   MEDPARTITIONER_UserGraph.cxx
98   MEDPARTITIONER_Utils.cxx
99   MEDPARTITIONER_ParaDomainSelector.cxx
100   MEDPARTITIONER_ConnectZone.cxx
101   MEDPARTITIONER_SkyLineArray.cxx
102   MEDPARTITIONER_metis.c
103   )
104
105 SET(medpartitionercpp_LDFLAGS
106   ${MEDFILE_C_LIBRARIES}
107   ${HDF5_LIBRARIES}
108   ${STDLIB}
109   ${LIBXML2_LIBRARIES}
110   interpkernel
111   medcoupling
112   medloader
113 )
114 IF(SALOME_MED_PARTITIONER_PARMETIS)
115   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_ParMetisGraph.hxx)
116   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_ParMetisGraph.cxx MEDPARTITIONER_MetisGraph.cxx)
117   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${PARMETIS_DEFINITIONS}")
118   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${PARMETIS_LIBRARIES})
119 ENDIF(SALOME_MED_PARTITIONER_PARMETIS)
120 IF(SALOME_MED_PARTITIONER_METIS)
121   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_MetisGraph.hxx)
122   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_MetisGraph.cxx)
123   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${METIS_DEFINITIONS}")
124   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${METIS_LIBRARIES})
125 ENDIF(SALOME_MED_PARTITIONER_METIS)
126 IF(SALOME_MED_PARTITIONER_SCOTCH)
127   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_ScotchGraph.hxx)
128   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_ScotchGraph.cxx)
129   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${SCOTCH_DEFINITIONS}")
130   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${SCOTCH_LIBRARIES})
131 ENDIF(SALOME_MED_PARTITIONER_SCOTCH)
132
133 IF(${SALOME_USE_MPI})
134   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_UtilsPara.cxx MEDPARTITIONER_JointFinder.cxx)
135   ADD_EXECUTABLE(medpartitioner_para medpartitioner_para.cxx)
136   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${MPI_LIBRARIES})
137   SET_TARGET_PROPERTIES(medpartitioner_para PROPERTIES COMPILE_FLAGS "${medpartitionercpp_DEFINITIONS}")
138   TARGET_LINK_LIBRARIES(medpartitioner_para medpartitionercpp ${medpartitionercpp_LDFLAGS})
139   INSTALL(TARGETS medpartitioner_para DESTINATION ${SALOME_INSTALL_BINS})
140 ENDIF(${SALOME_USE_MPI})
141
142 ADD_DEFINITIONS(${medpartitionercpp_DEFINITIONS})
143   
144 ADD_LIBRARY(medpartitionercpp SHARED ${medpartitionercpp_SOURCES})
145 TARGET_LINK_LIBRARIES(medpartitionercpp ${medpartitionercpp_LDFLAGS} ${PLATFORM_LIBS} ${PTHREAD_LIBS})
146 INSTALL(TARGETS medpartitionercpp DESTINATION ${SALOME_INSTALL_LIBS})
147
148 ADD_EXECUTABLE(medpartitioner medpartitioner.cxx)
149 TARGET_LINK_LIBRARIES(medpartitioner medpartitionercpp ${medpartitionercpp_LDFLAGS})
150 INSTALL(TARGETS medpartitioner DESTINATION ${SALOME_INSTALL_BINS})
151
152 INSTALL(FILES ${medpartitionercpp_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})