Salome HOME
Merge from BR_PORTING_VTK6 01/03/2013
[modules/gui.git] / CMakeLists.txt
1 # Copyright (C) 2012  CEA/DEN, EDF R&D, OPEN CASCADE
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 PROJECT(SALOME_GUI)
20
21 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
22
23 IF(COMMAND cmake_policy)
24   cmake_policy(SET CMP0003 NEW)
25 ENDIF(COMMAND cmake_policy)
26
27 IF(APPLE)
28   SET(CMAKE_C_COMPILER gcc)
29   SET(CMAKE_CXX_COMPILER g++)
30   # because default is clang(llvm) with mountain lion at least
31 ENDIF(APPLE)
32
33 # Temporary definitions
34 SET(DOXYGEN_IS_OK 0)
35 IF(WINDOWS)
36  SET(CPPUNIT_IS_OK 0)
37 ENDIF(WINDOWS)
38
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)
52
53 ENABLE_TESTING()
54 SET(VERSION "7.0.0")
55 SET(VERSION_DEV "1")
56
57 SET(BUILD_SHARED_LIBS true)
58
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})
65
66 STRING(REPLACE "\\" "/" KERNEL_ROOT_DIR ${KERNEL_ROOT_DIR})
67
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)
70
71 find_package(PLATFORM)
72
73
74 # Threads
75 SET(CMAKE_THREAD_PREFER_PTHREAD)
76 find_package(Threads REQUIRED)
77
78
79 # required prerequisites from KERNEL
80
81 find_package(SalomePYTHON)
82 find_package(SalomeSWIG)
83 find_package(SalomeLIBXML2)
84 find_package(SalomeHDF5)
85 find_package(SalomeBOOST)
86
87 # required prerequisites for GUI
88
89 find_package(SalomeQT4)
90 find_package(SalomeSIP)
91 find_package(SalomePYQT4)
92
93 # optional prerequisites from KERNEL
94
95 if(SALOME_USE_MPI OR HDF5_IS_PARALLEL)
96   find_package(SalomeMPI)
97 endif(SALOME_USE_MPI OR HDF5_IS_PARALLEL)
98
99 if(SALOME_USE_CORBA)
100   find_package(OMNIORB)
101 endif(SALOME_USE_CORBA)
102
103 if(SALOME_USE_TEST)
104   find_package(SalomeCPPUNIT)
105 endif(SALOME_USE_TEST)
106
107 if(SALOME_USE_DOC)
108   find_package(SalomeDOXYGEN)
109   find_package(SalomeSPHINX)
110 endif(SALOME_USE_DOC)
111
112 if(SALOME_USE_LIBBATCH)
113   find_package(LIBBATCH)
114 endif(SALOME_USE_LIBBATCH)
115
116
117 # optional prerequisites for GUI
118
119 if(SALOME_USE_OCCVIEWER)
120   find_package(SalomeCAS)
121 endif(SALOME_USE_OCCVIEWER)
122
123 if(SALOME_USE_GLVIEWER)
124   find_package(OpenGL REQUIRED)
125 endif(SALOME_USE_GLVIEWER)
126
127 if(SALOME_USE_VTKVIEWER)
128   find_package(SalomeVTK)
129 endif(SALOME_USE_VTKVIEWER)
130
131 if(SALOME_USE_PLOT2DVIEWER)
132   find_package(SalomeQWT)
133 endif(SALOME_USE_PLOT2DVIEWER)
134
135 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}
136   OUTPUT_VARIABLE XVERSION)
137
138 SET(GUI_salomebin_BINS bin/salome)
139
140 SET(GUI_salomelib_LIBS lib/salome)
141 SET(GUI_paraviewlib_LIBS lib/paraview)
142
143 SET(GUI_salomeinclude_HEADERS include/salome)
144
145 SET(GUI_salomeres_DATA share/salome/resources/gui)
146
147 SET(GUI_salomeres_SCRIPTS share/salome/resources/gui)
148
149 SET(GUI_salomepluginsdir share/salome/plugins/gui)
150
151 SET(GUI_salomescript_SCRIPTS bin/salome)
152
153 SET(GUI_salomescript_DATA bin/salome)
154
155 SET(GUI_salomescript_PYTHON bin/salome)
156 SET(KERNEL_salomescript_PYTHON ${GUI_salomescript_PYTHON})
157
158 SET(GUI_appliskel_SCRIPTS bin/salome/appliskel)
159
160 SET(GUI_appliskel_PYTHON bin/salome/appliskel)
161
162 SET(GUI_pythondir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
163
164 SET(GUI_salomepythondir ${GUI_pythondir}/salome)
165 SET(KERNEL_salomepythondir ${GUI_salomepythondir})
166
167 SET(GUI_sharedpkgpython_PYTHON ${GUI_salomepythondir}/shared_modules)
168
169 SET(GUI_admlocalcmake adm_local/cmake_files)
170
171 SET(IDLDIR)                        
172 IF(SALOME_USE_CORBA)
173   SET(IDLDIR idl)
174 ENDIF(SALOME_USE_CORBA)
175
176 SET(SUBDIRS
177   ${IDLDIR}
178   adm_local
179   resources
180   src
181   doc
182   bin
183   tools
184 )
185 FOREACH(dir ${SUBDIRS})
186   ADD_SUBDIRECTORY(${dir})
187 ENDFOREACH(dir ${SUBDIRS})
188
189 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/GUI_version.h.in)
190 SET(output ${CMAKE_CURRENT_BINARY_DIR}/GUI_version.h)
191 MESSAGE(STATUS "Creation of ${output}")
192 CONFIGURE_FILE(${input} ${output} @ONLY)
193 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/GUI_version.h DESTINATION ${GUI_salomeinclude_HEADERS})