From: caremoli Date: Wed, 16 Mar 2011 17:52:22 +0000 (+0000) Subject: CCAR: add an option calciumextendedinterface to C++ component to use or not X-Git-Tag: V6_3_0a1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cb990e997e7f1392340cc6791ab1c7eeaf9c8d9b;p=tools%2Fyacsgen.git CCAR: add an option calciumextendedinterface to C++ component to use or not the Calcium Extended Interface defined by header CalciumInterface.hxx. --- diff --git a/Examples/cpp1/components.py b/Examples/cpp1/components.py index 0b6a1fd..fbde9bd 100644 --- a/Examples/cpp1/components.py +++ b/Examples/cpp1/components.py @@ -49,6 +49,7 @@ c1=CPPComponent("compo1",services=[ ), ], includes="-I/usr/include", + calciumextendedinterface=1, ) diff --git a/module_generator/cpp_tmpl.py b/module_generator/cpp_tmpl.py index 27434af..bfe77e0 100644 --- a/module_generator/cpp_tmpl.py +++ b/module_generator/cpp_tmpl.py @@ -28,7 +28,8 @@ cxxCompo=""" #include #include -#include +#include +${CalciumInterface} #include #include #include @@ -125,6 +126,8 @@ static void unexpectedHandler(void) ${servicesdef} //ENDDEF +#include + extern "C" void cp_exit(int err); extern "C" void F_FUNC(cpexit,CPEXIT)(int *err) diff --git a/module_generator/cppcompo.py b/module_generator/cppcompo.py index 3fef424..7e88b2e 100644 --- a/module_generator/cppcompo.py +++ b/module_generator/cppcompo.py @@ -54,6 +54,8 @@ class CPPComponent(Component): :param addmethods: is a C++ specific parameter that can be used to redefine a component method (DumpPython for example). This parameter is a string that must contain the definition and implementation code of the method. See the cppgui1 example for how to use it. + :param calciumextendedinterface: if you want to use the Calcium extended interface for C++ as defined by the header CalciumInterface.hxx + set this parameter to 1. By default its value is 0 so to not use extended interface. The extended interface requires boost as a dependency. For example, the following call defines a standalone component named "mycompo" with one service s1 (it must have been defined before):: @@ -62,8 +64,10 @@ class CPPComponent(Component): """ def __init__(self, name, services=None, libs="", rlibs="", includes="", kind="lib", exe_path=None, sources=None, inheritedclass="", compodefs="", - idls=None,interfacedefs="",inheritedinterface="",addedmethods=""): + idls=None,interfacedefs="",inheritedinterface="",addedmethods="", + calciumextendedinterface=0): self.exe_path = exe_path + self.calciumextendedinterface=calciumextendedinterface Component.__init__(self, name, services, impl="CPP", libs=libs, rlibs=rlibs, includes=includes, kind=kind, sources=sources, inheritedclass=inheritedclass, compodefs=compodefs, idls=idls, @@ -172,9 +176,15 @@ AM_CFLAGS=$(SALOME_INCLUDES) -fexceptions instream=instream, outstream=outstream) services.append(service) inits.append(init) + + CalciumInterface="" + if self.calciumextendedinterface: + CalciumInterface="#include " + return cxxCompo.substitute(component=self.name, module=gen.module.name, exe=exe, exe_path=self.exe_path, servicesdef="\n".join(defs), servicesimpl="\n".join(services), - initservice='\n'.join(inits)) + initservice='\n'.join(inits), + CalciumInterface=CalciumInterface) diff --git a/module_generator/gener.py b/module_generator/gener.py index b82c238..beb3ea9 100644 --- a/module_generator/gener.py +++ b/module_generator/gener.py @@ -398,8 +398,15 @@ AM_CFLAGS=$(SALOME_INCLUDES) -fexceptions #for catalog files catalogfile = "%sCatalog.xml" % module.name + need_boost=0 + for compo in module.components: + if hasattr(compo,"calciumextendedinterface") and compo.calciumextendedinterface: + need_boost=1 + break + #add makefile definitions to make_common_starter.am - common_starter = makecommon + other_includes="" + common_starter = makecommon.substitute(other_includes=other_includes) for mod in self.used_modules: common_starter = common_starter + salome_modules[mod]["makefiledefs"] + '\n' @@ -435,6 +442,12 @@ AM_CFLAGS=$(SALOME_INCLUDES) -fexceptions other_summary="" other_require="" + if need_boost: + other_check=other_check+"""CHECK_BOOST +""" + other_summary=other_summary+"""echo " Boost ................. : $boost_ok" +""" + if module.gui: other_check=other_check + """CHECK_SALOME_GUI CHECK_QT @@ -528,11 +541,12 @@ echo " Qt ..................... : $qt_ok" for fidl in glob.glob(idl): shutil.copyfile(fidl, os.path.join(namedir, "idl", os.path.basename(fidl))) - for m4file in ("check_Kernel.m4", "check_omniorb.m4", - "ac_linker_options.m4", "ac_cxx_option.m4", - "python.m4", "enable_pthreads.m4", "check_f77.m4", - "acx_pthread.m4", "check_boost.m4", "check_paco++.m4", - "check_mpi.m4", "check_lam.m4", "check_openmpi.m4", "check_mpich.m4"): + checks= ("check_Kernel.m4", "check_omniorb.m4", "ac_linker_options.m4", "ac_cxx_option.m4", + "python.m4", "enable_pthreads.m4", "check_f77.m4", "acx_pthread.m4", "check_paco++.m4", + "check_mpi.m4", "check_lam.m4", "check_openmpi.m4", "check_mpich.m4") + if need_boost: + checks=checks+("check_boost.m4",) + for m4file in checks: shutil.copyfile(os.path.join(self.kernel, "salome_adm", "unix", "config_files", m4file), os.path.join(namedir, "adm_local", m4file)) diff --git a/module_generator/mod_tmpl.py b/module_generator/mod_tmpl.py index 59bddf2..d4a4756 100644 --- a/module_generator/mod_tmpl.py +++ b/module_generator/mod_tmpl.py @@ -71,7 +71,6 @@ AC_PROG_LIBTOOL AC_PROG_CC AC_PROG_CXX CHECK_F77 -CHECK_BOOST CHECK_OMNIORB CHECK_PACO CHECK_MPI @@ -96,7 +95,6 @@ echo " Threads ................ : $$threads_ok" echo " OmniOrb (CORBA) ........ : $$omniORB_ok" echo " OmniOrbpy (CORBA) ...... : $$omniORBpy_ok" echo " Python ................. : $$python_ok" -echo " Boost ................. : $$boost_ok" echo " SALOME KERNEL .......... : $$Kernel_ok" echo " PaCO++ ................. : $$PaCO_ok" echo " MPI .................... : $$mpi_ok" @@ -144,38 +142,39 @@ fi makecommon=""" # Standard directory for installation -salomeincludedir = $(includedir)/salome -libdir = $(prefix)/lib/salome -bindir = $(prefix)/bin/salome -salomescriptdir = $(bindir) -salomepythondir = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome +salomeincludedir = $$(includedir)/salome +libdir = $$(prefix)/lib/salome +bindir = $$(prefix)/bin/salome +salomescriptdir = $$(bindir) +salomepythondir = $$(prefix)/lib/python$$(PYTHON_VERSION)/site-packages/salome # Directory for installing idl files -salomeidldir = $(prefix)/idl/salome +salomeidldir = $$(prefix)/idl/salome # Directory for installing resource files -salomeresdir = $(prefix)/share/salome/resources/${MODULE_NAME} +salomeresdir = $$(prefix)/share/salome/resources/$${MODULE_NAME} # Directories for installing admin files -admlocaldir = $(prefix)/adm_local -admlocalunixdir = $(admlocaldir)/unix -admlocalm4dir = $(admlocaldir)/unix/config_files +admlocaldir = $$(prefix)/adm_local +admlocalunixdir = $$(admlocaldir)/unix +admlocalm4dir = $$(admlocaldir)/unix/config_files # Shared modules installation directory -sharedpkgpythondir =$(pkgpythondir)/shared_modules +sharedpkgpythondir =$$(pkgpythondir)/shared_modules # Documentation directory -salomedocdir = $(prefix)/share/doc/salome/gui/${MODULE_NAME} +salomedocdir = $$(prefix)/share/doc/salome/gui/$${MODULE_NAME} -IDL_INCLUDES = -I$(KERNEL_ROOT_DIR)/idl/salome -KERNEL_LIBS= -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeContainer -lOpUtil -lSalomeDSCContainer -lSalomeDSCSuperv -lSalomeDatastream -lSalomeDSCSupervBasic -lCalciumC -KERNEL_INCLUDES= -I$(KERNEL_ROOT_DIR)/include/salome $(OMNIORB_INCLUDES) $(BOOST_CPPFLAGS) +IDL_INCLUDES = -I$$(KERNEL_ROOT_DIR)/idl/salome +KERNEL_LIBS= -L$$(KERNEL_ROOT_DIR)/lib/salome -lSalomeContainer -lOpUtil -lSalomeDSCContainer -lSalomeDSCSuperv -lSalomeDatastream -lSalomeDSCSupervBasic -lCalciumC +KERNEL_INCLUDES= -I$$(KERNEL_ROOT_DIR)/include/salome $$(OMNIORB_INCLUDES) ${other_includes} -SALOME_LIBS= ${KERNEL_LIBS} -SALOME_IDL_LIBS= -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeIDLKernel -SALOME_INCLUDES= ${KERNEL_INCLUDES} +SALOME_LIBS= $${KERNEL_LIBS} +SALOME_IDL_LIBS= -L$$(KERNEL_ROOT_DIR)/lib/salome -lSalomeIDLKernel +SALOME_INCLUDES= $${KERNEL_INCLUDES} """ +makecommon=Template(makecommon) resMakefile=""" include $$(top_srcdir)/adm_local/make_common_starter.am