]> SALOME platform Git repositories - modules/med.git/blob - CMakeLists.txt
Salome HOME
CMake: splitting OmniORB and OmniORBPy detection
[modules/med.git] / 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 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
21
22 IF(COMMAND cmake_policy)
23   cmake_policy(SET CMP0003 NEW)
24 ENDIF(COMMAND cmake_policy)
25
26 ENABLE_TESTING()
27 SET(VERSION "7.2.0")
28 SET(VERSION_DEV "0")
29 SET(WITH_MEDMEMGUI "0")
30
31 #Defining all options first
32 option(SALOME_USE_MPI "Use MPI containers" OFF)
33
34
35 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR})
36 IF(KERNEL_ROOT_DIR)
37   FILE(TO_CMAKE_PATH $ENV{KERNEL_ROOT_DIR} KERNEL_ROOT_DIR)
38   SET(MED_ENABLE_KERNEL ON)
39   
40   # directories for packages detection
41   SET(SALOME_MACROS_DIR ${KERNEL_ROOT_DIR}/salome_adm/cmake_files)
42   LIST(APPEND CMAKE_MODULE_PATH "${SALOME_MACROS_DIR}")
43
44   INCLUDE(SalomeMacros)
45   INCLUDE(SalomeSetupPlatform)
46     
47   FIND_PACKAGE(SalomeKERNEL)
48   
49   # Try first to find medfile version using the new CMake first 
50   FIND_PACKAGE(SalomeMedfile QUIET)
51   IF(medfile_FOUND)
52      MESSAGE(STATUS "Found Medfile in config mode (new CMake version of medfile)")
53      # Backward compat:
54      SET(MED_ENABLE_MED3 ON)
55      SET(MED3_INCLUDE_DIRS "${MEDFILE_INCLUDE_DIRS}")
56      SET(MED3_LIBS_C_ONLY "${MEDFILE_C_LIBRARIES}")
57   ELSE()
58     # if not found, revert to the old logic:
59     FIND_PACKAGE(MEDFILE REQUIRED)
60     SET(MED_ENABLE_MED3 ON)
61   ENDIF()
62   
63   FIND_PACKAGE(SalomePThread)
64   FIND_PACKAGE(SalomePython)
65   SET(PYTHON_LIBS ${PYTHON_LIBRARIES})
66   
67   FIND_PACKAGE(SalomeOmniORB)
68   FIND_PACKAGE(SalomeOmniORBPy)
69   SET(OMNIORB_LIBS ${OMNIORB_LIBRARIES})
70   
71   IF(SALOME_USE_MPI)
72     FIND_PACKAGE(SalomeMPI)
73     SET(MPI_IS_OK 1)
74   ENDIF()
75   
76   FIND_PACKAGE(SalomeHDF5)  
77   FIND_PACKAGE(SalomeBoost)
78   
79   FIND_PACKAGE(SalomeLibXml2)
80   # Backward compat:
81   SET(LIBXML_INCLUDE_DIRS "${LIBXML2_INCLUDE_DIR}")
82   SET(LIBXML_LIBS "${LIBXML2_LIBRARIES}")
83   
84   FIND_PACKAGE(SalomeSWIG)
85   SET(SWIG_STATUS TRUE)
86   
87   FIND_PACKAGE(SalomeCppUnit)
88   SET(CPPUNIT_IS_OK ON)
89   SET(CPPUNIT_LIBS "${CPPUNIT_LIBRARIES}")
90   
91   FIND_PACKAGE(SalomeDoxygen)
92   FIND_PACKAGE(SalomeSphinx)
93   
94
95     
96   SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR})
97   FILE(TO_CMAKE_PATH "$ENV{GUI_ROOT_DIR}" GUI_ROOT_DIR)
98   IF(GUI_ROOT_DIR)
99     LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
100     SET(MED_ENABLE_GUI ON)
101     
102     FIND_PACKAGE(SalomeGUI)
103     
104     FIND_PACKAGE(SalomeCAS)
105     FIND_PACKAGE(SalomeOpenGL)
106     FIND_PACKAGE(SalomeQt4)
107     
108     FIND_PACKAGE(SalomeQwt)
109     FIND_PACKAGE(SalomePyQt4)    
110   ENDIF(GUI_ROOT_DIR)
111 ELSE(KERNEL_ROOT_DIR)
112   SET(SALOME_MACROS_DIR ${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files)
113   LIST(APPEND CMAKE_MODULE_PATH "${SALOME_MACROS_DIR}")
114   
115   # TODO: the macros below should be loaded with a FIND_PACKAGE(), and should be sync'd with
116   # what has been done in KERNEL + GUI:
117   
118   INCLUDE(FindPLATFORM)
119   if(SALOME_USE_MPI)
120     INCLUDE(FindMPI)
121   endif(SALOME_USE_MPI)
122   INCLUDE(FindMEDFILE)
123   INCLUDE(FindBOOST)
124   INCLUDE(FindCPPUNIT)
125   INCLUDE(FindHDF5)
126   INCLUDE(FindPYTHON)
127   INCLUDE(FindLIBXML2)
128   INCLUDE(FindPTHREADS)
129   INCLUDE(FindSWIG)
130   #INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindMEDFILE.cmake)
131 ENDIF(KERNEL_ROOT_DIR)
132
133 # TODO: write those in the new format, and load them via FIND_PACKAGE():
134 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindPARMETIS.cmake)
135 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindMETIS.cmake)
136 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSCOTCH.cmake)
137 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSPLITTER.cmake)
138 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindRENUMBER.cmake)
139 IF(WIN32)
140   INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindXDR.cmake)
141 ENDIF(WIN32)
142
143 EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sys; t=sys.argv[-1].split(\".\") ; t[:]=(int(elt) for elt in t) ; sys.stdout.write(\"0x%02x%02x%02x\"%tuple(t))" ${VERSION}
144   OUTPUT_VARIABLE XVERSION)
145
146 # TODO: adjust to the global SALOME install dirs exposed from KERNEL:
147 SET(MED_salomebin_BINS bin/salome)
148 SET(MED_salomelib_LIBS lib/salome)
149 SET(MED_salomeidl_IDLS idl/salome)
150 SET(KERNEL_salomeidl_IDLS ${MED_salomeidl_IDLS})
151 SET(MED_salomeinclude_HEADERS include/salome)
152 SET(MED_salomeres_DATA share/salome/resources/med)
153 SET(MED_salomeres_SCRIPTS share/salome/resources/med)
154 SET(MED_salomescript_SCRIPTS bin/salome)
155 SET(MED_salomescript_DATA bin/salome)
156 SET(MED_salomescript_PYTHON bin/salome)
157 SET(MED_appliskel_SCRIPTS bin/salome/appliskel)
158 SET(MED_appliskel_PYTHON bin/salome/appliskel)
159 SET(MED_pythondir lib/python${PYTHON_VERSION}/site-packages)
160 SET(MED_salomepythondir ${MED_pythondir}/salome)
161 SET(MED_sharedpkgpython_PYTHON ${MED_salomepythondir}/shared_modules)
162 SET(MED_admlocalcmake adm_local/cmake_files)
163
164 SET(KERNEL_salomescript_PYTHON ${MED_salomescript_PYTHON})
165 SET(KERNEL_salomepythondir ${MED_salomepythondir})
166
167 IF(MED_ENABLE_KERNEL)
168   ADD_SUBDIRECTORY(idl)
169 ELSE(MED_ENABLE_KERNEL)
170   ADD_SUBDIRECTORY(adm_local_without_kernel)
171 ENDIF(MED_ENABLE_KERNEL)
172 ADD_SUBDIRECTORY(adm_local)
173 ADD_SUBDIRECTORY(src)
174 ADD_SUBDIRECTORY(doc)
175 ADD_SUBDIRECTORY(resources)
176 ADD_SUBDIRECTORY(bin)
177
178 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/MED_version.h.in)
179 SET(output ${CMAKE_CURRENT_BINARY_DIR}/MED_version.h)
180 MESSAGE(STATUS "Creation of ${output}")
181 CONFIGURE_FILE(${input} ${output} @ONLY)
182 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/MED_version.h DESTINATION ${MED_salomeinclude_HEADERS})