- makefile_lib="-L\${${class_name}_CPP_ROOT}${lib_dir#${cpp_root_dir}} -l${lib_file}"
- makefile_include="-I\${${class_name}_CPP_ROOT}${hxx_dir#${cpp_root_dir}}"
- echo -e "\n\n[QUESTION]"
- echo -e "\nThe following option was generated to indicate where to find"
- echo -e "the needed libraries and include files when compiling and linking the c++ component :\n\n\t${makefile_lib}\n\t${makefile_include}"
- echo -e "\n\t(with \${${class_name}_CPP_ROOT} set to ${cpp_root_dir} at compile time)\n"
- echo -e "Do you want to modify it? (answer yes if something is wrong or a library is missing): "
- echo -e " answer no if flags are OK ):"
- read answer
- case $answer in
- y* | Y* | o* | O* ) read_makefile_option ;;
- esac
+ makefile_lib="-L\${${CLASS_NAME}_CPP_ROOT}${lib_dir#${CPP_ROOT_DIR}} -l${lib_file}"
+ makefile_include="-I\${${CLASS_NAME}_CPP_ROOT}${hxx_dir#${CPP_ROOT_DIR}}"
+
+ echo -e "\nlinking option : $makefile_lib"
+ echo -e "include option : $makefile_include"
+}
+
+generate_module_source()
+{
+#
+# go in temporary directory to work on code generation
+ cd ${tmp_dir}
+#
+#
+# ------------------------- parse hxx file and generate code ---------------------------------------
+#
+ echo -e "\n-> Extract public functions\n"
+ cat ${hxx_file} | awk -f ${gene_dir}/parse1.awk > ${CLASS_NAME}_public_functions
+ cat ${CLASS_NAME}_public_functions
+ if [ ! -s ${CLASS_NAME}_public_functions ]
+ then
+ echo -e "\nError:\n Sorry - No compatible function was found!\n Please check your header file\n"
+ exit
+ fi
+#
+ echo -e "\n\n-> Parse public functions and generate Salome2 files\n\n compatibility function\n"
+ cat ${CLASS_NAME}_public_functions | awk -f ${gene_dir}/parse2.awk |\
+ awk -v class_name=${CLASS_NAME} -f ${gene_dir}/parse3.awk
+#
+# outputs
+ echo -e "\n IDL file:"
+ cat parse_result > hxx2salome_journal
+ echo -e "\n----------------- IDL file ------------------\n">>hxx2salome_journal
+ cat code_idl >> hxx2salome_journal
+ cat code_idl
+ echo -e "\n----------------- hxx file ------------------\n" >> hxx2salome_journal
+ cat code_hxx >> hxx2salome_journal
+ echo -e "\n----------------- cxx file ------------------\n" >> hxx2salome_journal
+ cat code_cxx >> hxx2salome_journal
+ echo
+#
+#
+# ------------------- duplicates template module and insert generated code ------------------------------
+#
+ echo -e "\n-> Duplicate template module" | tee hxx2salome_journal
+ tar xvfz ${gene_dir}/template_src.tgz >> hxx2salome_journal
+ mv TEMPLATE_SRC ${CLASS_NAME}_SRC
+ ${gene_dir}/renameSalomeModule -i TEMPLATE ${CLASS_NAME} ${CLASS_NAME}_SRC >> hxx2salome_journal
+#
+ echo -e "\n-> Substitute generated code in idl file"
+ echo "// this idl file was generated by hxx2salome" > tmpfile
+ cat ${CLASS_NAME}_SRC/idl/${CLASS_NAME}_Gen.idl |awk '
+ $0 ~ "HXX2SALOME_IDL_CODE" {system("cat code_idl >> tmpfile")}
+ $0 != "HXX2SALOME_IDL_CODE" { print $0 >> "tmpfile" }'
+ mv tmpfile ${CLASS_NAME}_SRC/idl/${CLASS_NAME}_Gen.idl
+#
+ echo -e "\n-> Substitute generated code in hxx file"
+ echo "// this hxx file was generated by hxx2salome" > tmpfile
+ cat ${CLASS_NAME}_SRC/src/${CLASS_NAME}/${CLASS_NAME}_i.hxx |awk '
+ $0 ~ "HXX2SALOME_HXX_CODE" {system("cat code_hxx >> tmpfile")}
+ $0 !~ "HXX2SALOME" { print $0 >> "tmpfile" }'
+ mv tmpfile ${CLASS_NAME}_SRC/src/${CLASS_NAME}/${CLASS_NAME}_i.hxx
+#
+ echo -e "\n-> Substitute generated code in cxx file"
+ echo "// this cxx file was generated by hxx2salome" > tmpfile
+ cat ${CLASS_NAME}_SRC/src/${CLASS_NAME}/${CLASS_NAME}_i.cxx |awk -v cpp_include=$hxx '
+ $0 ~ "HXX2SALOME_CXX_CODE" {system("cat code_cxx >> tmpfile")}
+ $0 ~ "HXX2SALOME_CPP_INCLUDE" { printf "#include \"%s\"\n",cpp_include >> "tmpfile" }
+ $0 !~ "HXX2SALOME" { print $0 >> "tmpfile" }'
+ mv tmpfile ${CLASS_NAME}_SRC/src/${CLASS_NAME}/${CLASS_NAME}_i.cxx
+#
+# add flags in makefile
+ get_python_test_file
+ get_info_makefile