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