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