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