1 # Copyright (C) 2010-2013 CEA/DEN, EDF R&D
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 ## Generation of the list of VTK classes (to be wrapped into IDLs)
22 ## =====================================
23 IF(NOT SALOME_LIGHT_ONLY)
24 # TODO: the below requires ParaView in the PYTHONPATH ... not so nice:
25 MESSAGE(STATUS "Generating list of wrapped VTK classes ...")
26 LIST(GET PARAVIEW_INCLUDE_DIRS 0 PARAVIEW_INCLUDE_DIR0)
27 EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/getwrapclasses.py ${PARAVIEW_INCLUDE_DIR0}
30 MESSAGE(FATAL_ERROR "Unable to run the Python script retrieving the list of VTK classes.")
34 INCLUDE(GenerateWrapList.cmake)
36 ## Parser for VTK header files
37 ## ===========================
39 ## Everything under the ParaView subdirectory is a pure copy of ParaView source
43 ${CMAKE_CURRENT_SOURCE_DIR}/ParaView
44 ${PROJECT_BINARY_DIR}/idl
45 ${PROJECT_SOURCE_DIR}/src/PVGUI
48 # Wrapper executable generating the headers, source files and IDL files
49 # corresponding to VTK wrapping:
56 SET(vtkWrapIDL_HH_CPPFLAGS -DIDL_I_HH)
57 SET(vtkWrapIDL_CC_CPPFLAGS -DIDL_I_CC)
58 SET(vtkWrapIDL_CPPFLAGS)
60 #VTN TODO: vtkParseData supports two types of structures for wrapping.
61 #We use old structures currently, but is is not influent for results of wrapping.
62 #It may be necessary to port vtkWrapIDL to new approach in future.
63 #IF(VTK_LEGACY_REMOVE)
64 # ADD_DEFINITIONS(-DVTK_PARSE_LEGACY_REMOVE)
67 FOREACH(name ${_wrap_PROGRAMS})
68 ADD_EXECUTABLE(${name}
69 ParaView/vtkParse.tab.c
70 ParaView/vtkParsePreprocess.c
71 ParaView/vtkParseHierarchy.c
72 ParaView/vtkParseExtras.c
73 ParaView/vtkParseMain.c
74 ParaView/vtkParseData.c
75 ParaView/vtkParseString.c
77 # ParaView/vtkWrapText.c
78 ${PROJECT_SOURCE_DIR}/idl/vtkWrapIDL.c)
79 ADD_DEPENDENCIES(${name} generate_txt)
81 set_property(SOURCE ParaView/vtkParseMain.c PROPERTY COMPILE_DEFINITIONS
82 VTK_PARSE_VERSION="${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}")
85 FOREACH(f ${PARAVIEW_INCLUDES} ${VTK_INCLUDES} ${PLATFORM_CPPFLAGS} ${PTHREAD_CFLAGS} ${${name}_CPPFLAGS})
86 SET(flags "${flags} ${f}")
87 ENDFOREACH(f ${PARAVIEW_INCLUDES} ${VTK_INCLUDES} ${PLATFORM_CPPFLAGS} ${PTHREAD_CFLAGS} ${${name}_CPPFLAGS})
89 SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "${flags}")
90 TARGET_LINK_LIBRARIES(${name} ${PLATFORM_LIBADD})
92 SET(${name}_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${name})
94 IF(CMAKE_BUILD_TOOL STREQUAL nmake)
95 SET(${name}_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${name}.exe)
96 ELSE(CMAKE_BUILD_TOOL STREQUAL nmake)
97 SET(${name}_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${name}.exe)
98 ENDIF(CMAKE_BUILD_TOOL STREQUAL nmake)
100 INSTALL(FILES ${${name}_EXEFILE} DESTINATION bin/salome PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
101 ENDFOREACH(name ${_wrap_PROGRAMS})
103 # Generate headers and sources corresponding to the IDL implementations:
106 ## From 2.8.10, we should use:
107 ## SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
108 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
109 ADD_LIBRARY(VTK_IDL_Impl OBJECT ${WRAP_IDL_I_CC})
111 # Make the list of wrapped files visible from the top directory (will be used in PVGUI and idl):
112 SET(WRAP_IDL_I_HH "${WRAP_IDL_I_HH}" PARENT_SCOPE)
113 SET(WRAP_IDL_I_CC "${WRAP_IDL_I_CC}" PARENT_SCOPE)