1 # Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
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
20 INSTALL(CODE "SET(INSTALL_PYIDL_DIR lib/python${PYTHON_VERSION}/site-packages/salome)") # R1 CHECK
22 INSTALL(CODE "SET(INSTALL_PYIDL_DIR bin/salome)") # R1 CHECK
25 INSTALL(CODE "MACRO(OMNIORB_COMPILE_IDL_FORPYTHON_ON_INSTALL MYOMNIORBIDLPYTHON MYIDLPYFLAGS MYIDLFILE MYFULLDIR)
26 FILE(MAKE_DIRECTORY \${MYFULLDIR})
27 STRING(REPLACE \" \" \";\" MYIDLPYFLAGS2 \${MYIDLPYFLAGS})
28 MESSAGE(STATUS \"Compiling \${MYIDLFILE} into \${MYFULLDIR}\")
29 EXECUTE_PROCESS(COMMAND \${MYOMNIORBIDLPYTHON} \${MYIDLPYFLAGS2} -C\${MYFULLDIR} \${MYIDLFILE})
30 ENDMACRO(OMNIORB_COMPILE_IDL_FORPYTHON_ON_INSTALL)")
32 # This MACRO uses the following vars
33 # - OMNIORB_IDL : the idl tool (given by default by FindOMNIORB.cmake)
34 # - OMNIORB_IDLCXXFLAGS : the options (include excluded) to give to omniidl generator (given by default by FindOMNIORB.cmake)
36 # MYMODULE is a string that will be used to create a target with sources containing *.cc coming from the compilation of ${MYIDLFILES}
37 # MYIDLFILES containing all idl files to be compiled.
38 # MYIDLCXXFLAGS containing all directories (only directories) where to find *.idl which depend ${MYIDLFILES}.
39 MACRO(OMNIORB_ADD_MODULE MYMODULE MYIDLFILES MYIDLCXXFLAGS)
41 FOREACH(input ${MYIDLFILES})
42 STRING(REGEX REPLACE ".idl" "" base ${input})
43 SET(OMNIORB_IDLCXXFLAGS2 "${OMNIORB_IDLCXXFLAGS}")
44 SET(src ${CMAKE_CURRENT_BINARY_DIR}/${base}SK.cc)
45 SET(MYSOURCES ${MYSOURCES} ${src})
47 SET(dynsrc ${CMAKE_CURRENT_BINARY_DIR}/${base}DynSK.cc)
48 SET(outputs ${outputs} ${dynsrc})
49 SET(inc ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh)
50 SET(outputs ${outputs} ${inc})
51 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
52 SET(flags ${OMNIORB_IDLCXXFLAGS2})
53 STRING(REGEX MATCH "-bcxx" ISBCXX ${flags})
55 SET(flags -bcxx ${flags})
57 FOREACH(f ${MYIDLCXXFLAGS})
58 SET(flags ${flags} "-I${f}")
59 ENDFOREACH(f ${MYIDLCXXFLAGS})
60 ADD_CUSTOM_COMMAND(OUTPUT ${outputs}
61 COMMAND ${OMNIORB_IDL} ${flags} ${input}
62 MAIN_DEPENDENCY ${input})
63 SET(IDLPYFLAGS ${flags})
64 INSTALL(FILES ${input} DESTINATION idl/salome)
65 SET(IDL_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh)
66 INSTALL(FILES ${IDL_HEADER} DESTINATION include/salome)
68 FOREACH(f ${MYIDLCXXFLAGS})
69 SET(flags "${flags} -I${f}")
70 ENDFOREACH(f ${MYIDLCXXFLAGS})
71 STRING(REGEX MATCH "-bpython" ISBPYTHON ${flags})
73 SET(flags "-bpython ${flags}")
75 SET(IDLPYFLAGS ${flags})
76 STRING(REPLACE "\\" "/" IDLPYFLAGS ${IDLPYFLAGS})
77 INSTALL(CODE "OMNIORB_COMPILE_IDL_FORPYTHON_ON_INSTALL( \"${OMNIORB_IDL_PYTHON}\" \"${IDLPYFLAGS}\" \"${input}\" \"${CMAKE_INSTALL_PREFIX}/\${INSTALL_PYIDL_DIR}\" )")
78 ENDFOREACH(input ${MYIDLFILES})
79 ADD_LIBRARY(${MYMODULE} SHARED ${MYSOURCES})
80 ENDMACRO(OMNIORB_ADD_MODULE)