Salome HOME
SOURCE -> PROJECT
[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(SALOME_MED_PARTITIONER_PARMETIS)
49   ADD_DEFINITIONS(${PARMETIS_DEFINITIONS})
50   ADD_DEFINITIONS("-DMED_ENABLE_PARMETIS")
51   ADD_DEFINITIONS("-DMED_ENABLE_METIS")
52   INCLUDE_DIRECTORIES(${PARMETIS_INCLUDE_DIRS})
53 ENDIF(SALOME_MED_PARTITIONER_PARMETIS)
54
55 IF(SALOME_USE_MPI)
56   ADD_DEFINITIONS(${MPI_DEFINITIONS})
57   ADD_DEFINITIONS("-DHAVE_MPI2")
58   INCLUDE_DIRECTORIES(${MPI_INCLUDE_DIRS})
59 ENDIF(SALOME_USE_MPI)
60
61 IF(SALOME_BUILD_TESTS)
62   ADD_SUBDIRECTORY(Test)
63 ENDIF(SALOME_BUILD_TESTS)
64
65 SET(medpartitionercpp_HEADERS_HXX
66   MEDPARTITIONER_MeshCollection.hxx
67   MEDPARTITIONER_MeshCollectionDriver.hxx
68   MEDPARTITIONER_MeshCollectionMedXmlDriver.hxx
69   MEDPARTITIONER_MeshCollectionMedAsciiDriver.hxx
70   MEDPARTITIONER_ParallelTopology.hxx
71   MEDPARTITIONER_JointFinder.hxx
72   MEDPARTITIONER_Graph.hxx
73   MEDPARTITIONER_UserGraph.hxx
74   MEDPARTITIONER_Utils.hxx
75   MEDPARTITIONER.hxx
76   MEDPARTITIONER_ParaDomainSelector.hxx
77   MEDPARTITIONER_ConnectZone.hxx
78   MEDPARTITIONER_SkyLineArray.hxx
79   MEDPARTITIONER_Topology.hxx
80   )
81
82 SET(medpartitionercpp_SOURCES
83   MEDPARTITIONER_MeshCollection.cxx
84   MEDPARTITIONER_MeshCollectionDriver.cxx
85   MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx
86   MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx
87   MEDPARTITIONER_ParallelTopology.cxx
88   MEDPARTITIONER_Graph.cxx
89   MEDPARTITIONER_UserGraph.cxx
90   MEDPARTITIONER_Utils.cxx
91   MEDPARTITIONER_ParaDomainSelector.cxx
92   MEDPARTITIONER_ConnectZone.cxx
93   MEDPARTITIONER_SkyLineArray.cxx
94   MEDPARTITIONER_metis.c
95   )
96
97 SET(medpartitionercpp_LDFLAGS
98   ${MEDFILE_C_LIBRARIES}
99   ${HDF5_LIBRARIES}
100   ${STDLIB}
101   ${LIBXML2_LIBRARIES}
102   interpkernel
103   medcoupling
104   medloader
105 )
106 IF(SALOME_MED_PARTITIONER_PARMETIS)
107   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_ParMetisGraph.hxx)
108   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_ParMetisGraph.cxx MEDPARTITIONER_MetisGraph.cxx)
109   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${PARMETIS_DEFINITIONS}")
110   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${PARMETIS_LIBRARIES})
111 ENDIF(SALOME_MED_PARTITIONER_PARMETIS)
112 IF(SALOME_MED_PARTITIONER_METIS)
113   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_MetisGraph.hxx)
114   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_MetisGraph.cxx)
115   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${METIS_DEFINITIONS}")
116   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${METIS_LIBRARIES})
117 ENDIF(SALOME_MED_PARTITIONER_METIS)
118 IF(SALOME_MED_PARTITIONER_SCOTCH)
119   SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_ScotchGraph.hxx)
120   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_ScotchGraph.cxx)
121   SET(medpartitionercpp_DEFINITIONS "${medpartitionercpp_DEFINITIONS} ${SCOTCH_DEFINITIONS}")
122   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${SCOTCH_LIBRARIES})
123 ENDIF(SALOME_MED_PARTITIONER_SCOTCH)
124
125 IF(${SALOME_USE_MPI})
126   SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_UtilsPara.cxx MEDPARTITIONER_JointFinder.cxx)
127   ADD_EXECUTABLE(medpartitioner_para medpartitioner_para.cxx)
128   SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${MPI_LIBRARIES})
129   SET_TARGET_PROPERTIES(medpartitioner_para PROPERTIES COMPILE_FLAGS "${medpartitionercpp_DEFINITIONS}")
130   TARGET_LINK_LIBRARIES(medpartitioner_para medpartitionercpp ${medpartitionercpp_LDFLAGS})
131   INSTALL(TARGETS medpartitioner_para DESTINATION ${SALOME_INSTALL_BINS})
132 ENDIF(${SALOME_USE_MPI})
133   
134 ADD_LIBRARY(medpartitionercpp SHARED ${medpartitionercpp_SOURCES})
135 SET_TARGET_PROPERTIES(medpartitionercpp PROPERTIES COMPILE_FLAGS "${PLATFORM_DEFINITIONS} ${medpartitionercpp_DEFINITIONS}")
136 TARGET_LINK_LIBRARIES(medpartitionercpp ${medpartitionercpp_LDFLAGS} ${PLATFORM_LIBS} ${PTHREAD_LIBS})
137 INSTALL(TARGETS medpartitionercpp DESTINATION ${SALOME_INSTALL_LIBS})
138
139 ADD_EXECUTABLE(medpartitioner medpartitioner.cxx)
140 SET_TARGET_PROPERTIES(medpartitioner PROPERTIES COMPILE_FLAGS "${PLATFORM_DEFINITIONS} ${medpartitionercpp_DEFINITIONS}")
141 TARGET_LINK_LIBRARIES(medpartitioner medpartitionercpp ${medpartitionercpp_LDFLAGS})
142 INSTALL(TARGETS medpartitioner DESTINATION ${SALOME_INSTALL_BINS})
143
144 INSTALL(FILES ${medpartitionercpp_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})