--- /dev/null
+ subroutine bidul()
+ write(6,*)"coucou"
+ return
+ end
CALL cplDB(compo,CP_ITERATION,t0,t1,1,'PARAM',1,nval,tt,info)
write(6,*)'info=',info
write(6,*)'tt=',tt
+ call bidul()
c=a+b
return
end
c2=F77Component("fcode2", services=[Service("serv1",inport=[("a","double"),("b","double")],
outport=[("c","double")],
instream=[("PARAM","CALCIUM_double","I")],), ],
- libs="-L%s -lcode2" % cwd)
+ sources=["code2.f","bidul.f"])
g=Generator(Module("fcompos",components=[c1,c2],prefix="./install"),context)
g.generate()
--- /dev/null
+def f():
+ print "coucou"
cwd=os.getcwd()
+defs="""
+import bidul
+"""
body="""
#b1
val=numpy.zeros(10,'d')
info,tt,ii,mval=calcium.cp_ldb(component, dep, 0.,1., 1, "aa", nval,val)
print mval,val
+ bidul.f()
c=a+b
d=a-b
err=calcium.cp_fin(component,calcium.CP_ARRET)
outport=[("c","double"),("d","double")],
instream=[("aa","CALCIUM_double","I"),],
outstream=[("ba","CALCIUM_double","I"),],
- defs="#def1",body=body,
+ defs=defs,body=body,
),
],
+ sources=["bidul.py"],
)
-include README.txt
-recursive-include Examples/fort1 code1.f code2.f components.py coupling.xml Makefile README.txt
-recursive-include Examples/cpp1 components.py coupling.xml README.txt
-recursive-include Examples/pyth1 components.py coupling.xml README.txt
+include Examples/fort1/code1.f Examples/fort1/code2.f Examples/fort1/components.py Examples/fort1/coupling.xml Examples/fort1/Makefile Examples/fort1/README.txt
+include Examples/cpp1/components.py Examples/cpp1/coupling.xml Examples/cpp1/README.txt
+include Examples/pyth1/components.py Examples/pyth1/coupling.xml Examples/pyth1/README.txt
+include Examples/fort2/code1.f Examples/fort2/code2.f Examples/fort2/components.py Examples/fort2/coupling.xml Examples/fort2/Makefile Examples/fort2/README.txt
+include Examples/cpp2/components.py Examples/cpp2/coupling.xml Examples/cpp2/README.txt Examples/cpp2/Makefile Examples/cpp2/prog.cxx
+include Examples/pyth2/components.py Examples/pyth2/coupling.xml Examples/pyth2/README.txt
AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions
lib_LTLIBRARIES = lib${component}Engine.la
-lib${component}Engine_la_SOURCES = ${component}.cxx
+lib${component}Engine_la_SOURCES = ${component}.cxx ${sources}
nodist_lib${component}Engine_la_SOURCES =
lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl $$(KERNEL_INCLUDES) ${includes}
lib${component}Engine_la_FFLAGS = $$(KERNEL_INCLUDES) -fexceptions ${includes}
class CPPComponent(Component):
def __init__(self, name, services=None, libs="", rlibs="", includes="",
- kind="lib", exe_path=None):
+ kind="lib", exe_path=None, sources=None):
self.exe_path = exe_path
Component.__init__(self, name, services, impl="CPP", libs=libs,
- rlibs=rlibs, includes=includes, kind=kind)
+ rlibs=rlibs, includes=includes, kind=kind,
+ sources=sources)
def validate(self):
""" validate component definition parameters"""
cxxfile = "%s.cxx" % self.name
hxxfile = "%s.hxx" % self.name
if self.kind == "lib":
+ sources = " ".join(self.sources)
return {"Makefile.am":compoMakefile.substitute(module=gen.module.name,
component=self.name,
libs=self.libs,
rlibs=self.rlibs,
+ sources=sources,
includes=self.includes),
cxxfile:self.makecxx(gen), hxxfile:self.makehxx(gen)}
if self.kind == "exe":
class F77Component(CPPComponent):
def __init__(self, name, services=None, libs="", rlibs="",
- kind="lib", exe_path=None):
- self.exe_path = exe_path
- Component.__init__(self, name, services, impl="F77",
- libs=libs, rlibs=rlibs, kind=kind)
+ kind="lib", exe_path=None, sources=None):
+ CPPComponent.__init__(self, name, services, libs=libs, rlibs=rlibs,
+ kind=kind, exe_path=exe_path, sources=sources)
+ self.impl = "F77"
def makebody(self):
for serv in self.services:
if compo.name in lcompo:
raise Invalid("%s is already defined as a component of the module" % compo.name)
lcompo.add(compo.name)
+ compo.validate()
class Component(object):
def __init__(self, name, services=None, impl="PY", libs="", rlibs="",
- includes="", kind="lib"):
+ includes="", kind="lib", sources=None):
self.name = name
self.impl = impl
self.kind = kind
self.libs = libs
self.rlibs = rlibs
self.includes = includes
- self.validate()
+ self.sources = sources or []
def validate(self):
if self.impl not in ValidImpl:
lnames.add(serv.name)
serv.validate()
+ for src in self.sources:
+ if not os.path.exists(src):
+ raise Invalid("Source file %s does not exist" % src)
+
def getImpl(self):
return "SO", ""
"adm_local":{"make_common_starter.am":makecommon, "check_aster.m4":check_aster},
}, namedir)
os.chmod(os.path.join(namedir, "autogen.sh"), 0777)
+ #copy source files if any in creates tree
+ for compo in module.components:
+ for src in compo.sources:
+ shutil.copyfile(src, os.path.join(namedir, "src", compo.name, src))
for m4file in ("check_Kernel.m4", "check_omniorb.m4",
"ac_linker_options.m4", "ac_cxx_option.m4",
from pyth_tmpl import pycompoEXEMakefile, pycompoMakefile
class PYComponent(Component):
- def __init__(self, name, services=None, python_path=None, kind="lib"):
+ def __init__(self, name, services=None, python_path=None, kind="lib",
+ sources=None):
self.python_path = python_path or []
- Component.__init__(self, name, services, impl="PY", kind=kind)
+ Component.__init__(self, name, services, impl="PY", kind=kind,
+ sources=sources)
def validate(self):
Component.validate(self)
def makeCompo(self, gen):
pyfile = "%s.py" % self.name
+ sources = " ".join(self.sources)
if self.kind == "lib":
return {"Makefile.am":pycompoMakefile.substitute(module=gen.module.name,
- component=self.name), pyfile:self.makepy(gen)}
+ component=self.name,
+ sources=sources),
+ pyfile:self.makepy(gen)
+ }
if self.kind == "exe":
return {"Makefile.am":pycompoEXEMakefile.substitute(module=gen.module.name,
- component=self.name), self.name+".exe":self.makepyexe(gen),
- }
+ component=self.name,
+ sources=sources),
+ self.name+".exe":self.makepyexe(gen),
+ }
def makepy(self, gen):
services = []
#Makefile
pycompoMakefile="""include $$(top_srcdir)/adm_local/make_common_starter.am
-salomepython_PYTHON = ${component}.py
+salomepython_PYTHON = ${component}.py ${sources}
"""
pycompoMakefile=Template(pycompoMakefile)
pycompoEXEMakefile="""include $$(top_srcdir)/adm_local/make_common_starter.am
+salomepython_PYTHON = ${sources}
dist_salomescript_SCRIPTS= ${component}.exe
"""
pycompoEXEMakefile=Template(pycompoEXEMakefile)