1 # Copyright (C) 2012-2013 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
22 IF(COMMAND cmake_policy)
23 cmake_policy(SET CMP0003 NEW)
24 ENDIF(COMMAND cmake_policy)
29 SET(WITH_MEDMEMGUI "0")
31 #Defining all options first
32 option(SALOME_USE_MPI "Use MPI containers" OFF)
35 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR})
37 FILE(TO_CMAKE_PATH $ENV{KERNEL_ROOT_DIR} KERNEL_ROOT_DIR)
38 SET(MED_ENABLE_KERNEL ON)
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}")
45 INCLUDE(SalomeSetupPlatform)
47 FIND_PACKAGE(SalomeKERNEL)
49 # Try first to find medfile version using the new CMake first
50 FIND_PACKAGE(SalomeMedfile QUIET)
52 MESSAGE(STATUS "Found Medfile in config mode (new CMake version of medfile)")
54 SET(MED_ENABLE_MED3 ON)
55 SET(MED3_INCLUDE_DIRS "${MEDFILE_INCLUDE_DIRS}")
56 SET(MED3_LIBS_C_ONLY "${MEDFILE_C_LIBRARIES}")
58 # if not found, revert to the old logic:
59 FIND_PACKAGE(MEDFILE REQUIRED)
60 SET(MED_ENABLE_MED3 ON)
63 FIND_PACKAGE(SalomePThread)
64 FIND_PACKAGE(SalomePython)
65 SET(PYTHON_LIBS ${PYTHON_LIBRARIES})
67 FIND_PACKAGE(SalomeOmniORB)
68 FIND_PACKAGE(SalomeOmniORBPy)
69 SET(OMNIORB_LIBS ${OMNIORB_LIBRARIES})
72 FIND_PACKAGE(SalomeMPI)
76 FIND_PACKAGE(SalomeHDF5)
77 FIND_PACKAGE(SalomeBoost)
79 FIND_PACKAGE(SalomeLibXml2)
81 SET(LIBXML_INCLUDE_DIRS "${LIBXML2_INCLUDE_DIR}")
82 SET(LIBXML_LIBS "${LIBXML2_LIBRARIES}")
84 FIND_PACKAGE(SalomeSWIG)
87 FIND_PACKAGE(SalomeCppUnit)
89 SET(CPPUNIT_LIBS "${CPPUNIT_LIBRARIES}")
91 FIND_PACKAGE(SalomeDoxygen)
92 FIND_PACKAGE(SalomeSphinx)
96 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR})
97 FILE(TO_CMAKE_PATH "$ENV{GUI_ROOT_DIR}" GUI_ROOT_DIR)
99 LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
100 SET(MED_ENABLE_GUI ON)
102 FIND_PACKAGE(SalomeGUI)
104 FIND_PACKAGE(SalomeCAS)
105 FIND_PACKAGE(SalomeOpenGL)
106 FIND_PACKAGE(SalomeQt4)
108 FIND_PACKAGE(SalomeQwt)
109 FIND_PACKAGE(SalomePyQt4)
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}")
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:
118 INCLUDE(FindPLATFORM)
121 endif(SALOME_USE_MPI)
128 INCLUDE(FindPTHREADS)
130 #INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindMEDFILE.cmake)
131 ENDIF(KERNEL_ROOT_DIR)
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)
140 INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindXDR.cmake)
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)
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)
164 SET(KERNEL_salomescript_PYTHON ${MED_salomescript_PYTHON})
165 SET(KERNEL_salomepythondir ${MED_salomepythondir})
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)
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})