]> SALOME platform Git repositories - modules/paravis.git/blob - idl/CMakeLists.txt
Salome HOME
f79543bfe9c270efb8987ae9715fda9e24e51a76
[modules/paravis.git] / idl / CMakeLists.txt
1 # Copyright (C) 2010-2012  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 SET(VERSION_INFO ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MAINTENANCE})
21 SET(SOVERSION_INFO ${VERSION_MAJOR}.${VERSION_MINOR})
22
23 ADD_DEFINITIONS(-DHAVE_SALOME_CONFIG)
24 INCLUDE_DIRECTORIES(${OMNIORB_INCLUDE_DIRS} ${KERNEL_ROOT_DIR}/include/salome ${CMAKE_BINARY_DIR}/idl)
25
26 INCLUDE(wrap.cmake)
27
28
29 SET(BASEIDL_FILES
30   PARAVIS_Gen_Types.idl
31   PARAVIS_Gen.idl
32   )
33
34 SET(BASEIDL_SK_FILES
35   PARAVIS_Gen_TypesSK.cc
36   PARAVIS_GenSK.cc
37   )
38
39 # potential problem on parallel make on the following - multiple outputs
40 SET(SUFFIXES
41   .idl
42   .hh
43   SK.cc
44   )
45
46 SET(srcs)
47 FOREACH(f ${BASEIDL_SK_FILES} ${WRAP_SK_FILES})
48   SET(srcs ${srcs} ${CMAKE_CURRENT_BINARY_DIR}/${f})
49 ENDFOREACH(f ${BASEIDL_SK_FILES} ${WRAP_SK_FILES})
50
51 IF(WINDOWS)
52 ADD_LIBRARY(SalomeIDLPARAVIS STATIC ${srcs})
53 ELSE(WINDOWS)
54 ADD_LIBRARY(SalomeIDLPARAVIS SHARED ${srcs})
55 ENDIF(WINDOWS)
56
57 SET(flags)
58 FOREACH(f ${PLATFORM_CPPFLAGS} ${PTHREAD_CFLAGS} ${OMNIORB_DEFINITIONS} ${KERNEL_CXXFLAGS})
59   SET(flags "${flags} ${f}")
60 ENDFOREACH(f ${PLATFORM_CPPFLAGS} ${PTHREAD_CFLAGS} ${OMNIORB_DEFINITIONS} ${KERNEL_CXXFLAGS})
61
62 SET_TARGET_PROPERTIES(SalomeIDLPARAVIS PROPERTIES COMPILE_FLAGS "${flags}")
63 SET_TARGET_PROPERTIES(SalomeIDLPARAVIS PROPERTIES VERSION ${VERSION_INFO} SOVERSION ${SOVERSION_INFO})
64
65 TARGET_LINK_LIBRARIES(SalomeIDLPARAVIS ${PLATFORM_LIBADD} ${PLATFORM_LDFLAGS} ${OMNIORB_LIBRARIES})
66 INSTALL(TARGETS SalomeIDLPARAVIS DESTINATION lib/salome)
67   
68 ADD_EXECUTABLE(vtkWrapIDL 
69   ${CMAKE_SOURCE_DIR}/src/ParaView/vtkParse.tab.c 
70   ${CMAKE_SOURCE_DIR}/src/ParaView/vtkParsePreprocess.c
71   ${CMAKE_SOURCE_DIR}/src/ParaView/vtkParseHierarchy.c
72   ${CMAKE_SOURCE_DIR}/src/ParaView/vtkParseExtras.c
73   ${CMAKE_SOURCE_DIR}/src/ParaView/vtkParseMain.c
74   ${CMAKE_SOURCE_DIR}/src/ParaView/vtkParseData.c
75   ${CMAKE_SOURCE_DIR}/src/ParaView/vtkParseString.c
76   ${CMAKE_SOURCE_DIR}/src/ParaView/vtkWrap.c
77 #  ${CMAKE_SOURCE_DIR}/src/ParaView/vtkWrapText.c
78   ${CMAKE_CURRENT_SOURCE_DIR}/vtkWrapIDL.c)
79
80 set_property(SOURCE ${CMAKE_SOURCE_DIR}/src/ParaView/vtkParseMain.c PROPERTY COMPILE_DEFINITIONS
81   VTK_PARSE_VERSION="${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}")
82
83 ADD_DEPENDENCIES(vtkWrapIDL generate_txt)
84   
85 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/ParaView)
86 SET(flags)
87 FOREACH(f ${PLATFORM_CPPFLAGS} ${PTHREAD_CFLAGS} ${PARAVIEW_INCLUDES} ${VTK_INCLUDES})
88   SET(flags "${flags} ${f}")
89 ENDFOREACH(f ${PLATFORM_CPPFLAGS} ${PTHREAD_CFLAGS} ${PARAVIEW_INCLUDES} ${VTK_INCLUDES})
90
91 #VTN TODO:
92 #IF(VTK_LEGACY_REMOVE)
93 #  ADD_DEFINITIONS(-DVTK_PARSE_LEGACY_REMOVE)
94 #ENDIF()
95 SET_TARGET_PROPERTIES(vtkWrapIDL PROPERTIES COMPILE_FLAGS "${flags}")
96
97 TARGET_LINK_LIBRARIES(vtkWrapIDL ${PLATFORM_LDFLAGS} ${PLATFORM_LIBADD})
98 SET(vtkWrapIDL_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/vtkWrapIDL)
99 IF(WINDOWS)
100   IF(CMAKE_BUILD_TOOL STREQUAL nmake)
101     SET(vtkWrapIDL_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/vtkWrapIDL.exe)
102   ELSE(CMAKE_BUILD_TOOL STREQUAL nmake)
103     SET(vtkWrapIDL_EXEFILE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/vtkWrapIDL.exe)
104   ENDIF(CMAKE_BUILD_TOOL STREQUAL nmake)
105 ENDIF(WINDOWS)
106 INSTALL(FILES ${vtkWrapIDL_EXEFILE} DESTINATION bin/salome PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
107
108 FOREACH(input ${BASEIDL_FILES} ${WRAP_IDL})
109   STRING(REGEX REPLACE ".idl" "" base ${input})
110   SET(src ${CMAKE_CURRENT_BINARY_DIR}/${base}SK.cc)
111   SET(outputs ${src})
112   SET(dynsrc ${CMAKE_CURRENT_BINARY_DIR}/${base}DynSK.cc)
113   SET(outputs ${outputs} ${dynsrc})
114   SET(inc ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh)
115   SET(outputs ${outputs} ${inc})
116   LIST(FIND BASEIDL_FILES ${input} BASE_INDEX)
117   IF(${BASE_INDEX} EQUAL -1)
118     SET(input ${CMAKE_CURRENT_BINARY_DIR}/${input})
119   ELSE(${BASE_INDEX} EQUAL -1)
120     SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
121   ENDIF(${BASE_INDEX} EQUAL -1)
122   ADD_CUSTOM_COMMAND(
123     OUTPUT ${outputs}
124     COMMAND ${OMNIORB_IDL_PYTHON} -bcxx ${IDLCXXFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR} -I${KERNEL_ROOT_DIR}/idl/salome ${OMNIORB_IDLCXXFLAGS} ${input}
125     MAIN_DEPENDENCY ${input}
126     )
127   INSTALL(FILES ${input} DESTINATION idl/salome)
128
129   SET(IDL_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh)
130   INSTALL(FILES ${IDL_HEADER} DESTINATION include/salome)
131   INSTALL(CODE "SET(IDL_FILE ${input})")
132   INSTALL(CODE "SET(DIR lib/python${PYTHON_VERSION}/site-packages/salome)")
133   INSTALL(CODE "SET(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})")
134   INSTALL(CODE "SET(OMNIORB_IDL_PYTHON ${OMNIORB_IDL_PYTHON})")
135   INSTALL(CODE "SET(IDLPYFLAGS -bpythonIDL -p${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR} -I${KERNEL_ROOT_DIR}/idl/salome)")
136   INSTALL(SCRIPT ${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/install_python_from_idl.cmake)
137
138 ENDFOREACH(input ${IDL_FILES})