Salome HOME
Synchronize adm files
[modules/paravis.git] / src / PVGUI / CMakeLists.txt
1 # Copyright (C) 2010-2014  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, or (at your option) any later version.
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 INCLUDE(UseQt4Ext)
21
22 # --- options ---
23
24 INCLUDE_DIRECTORIES(${OMNIORB_INCLUDE_DIR} 
25     ${KERNEL_INCLUDE_DIRS}
26     ${GUI_INCLUDE_DIRS} 
27     ${PROJECT_BINARY_DIR}/idl 
28     ${PROJECT_BINARY_DIR} 
29     ${CAS_INCLUDE_DIRS} 
30     ${Boost_INCLUDE_DIRS}
31     ${QT_INCLUDES}
32     ${CMAKE_CURRENT_SOURCE_DIR}
33     )
34
35 # additional preprocessor / compiler flags
36 ADD_DEFINITIONS(${CAS_DEFINITIONS})
37 ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
38 ADD_DEFINITIONS(${OMNIORB_DEFINITIONS})
39
40 # libraries to link to
41 SET(_PARAVIEW_APP_COMPO_LIB
42   pqApplicationComponents
43   )
44
45 SET(_link_LIBRARIES 
46   ${OMNIORB_LIBRARIES}
47   ${QT_LIBRARIES}
48   ${CAS_KERNEL}
49   ${PYTHON_LIBS}
50   ${KERNEL_LDFLAGS} ${KERNEL_SalomeDS} ${KERNEL_SALOMELocalTrace} ${KERNEL_SalomeIDLKernel} 
51                     ${KERNEL_SalomeNS} ${KERNEL_SalomeLifeCycleCORBA} ${KERNEL_SalomeContainer} ${KERNEL_TOOLSDS}
52   ${GUI_LDFLAGS} ${GUI_SalomeApp} ${GUI_LightApp} ${GUI_CAM} ${GUI_qtx} ${GUI_suit} ${GUI_Event} ${GUI_PyInterp} 
53                  ${GUI_SalomeObject} ${GUI_vtkTools}
54   ${MED_SalomeIDLMED}
55   ${_PARAVIEW_APP_COMPO_LIB}
56   SalomeIDLPARAVIS
57 )
58
59 # --- headers ---
60
61 # header files / to be processed by moc
62 SET(_moc_HEADERS
63   PVGUI_Module.h
64   PVGUI_ViewManager.h
65   PVGUI_ViewModel.h
66   PVGUI_ViewWindow.h
67   PVGUI_ParaViewSettingsPane.h
68 )
69
70 # header files / no moc processing
71 SET(_other_HEADERS
72   PVGUI_OutputWindowAdapter.h
73   PVGUI_Tools.h
74   #PVGUI_MatplotlibMathTextUtilities.h
75   PV_I.h
76   PARAVIS_Gen_i.hh
77   PV_Events.h
78   PV_Tools.h
79 )
80
81 # header files / to install
82 SET(PVGUI_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
83
84 # --- resources ---
85
86 # resource files / to be processed by lrelease
87 SET(_ts_RESOURCES
88   resources/PARAVIS_images.ts
89   resources/PARAVIS_msg_en.ts
90   resources/PARAVIS_msg_fr.ts
91   resources/PARAVIS_msg_ja.ts
92 )
93
94 # resource files / static
95 SET(_other_RESOURCES
96   # sampleservers.pvsc ???
97 )
98
99 IF(SALOME_BUILD_DOC)
100   # --- ParaView documentation is built as a resource ---
101   # Check ParaView documentation file existence
102   # if it exists add it to the resources (compile into binary form)
103   # otherwise print warning message
104   SET(PV_DOC_FILE ${VTK_INSTALL_PREFIX}/share/doc/paraview-${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}/paraview.qch)
105   IF (EXISTS ${PV_DOC_FILE})
106     SET(RC_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/PVGUI.qrc.in)
107     SET(RC_GENERATED ${CMAKE_CURRENT_BINARY_DIR}/PVGUI.qrc)
108     MESSAGE(STATUS "Creation of ${RC_GENERATED}")
109     CONFIGURE_FILE(${RC_SOURCE} ${RC_GENERATED})
110     SET(_rcc_RESOURCES ${RC_GENERATED})
111     ADD_DEFINITIONS(-DHAS_PV_DOC)
112   ELSE ()
113     MESSAGE(WARNING "Help file for ParaView has not been found! ParaView documentation will not be available.")
114   ENDIF ()
115 ENDIF()
116
117 # --- sources ---
118
119 # sources / rcc wrappings
120 QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
121
122 # sources / moc wrappings
123 QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
124
125 # sources / EDF specific stuff
126 INCLUDE(vtkWrapClientServer)
127 VTK_WRAP_ClientServer(vtkEDFCutterCS vtkEDFCutter_SRCS ${GUI_ROOT_DIR}/include/salome/vtkEDFCutter.h)
128
129 # sources / static
130 SET(_other_SOURCES
131   PVGUI_Module.cxx
132   PVGUI_Module_actions.cxx
133   PVGUI_Module_widgets.cxx
134   PVGUI_ViewManager.cxx
135   PVGUI_ViewModel.cxx
136   PVGUI_ViewWindow.cxx
137   PVGUI_OutputWindowAdapter.cxx
138   PVGUI_Tools.cxx
139   PVGUI_ParaViewSettingsPane.cxx
140   #PVGUI_MatplotlibMathTextUtilities.cxx
141   PARAVIS_Gen_i.cc
142   PV_Tools.cxx
143   )
144
145 IF(NOT SALOME_PARAVIS_MINIMAL_CORBA)
146   # Generate headers and sources corresponding to the IDL implementations:
147   INCLUDE(${PROJECT_SOURCE_DIR}/src/VTKWrapping/wrap.cmake)
148
149   ## From 2.8.10, we should use:
150   ## SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
151   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
152
153   # Make the list of wrapped files visible from the top directory (will be used in idl):
154   SET(WRAP_IDL_I_HH "${WRAP_IDL_I_HH}" PARENT_SCOPE)
155   SET(WRAP_IDL_I_CC "${WRAP_IDL_I_CC}" PARENT_SCOPE)
156
157   SET(_VTK_wrap_SOURCES
158     PARAVIS_CreateClass.cxx
159     ${WRAP_IDL_I_CC}
160   )
161 ENDIF()
162   
163 # sources / to compile
164 SET(PVGUI_SOURCES 
165   ${_other_SOURCES} 
166   ${_moc_SOURCES} 
167   ${_rcc_SOURCES} 
168   ${vtkEDFCutter_SRCS} 
169   ${_VTK_wrap_SOURCES}
170   )
171
172 # --- rules ---
173
174 IF(NOT SALOME_PARAVIS_MINIMAL_CORBA)
175   ADD_CUSTOM_COMMAND(
176    OUTPUT PARAVIS_CreateClass.cxx
177     COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/VTKWrapping/create_class.py ${CMAKE_BINARY_DIR}
178     DEPENDS ${CMAKE_BINARY_DIR}/wrapfiles.txt 
179          ${PROJECT_BINARY_DIR}/idl/PARAVIS_Gen.hh 
180          ${PROJECT_BINARY_DIR}/idl/PARAVIS_Gen_Types.hh
181          SalomeIDLPARAVIS
182          generate_implements
183   )
184
185   # All wrapping tools have to be build before generating the above module - NEEDED?
186   ###ADD_DEPENDENCIES(SalomeIDLPARAVIS vtkWrapIDL_HH vtkWrapIDL_CC vtkWrapIDL)
187
188   # Intermediate target used in PVGUI directory (we can not cross reference
189   # a generated source file across directories, hence this trick):
190   INCLUDE_DIRECTORIES(
191     ${PROJECT_BINARY_DIR}/idl
192     ${PROJECT_BINARY_DIR}/src/VTKWrapping
193   )
194 ENDIF()
195
196 ADD_LIBRARY(PARAVIS ${PVGUI_SOURCES})
197 IF(NOT SALOME_PARAVIS_MINIMAL_CORBA)
198   # Make sure the generation of the VTK wrapping get executed first:
199   ADD_DEPENDENCIES(PARAVIS PARAVIS_CreateClass.cxx)
200 ENDIF()
201
202 IF(NOT SALOME_PARAVIS_MINIMAL_CORBA)
203   # Ensure .hh files corresponding to IDL have been generated first:
204   ADD_DEPENDENCIES(PARAVIS omniorb_module_SalomeIDLPARAVIS)  
205 ENDIF()
206
207 TARGET_LINK_LIBRARIES(PARAVIS ${_link_LIBRARIES})
208 INSTALL(TARGETS PARAVIS EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
209
210
211 # --- header and resources installation ---
212 INSTALL(FILES ${PVGUI_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
213 QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_PARAVIS_INSTALL_RES_DATA}")
214 INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_PARAVIS_INSTALL_RES_DATA})