1 # Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE
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
21 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
23 IF(COMMAND cmake_policy)
24 cmake_policy(SET CMP0003 NEW)
25 ENDIF(COMMAND cmake_policy)
28 SET(CMAKE_C_COMPILER gcc)
29 SET(CMAKE_CXX_COMPILER g++)
30 # because default is clang(llvm) with mountain lion at least
33 # Temporary definitions
39 #Defining all options first
40 option(SALOME_USE_MPI "Use MPI containers" OFF)
41 option(SALOME_USE_CORBA "Use distribute application with components" ON)
42 option(SALOME_USE_DOC "Generate documentation" ON)
43 option(SALOME_USE_TEST "Generate test" OFF)
44 OPTION(SALOME_USE_VTKVIEWER "Enable VTK visualization (Mandatory in classic configurations)" ON)
45 OPTION(SALOME_USE_SALOMEOBJECT "Enable Salome Object (Mandatory in classic configurations)" ON)
46 OPTION(SALOME_USE_OCCVIEWER "Enable OCC visualization (Mandatory in classic configurations)" ON)
47 OPTION(SALOME_USE_GLVIEWER "Enable OpenGL visualization (Mandatory in classic configurations)" ON)
48 OPTION(SALOME_USE_PLOT2DVIEWER "Enable Plot2D visualization (Mandatory in classic configurations)" ON)
49 OPTION(SALOME_USE_PYCONSOLE "Enable Python GUI interface (Mandatory in classic configurations)" ON)
50 OPTION(SALOME_USE_SUPERVGRAPHVIEWER "Enable Supervision visualization (Mandatory in classic configurations)" ON)
51 OPTION(SALOME_USE_QXGRAPHVIEWER "Enable QX graph visualization (Mandatory in classic configurations)" ON)
57 SET(BUILD_SHARED_LIBS true)
59 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
60 IF(EXISTS ${KERNEL_ROOT_DIR})
61 INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake)
62 ELSE(EXISTS ${KERNEL_ROOT_DIR})
63 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
64 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
66 STRING(REPLACE "\\" "/" KERNEL_ROOT_DIR ${KERNEL_ROOT_DIR})
68 # directories for packages detection
69 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${KERNEL_ROOT_DIR}/salome_adm/cmake_files ${CMAKE_SOURCE_DIR}/adm_local/cmake_files ${CMAKE_SOURCE_DIR}/adm_local/cmake_files/deprecated )
70 find_package(PLATFORM)
74 SET(CMAKE_THREAD_PREFER_PTHREAD)
75 find_package(Threads REQUIRED)
78 # required prerequisites from KERNEL
80 find_package(SalomePYTHON)
81 find_package(SalomeSWIG)
82 find_package(SalomeLIBXML2)
83 find_package(SalomeHDF5)
84 find_package(SalomeBOOST)
86 # required prerequisites for GUI
88 find_package(SalomeQT4)
89 find_package(SalomeSIP)
90 find_package(SalomePYQT4)
92 # optional prerequisites from KERNEL
94 if(SALOME_USE_MPI OR HDF5_IS_PARALLEL)
95 find_package(SalomeMPI)
96 endif(SALOME_USE_MPI OR HDF5_IS_PARALLEL)
100 endif(SALOME_USE_CORBA)
103 find_package(SalomeCPPUNIT)
104 endif(SALOME_USE_TEST)
107 find_package(SalomeDOXYGEN)
108 find_package(SalomeSPHINX)
109 endif(SALOME_USE_DOC)
111 if(SALOME_USE_LIBBATCH)
112 find_package(LIBBATCH)
113 endif(SALOME_USE_LIBBATCH)
116 # optional prerequisites for GUI
118 if(SALOME_USE_OCCVIEWER)
119 find_package(SalomeCAS)
120 endif(SALOME_USE_OCCVIEWER)
122 if(SALOME_USE_GLVIEWER)
123 find_package(OpenGL REQUIRED)
124 endif(SALOME_USE_GLVIEWER)
126 if(SALOME_USE_VTKVIEWER)
127 find_package(SalomeVTK)
128 endif(SALOME_USE_VTKVIEWER)
130 if(SALOME_USE_PLOT2DVIEWER)
131 find_package(SalomeQWT)
132 endif(SALOME_USE_PLOT2DVIEWER)
134 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}
135 OUTPUT_VARIABLE XVERSION)
137 SET(GUI_salomebin_BINS bin/salome)
139 SET(GUI_salomelib_LIBS lib/salome)
140 SET(GUI_paraviewlib_LIBS lib/paraview)
142 SET(GUI_salomeinclude_HEADERS include/salome)
144 SET(GUI_salomeres_DATA share/salome/resources/gui)
146 SET(GUI_salomeres_SCRIPTS share/salome/resources/gui)
148 SET(GUI_salomepluginsdir share/salome/plugins/gui)
150 SET(GUI_salomescript_SCRIPTS bin/salome)
152 SET(GUI_salomescript_DATA bin/salome)
154 SET(GUI_salomescript_PYTHON bin/salome)
155 SET(KERNEL_salomescript_PYTHON ${GUI_salomescript_PYTHON})
157 SET(GUI_appliskel_SCRIPTS bin/salome/appliskel)
159 SET(GUI_appliskel_PYTHON bin/salome/appliskel)
161 SET(GUI_pythondir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
163 SET(GUI_salomepythondir ${GUI_pythondir}/salome)
164 SET(KERNEL_salomepythondir ${GUI_salomepythondir})
166 SET(GUI_sharedpkgpython_PYTHON ${GUI_salomepythondir}/shared_modules)
168 SET(GUI_admlocalcmake adm_local/cmake_files)
173 ENDIF(SALOME_USE_CORBA)
184 FOREACH(dir ${SUBDIRS})
185 ADD_SUBDIRECTORY(${dir})
186 ENDFOREACH(dir ${SUBDIRS})
188 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/GUI_version.h.in)
189 SET(output ${CMAKE_CURRENT_BINARY_DIR}/GUI_version.h)
190 MESSAGE(STATUS "Creation of ${output}")
191 CONFIGURE_FILE(${input} ${output} @ONLY)
192 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/GUI_version.h DESTINATION ${GUI_salomeinclude_HEADERS})