1 # Copyright (C) 2006-2016 CEA/DEN, EDF R&D
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
19 generate_corba_module_source()
22 if [ ${BE_QUIET} -lt 1 ] ; then
23 echo -e "\n\n\tCorba wrapper generation"
26 # ------------------------- Corba generation ------------------------------------------------------
27 if [ ${BE_QUIET} -lt 1 ] ; then
28 echo -e "\n\n-> Generate Salome2 Corba files\n"
30 cat ${CLASS_NAME}_public_functions |\
31 awk -v class_name=${CLASS_NAME} -f ${gene_dir}/parse3.awk
33 if [ `grep -c MEDMEM:: ${CLASS_NAME}_public_functions` -gt 0 ]
42 cat parse_result >> hxx2salome_journal
43 echo -e "\n----------------- IDL file ------------------\n" >> hxx2salome_journal
44 cat code_idl >> hxx2salome_journal
45 echo -e "\n----------------- hxx file ------------------\n" >> hxx2salome_journal
46 cat code_hxx >> hxx2salome_journal
47 echo -e "\n----------------- cxx file ------------------\n" >> hxx2salome_journal
48 cat code_cxx >> hxx2salome_journal
50 if [ ${BE_QUIET} -lt 1 ] ; then
51 echo -e "\n IDL file:"
56 if [ ${BE_QUIET} -lt 1 ] ; then
57 echo -e "\n-> Substitute generated code in idl file"
59 echo "// this idl file was generated by hxx2salome" > tmpfile
60 cat ${CLASS_NAME}_SRC/idl/${CLASS_NAME}_Gen.idl |awk \
61 '$0 ~ "HXX2SALOME_IDL_CODE" {system("cat code_idl >> tmpfile")}
62 $0 != "HXX2SALOME_IDL_CODE" { print $0 >> "tmpfile" }'
63 mv tmpfile ${CLASS_NAME}_SRC/idl/${CLASS_NAME}_Gen.idl
65 if [ ${BE_QUIET} -lt 1 ] ; then
66 echo -e "\n-> Substitute generated code in hxx file"
68 echo "// this hxx file was generated by hxx2salome" > tmpfile
69 cat ${CLASS_NAME}_SRC/src/${CLASS_NAME}_I/${CLASS_NAME}_i.hxx |awk '
70 $0 ~ "HXX2SALOME_HXX_CODE" {system("cat code_hxx >> tmpfile")}
71 $0 !~ "HXX2SALOME" { print $0 >> "tmpfile" }'
72 mv tmpfile ${CLASS_NAME}_SRC/src/${CLASS_NAME}_I/${CLASS_NAME}_i.hxx
74 if [ ${BE_QUIET} -lt 1 ] ; then
75 echo -e "\n-> Substitute generated code in cxx file"
77 echo "// this cxx file was generated by hxx2salome" > tmpfile
78 cat ${CLASS_NAME}_SRC/src/${CLASS_NAME}_I/${CLASS_NAME}_i.cxx |awk -v cpp_include=$hxx '
79 $0 ~ "HXX2SALOME_CXX_CODE" {system("cat code_cxx >> tmpfile")}
80 $0 ~ "HXX2SALOME_CPP_INCLUDE" { printf "#include \"%s\"\n",cpp_include >> "tmpfile" }
81 $0 !~ "HXX2SALOME" { print $0 >> "tmpfile" }'
82 mv tmpfile ${CLASS_NAME}_SRC/src/${CLASS_NAME}_I/${CLASS_NAME}_i.cxx
86 if [ ${BE_QUIET} -lt 1 ] ; then
87 echo -e "\n-> Substitute flags in Makefile.am files"
91 sed -e "s/SUBDIRS = /SUBDIRS = ${CLASS_NAME}_I/" \
92 < ${CLASS_NAME}_SRC/src/Makefile.am \
93 > ${CLASS_NAME}_SRC/src/Makefile.am_new
94 \mv -f ${CLASS_NAME}_SRC/src/Makefile.am_new \
95 ${CLASS_NAME}_SRC/src/Makefile.am
98 if [ ${USE_MED} == 1 ]
100 sed "s?USE_MED=0?USE_MED=1\nIDL_FILES += MED.idl\nIDL_SRC += MEDSK.cc?" ${CLASS_NAME}_SRC/idl/Makefile.am > tmpfile
101 sed "s?XXX?XXX -DUSE_MED -I\${MED_ROOT_DIR}/idl/salome?" tmpfile > tmp2file
102 mv tmp2file ${CLASS_NAME}_SRC/idl/Makefile.am
105 # C++ implementation Makefile.am
106 sed "s?HXX2SALOME_INCLUDE?${makefile_include}?g
107 s?HXX2SALOME_PYTHON_FILE?${python_test_file}?g
108 s?HXX2SALOME_LIB?${makefile_lib}?g
109 " ${CLASS_NAME}_SRC/src/${CLASS_NAME}_I/Makefile.am > tmpfile
110 sed "s?XXX?XXX -I$hxx_dir?" tmpfile > tmp2file
111 if [ ${BE_QUIET} -lt 1 ] ; then
112 cat ${CLASS_NAME}_public_functions
114 if [ ${USE_MED} == 1 ]
116 sed "/AM_CXXFLAGS/s?\$? -DUSE_MED \${MED2_INCLUDES} -I\${MED_ROOT_DIR}/include/salome?" tmp2file > tmpfile
117 sed "s?USE_MED=0?USE_MED=1?" tmpfile > tmp2file
119 mv tmp2file ${CLASS_NAME}_SRC/src/${CLASS_NAME}_I/Makefile.am
120 \rm -f tmpfile tmp2file
122 # generate component catalog
123 if [ ${BE_QUIET} -lt 1 ] ; then
124 echo -e "\n-> Generate component catalog" | tee hxx2salome_journal
126 if [ -f ${KERNEL_ROOT_DIR}/bin/salome/runIDLparser ]
128 idlparser=${KERNEL_ROOT_DIR}/bin/salome/runIDLparser
130 idlparser=${gene_dir}/runIDLparser
132 if [ ${USE_MED} == 1 ]
134 idlparser="${idlparser} -DUSE_MED=1 -I${MED_ROOT_DIR}/idl/salome"
137 cd ${CLASS_NAME}_SRC/resources
138 VER=`cat ${KERNEL_ROOT_DIR}/bin/salome/VERSION | awk ' { print $NF }'` # extract number of version
139 ${idlparser} -Wbcatalog=tmp.xml,icon=${CLASS_NAME}.png,version=${VER} -I${KERNEL_ROOT_DIR}/idl/salome ../idl/${CLASS_NAME}_Gen.idl >& /dev/null | tee hxx2salome_journal
140 cat tmp.xml | sed 's/_Gen//g' > ${CLASS_NAME}Catalog.xml
145 clean_corba_module_source()
147 \rm -rf ${CLASS_NAME}_SRC/src/${CLASS_NAME}_I
148 \rm -rf ${CLASS_NAME}_SRC/idl/*
149 touch ${CLASS_NAME}_SRC/idl/Makefile.am
150 sed -e "s/^CHECK_OMNIORB/dnl CHECK_OMNIORB/" -e "/CORBA/s/^/dnl /" ${CLASS_NAME}_SRC/configure.in.base > ${CLASS_NAME}_SRC/configure.in.temp
151 mv ${CLASS_NAME}_SRC/configure.in.temp ${CLASS_NAME}_SRC/configure.in.base