1 # Copyright (C) 2007-2014 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, or (at your option) any later version.
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 # TYPE contains type of the library
40 MACRO(OMNIORB_ADD_MODULE MYMODULE MYIDLFILES MYIDLCXXFLAGS TYPE)
42 FOREACH(input ${MYIDLFILES})
43 GET_FILENAME_COMPONENT(base ${input} NAME_WE)
44 # STRING(REGEX REPLACE ".idl" "" base ${input})
45 SET(OMNIORB_IDLCXXFLAGS2 "${OMNIORB_IDLCXXFLAGS}")
46 SET(src ${CMAKE_CURRENT_BINARY_DIR}/${base}SK.cc)
47 SET(MYSOURCES ${MYSOURCES} ${src})
49 SET(dynsrc ${CMAKE_CURRENT_BINARY_DIR}/${base}DynSK.cc)
50 SET(MYSOURCES ${MYSOURCES} ${dynsrc})
51 SET(outputs ${outputs} ${dynsrc})
52 SET(inc ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh)
53 SET(outputs ${outputs} ${inc})
54 GET_FILENAME_COMPONENT(path ${input} PATH)
56 SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
58 SET(flags ${OMNIORB_IDLCXXFLAGS2})
59 STRING(REGEX MATCH "-bcxx" ISBCXX ${flags})
61 SET(flags -bcxx ${flags})
63 FOREACH(f ${MYIDLCXXFLAGS})
64 SET(flags ${flags} "-I${f}")
65 ENDFOREACH(f ${MYIDLCXXFLAGS})
66 ADD_CUSTOM_COMMAND(OUTPUT ${outputs}
67 COMMAND ${OMNIORB_IDL} ${flags} ${input}
68 MAIN_DEPENDENCY ${input})
69 SET(IDLPYFLAGS ${flags})
70 INSTALL(FILES ${input} DESTINATION idl/salome)
71 SET(IDL_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh)
72 INSTALL(FILES ${IDL_HEADER} DESTINATION include/salome)
74 FOREACH(f ${MYIDLCXXFLAGS})
75 SET(flags "${flags} -I${f}")
76 ENDFOREACH(f ${MYIDLCXXFLAGS})
77 STRING(REGEX MATCH "-bpython" ISBPYTHON ${flags})
79 SET(flags "-bpython ${flags}")
81 SET(IDLPYFLAGS ${flags})
82 STRING(REPLACE "\\" "/" IDLPYFLAGS ${IDLPYFLAGS})
83 INSTALL(CODE "OMNIORB_COMPILE_IDL_FORPYTHON_ON_INSTALL( \"${OMNIORB_IDL_PYTHON}\" \"${IDLPYFLAGS}\" \"${input}\" \"${CMAKE_INSTALL_PREFIX}/\${INSTALL_PYIDL_DIR}\" )")
84 ENDFOREACH(input ${MYIDLFILES})
85 ADD_LIBRARY(${MYMODULE} ${TYPE} ${MYSOURCES})
87 ENDMACRO(OMNIORB_ADD_MODULE)