From: Ovidiu Mircescu Date: Fri, 21 Mar 2014 15:20:09 +0000 (+0100) Subject: Examples updated for the new API which generates modules for cmake. X-Git-Tag: V7_5_0a1~4^2~2^2~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=73e15b55cf02729e6d2396ee96fb8e926494f76f;p=tools%2Fyacsgen.git Examples updated for the new API which generates modules for cmake. Aster examples (ast*) still need to be fixed. Paco examples (paco*) do not work and will be probably removed. --- diff --git a/Examples/calcium1/Makefile b/Examples/calcium1/Makefile index a6f538c..a6ccdbb 100644 --- a/Examples/calcium1/Makefile +++ b/Examples/calcium1/Makefile @@ -27,4 +27,4 @@ code1.o:code1.f $(FC) -c code1.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions clean: - rm -rf *.o *.so install install.bak traceExec_proc appli appli.bak pycompos_SRC pycompos_SRC.bak + rm -rf *.o *.so install install.bak traceExec_proc appli appli.bak pycompos_SRC pycompos_SRC.bak pycompos_build pycompos_build.bak diff --git a/Examples/calcium1/components.py b/Examples/calcium1/components.py index 150b8b5..271268d 100644 --- a/Examples/calcium1/components.py +++ b/Examples/calcium1/components.py @@ -21,6 +21,7 @@ import os #import context from .. execfile("../context.py") from module_generator import Generator,Module,Service,PYComponent,CPPComponent,F77Component +from module_generator import Library # C++ component @@ -449,13 +450,12 @@ c3=F77Component("fcode1", ], ), ], - libs="-L%s -lcode1" % cwd, - rlibs="-Wl,--rpath -Wl,%s" % cwd, + libs=[Library(name="code1", path=cwd)], + rlibs=cwd, ) -g=Generator(Module("pycompos",components=[c1,c2,c3],prefix="./install",layout="multidir"),context) +g=Generator(Module("pycompos",components=[c1,c2,c3],prefix="./install"),context) g.generate() -g.bootstrap() g.configure() g.make() g.install() diff --git a/Examples/calcium2/Makefile b/Examples/calcium2/Makefile index a6f538c..a6ccdbb 100644 --- a/Examples/calcium2/Makefile +++ b/Examples/calcium2/Makefile @@ -27,4 +27,4 @@ code1.o:code1.f $(FC) -c code1.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions clean: - rm -rf *.o *.so install install.bak traceExec_proc appli appli.bak pycompos_SRC pycompos_SRC.bak + rm -rf *.o *.so install install.bak traceExec_proc appli appli.bak pycompos_SRC pycompos_SRC.bak pycompos_build pycompos_build.bak diff --git a/Examples/calcium2/components.py b/Examples/calcium2/components.py index 7fd81fe..93676f7 100644 --- a/Examples/calcium2/components.py +++ b/Examples/calcium2/components.py @@ -22,6 +22,7 @@ import os #import context from .. execfile("../context.py") from module_generator import Generator,Module,Service,PYComponent,CPPComponent,F77Component +from module_generator import Library # C++ component @@ -447,13 +448,12 @@ c3=F77Component("fcode1", ], ), ], - libs="-L%s -lcode1" % cwd, - rlibs="-Wl,--rpath -Wl,%s" % cwd, + libs=[Library(name="code1", path=cwd)], + rlibs=cwd, ) -g=Generator(Module("pycompos",components=[c1,c2,c3],prefix="./install",layout="multidir"),context) +g=Generator(Module("pycompos",components=[c1,c2,c3],prefix="./install"),context) g.generate() -g.bootstrap() g.configure() g.make() g.install() diff --git a/Examples/context.py b/Examples/context.py index ed2317c..7023d24 100644 --- a/Examples/context.py +++ b/Examples/context.py @@ -18,15 +18,15 @@ # import os,sys -sys.path.insert(0,"../..") -SALOME_ROOT=os.path.expanduser("~/Salome/Install") -SALOME_PREREQ=os.path.expanduser("~/.packages.d/envSalome6main") +SALOME_ROOT=os.getenv("SALOME_DIR") +SALOME_PREREQ=os.path.join(SALOME_ROOT, "salome_prerequisites.sh") +#SALOME_PREREQ=os.path.join(SALOME_ROOT, "salome_prerequisites_appli.sh") -KERNEL_ROOT_DIR=os.getenv("KERNEL_ROOT_DIR",os.path.join(SALOME_ROOT,"KERNEL_V6")) -GUI_ROOT_DIR=os.getenv("GUI_ROOT_DIR",os.path.join(SALOME_ROOT,"GUI_V6")) -YACS_ROOT_DIR=os.getenv("YACS_ROOT_DIR",os.path.join(SALOME_ROOT,"YACS_V6")) -GEOM_ROOT_DIR=os.getenv("GEOM_ROOT_DIR",os.path.join(SALOME_ROOT,"GEOM_V6")) +KERNEL_ROOT_DIR=os.getenv("KERNEL_ROOT_DIR","") +GUI_ROOT_DIR=os.getenv("GUI_ROOT_DIR","") +YACS_ROOT_DIR=os.getenv("YACS_ROOT_DIR","") +GEOM_ROOT_DIR=os.getenv("GEOM_ROOT_DIR","") context={'update':1, "makeflags":"", diff --git a/Examples/cpp1/Makefile b/Examples/cpp1/Makefile index cef684d..360fa5a 100644 --- a/Examples/cpp1/Makefile +++ b/Examples/cpp1/Makefile @@ -18,4 +18,4 @@ # clean: - rm -rf *.o *.so cppcompos_SRC cppcompos_SRC.bak appli appli.bak install install.bak traceExec_proc + rm -rf *.o *.so cppcompos_SRC cppcompos_SRC.bak appli appli.bak install install.bak traceExec_proc cppcompos_build.bak cppcompos_build diff --git a/Examples/cpp1/components.py b/Examples/cpp1/components.py index 51522a0..d5bf043 100644 --- a/Examples/cpp1/components.py +++ b/Examples/cpp1/components.py @@ -48,14 +48,12 @@ c1=CPPComponent("compo1",services=[ defs="//def1",body=body, ), ], - includes="-I/usr/include", calciumextendedinterface=1, ) g=Generator(Module("cppcompos",components=[c1],prefix="./install"),context) g.generate() -g.bootstrap() g.configure() g.make() g.install() diff --git a/Examples/cpp2/Makefile b/Examples/cpp2/Makefile index f8e6318..7a56c68 100644 --- a/Examples/cpp2/Makefile +++ b/Examples/cpp2/Makefile @@ -20,6 +20,6 @@ include ../makefile.inc prog:prog.cxx - g++ -o prog prog.cxx -L./install/lib/salome -lcompo1Exelib + g++ -o prog prog.cxx -L./install/lib/salome -lcompo1Exelib -lSalomeIDLcppcompos clean: - rm -rf *.o prog install install.bak appli appli.bak cppcompos_SRC cppcompos_SRC.bak compo1_inst_1 traceExec_proc + rm -rf *.o prog install install.bak appli appli.bak cppcompos_SRC cppcompos_SRC.bak compo1_inst_1 traceExec_proc cppcompos_build cppcompos_build.bak diff --git a/Examples/cpp2/components.py b/Examples/cpp2/components.py index 2a4e024..94d45ab 100644 --- a/Examples/cpp2/components.py +++ b/Examples/cpp2/components.py @@ -48,7 +48,6 @@ c1=CPPComponent("compo1",services=[ defs="//def1",body=body, ), ], - includes="-I/usr/include", kind="exe", exe_path=os.path.join(cwd,"prog"), ) @@ -56,7 +55,6 @@ c1=CPPComponent("compo1",services=[ g=Generator(Module("cppcompos",components=[c1],prefix="./install"),context) g.generate() -g.bootstrap() g.configure() g.make() g.install() diff --git a/Examples/cppgui1/Makefile b/Examples/cppgui1/Makefile index cef684d..360fa5a 100644 --- a/Examples/cppgui1/Makefile +++ b/Examples/cppgui1/Makefile @@ -18,4 +18,4 @@ # clean: - rm -rf *.o *.so cppcompos_SRC cppcompos_SRC.bak appli appli.bak install install.bak traceExec_proc + rm -rf *.o *.so cppcompos_SRC cppcompos_SRC.bak appli appli.bak install install.bak traceExec_proc cppcompos_build.bak cppcompos_build diff --git a/Examples/cppgui1/components.py b/Examples/cppgui1/components.py index 13c5381..fc91a91 100644 --- a/Examples/cppgui1/components.py +++ b/Examples/cppgui1/components.py @@ -103,7 +103,6 @@ c1=CPPComponent("cppcompos",services=[ defs="//def1",body=body, ), ], - includes="-I/usr/include", idls=["*.idl"], interfacedefs=idldefs, inheritedinterface="Idl_A", @@ -119,7 +118,6 @@ modul=Module("cppcompos",components=[c1],prefix="./install", g=Generator(modul,context) g.generate() -g.bootstrap() g.configure() g.make() g.install() diff --git a/Examples/exec.sh b/Examples/exec.sh new file mode 100755 index 0000000..d035773 --- /dev/null +++ b/Examples/exec.sh @@ -0,0 +1,14 @@ +#/bin/bash +# execute a command within SALOME environment + +com=$* + +# Modify to your SALOME installation +export SALOME_DIR=/local00/home/I35256/salome/install/V7_main_git + +source $SALOME_DIR/salome_prerequisites.sh +source $SALOME_DIR/salome_modules.sh + +echo execution: $com +$com + diff --git a/Examples/fort1/Makefile b/Examples/fort1/Makefile index f140837..62836c0 100644 --- a/Examples/fort1/Makefile +++ b/Examples/fort1/Makefile @@ -24,10 +24,13 @@ libcode1.so:code1.o $(FC) -shared -fPIC -o libcode1.so code1.o code1.o:code1.f $(FC) -c code1.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions -libcode2.so:code2.o - $(FC) -shared -fPIC -o libcode2.so code2.o +libcode2.so:code2.o bidul.o + $(FC) -shared -fPIC -o libcode2.so code2.o bidul.o code2.o:code2.f $(FC) -c code2.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions +bidul.o:bidul.f + $(FC) -c bidul.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions + clean: - rm -rf *.o *.so fcompos_SRC install fcompos_SRC.bak traceExec_proc appli appli.bak install.bak + rm -rf *.o *.so fcompos_SRC install fcompos_SRC.bak traceExec_proc appli appli.bak install.bak fcompos_build fcompos_build.bak diff --git a/Examples/fort1/components.py b/Examples/fort1/components.py index 4bb6006..c98bf1f 100644 --- a/Examples/fort1/components.py +++ b/Examples/fort1/components.py @@ -22,14 +22,15 @@ import os #import context from .. execfile("../context.py") from module_generator import Generator,Module,Service,F77Component +from module_generator import Library cwd=os.getcwd() c1=F77Component("fcode1", services=[Service("serv1",inport=[("a","double"),("b","double")], outport=[("c","double")], outstream=[("PARAM","CALCIUM_double","I")],), ], - libs="-L%s -lcode1" % cwd, - rlibs="-Wl,--rpath -Wl,%s" % cwd, + libs = [Library(name="code1", path=cwd)], + rlibs = cwd, ) c2=F77Component("fcode2", services=[Service("serv1",inport=[("a","double"),("b","double")], @@ -39,7 +40,6 @@ c2=F77Component("fcode2", services=[Service("serv1",inport=[("a","double"),("b", g=Generator(Module("fcompos",components=[c1,c2],prefix="./install"),context) g.generate() -g.bootstrap() g.configure() g.make() g.install() diff --git a/Examples/fort2/Makefile b/Examples/fort2/Makefile index 8bfe7ae..1e8c25b 100644 --- a/Examples/fort2/Makefile +++ b/Examples/fort2/Makefile @@ -19,16 +19,18 @@ include ../makefile.inc +OPT_RPATH=-Wl,-rpath-link,$(KERNEL_ROOT_DIR)/lib/salome -Wl,-rpath-link,install/lib/salome + all:prog1 prog2 prog1:code1.o - $(FC) -o prog1 code1.o -L./install/lib/salome -lfcode1Exelib -L$(KERNEL_ROOT_DIR)/lib/salome -lCalciumC + $(FC) -o prog1 code1.o -L./install/lib/salome -lfcode1Exelib -L$(KERNEL_ROOT_DIR)/lib/salome -lCalciumC $(OPT_RPATH) code1.o:code1.f $(FC) -c code1.f -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions prog2:code2.o - $(FC) -o prog2 code2.o -L./install/lib/salome -lfcode2Exelib -L$(KERNEL_ROOT_DIR)/lib/salome -lCalciumC + $(FC) -o prog2 code2.o -L./install/lib/salome -lfcode2Exelib -L$(KERNEL_ROOT_DIR)/lib/salome -lCalciumC $(OPT_RPATH) code2.o:code2.f $(FC) -c code2.f -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions clean: - rm -rf *.o prog1 prog2 fcode1_inst_1 fcode2_inst_1 fcompos_SRC install traceExec_proc install.bak fcompos_SRC.bak appli appli.bak + rm -rf *.o prog1 prog2 fcode1_inst_1 fcode2_inst_1 fcompos_SRC install traceExec_proc install.bak fcompos_SRC.bak appli appli.bak fcompos_build.bak fcompos_build diff --git a/Examples/fort2/components.py b/Examples/fort2/components.py index 49c5547..f441f1c 100644 --- a/Examples/fort2/components.py +++ b/Examples/fort2/components.py @@ -40,7 +40,6 @@ c2=F77Component("fcode2", services=[Service("serv1",inport=[("a","double"),("b", g=Generator(Module("fcompos",components=[c1,c2],prefix="./install"),context) g.generate() -g.bootstrap() g.configure() g.make() g.install() diff --git a/Examples/hxx1/Makefile b/Examples/hxx1/Makefile index c00e8f9..6bf9d52 100644 --- a/Examples/hxx1/Makefile +++ b/Examples/hxx1/Makefile @@ -18,4 +18,4 @@ # clean: - rm -rf *.o *.so hxxcompos_SRC hxxcompos_SRC.bak appli appli.bak install install.bak traceExec_proc COMPONENTCPP_INSTALL COMPONENTCPP_SRC COMPONENTCPP_BUILD parse_result parse_type_result + rm -rf parse_* appli install hxxcompos_* COMPONENTCPP_* diff --git a/Examples/hxx1/build.sh b/Examples/hxx1/build.sh new file mode 100755 index 0000000..da0953e --- /dev/null +++ b/Examples/hxx1/build.sh @@ -0,0 +1,19 @@ + +# build COMPONENTCPP lib +tar -xzvf cpp_component.tgz +mkdir COMPONENTCPP_BUILD +export HXXTESTPATH=`pwd` +cd COMPONENTCPP_SRC +../../exec.sh ./build_configure +cd ../COMPONENTCPP_BUILD +../../exec.sh ../COMPONENTCPP_SRC/configure --prefix=$HXXTESTPATH/COMPONENTCPP_INSTALL +../../exec.sh make +../../exec.sh make install +cd .. +# build & test SALOME component +../exec.sh python component.py + +appli/salome start -t +sleep 2 +appli/salome shell python test_compohxx.py +appli/salome killall diff --git a/Examples/hxx1/component.py b/Examples/hxx1/component.py index c69d07a..dfac34f 100644 --- a/Examples/hxx1/component.py +++ b/Examples/hxx1/component.py @@ -28,7 +28,9 @@ gui_root_dir=os.environ["GUI_ROOT_DIR"] yacs_root_dir=os.environ["YACS_ROOT_DIR"] med_root_dir=os.environ["MED_ROOT_DIR"] geom_root_dir=os.environ["GEOM_ROOT_DIR"] -prereq_file=os.path.join(kernel_root_dir,"..","env_products.sh") +SALOME_ROOT=os.getenv("SALOME_DIR") +prereq_file=os.path.join(SALOME_ROOT, "salome_prerequisites.sh") + if not os.path.exists(prereq_file): prereq_file=os.path.join(kernel_root_dir,"..","..","env_products.sh") if not os.path.exists(prereq_file): @@ -60,20 +62,19 @@ c4=HXX2SALOMEComponent("ICOCO.hxx","libICOCOCXX.so" , cpppath ) g=Generator(Module("hxxcompos",components=[c4,c1],prefix="./install"),context) g.generate() -g.bootstrap() g.configure() g.make() g.install() g.make_appli("appli", - restrict=["KERNEL","GUI","YACS"], - altmodules={"GUI":gui_root_dir, - "MED":med_root_dir, - "YACS":yacs_root_dir, - "GEOM":geom_root_dir}) + restrict=["KERNEL","GUI","YACS","MED","GEOM"], +# altmodules={"GUI":gui_root_dir, +# "MED":med_root_dir, +# "YACS":yacs_root_dir, +# "GEOM":geom_root_dir}) + ) cppenv=""" export CALCULCPP_ROOT_DIR=%(cpppath)s export ICOCOCPP_ROOT_DIR=%(cpppath)s """ % {"cpppath" : cpppath} cppenvfile=open("appli/env.d/cppEnv.sh","w") cppenvfile.write(cppenv) cppenvfile.close() - diff --git a/Examples/makefile.inc b/Examples/makefile.inc index a83bdf1..d708f30 100644 --- a/Examples/makefile.inc +++ b/Examples/makefile.inc @@ -17,8 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -KERNEL_ROOT_DIR=$(HOME)/Salome/Install/KERNEL_V6 -MED2HOME=/temp +#MED2HOME=/temp ASTER_ROOT=$(HOME)/Aster/V10.3/aster ASTER_VERSION=STA10.3 diff --git a/Examples/pydoc1/Makefile b/Examples/pydoc1/Makefile index 3df18b8..d8bc261 100644 --- a/Examples/pydoc1/Makefile +++ b/Examples/pydoc1/Makefile @@ -18,4 +18,4 @@ # clean: - rm -rf *.pyc pycompos_SRC pycompos_SRC.bak appli appli.bak install install.bak traceExec_proc + rm -rf *.pyc pycompos_* appli appli.bak install install.bak traceExec_proc diff --git a/Examples/pydoc1/components.py b/Examples/pydoc1/components.py index 1878528..72e88d6 100644 --- a/Examples/pydoc1/components.py +++ b/Examples/pydoc1/components.py @@ -46,7 +46,6 @@ modul=Module("pycompos",components=[c1],prefix="./install", g=Generator(modul,context) g.generate() -g.bootstrap() g.configure() g.make() g.install() diff --git a/Examples/pygui1/Makefile b/Examples/pygui1/Makefile index 3df18b8..1ea1039 100644 --- a/Examples/pygui1/Makefile +++ b/Examples/pygui1/Makefile @@ -18,4 +18,4 @@ # clean: - rm -rf *.pyc pycompos_SRC pycompos_SRC.bak appli appli.bak install install.bak traceExec_proc + rm -rf *.pyc pycompos_SRC pycompos_SRC.bak appli appli.bak install install.bak traceExec_proc pycompos_build.bak pycompos_build diff --git a/Examples/pygui1/components.py b/Examples/pygui1/components.py index ad7c933..6e2d3e2 100644 --- a/Examples/pygui1/components.py +++ b/Examples/pygui1/components.py @@ -109,7 +109,6 @@ modul=Module("pycompos",components=[c1],prefix="./install", g=Generator(modul,context) g.generate() -g.bootstrap() g.configure() g.make() g.install() diff --git a/Examples/pyth1/Makefile b/Examples/pyth1/Makefile index 51e2078..0567fc0 100644 --- a/Examples/pyth1/Makefile +++ b/Examples/pyth1/Makefile @@ -18,4 +18,4 @@ # clean: - rm -rf *.o *.so *.pyc pycompos_SRC pycompos_SRC.bak appli appli.bak install install.bak traceExec_proc + rm -rf *.o *.so *.pyc pycompos_SRC pycompos_SRC.bak appli appli.bak install install.bak traceExec_proc pycompos_build.bak pycompos_build diff --git a/Examples/pyth1/components.py b/Examples/pyth1/components.py index 3f7a743..de60026 100644 --- a/Examples/pyth1/components.py +++ b/Examples/pyth1/components.py @@ -59,7 +59,6 @@ c1=PYComponent("compo2",services=[ g=Generator(Module("pycompos",components=[c1],prefix="./install"),context) g.generate() -g.bootstrap() g.configure() g.make() g.install() diff --git a/Examples/pyth2/Makefile b/Examples/pyth2/Makefile index 5ef6962..fd8b894 100644 --- a/Examples/pyth2/Makefile +++ b/Examples/pyth2/Makefile @@ -18,4 +18,4 @@ # clean: - rm -rf *.o *.so *.pyc pycompos_SRC pycompos_SRC.bak appli appli.bak install install.bak traceExec_proc compo2_inst_1 + rm -rf *.o *.so *.pyc pycompos_SRC pycompos_SRC.bak appli appli.bak install install.bak traceExec_proc compo2_inst_1 pycompos_build.bak pycompos_build diff --git a/Examples/pyth2/components.py b/Examples/pyth2/components.py index 883a937..f30385a 100644 --- a/Examples/pyth2/components.py +++ b/Examples/pyth2/components.py @@ -55,7 +55,6 @@ c1=PYComponent("compo2",services=[ g=Generator(Module("pycompos",components=[c1],prefix="./install"),context) g.generate() -g.bootstrap() g.configure() g.make() g.install() diff --git a/Examples/types1/Makefile b/Examples/types1/Makefile index 02ae2e7..ebb51da 100644 --- a/Examples/types1/Makefile +++ b/Examples/types1/Makefile @@ -18,4 +18,4 @@ # clean: - rm -rf *.o *.so mymodule_SRC mymodule_SRC.bak appli appli.bak install install.bak traceExec_* + rm -rf *.o *.so *.bak mymodule_SRC mymodule_build appli install traceExec_* diff --git a/Examples/types1/components.py b/Examples/types1/components.py index 7f9020c..f665fad 100644 --- a/Examples/types1/components.py +++ b/Examples/types1/components.py @@ -24,30 +24,6 @@ execfile("../context.py") from module_generator import Generator,Module,Service,CPPComponent,PYComponent,add_type,add_module -#overload module GEOM definition -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 -""" -add_module("GEOM",idldefs,makefiledefs,configdefs) - #overload GEOM_Object definition add_type("GEOM_Object", "GEOM::GEOM_Object_ptr", "GEOM::GEOM_Object_out", "GEOM", "GEOM::GEOM_Object","GEOM::GEOM_Object_ptr") @@ -222,7 +198,6 @@ c2=PYComponent("compo2",services=[ g=Generator(Module("mymodule",components=[c1,c2],prefix="./install"),context) g.generate() -g.bootstrap() g.configure() g.make() g.install()