Salome HOME
Building ParaVis SALOME module om win32 platform.
[modules/paravis.git] / src / VTKWrapping / CMakeLists.txt
1 # Copyright (C) 2010-2013  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.
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 ## Parser for VTK header files 
21 ## ===========================
22 ##
23 ## Everything under the ParaView subdirectory is a pure copy of ParaView source
24 ## code.
25
26 INCLUDE_DIRECTORIES(
27   ${CMAKE_CURRENT_SOURCE_DIR}/ParaView
28   ${PROJECT_BINARY_DIR}/idl
29   ${PROJECT_SOURCE_DIR}/src/PVGUI
30   )
31   
32 # Wrapper executable generating the headers, source files and IDL files 
33 # corresponding to VTK wrapping:
34 SET(_wrap_PROGRAMS
35   vtkWrapIDL_HH
36   vtkWrapIDL_CC
37   vtkWrapIDL
38   )
39
40 SET(vtkWrapIDL_HH_CPPFLAGS -DIDL_I_HH)
41 SET(vtkWrapIDL_CC_CPPFLAGS -DIDL_I_CC)
42 SET(vtkWrapIDL_CPPFLAGS)
43
44 #VTN TODO: vtkParseData supports two types of structures for wrapping.
45 #We use old structures currently, but is is not influent for results of wrapping.
46 #It may be necessary to port vtkWrapIDL to new approach in future.
47 #IF(VTK_LEGACY_REMOVE)  
48 #  ADD_DEFINITIONS(-DVTK_PARSE_LEGACY_REMOVE)
49 #ENDIF()
50
51 ADD_DEFINITIONS(${OMNIORB_DEFINITIONS})
52
53 FOREACH(name ${_wrap_PROGRAMS})
54   ADD_EXECUTABLE(${name} 
55     ParaView/vtkParse.tab.c 
56     ParaView/vtkParsePreprocess.c
57     ParaView/vtkParseHierarchy.c
58     ParaView/vtkParseExtras.c
59     ParaView/vtkParseMain.c
60     ParaView/vtkParseData.c
61     ParaView/vtkParseString.c
62     ParaView/vtkWrap.c
63 #    ParaView/vtkWrapText.c
64     ${PROJECT_SOURCE_DIR}/idl/vtkWrapIDL.c)
65   ADD_DEPENDENCIES(${name} generate_txt)
66   
67   set_property(SOURCE ParaView/vtkParseMain.c PROPERTY COMPILE_DEFINITIONS
68     VTK_PARSE_VERSION="${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}")
69
70   SET(flags)
71   FOREACH(f ${PARAVIEW_INCLUDES} ${VTK_INCLUDES} ${PLATFORM_CPPFLAGS} ${PTHREAD_CFLAGS} ${${name}_CPPFLAGS})
72     SET(flags "${flags} ${f}")
73   ENDFOREACH(f ${PARAVIEW_INCLUDES} ${VTK_INCLUDES} ${PLATFORM_CPPFLAGS} ${PTHREAD_CFLAGS} ${${name}_CPPFLAGS})
74   
75   SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "${flags}")
76   TARGET_LINK_LIBRARIES(${name} ${PLATFORM_LIBADD})
77   
78   SET(${name}_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${name})
79   IF(WIN32)
80     IF(CMAKE_BUILD_TOOL STREQUAL nmake)
81       SET(${name}_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${name}.exe)
82     ELSE(CMAKE_BUILD_TOOL STREQUAL nmake)
83       SET(${name}_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${name}.exe)
84     ENDIF(CMAKE_BUILD_TOOL STREQUAL nmake)
85   ENDIF(WIN32)
86   INSTALL(FILES ${${name}_EXEFILE} DESTINATION bin/salome PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
87 ENDFOREACH(name ${_wrap_PROGRAMS})
88
89 # Generate headers and sources corresponding to the IDL implementations:
90 INCLUDE(wrap.cmake)
91
92 ## From 2.8.10, we should use:
93 ## SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
94 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
95 ADD_LIBRARY(VTK_IDL_Impl OBJECT ${WRAP_IDL_I_CC})
96 # Ensure .hh files corresponding to IDL have been generated first:
97 ADD_DEPENDENCIES(VTK_IDL_Impl omniorb_module_SalomeIDLPARAVIS)
98
99 # Make the list of wrapped files visible from the top directory (will be used in PVGUI and idl):
100 SET(WRAP_IDL_I_HH "${WRAP_IDL_I_HH}" PARENT_SCOPE)
101 SET(WRAP_IDL_I_CC "${WRAP_IDL_I_CC}" PARENT_SCOPE)