]> SALOME platform Git repositories - tools/yacsgen.git/commitdiff
Salome HOME
CCAR: add an option calciumextendedinterface to C++ component to use or not V6_3_0a1
authorcaremoli <caremoli>
Wed, 16 Mar 2011 17:52:22 +0000 (17:52 +0000)
committercaremoli <caremoli>
Wed, 16 Mar 2011 17:52:22 +0000 (17:52 +0000)
the Calcium Extended Interface defined by header CalciumInterface.hxx.

Examples/cpp1/components.py
module_generator/cpp_tmpl.py
module_generator/cppcompo.py
module_generator/gener.py
module_generator/mod_tmpl.py

index 0b6a1fddff72748df5076eaaf932d2d8decd0670..fbde9bd9b301ee7597fa37d06246faffca297beb 100644 (file)
@@ -49,6 +49,7 @@ c1=CPPComponent("compo1",services=[
                  ),
           ],
          includes="-I/usr/include",
+         calciumextendedinterface=1,
          )
 
 
index 27434af73a239057fb9ed558519aa7d13c661d38..bfe77e0d93a9c669d0a2c6396483bbc3de2cc47d 100644 (file)
@@ -28,7 +28,8 @@ cxxCompo="""
 #include <unistd.h>
 
 #include <Calcium.hxx>
-#include <calcium.h>
+#include <CalciumException.hxx>
+${CalciumInterface}
 #include <signal.h>
 #include <SALOME_NamingService.hxx>
 #include <Utils_SALOME_Exception.hxx>
@@ -125,6 +126,8 @@ static void unexpectedHandler(void)
 ${servicesdef}
 //ENDDEF
 
+#include <calcium.h>
+
 extern "C" void cp_exit(int err);
 
 extern "C" void F_FUNC(cpexit,CPEXIT)(int *err)
index 3fef424f8334275b7395df5ebe362c24dd6cadb1..7e88b2eea0559a40793218070e3f44b9fe541ff2 100644 (file)
@@ -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 <CalciumInterface.hxx>"
+
     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)
 
index b82c2384c34ab2f1a11efbdc464af7e46098fed4..beb3ea934ef0dc0a906c26f556bc6a388265400a 100644 (file)
@@ -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))
 
index 59bddf2f03c1909c900e9aa65c1c1825cd45fcc7..d4a4756fa1a751ebf2d5132d47f601fdb186d9eb 100644 (file)
@@ -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