From: caremoli Date: Mon, 29 Mar 2010 15:14:01 +0000 (+0000) Subject: CCAR: add the way to declare data types that are defined in SALOME modules X-Git-Tag: V5_1_4a1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e02548394641cd0bbd4b78d0b494cfc65da7d556;p=tools%2Fyacsgen.git CCAR: add the way to declare data types that are defined in SALOME modules other than KERNEL. Only one module has been added : GEOM Only one data type has been added : GEOM_Object The structure is ready for other modules and data types. --- diff --git a/Examples/ast2/exeaster b/Examples/ast2/exeaster index 1d35279..544e2a1 100755 --- a/Examples/ast2/exeaster +++ b/Examples/ast2/exeaster @@ -4,7 +4,7 @@ END cat > temp.export << END P actions make_etude -P version STA10.0 +P version STA10.1 P nomjob salome P ncpus 1 A memjeveux 4.000000 @@ -28,5 +28,5 @@ F resu $PWD/resu R 8 F erre $PWD/erre R 9 END -/local/cchris/Aster/V10/Install/ASTK/ASTK_SERV/bin/as_run temp.export +/local/cchris/Aster/V10.1/aster/ASTK/ASTK_SERV/bin/as_run temp.export diff --git a/Examples/ast2/myaster/config.txt b/Examples/ast2/myaster/config.txt index d172477..eeb3785 100644 --- a/Examples/ast2/myaster/config.txt +++ b/Examples/ast2/myaster/config.txt @@ -37,17 +37,17 @@ # ID_PERF | id | - | claui2c6 # -ENV_SH | env | - | /local/cchris/Aster/V10/Install/STA10.0/profile.sh +ENV_SH | env | - | /local/cchris/Aster/V10.1/aster/STA10.1/profile.sh # LIB | ar | ? | /usr/bin/ar -rv # -BIBL | python | 2.4 | -lpython2.5 -BIBL | med | 2.3.5 | -Wl,-R -Wl,/local/cchris/pkg/med235/install/lib -L/local/cchris/pkg/med235/install/lib -lmed -BIBL | hdf5 | 1.6.5 | -lhdf5 +BIBL | python | 2.4 | -L/usr/lib -L/usr/lib/python2.5/config -lpython2.5 +BIBL | med | 2.3.5 | -L/local/cchris/Aster/V10.1/aster/public/med-2.3.6/lib -lmed +BIBL | hdf5 | 1.6.5 | -L/usr/lib -lhdf5 BIBL | zmat | 8.4 | -BIBL | mumps | ? | /local/cchris/Aster/V10/Install/public/mumps-4.7.3/lib/libdmumps.a /local/cchris/Aster/V10/Install/public/mumps-4.7.3/lib/libzmumps.a /local/cchris/Aster/V10/Install/public/mumps-4.7.3/lib/libpord.a /local/cchris/Aster/V10/Install/public/mumps-4.7.3/libseq/libmpiseq.a +BIBL | mumps | ? | /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libdmumps.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libzmumps.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libsmumps.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libcmumps.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libmumps_common.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libpord.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libmpiseq.a -L/local/cchris/Aster/V10.1/aster/public/metis-4.0/lib -lmetis BIBL | scotch | 4.0 | -BIBL | math | ? | /usr/lib/liblapack.a /usr/lib/libblas.a /usr/lib/gcc/x86_64-linux-gnu/4.3/libgfortran.a /usr/lib/gcc/x86_64-linux-gnu/4.3/libgfortran.a +BIBL | math | ? | -L/usr/lib -llapack -L/usr/lib -lblas -L/usr/lib/gcc/x86_64-linux-gnu/4.3 -lgfortran BIBL | mpi | 2 | BIBL | c++ | ? | -L/usr/lib/gcc/x86_64-linux-gnu/4.3 -lstdc++ -lsupc++ BIBL | sys | ? | -Wl,--allow-multiple-definition -Wl,--export-dynamic -lieee -ldl -lpthread -lutil -lm -lz @@ -63,24 +63,23 @@ LINK | link | ? | /usr/bin/gfortran OPTL | link | ? | -fopenmp # CC | cc | ? | /usr/bin/gcc -OPTC_D | cc | ? | -c -g -fno-stack-protector -OPTC_O | cc | ? | -c -O2 -fno-stack-protector -INCL | include | ? | -I/local/cchris/Aster/V10/Install/STA10.0/bibc/include -I/usr/include/python2.5 -I/local/cchris/Aster/V10/Install/public/hdf5-1.6.5/include +OPTC_D | cc | ? | -c -g -fno-stack-protector -fPIC +OPTC_O | cc | ? | -c -O2 -fno-stack-protector -fPIC +INCL | include | ? | -I/local/cchris/Aster/V10.1/aster/STA10.1/bibc/include -I/usr/include/python2.5 # F77 | f77 | ? | /usr/bin/gfortran -OPTF_D | f77 | ? | -c -g -fopenmp -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 -OPTF_O | f77 | ? | -c -O2 -fopenmp -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 +OPTF_D | f77 | ? | -c -g -fopenmp -fPIC -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 +OPTF_O | f77 | ? | -c -O2 -fopenmp -fPIC -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 INCLF | include | ? | -I/local/cchris/Salome/Install/KERNEL_V5/include/salome # F90 | f90 | ? | /usr/bin/gfortran -OPTF90_D | f90 | ? | -c -g -ffixed-line-length-0 -x f77-cpp-input -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 -OPTF90_O | f90 | ? | -c -O2 -ffixed-line-length-0 -x f77-cpp-input -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 -INCLF90 | include | ? | -I/local/cchris/Aster/V10/Install/STA10.0/bibf90/include_mumps-4.7.3 +OPTF90_D | f90 | ? | -c -g -ffixed-line-length-0 -x f77-cpp-input -fPIC -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 +OPTF90_O | f90 | ? | -c -O2 -ffixed-line-length-0 -x f77-cpp-input -fPIC -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 +INCLF90 | include | ? | -I/local/cchris/Aster/V10.1/aster/STA10.1/bibf90/include_mumps-4.8.4 # G77_AGLA | g77 | ? | unused # SRCFOR | src | 11-04 | bibfor -#Comment following line if you have no f90 compiler SRCF90 | src | 11-04 | bibf90 SRCFERM | src | 11-04 | fermetur SRCC | src | 11-04 | bibc @@ -113,9 +112,9 @@ ARGEXE | exec | 03-02 | -eficas_path ./Python MAKE_SURCH_OFFI | build | 11-04 | Lecture_Cata_Ele/make_surch_offi.py MAKE_CAPY_OFFI | build | 11-04 | Lecture_Cata_Ele/make_capy_offi.py # -REPOUT | exec | 11-04 | /local/cchris/Aster/V10/Install/outils -REPMAT | exec | 02-05 | /local/cchris/Aster/V10/Install/STA10.0/materiau -REPDEX | exec | 02-05 | /local/cchris/Aster/V10/Install/STA10.0/datg +REPOUT | exec | 11-04 | /local/cchris/Aster/V10.1/aster/outils +REPMAT | exec | 02-05 | /local/cchris/Aster/V10.1/aster/STA10.1/materiau +REPDEX | exec | 02-05 | /local/cchris/Aster/V10.1/aster/STA10.1/datg # SUPERV | exec | 03-02 | Accas SUPERV | exec | 03-02 | Build diff --git a/Examples/context.py b/Examples/context.py index a54f9c8..4ac8c3f 100644 --- a/Examples/context.py +++ b/Examples/context.py @@ -9,12 +9,12 @@ context={'update':1, "makeflags":"", "prerequisites":"/local/cchris/.packages.d/envSalome5", "kernel":KERNEL_ROOT_DIR, - "paco":"/local/cchris/pkg/paco/install", - "mpi":"/usr/lib/openmpi", } -aster_home="/local/cchris/Aster/V10/Install" -aster_version="STA10.0" +aster_home="/local/cchris/Aster/V10.1/aster" +aster_version="STA10.1" +#aster_home="/local/cchris/Aster/V10/Install" +#aster_version="STA10.0" diff --git a/Examples/makefile.inc b/Examples/makefile.inc index 2623cc8..ba991c1 100644 --- a/Examples/makefile.inc +++ b/Examples/makefile.inc @@ -1,7 +1,9 @@ KERNEL_ROOT_DIR=/local/cchris/Salome/Install/KERNEL_V5 -ASTER_ROOT=/local/cchris/Aster/V10/Install -ASTER_VERSION=STA10.0 +ASTER_ROOT=/local/cchris/Aster/V10.1/aster +ASTER_VERSION=STA10.1 +#ASTER_ROOT=/local/cchris/Aster/V10/Install +#ASTER_VERSION=STA10.0 FC=gfortran diff --git a/Examples/paco1/components.py b/Examples/paco1/components.py index 2d4cc72..7d28aed 100644 --- a/Examples/paco1/components.py +++ b/Examples/paco1/components.py @@ -2,7 +2,7 @@ import os from module_generator import Generator,Module,Service,PACOComponent #import context from .. -execfile("../context.py") +execfile("../pacocontext.py") cwd=os.getcwd() diff --git a/Examples/paco2/components.py b/Examples/paco2/components.py index 3ace344..8ce0e06 100644 --- a/Examples/paco2/components.py +++ b/Examples/paco2/components.py @@ -2,7 +2,7 @@ import os from module_generator import Generator,Module,Service,PACOComponent #import context from .. -execfile("../context.py") +execfile("../pacocontext.py") cwd=os.getcwd() diff --git a/Examples/paco3/components.py b/Examples/paco3/components.py index 56f8045..3896702 100644 --- a/Examples/paco3/components.py +++ b/Examples/paco3/components.py @@ -3,7 +3,7 @@ import os from module_generator import Generator,Module,Service,PACOComponent #import context from .. -execfile("../context.py") +execfile("../pacocontext.py") cwd=os.getcwd() diff --git a/Examples/pacocontext.py b/Examples/pacocontext.py new file mode 100644 index 0000000..4d4e822 --- /dev/null +++ b/Examples/pacocontext.py @@ -0,0 +1,22 @@ + +import os + +KERNEL_ROOT_DIR=os.getenv("KERNEL_ROOT_DIR","/local/cchris/Salome/Install/KERNEL_V5") +GUI_ROOT_DIR=os.getenv("GUI_ROOT_DIR","/local/cchris/Salome/Install/GUI_V5") +YACS_ROOT_DIR=os.getenv("YACS_ROOT_DIR","/local/cchris/Salome/Install/YACS_V5_1_main") + +context={'update':1, + "makeflags":"", + "prerequisites":"/local/cchris/.packages.d/envSalome5", + "kernel":KERNEL_ROOT_DIR, + "paco":"/local/cchris/pkg/paco/install", + "mpi":"/usr/lib/openmpi", + } + + +aster_home="/local/cchris/Aster/V10.1/aster" +aster_version="STA10.1" +#aster_home="/local/cchris/Aster/V10/Install" +#aster_version="STA10.0" + + diff --git a/module_generator/__init__.py b/module_generator/__init__.py index e25bec1..99b9b51 100644 --- a/module_generator/__init__.py +++ b/module_generator/__init__.py @@ -1,7 +1,7 @@ """ - Pacakge to generate SALOME modules with components + Package to generate SALOME modules with components implemented in C++, Fortran or Python - that can use datastream ports + that can use datastream ports """ from gener import Module, Service, Generator from fcompo import F77Component diff --git a/module_generator/cata_tmpl.py b/module_generator/cata_tmpl.py index 8b714d4..71d60a8 100644 --- a/module_generator/cata_tmpl.py +++ b/module_generator/cata_tmpl.py @@ -13,6 +13,8 @@ idl=""" #include "SALOME_Exception.idl" #include "SALOME_PACOExtension.idl" +${idldefs} + module ${module} { typedef sequence stringvec; @@ -82,8 +84,8 @@ salomepython_DATA = ${module}_idl.py ${PACO_salomepython_DATA} lib${module}_la_SOURCES = nodist_lib${module}_la_SOURCES = ${module}SK.cc nodist_salomeinclude_HEADERS= ${module}.hh ${PACO_SALOMEINCLUDE_HEADERS} -lib${module}_la_CXXFLAGS = -I. $$(KERNEL_INCLUDES) -lib${module}_la_LIBADD = $$(KERNEL_LIBS) +lib${module}_la_CXXFLAGS = -I. $$(SALOME_INCLUDES) +lib${module}_la_LIBADD = $$(SALOME_IDL_LIBS) ########################################################## %SK.cc %.hh : %.idl \t$$(OMNIORB_IDL) -bcxx $$(IDLCXXFLAGS) $$(OMNIORB_IDLCXXFLAGS) $$(IDL_INCLUDES) $$< diff --git a/module_generator/cpp_tmpl.py b/module_generator/cpp_tmpl.py index f564728..e1b9721 100644 --- a/module_generator/cpp_tmpl.py +++ b/module_generator/cpp_tmpl.py @@ -377,9 +377,9 @@ exeCPP=Template(exeCPP) compoMakefile=""" 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} -lib${component}Engine_la_LIBADD = -L$$(top_builddir)/idl -l${module} $$(FLIBS) ${libs} +lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl $$(SALOME_INCLUDES) ${includes} +lib${component}Engine_la_FFLAGS = $$(SALOME_INCLUDES) -fexceptions ${includes} +lib${component}Engine_la_LIBADD = ${libs} -L$$(top_builddir)/idl -l${module} $${SALOME_LIBS} $$(FLIBS) lib${component}Engine_la_LDFLAGS = ${rlibs} """ compoMakefile=Template(compoMakefile) @@ -387,9 +387,9 @@ compoMakefile=Template(compoMakefile) compoEXEMakefile=""" lib${component}Exelib_la_SOURCES = ${component}.cxx nodist_lib${component}Exelib_la_SOURCES = -lib${component}Exelib_la_CXXFLAGS = -I$$(top_builddir)/idl $$(KERNEL_INCLUDES) ${includes} -lib${component}Exelib_la_FFLAGS = $$(KERNEL_INCLUDES) -fexceptions ${includes} -lib${component}Exelib_la_LIBADD = -L$$(top_builddir)/idl -l${module} $$(FLIBS) ${libs} +lib${component}Exelib_la_CXXFLAGS = -I$$(top_builddir)/idl $$(SALOME_INCLUDES) ${includes} +lib${component}Exelib_la_FFLAGS = $$(SALOME_INCLUDES) -fexceptions ${includes} +lib${component}Exelib_la_LIBADD = ${libs} -L$$(top_builddir)/idl -l${module} $${SALOME_LIBS} $$(FLIBS) lib${component}Exelib_la_LDFLAGS = ${rlibs} """ compoEXEMakefile=Template(compoEXEMakefile) diff --git a/module_generator/cppcompo.py b/module_generator/cppcompo.py index adc8977..642750d 100644 --- a/module_generator/cppcompo.py +++ b/module_generator/cppcompo.py @@ -50,7 +50,7 @@ class CPPComponent(Component): makefileItems={"header":""" include $(top_srcdir)/adm_local/make_common_starter.am -AM_CFLAGS=$(KERNEL_INCLUDES) -fexceptions +AM_CFLAGS=$(SALOME_INCLUDES) -fexceptions """} if self.kind == "lib": makefileItems["lib_LTLIBRARIES"]=["lib"+self.name+"Engine.la"] diff --git a/module_generator/gener.py b/module_generator/gener.py index dd5b8ac..c8a59eb 100644 --- a/module_generator/gener.py +++ b/module_generator/gener.py @@ -22,57 +22,19 @@ from cata_tmpl import cataOutStream, cataInStream, cataOutparam, cataInparam from cata_tmpl import cataOutParallelStream, cataInParallelStream from cata_tmpl import cataService, cataCompo from aster_tmpl import check_aster - -corbaTypes = {"double":"CORBA::Double", "long":"CORBA::Long", - "string":"const char*", "dblevec":"const %s::dblevec&", - "stringvec":"const %s::stringvec&", "intvec":"const %s::intvec&", - "dataref":"const Engines::dataref&","file":None - } - -corbaOutTypes = {"double":"CORBA::Double&", "long":"CORBA::Long&", - "string":"CORBA::String_out", "dblevec":"%s::dblevec_out", - "stringvec":"%s::stringvec_out", "intvec":"%s::intvec_out", - "dataref":"Engines::dataref_out","file":None - } - -def corba_in_type(typ, module): - if typ in ("dblevec", "intvec", "stringvec"): - return corbaTypes[typ] % module - else: - return corbaTypes[typ] - -def corba_out_type(typ, module): - if typ in ("dblevec", "intvec", "stringvec"): - return corbaOutTypes[typ] % module - else: - return corbaOutTypes[typ] - -calciumTypes = {"CALCIUM_double":"CALCIUM_double", - "CALCIUM_integer":"CALCIUM_integer", - "CALCIUM_real":"CALCIUM_real", - "CALCIUM_string":"CALCIUM_string", - "CALCIUM_complex":"CALCIUM_complex", - "CALCIUM_logical":"CALCIUM_logical", - "CALCIUM_long":"CALCIUM_long", - } - -DatastreamParallelTypes = {"Param_Double_Port":"Param_Double_Port"} - -ValidImpl = ("CPP", "PY", "F77", "ASTER", "PACO") -ValidImplTypes = ("sequential", "parallel") -ValidTypes = corbaTypes.keys() -ValidStreamTypes = calciumTypes.keys() -ValidParallelStreamTypes = DatastreamParallelTypes.keys() -ValidDependencies = ("I", "T") -PyValidTypes = ValidTypes+["pyobj"] +from salomemodules import salome_modules +from yacstypes import corbaTypes, corbaOutTypes, moduleTypes, idlTypes, corba_in_type, corba_out_type +from yacstypes import ValidTypes, PyValidTypes, calciumTypes, DatastreamParallelTypes +from yacstypes import ValidImpl, ValidImplTypes, ValidStreamTypes, ValidParallelStreamTypes, ValidDependencies def makedirs(namedir): + """Create a new directory named namedir. If a directory already exists copy it to namedir.bak""" if os.path.exists(namedir): dirbak = namedir+".bak" if os.path.exists(dirbak): shutil.rmtree(dirbak) os.rename(namedir, dirbak) - os.listdir(dirbak) #sert seulement a mettre a jour le systeme de fichier sur certaines machines + os.listdir(dirbak) #needed to update filesystem on special machines (cluster with NFS, for example) os.makedirs(namedir) class Module(object): @@ -92,7 +54,7 @@ class Module(object): def validate(self): # Test Module name, canot have a "-" in the name if self.name.find("-") != -1: - raise Invalid("Module name %s is not valid, remove caracter - in the module name" % self.name) + raise Invalid("Module name %s is not valid, remove character - in the module name" % self.name) lcompo = set() for compo in self.components: if compo.name in lcompo: @@ -101,7 +63,7 @@ class Module(object): compo.validate() class Component(object): - def __init__(self, name, services=None, impl="PY", libs="", rlibs="", + def __init__(self, name, services=None, impl="PY", libs="", rlibs="", includes="", kind="lib", sources=None): self.name = name self.impl = impl @@ -258,7 +220,7 @@ class Generator(object): makefile = "SUBDIRS=" makefileItems={"header":""" include $(top_srcdir)/adm_local/make_common_starter.am -AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions +AM_CFLAGS=$$(SALOME_INCLUDES) -fexceptions """, "salomepython_PYTHON":[], "dist_salomescript_SCRIPTS":[], @@ -268,13 +230,23 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions "body":"", } + #get the list of SALOME modules used and put it in used_modules attribute + modules = {} + for compo in module.components: + for serv in compo.services: + for name, typ in serv.inport + serv.outport: + mod = moduleTypes[typ] + if mod: + modules[mod] = 1 + self.used_modules = modules.keys() + for compo in module.components: #for components files fdict=compo.makeCompo(self) if self.module.layout=="multidir": srcs[compo.name] = fdict #for src/Makefile.am - makefile = makefile+" "+compo.name + makefile = makefile + " " + compo.name else: srcs.update(fdict) #for src/Makefile.am @@ -286,7 +258,7 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions makefileItems["salomeinclude_HEADERS"]=makefileItems["salomeinclude_HEADERS"]+mdict.get("salomeinclude_HEADERS",[]) makefileItems["body"]=makefileItems["body"]+mdict.get("body","")+'\n' - if self.module.layout=="multidir": + if self.module.layout == "multidir": srcs["Makefile.am"] = makefile+'\n' else: srcs["Makefile.am"] = self.makeMakefile(makefileItems) @@ -294,14 +266,24 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions #for catalog files catalogfile = "%sCatalog.xml" % module.name + #add makefile definitions to make_common_starter.am + common_starter = makecommon + for mod in self.used_modules: + common_starter = common_starter + salome_modules[mod]["makefiledefs"] + '\n' + self.makeFiles({"autogen.sh":autogen, "Makefile.am":mainMakefile, "README":"", "NEWS":"", "AUTHORS":"", "ChangeLog":"", "src":srcs, "resources":{"Makefile.am":resMakefile.substitute(module=module.name), catalogfile:self.makeCatalog()}, - "adm_local":{"make_common_starter.am":makecommon, "check_aster.m4":check_aster}, + "adm_local":{"make_common_starter.am": common_starter, "check_aster.m4":check_aster}, }, namedir) + #add checks for modules in configure.ac + configure_modules="" + for mod in self.used_modules: + configure_modules = configure_modules + salome_modules[mod]["configdefs"] + '\n' + #for configure.ac configure_makefiles = [] if self.module.layout=="multidir": @@ -320,20 +302,22 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions self.makeFiles({"configure.ac":configure.substitute(module=module.name.lower(), makefiles='\n'.join(configure_makefiles), - paco_configure=paco_configure), - "idl":{"Makefile.am":idlMakefile.substitute(module=module.name, + paco_configure=paco_configure, + modules=configure_modules), + "idl":{"Makefile.am":idlMakefile.substitute(module=module.name, PACO_BUILT_SOURCES=PACO_BUILT_SOURCES, PACO_SALOMEINCLUDE_HEADERS=PACO_SALOMEINCLUDE_HEADERS, PACO_INCLUDES=PACO_INCLUDES, PACO_salomepython_DATA=PACO_salomepython_DATA, - PACO_salomeidl_DATA=PACO_salomeidl_DATA), - idlfile:self.makeidl(), - xmlfile:self.makexml()}, + PACO_salomeidl_DATA=PACO_salomeidl_DATA), + idlfile:self.makeidl(), + xmlfile:self.makexml()}, }, namedir) else : - self.makeFiles({"configure.ac":configure.substitute(module=module.name.lower(), + self.makeFiles({"configure.ac":configure.substitute(module=module.name.lower(), makefiles='\n'.join(configure_makefiles), - paco_configure=""), + paco_configure="", + modules=configure_modules), "idl":{"Makefile.am":idlMakefile.substitute(module=module.name, PACO_BUILT_SOURCES="", PACO_SALOMEINCLUDE_HEADERS="", @@ -433,10 +417,10 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions params = [] for name, typ in serv.inport: if typ == "file":continue #files are not passed through IDL interface - params.append("in %s %s" % (typ, name)) + params.append("in %s %s" % (idlTypes[typ], name)) for name, typ in serv.outport: if typ == "file":continue #files are not passed through IDL interface - params.append("out %s %s" % (typ, name)) + params.append("out %s %s" % (idlTypes[typ], name)) service = " void %s(" % serv.name service = service+",".join(params)+");" services.append(service) @@ -449,17 +433,27 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions if typ == "file":continue #files are not passed through IDL interface if compo.impl in ("PY", "ASTER") and typ == "pyobj": typ = "Engines::fileBlock" + else: + typ=idlTypes[typ] params.append("in %s %s" % (typ, name)) for name, typ in serv.outport: if typ == "file":continue #files are not passed through IDL interface if compo.impl in ("PY", "ASTER") and typ == "pyobj": typ = "Engines::fileBlock" + else: + typ=idlTypes[typ] params.append("out %s %s" % (typ, name)) service = " void %s(" % serv.name service = service+",".join(params)+") raises (SALOME::SALOME_Exception);" services.append(service) interfaces.append(interface.substitute(component=compo.name, services="\n".join(services))) - return idl.substitute(module=self.module.name, interfaces='\n'.join(interfaces)) + + #build idl includes for SALOME modules + idldefs="" + for mod in self.used_modules: + idldefs = idldefs + salome_modules[mod]["idldefs"] + + return idl.substitute(module=self.module.name, interfaces='\n'.join(interfaces),idldefs=idldefs) # For PaCO++ def makexml(self): diff --git a/module_generator/mod_tmpl.py b/module_generator/mod_tmpl.py index 9684500..8698913 100644 --- a/module_generator/mod_tmpl.py +++ b/module_generator/mod_tmpl.py @@ -44,6 +44,9 @@ if test "x$$Kernel_ok" = "xno"; then AC_MSG_ERROR([You must define a correct KERNEL_ROOT_DIR or use the --with-kernel= configure option !]) fi +dnl Check Salome modules Install +${modules} + AC_PROG_LIBTOOL AC_PROG_CC AC_PROG_CXX @@ -144,6 +147,10 @@ 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) +SALOME_LIBS= ${KERNEL_LIBS} +SALOME_IDL_LIBS= -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeIDLKernel +SALOME_INCLUDES= ${KERNEL_INCLUDES} + """ resMakefile=""" diff --git a/module_generator/paco_tmpl.py b/module_generator/paco_tmpl.py index b8312c2..d7d75cc 100644 --- a/module_generator/paco_tmpl.py +++ b/module_generator/paco_tmpl.py @@ -36,8 +36,8 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) $$(PACO_INCLUDES) -fexceptions lib_LTLIBRARIES = lib${component}Engine.la 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) $$(PACO_INCLUDES) $$(MPI_INCLUDES) ${includes} -lib${component}Engine_la_LIBADD = -L$$(top_builddir)/idl -l${module} @KERNEL_ROOT_DIR@/lib/salome/libSalomeParallelDSCContainer.la @PACOPATH@/lib/libPaCO_direct_comScheduling.la $$(FLIBS) ${libs} $$(PACO_LIBS) +lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl $$(SALOME_INCLUDES) $$(PACO_INCLUDES) $$(MPI_INCLUDES) ${includes} +lib${component}Engine_la_LIBADD = -L$$(top_builddir)/idl -l${module} @KERNEL_ROOT_DIR@/lib/salome/libSalomeParallelDSCContainer.la @PACOPATH@/lib/libPaCO_direct_comScheduling.la $$(FLIBS) ${libs} $$(PACO_LIBS) $$(SALOME_LIBS) lib${component}Engine_la_LDFLAGS = ${rlibs} salomeinclude_HEADERS = ${component}.hxx """ diff --git a/module_generator/salomemodules.py b/module_generator/salomemodules.py new file mode 100644 index 0000000..7a2f515 --- /dev/null +++ b/module_generator/salomemodules.py @@ -0,0 +1,31 @@ +####################################################################### +# SALOME modules # +####################################################################### +salome_modules={} + +#module GEOM +idldefs=""" +#include "GEOM_Gen.idl" +""" +makefiledefs=""" +#module GEOM +GEOM_IDL_INCLUDES = -I$(GEOM_ROOT_DIR)/idl/salome +GEOM_INCLUDES= -I$(GEOM_ROOT_DIR)/include/salome +GEOM_IDL_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome -lSalomeIDLGEOM +GEOM_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome +SALOME_LIBS += ${GEOM_LIBS} +SALOME_IDL_LIBS += ${GEOM_IDL_LIBS} +SALOME_INCLUDES += ${GEOM_INCLUDES} +IDL_INCLUDES += ${GEOM_IDL_INCLUDES} +""" +configdefs=""" +if test "x${GEOM_ROOT_DIR}" != "x" && test -d ${GEOM_ROOT_DIR} ; then + AC_MSG_RESULT(Using GEOM installation in ${GEOM_ROOT_DIR}) +else + AC_MSG_ERROR([Cannot find module GEOM. Have you set GEOM_ROOT_DIR ?],1) +fi +""" + +salome_modules["GEOM"]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs} + + diff --git a/module_generator/yacstypes.py b/module_generator/yacstypes.py new file mode 100644 index 0000000..cef9507 --- /dev/null +++ b/module_generator/yacstypes.py @@ -0,0 +1,60 @@ +########################################################### +# Types definitions # +########################################################### +corbaTypes = {"double":"CORBA::Double", "long":"CORBA::Long", + "string":"const char*", "dblevec":"const %s::dblevec&", + "stringvec":"const %s::stringvec&", "intvec":"const %s::intvec&", + "file":None + } + +corbaOutTypes = {"double":"CORBA::Double&", "long":"CORBA::Long&", + "string":"CORBA::String_out", "dblevec":"%s::dblevec_out", + "stringvec":"%s::stringvec_out", "intvec":"%s::intvec_out", + "file":None + } +moduleTypes = {"double":"", "long":"", "string":"", "dblevec":"", "stringvec":"", "intvec":"", "file":"" } + +idlTypes = {"double":"double", "long":"long", "string":"string", "dblevec":"dblevec", "stringvec":"stringvec", "intvec":"intvec", "file":"" } + +def corba_in_type(typ, module): + if corbaTypes[typ].count("%s")>0: + return corbaTypes[typ] % module + else: + return corbaTypes[typ] + +def corba_out_type(typ, module): + if corbaOutTypes[typ].count("%s")>0: + return corbaOutTypes[typ] % module + else: + return corbaOutTypes[typ] + +ValidTypes = corbaTypes.keys() +PyValidTypes = ValidTypes+["pyobj"] + +def add_type(typename, corbaType, corbaOutType, module, idltype): + corbaTypes[typename] = corbaType + corbaOutTypes[typename] = corbaOutType + moduleTypes[typename] = module + idlTypes[typename] = idltype + ValidTypes.append(typename) + PyValidTypes.append(typename) + +calciumTypes = {"CALCIUM_double":"CALCIUM_double", + "CALCIUM_integer":"CALCIUM_integer", + "CALCIUM_real":"CALCIUM_real", + "CALCIUM_string":"CALCIUM_string", + "CALCIUM_complex":"CALCIUM_complex", + "CALCIUM_logical":"CALCIUM_logical", + "CALCIUM_long":"CALCIUM_long", + } + +DatastreamParallelTypes = {"Param_Double_Port":"Param_Double_Port"} + +ValidImpl = ("CPP", "PY", "F77", "ASTER", "PACO") +ValidImplTypes = ("sequential", "parallel") +ValidStreamTypes = calciumTypes.keys() +ValidParallelStreamTypes = DatastreamParallelTypes.keys() +ValidDependencies = ("I", "T") + +add_type("dataref", "const Engines::dataref&", "Engines::dataref_out", "", "dataref") +add_type("GEOM_Object", "GEOM::GEOM_Object_ptr", "GEOM::GEOM_Object_out", "GEOM", "GEOM::GEOM_Object")