Salome HOME
Merge branch 'omu/generate_cmake'
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Fri, 5 Sep 2014 09:49:39 +0000 (11:49 +0200)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Fri, 5 Sep 2014 09:49:39 +0000 (11:49 +0200)
* omu/generate_cmake:
  Replace "runSession" calls by "salome shell".
  Update documentation in "Examples"
  Add a test for most of the examples.
  Fixed regression when creating executable components.
  Fix localhost resource in an example schema.
  Build script added for every example.
  Examples updated for the new API which generates modules for cmake.
  Autotools replaced by cmake in generated modules.

73 files changed:
Examples/README.txt [new file with mode: 0644]
Examples/build.sh [new file with mode: 0755]
Examples/calcium1/Makefile
Examples/calcium1/build.sh [new file with mode: 0755]
Examples/calcium1/components.py
Examples/calcium2/Makefile
Examples/calcium2/build.sh [new file with mode: 0755]
Examples/calcium2/components.py
Examples/clean.sh [new file with mode: 0755]
Examples/context.py
Examples/cpp1/Makefile
Examples/cpp1/README.txt
Examples/cpp1/build.sh [new file with mode: 0755]
Examples/cpp1/components.py
Examples/cpp2/Makefile
Examples/cpp2/README.txt
Examples/cpp2/build.sh [new file with mode: 0755]
Examples/cpp2/components.py
Examples/cppgui1/Makefile
Examples/cppgui1/build.sh [new file with mode: 0755]
Examples/cppgui1/components.py
Examples/exec.sh [new file with mode: 0755]
Examples/fort1/Makefile
Examples/fort1/README.txt
Examples/fort1/build.sh [new file with mode: 0755]
Examples/fort1/components.py
Examples/fort2/Makefile
Examples/fort2/README.txt
Examples/fort2/build.sh [new file with mode: 0755]
Examples/fort2/components.py
Examples/hxx1/Makefile
Examples/hxx1/build.sh [new file with mode: 0755]
Examples/hxx1/component.py
Examples/makefile.inc
Examples/pydoc1/Makefile
Examples/pydoc1/build.sh [new file with mode: 0755]
Examples/pydoc1/components.py
Examples/pygui1/Makefile
Examples/pygui1/README.txt
Examples/pygui1/build.sh [new file with mode: 0755]
Examples/pygui1/components.py
Examples/pyth1/Makefile
Examples/pyth1/README.txt
Examples/pyth1/build.sh [new file with mode: 0755]
Examples/pyth1/components.py
Examples/pyth2/Makefile
Examples/pyth2/README.txt
Examples/pyth2/build.sh [new file with mode: 0755]
Examples/pyth2/components.py
Examples/test_compo.py [new file with mode: 0755]
Examples/types1/Makefile
Examples/types1/README.txt
Examples/types1/build.sh [new file with mode: 0755]
Examples/types1/components.py
Examples/types1/coupling.xml
module_generator/__init__.py
module_generator/astcompo.py
module_generator/aster_tmpl.py
module_generator/cata_tmpl.py
module_generator/cpp_tmpl.py
module_generator/cppcompo.py
module_generator/doc_tmpl.py
module_generator/fcompo.py
module_generator/gener.py
module_generator/gui_tmpl.py
module_generator/hxx_para_tmpl.py
module_generator/hxx_tmpl.py
module_generator/hxxcompo.py
module_generator/hxxparacompo.py
module_generator/mod_tmpl.py
module_generator/pycompo.py
module_generator/pyth_tmpl.py
module_generator/salomemodules.py

diff --git a/Examples/README.txt b/Examples/README.txt
new file mode 100644 (file)
index 0000000..415d042
--- /dev/null
@@ -0,0 +1,8 @@
+Here you find examples of use of YACSGEN for every type of component.
+
+In order to build and test the examples, you have to:
+- change the SALOME installation directory in exec.sh (SALOME_DIR)
+- run "build.sh"
+
+Every example contains a "build.sh" script which shows you how to build and
+test it. In the main directory, it builds and tests all the examples.
diff --git a/Examples/build.sh b/Examples/build.sh
new file mode 100755 (executable)
index 0000000..cc1c2f7
--- /dev/null
@@ -0,0 +1,27 @@
+#/bin/bash
+# build all examples
+
+cur_dir=`pwd`
+
+script_dir=`dirname $0`
+
+# activate stop on error
+#set -e
+
+cd $script_dir
+
+list_dirs="calcium1 calcium2 cpp1 cpp2 cppgui1 fort1 fort2 pydoc1 pygui1 pyth1 pyth2 types1 hxx1"
+for dir in $list_dirs ; do
+  cd $dir
+  echo Building $dir ...
+  ./build.sh >build.log 2>&1
+  ret=$?
+  if [ $ret -ne 0 ] ; then
+    echo "Stop on error. See:"
+    echo "  "`pwd`/build.log
+    exit 1 
+  fi
+  cd ..
+done
+
+echo Build finished!
index a6f538c3c55db01e81c7c2ebc86e9496ce748498..44ca12dea73f4bc2e57d324aa28f65da4368bf97 100644 (file)
@@ -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 traceExec_proc appli *.bak pycompos_* *.err *.log
diff --git a/Examples/calcium1/build.sh b/Examples/calcium1/build.sh
new file mode 100755 (executable)
index 0000000..12c3ac0
--- /dev/null
@@ -0,0 +1,6 @@
+source ../exec.sh
+make
+python components.py
+
+# test
+appli/salome shell ../test_compo.py
index 150b8b5c62daa11157126494a48b93ca139b0ae2..271268d91533c561321a68b9b36460d1a5b973c6 100644 (file)
@@ -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()
index a6f538c3c55db01e81c7c2ebc86e9496ce748498..44ca12dea73f4bc2e57d324aa28f65da4368bf97 100644 (file)
@@ -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 traceExec_proc appli *.bak pycompos_* *.err *.log
diff --git a/Examples/calcium2/build.sh b/Examples/calcium2/build.sh
new file mode 100755 (executable)
index 0000000..4873413
--- /dev/null
@@ -0,0 +1,7 @@
+source ../exec.sh
+make
+python components.py
+
+# test
+appli/salome shell ../test_compo.py
+
index 7fd81fe3642a1ef9eb7f9fa0d4674fe0767e2d3b..93676f7229305ea46c2749a0f06eff7ab19b088b 100644 (file)
@@ -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/clean.sh b/Examples/clean.sh
new file mode 100755 (executable)
index 0000000..4908e47
--- /dev/null
@@ -0,0 +1,13 @@
+#/bin/bash
+# clean all examples
+
+script_dir=`dirname $0`
+cd $script_dir
+
+list_dirs="calcium1 calcium2 cpp1 cpp2 cppgui1 fort1 fort2 pydoc1 pygui1 pyth1 pyth2 types1 hxx1"
+
+for dir in $list_dirs ; do
+  cd $dir
+  make clean
+  cd ..
+done
index ed2317c9f7c942550cfc6698dc44efcf12385b64..7023d248e3650c30a476fa412a12d7ccd422964c 100644 (file)
 #
 
 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":"",
index cef684d168a9dd94b9fd41e37020e4a062d2ca26..1fd0ce18351212d17f62da80da73170d151f44d3 100644 (file)
@@ -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 appli install *.bak traceExec_proc cppcompos_* *.err *.log
index 6703a6225a34a1edc86ac4bc24547e0199e452ff..db8d590407ed11d417b7780164b94f1f527984ef 100644 (file)
@@ -1,16 +1,8 @@
 A C++ component dynamically loadable
 =========================================
 
-To build this example, modify the ../context.py file
-to take into account your configuration.
-
-1- your prerequisite file 
-2- your KERNEL_ROOT_DIR
-
-Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here and execute components.py ::
-
-  source <your prerequisite file>
-  python components.py
+To build this example, modify the ../exec.sh file to take into account your configuration.
+Run build.sh to build and test the component.
 
 You should get a SALOME module in source form (cppcompos_SRC), its installation (install) and
 a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module cppcompos.
diff --git a/Examples/cpp1/build.sh b/Examples/cpp1/build.sh
new file mode 100755 (executable)
index 0000000..e8aa57a
--- /dev/null
@@ -0,0 +1,5 @@
+../exec.sh python components.py
+
+# test
+appli/salome shell ../test_compo.py
+
index 51522a07fa4827a829940642d5198b4fad80278e..d5bf043b9d7779dbfec39287d83a247dbec54ad6 100644 (file)
@@ -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()
index f8e6318efcadb904067b2840179da04114a7e3f5..cd6752631259fc621200e989baaa415494fdd9ce 100644 (file)
@@ -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 appli *.bak compo1_inst_1 traceExec_proc cppcompos_* *.err *.log
index d167aa3bd1b67f23dcb48fe10aefc714aa39c31d..eefacf6b29eef89435bff1a16867b8588283179c 100644 (file)
@@ -1,23 +1,12 @@
 A C++ standalone component (executable form)
 =================================================
 
-To build this example, modify the ../context.py file
-to take into account your configuration.
-
-1- your prerequisite file 
-2- your KERNEL_ROOT_DIR
-
-Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here and execute components.py ::
-
-  source <your prerequisite file>
-  python components.py
+To build this example, modify the ../exec.sh file to take into account your configuration.
+Run build.sh to build and test the component.
 
 You should get a SALOME module in source form (cppcompos_SRC), its installation (install) and
 a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module cppcompos.
-
-To build the standalone component (executable named prog), execute the Makefile in the SALOME application environment::
-
-  ./appli/runSession make
+You also get the standalone component (executable named prog).
 
 To run a coupling:
 
diff --git a/Examples/cpp2/build.sh b/Examples/cpp2/build.sh
new file mode 100755 (executable)
index 0000000..a791344
--- /dev/null
@@ -0,0 +1,7 @@
+source ../exec.sh
+python components.py
+make
+
+# test
+appli/salome shell ../test_compo.py
+
index 2a4e02493f8ac83264955753662d4ff587e028ba..94d45abefb3e18708a657614e1b170e96a8ad89e 100644 (file)
@@ -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()
index cef684d168a9dd94b9fd41e37020e4a062d2ca26..6ad3d3abb2cf83b45d78bb1e3d579ce832f63d0c 100644 (file)
@@ -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_* appli install *.bak traceExec_proc *.err *.log
diff --git a/Examples/cppgui1/build.sh b/Examples/cppgui1/build.sh
new file mode 100755 (executable)
index 0000000..8430376
--- /dev/null
@@ -0,0 +1 @@
+../exec.sh python components.py
index 13c53811a1798cb5833700e02f8b39b868fbcdf0..fc91a9140d8a2de83d27c09f55dd5925acabc446 100644 (file)
@@ -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 (executable)
index 0000000..d035773
--- /dev/null
@@ -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
+
index f1408377e789b1aee4b3ae03f6aabb2d39af559e..f6e71acd1326248f8d76f1de44287624b8e064fc 100644 (file)
@@ -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_*  install appli traceExec_proc *.bak *.err *.log
index 846cd4c3aef02765e284734975a296f3c904571d..57b8242a035bb937691c959bca98fb1ae4753fc3 100644 (file)
@@ -1,24 +1,8 @@
 A Fortran component dynamically loadable
 =============================================
 
-To build this example, modify the ../context.py, ../makefile.inc and Makefile files
-to take into account your configuration.
-
-1- your prerequisite file 
-2- your KERNEL_ROOT_DIR
-3- your FORTRAN compiler
-
-Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here)::
-
-  source <your prerequisite file>
-
-Build the code1 et code2 libraries ::
-
-  make
-
-and process components.py ::
-
-  python components.py
+To build this example, modify the ../exec.sh file to take into account your configuration.
+Run build.sh to build and test the component.
 
 You should get a SALOME module in source form (fcompos_SRC), its installation (install) and
 a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module fcompos.
diff --git a/Examples/fort1/build.sh b/Examples/fort1/build.sh
new file mode 100755 (executable)
index 0000000..4873413
--- /dev/null
@@ -0,0 +1,7 @@
+source ../exec.sh
+make
+python components.py
+
+# test
+appli/salome shell ../test_compo.py
+
index 4bb60063949dbb655443f973b3e9f47bbd3301dd..c98bf1f5e0d36fb41f9345e471f6d90a70eeb13b 100644 (file)
@@ -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()
index 8bfe7ae5bcff7c4e29caca8bfe89d22f216c2cf4..3acad545c7835ed6eb6993e1f7c01fc53d5f90e9 100644 (file)
 
 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_*  install traceExec_proc *.bak appli *.err *.log
index ded462078635d1de823ca08ffa9a580b70359be0..2f50e5c7d2f7c49e66e0cc3cf8937577ddb92c99 100644 (file)
@@ -1,27 +1,12 @@
 A Fortran standalone component
 =================================
 
-To build this example, modify the ../context.py, ../makefile.inc and Makefile files
-to take into account your configuration.
-
-1- your prerequisite file 
-2- your KERNEL_ROOT_DIR
-3- your FORTRAN compiler
-
-Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here)::
-
-  source <your prerequisite file>
-
-and process components.py ::
-
-  python components.py
+To build this example, modify the ../exec.sh file to take into account your configuration.
+Run build.sh to build and test the component.
 
 You should get a SALOME module in source form (fcompos_SRC), its installation (install) and
 a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module fcompos.
-
-Build the code1 et code2 executables under the SALOME application environment::
-
-  ./appli/runSession make
+You also get the code1 et code2 executables.
 
 To run a coupling:
 
diff --git a/Examples/fort2/build.sh b/Examples/fort2/build.sh
new file mode 100755 (executable)
index 0000000..a791344
--- /dev/null
@@ -0,0 +1,7 @@
+source ../exec.sh
+python components.py
+make
+
+# test
+appli/salome shell ../test_compo.py
+
index 49c554788afe768596116967c7297fa192c8a2dd..f441f1c3a49d2ff3fb241e3b5474acc773899023 100644 (file)
@@ -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()
index c00e8f9337a8f0e1fc414f0fdea4f20eff7cff58..ebfce1d329fbbb44fe4afdd10b6d07d194d6f0fc 100644 (file)
@@ -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_* *.bak *.err *.log
diff --git a/Examples/hxx1/build.sh b/Examples/hxx1/build.sh
new file mode 100755 (executable)
index 0000000..23792fd
--- /dev/null
@@ -0,0 +1,18 @@
+
+# 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
+appli/salome shell python test_compohxx.py
+appli/salome killall
index c69d07aa349f0c1fe6466be4cf39439bf13e1b7a..dfac34f9c45b1a80259b8fa6f4eb816f6cdfc960 100644 (file)
@@ -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()
-
index a83bdf12eb4494e07bbf2866ae670862390a4dd9..d708f303e2c595a4e151735ecb5a216746f7e8e2 100644 (file)
@@ -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
index 3df18b819d7b2cffcc294531cdde8823c64d125a..a803c7806c0ea2de822849466f3c8b968e0fe5ab 100644 (file)
@@ -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 install *.bak traceExec_proc *.err *.log
diff --git a/Examples/pydoc1/build.sh b/Examples/pydoc1/build.sh
new file mode 100755 (executable)
index 0000000..8430376
--- /dev/null
@@ -0,0 +1 @@
+../exec.sh python components.py
index 1878528898f6abbe2f9c61283c3b1208751562de..72e88d6b67a9e650cf694db9fb52b4dc0b0660b2 100644 (file)
@@ -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()
index 3df18b819d7b2cffcc294531cdde8823c64d125a..a803c7806c0ea2de822849466f3c8b968e0fe5ab 100644 (file)
@@ -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 install *.bak traceExec_proc *.err *.log
index fb47288b9ef52097a639309cda297037abe535d5..ee110540e6bb939c3be53651bf885a1d61b75872 100644 (file)
@@ -1,16 +1,8 @@
 A Python component dynamically loadable
 ===============================================
 
-To build this example, modify the ../context.py file
-to take into account your configuration.
-
-1- your prerequisite file 
-2- your KERNEL_ROOT_DIR
-
-Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here and execute components.py ::
-
-  source <your prerequisite file>
-  python components.py
+To build this example, modify the ../exec.sh file to take into account your configuration.
+Run build.sh to build the component.
 
 You should get a SALOME module in source form (pycompos_SRC), its installation (install) and
 a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module pycompos.
diff --git a/Examples/pygui1/build.sh b/Examples/pygui1/build.sh
new file mode 100755 (executable)
index 0000000..8430376
--- /dev/null
@@ -0,0 +1 @@
+../exec.sh python components.py
index ad7c933a6255a99a5c7c5e7020ab6350dc057763..6e2d3e250f52fcb2855003ca3e84de218edc9291 100644 (file)
@@ -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()
index 51e2078393b55a5a35d8fbf5c9264f39ccc0af4d..a2a609ebf16104cb371d72e7e2a7fe006beee30c 100644 (file)
@@ -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_* appli install *.bak traceExec_proc *.err *.log
index 0b89847b9388d4cb388fa391e69e61bf19acf967..d57211f520789ce4ec671c64a8481f459796e1a1 100644 (file)
@@ -1,16 +1,8 @@
 A Python component dynamically loadable
 ===============================================
 
-To build this example, modify the ../context.py file
-to take into account your configuration.
-
-1- your prerequisite file 
-2- your KERNEL_ROOT_DIR
-
-Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here and execute components.py ::
-
-  source <your prerequisite file>
-  python components.py
+To build this example, modify the ../exec.sh file to take into account your configuration.
+Run build.sh to build and test the component.
 
 You should get a SALOME module in source form (pycompos_SRC), its installation (install) and
 a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module pycompos.
diff --git a/Examples/pyth1/build.sh b/Examples/pyth1/build.sh
new file mode 100755 (executable)
index 0000000..e8aa57a
--- /dev/null
@@ -0,0 +1,5 @@
+../exec.sh python components.py
+
+# test
+appli/salome shell ../test_compo.py
+
index 3f7a743afc42bb6f11b5287f9438d745af227286..de600260a2dbc9576af04ca8d518e786dcc4b6e1 100644 (file)
@@ -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()
index 5ef6962f21f10af35e4cc34d49239005a6af5861..c9936ce8f355fb8e9a0800f676111921c6de159d 100644 (file)
@@ -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_* appli install *.bak traceExec_proc compo2_inst_1 *.err *.log
index 88498ae081186c102594ed350b9813f1038c77ce..05ea69acf8a4b8c0730f1b9c502df9948df3869f 100644 (file)
@@ -1,16 +1,8 @@
 A Python standalone component (in executable form)
 =======================================================
 
-To build this example, modify the ../context.py file
-to take into account your configuration.
-
-1- your prerequisite file 
-2- your KERNEL_ROOT_DIR
-
-Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here and execute components.py ::
-
-  source <your prerequisite file>
-  python components.py
+To build this example, modify the ../exec.sh file to take into account your configuration.
+Run build.sh to build and test the component.
 
 You should get a SALOME module in source form (pycompos_SRC), its installation (install) and
 a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module pycompos.
diff --git a/Examples/pyth2/build.sh b/Examples/pyth2/build.sh
new file mode 100755 (executable)
index 0000000..e8aa57a
--- /dev/null
@@ -0,0 +1,5 @@
+../exec.sh python components.py
+
+# test
+appli/salome shell ../test_compo.py
+
index 883a9378171de1311702f0b0b627d9755df1b24f..f30385a27f2384c29f20bcb876e3c67fe9216d4e 100644 (file)
@@ -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/test_compo.py b/Examples/test_compo.py
new file mode 100755 (executable)
index 0000000..02dd33f
--- /dev/null
@@ -0,0 +1,61 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+# This test executes the coupling.xml schema found in the current directory
+# and verifies the execution state.
+import unittest
+
+import os
+import sys
+
+import imp
+appli_dir = "appli"
+sys.path[:0] = [os.path.join(appli_dir, "bin", "salome", "appliskel")]
+salome_module = imp.load_source("SALOME", os.path.join(appli_dir, "salome"))
+
+class TestCompo(unittest.TestCase):
+  def setUp(self):
+    #start salome and connect to it
+    try:
+      salome_module.main(["start", "-t"])
+    except SystemExit, e:
+      pass
+    import runSession
+    runSession.configureSession()
+    import setenv
+    setenv.main(True)
+    
+    # creat study and load catalogs
+    import SALOMERuntime
+    SALOMERuntime.RuntimeSALOME_setRuntime()
+    salome_runtime = SALOMERuntime.getSALOMERuntime()
+    
+    import salome
+    salome.salome_init()
+    
+    mc = salome.naming_service.Resolve('/Kernel/ModulCatalog')
+    ior = salome.orb.object_to_string(mc)
+    session_catalog = salome_runtime.loadCatalog("session", ior)
+    salome_runtime.addCatalog(session_catalog)
+
+  def test_exec_scheme(self):
+    import pilot
+    import loader
+
+    xmlLoader = loader.YACSLoader()
+    try:
+      p = xmlLoader.load("coupling.xml")
+    except IOError,ex:
+      self.fail("IO exception:" + ex);
+    self.assertTrue(p.isValid())
+    e = pilot.ExecutorSwig()
+    e.RunW(p)
+    self.assertEqual(p.getEffectiveState(), pilot.DONE)
+    
+  def tearDown(self):
+    try:
+      salome_module.main(["killall"])
+    except SystemExit, e:
+      pass
+  
+if __name__ == '__main__':
+    unittest.main()
index 02ae2e7affb62e87b65b8ef67db417a67d9047d0..0961fbbcc9fbd09b52bc29215f866352d22448d8 100644 (file)
@@ -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_* appli install *.bak traceExec_* *.err *.log
index 77692820c068ec9429b967b3cf90f0d7d1644b4e..2fc0fbfab6b2b201a4a2ad493cd38dfb2ed7be22 100644 (file)
@@ -1,16 +1,8 @@
 A test for several YACS types SALOME_TYPES and others
 =========================================================
 
-To build this example, modify the ../context.py file
-to take into account your configuration.
-
-1- your prerequisite file 
-2- your KERNEL_ROOT_DIR
-
-Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here and execute components.py ::
-
-  source <your prerequisite file>
-  python components.py
+To build this example, modify the ../exec.sh file to take into account your configuration.
+Run build.sh to build and test the component.
 
 You should get a SALOME module in source form (module_SRC), its installation (install) and
 a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module module.
diff --git a/Examples/types1/build.sh b/Examples/types1/build.sh
new file mode 100755 (executable)
index 0000000..e8aa57a
--- /dev/null
@@ -0,0 +1,5 @@
+../exec.sh python components.py
+
+# test
+appli/salome shell ../test_compo.py
+
index 7f9020c5cd3bb786d4787746b460d38f510b13fb..f665fad91d208eef57a63e508b24192fea588933 100644 (file)
@@ -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()
index fcf191898fa42892f27a086fb4bcb3443a9f3c1e..e3875ba2613984a56a6839a68e914b84ee36ec9d 100644 (file)
@@ -38,7 +38,7 @@
    <sequence name="stringvec" content="string"/>
    <container name="DefaultContainer">
       <property name="container_name" value="FactoryServer"/>
-      <property name="name" value="cli75al"/>
+      <property name="name" value="localhost"/>
    </container>
    <service name="s10">
       <component>compo1</component>
index 5cc1f1b0f7da64ecb47c96b22bb67d8267488cc0..306a4757f1c1410736e97243fbfd740c3573110d 100644 (file)
@@ -32,3 +32,4 @@ from hxxcompo import HXX2SALOMEComponent
 from hxxparacompo import HXX2SALOMEParaComponent
 from yacstypes import add_type
 from salomemodules import add_module
+from gener import Library
index ca9712416e4d61eef4ea849b6285c40227d34242..d5a001975bfabcfa24d0e98bfba0e1efca5885dc 100644 (file)
@@ -34,6 +34,7 @@ from aster_tmpl import asterCEXEService, asterEXEService
 from aster_tmpl import asterService, asterEXECompo, asterCEXECompo, asterCompo
 from aster_tmpl import comm, make_etude, cexe, exeaster
 from aster_tmpl import container, component
+from aster_tmpl import cmake_src_compo_aster, cmake_src_compo_aster_lib
 
 class ASTERComponent(Component):
   """
@@ -60,7 +61,7 @@ class ASTERComponent(Component):
                                                           exe_path="launch.sh",
                                                           argv=["-memjeveux","4"])
   """
-  def __init__(self, name, services=None, libs="", rlibs="", aster_dir="", 
+  def __init__(self, name, services=None, libs=[], rlibs="", aster_dir="", 
                      python_path=None, argv=None, kind="lib", exe_path=None):
     """initialise component attributes"""
     self.aster_dir = aster_dir
@@ -99,6 +100,12 @@ class ASTERComponent(Component):
       if not found:
         serv.inport.insert(0, ("jdc", "string"))
 
+  def libraryName(self):
+    """ Name of the target library
+        No library for an aster component
+    """
+    return ""
+    
   def getAsterPythonPath(self):
     """Directory of aster python modules
     """
@@ -142,11 +149,19 @@ ARGPYT         | exec    | -     | %s
       self.version=(int(v),int(r),int(p))
 
     if self.kind == "lib":
-      return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
+      f = self.name+".py"
+      return {"CMakeLists.txt":cmake_src_compo_aster_lib.substitute(sources=f),
               filename:self.makeaster(gen)}
     elif self.kind == "cexe":
       fdict=self.makecexepath(gen)
-      d= {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
+      sources = self.name + ".py\n  " + self.name + "_container.py"
+      if self.version < (10,1,2):
+       sources =  sources + "\n  E_SUPERV.py"
+      d= {"CMakeLists.txt":cmake_src_compo_aster.substitute(
+                                            sources=sources,
+                                            module=gen.module.name,
+                                            resources=self.name+"_config.txt",
+                                            scripts=self.name+".exe"),
            self.name+".exe":cexe.substitute(compoexe=self.exe_path),
            filename:self.makecexeaster(gen)
          }
@@ -154,32 +169,21 @@ ARGPYT         | exec    | -     | %s
       return d
     elif self.kind == "exe":
       fdict=self.makeexepath(gen)
-      d= {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
+      sources =  self.name + "_module.py\n  "
+      sources =  sources + self.name + "_component.py"
+      if self.version < (10,1,2):
+       sources =  sources + "\n  E_SUPERV.py"
+      d= {"CMakeLists.txt":cmake_src_compo_aster.substitute(
+                                            sources=sources,
+                                            module=gen.module.name,
+                                            resources=self.name+"_config.txt",
+                                            scripts=self.name+".exe"),
            self.name+".exe":exeaster.substitute(compoexe=self.exe_path),
            self.name+"_module.py":self.makeexeaster(gen)
          }
       d.update(fdict)
       return d
 
-  def getMakefileItems(self,gen):
-    makefileItems={"header":"include $(top_srcdir)/adm_local/make_common_starter.am"}
-    if self.kind == "lib":
-      makefileItems["salomepython_PYTHON"]=[self.name+".py"]
-    elif self.kind == "exe":
-      makefileItems["salomepython_PYTHON"]=[self.name+"_module.py",self.name+"_component.py"]
-      if self.version < (10,1,2):
-        makefileItems["salomepython_PYTHON"].append("E_SUPERV.py")
-      makefileItems["dist_salomescript_SCRIPTS"]=[self.name+".exe"]
-      makefileItems["salomeres_DATA"]=[self.name+"_config.txt"]
-    elif self.kind == "cexe":
-      makefileItems["salomepython_PYTHON"]=[self.name+".py",self.name+"_container.py"]
-      if self.version < (10,1,2):
-        makefileItems["salomepython_PYTHON"].append("E_SUPERV.py")
-      makefileItems["dist_salomescript_SCRIPTS"]=[self.name+".exe"]
-      makefileItems["salomeres_DATA"]=[self.name+"_config.txt"]
-    return makefileItems
-
-
   def makeexepath(self, gen):
     """standalone component: generate files for calculation code"""
 
index 641e4af6cb6314f920df69351e5a927f45a5c3e8..0c6fa1624e3b4e22331e94836f3fbc94bc1e6223 100644 (file)
@@ -314,40 +314,6 @@ asterCEXEService="""
 asterCEXEService=Template(asterCEXEService)
 asterEXEService=asterCEXEService
 
-
-check_aster="""
-#
-# Check availability of Aster binary distribution
-#
-
-AC_DEFUN([AC_CHECK_ASTER],[
-
-AC_CHECKING(for Aster)
-
-Aster_ok=no
-
-AC_ARG_WITH(aster,
-      [AC_HELP_STRING([--with-aster=DIR],[root directory path of Aster installation])],
-      [ASTER_DIR="$withval"],[ASTER_DIR=""])
-
-if test -f ${ASTER_DIR}/bin/aster ; then
-   Aster_ok=yes
-   AC_MSG_RESULT(Using Aster distribution in ${ASTER_DIR})
-
-   ASTER_INCLUDES=-I$ASTER_DIR/include/aster
-
-   AC_SUBST(ASTER_DIR)
-   AC_SUBST(ASTER_INCLUDES)
-
-else
-   AC_MSG_WARN("Cannot find Aster distribution")
-fi
-
-AC_MSG_RESULT(for Aster: $Aster_ok)
-
-])dnl
-"""
-
 comm="""
 DEBUT(PAR_LOT='NON')
 """
@@ -472,3 +438,43 @@ if __name__ == '__main__':
 """
 component=Template(component)
 
+# CMakeLists.txt in src/<component> for an aster component
+# template parameters:
+#   sources: source files, separated by spaces
+#   module: module name
+#   resources: files to be installed in resources directory
+#   scripts: scripts to be installed
+cmake_src_compo_aster="""
+# scripts / static
+SET(_bin_py
+  ${sources}
+)
+
+SET(_res_files
+  ${resources}
+)
+
+SET(_bin_scripts
+  ${scripts}
+)
+
+# --- rules ---
+INSTALL(FILES $${_res_files} DESTINATION $${SALOME_${module}_INSTALL_RES_DATA})
+SALOME_INSTALL_SCRIPTS("$${_bin_scripts}" $${SALOME_INSTALL_SCRIPT_SCRIPTS})
+SALOME_INSTALL_SCRIPTS("$${_bin_py}" $${SALOME_INSTALL_PYTHON})
+"""
+cmake_src_compo_aster=Template(cmake_src_compo_aster)
+
+# CMakeLists.txt in src/<component> for an aster lib component
+# template parameters:
+#   sources: source files, separated by spaces
+cmake_src_compo_aster_lib="""
+# scripts / static
+SET(_bin_SCRIPTS
+  ${sources}
+)
+
+# --- rules ---
+SALOME_INSTALL_SCRIPTS("$${_bin_SCRIPTS}" $${SALOME_INSTALL_PYTHON})
+"""
+cmake_src_compo_aster_lib=Template(cmake_src_compo_aster_lib)
index db4741bf4b70c81d84f2ded9d3ad24e27e230fa2..447ca7ef3c65b9125038eb2b19c52ffe3c0c8177 100644 (file)
@@ -94,43 +94,6 @@ xml_service = """\
       </Method>"""
 xml_service = Template(xml_service)
 
-idlMakefile="""
-include $$(top_srcdir)/adm_local/make_common_starter.am
-
-BUILT_SOURCES = ${module}SK.cc ${PACO_BUILT_SOURCES} ${other_sks}
-IDL_FILES=${module}.idl ${other_idls}
-
-lib_LTLIBRARIES = libSalomeIDL${module}.la
-salomeidl_DATA = $$(IDL_FILES) ${PACO_salomeidl_DATA}
-libSalomeIDL${module}_la_SOURCES      =
-nodist_libSalomeIDL${module}_la_SOURCES = ${module}SK.cc ${other_sks}
-nodist_salomeinclude_HEADERS= ${module}.hh ${PACO_SALOMEINCLUDE_HEADERS}
-libSalomeIDL${module}_la_CXXFLAGS     = -I.  $$(SALOME_INCLUDES)
-libSalomeIDL${module}_la_LIBADD     = $$(SALOME_IDL_LIBS)
-##########################################################
-%SK.cc %.hh : %.idl
-\t$$(OMNIORB_IDL) -bcxx $$(OMNIORB_IDLCXXFLAGS) $$(IDL_INCLUDES) $$<
-%_idl.py : %.idl
-\t$$(OMNIORB_IDL) $$(OMNIORB_IDLPYFLAGS) $$(IDL_INCLUDES) ${PACO_INCLUDES} $$<
-%PaCO.hxx %PaCO.cxx : %.idl %.xml
-\t$$(OMNIORB_IDL) -I@KERNEL_ROOT_DIR@/idl/salome -p@PACOPATH@/lib/python -bpaco -Wb$$(top_srcdir)/idl/$$*.xml,$$(srcdir):@PACOPATH@/idl:@KERNEL_ROOT_DIR@/idl/salome $$(top_srcdir)/idl/$$*.idl
-
-CLEANFILES = *.hh *SK.cc *.py *.hxx *.cxx
-
-EXTRA_DIST = $$(IDL_FILES)
-
-install-data-local: $$(IDL_FILES)
-\t$$(INSTALL) -d  $$(DESTDIR)$$(salomepythondir)
-\tls $$^ | while read file; do \\
-\t$$(OMNIORB_IDL) $$(OMNIORB_IDLPYFLAGS) $$(IDL_INCLUDES) -C$$(DESTDIR)$$(salomepythondir) $$$$file ; \\
-\tdone
-
-uninstall-local:
-\trm -rf $$(DESTDIR)$$(salomepythondir)/*
-
-"""
-idlMakefile=Template(idlMakefile)
-
 # PACO Part
 idlMakefilePaCO_BUILT_SOURCES = "${module}PaCO.cxx "
 idlMakefilePaCO_nodist_salomeinclude_HEADERS = "${module}PaCO.hxx "
index 0c64c1b7967092206de51a5386dc26b3013eeffd..97ead5bf6f6c552438411f30ffe22ff37826bf95 100644 (file)
@@ -36,6 +36,8 @@ ${CalciumInterface}
 #include <pthread.h>
 #include <execinfo.h>
 
+#define BUILD_EXE ${exe}
+
 typedef void (*sighandler_t)(int);
 sighandler_t setsig(int sig, sighandler_t handler)
 {
@@ -67,7 +69,7 @@ static void AttachDebugger()
   if(getenv ("DEBUGGER"))
     {
       std::stringstream exec;
-#if ${exe}
+#if BUILD_EXE
       exec << "$$DEBUGGER " << "${exe_path} " << getpid() << "&";
 #else
       exec << "$$DEBUGGER SALOME_Container " << getpid() << "&";
@@ -151,7 +153,7 @@ ${component}_i::${component}_i(CORBA::ORB_ptr orb,
                      const char *interfaceName)
           : Superv_Component_i(orb, poa, contId, instanceName, interfaceName)
 {
-#if ${exe}
+#if BUILD_EXE
   setsig(SIGSEGV,&THandler);
   set_terminate(&terminateHandler);
   set_unexpected(&unexpectedHandler);
@@ -167,7 +169,7 @@ ${component}_i::${component}_i(CORBA::ORB_ptr orb,
                      const char *interfaceName)
           : Superv_Component_i(orb, poa, container, instanceName, interfaceName)
 {
-#if ${exe}
+#if BUILD_EXE
   setsig(SIGSEGV,&THandler);
   set_terminate(&terminateHandler);
   set_unexpected(&unexpectedHandler);
@@ -183,7 +185,7 @@ ${component}_i::~${component}_i()
 
 void ${component}_i::destroy()
 {
-#if ${exe}
+#if BUILD_EXE
   _remove_ref();
   if(!CORBA::is_nil(_orb))
     _orb->shutdown(0);
@@ -356,7 +358,7 @@ ${body}
   catch (...)
     {
       std::cerr << "unknown exception" << std::endl;
-#if ${exe}
+#if BUILD_EXE
       _exit(-1);
 #endif
       //cp_fin(component,CP_ARRET);
@@ -407,22 +409,73 @@ exeCPP=Template(exeCPP)
 
 # Makefile
 
-compoMakefile="""
-lib${component}Engine_la_SOURCES      = ${component}.cxx ${sources}
-nodist_lib${component}Engine_la_SOURCES =
-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 -lSalomeIDL${module} $${SALOME_LIBS} $$(FLIBS)
-lib${component}Engine_la_LDFLAGS = ${rlibs}
-"""
-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  $$(SALOME_INCLUDES) ${includes}
-lib${component}Exelib_la_FFLAGS = $$(SALOME_INCLUDES) -fexceptions ${includes}
-lib${component}Exelib_la_LIBADD   = ${libs} -L$$(top_builddir)/idl -lSalomeIDL${module} $${SALOME_LIBS} $$(FLIBS)
-lib${component}Exelib_la_LDFLAGS = ${rlibs}
+# CMakeLists.txt in src/<component>
+# template parameters:
+#   module : module name
+#   component : component name
+#   componentlib : name of the target library
+#   includes : additional headers, separated by spaces or \n. can be empty
+#   sources : additional sources, separated by spaces or \n. can be empty
+#   libs : additional libraries
+#   find_libs : find_library commands
+#   target_properties : set_target_properties commands
+cmake_src_compo_cpp = """
+# --- options ---
+# additional include directories
+INCLUDE_DIRECTORIES(
+  $${KERNEL_INCLUDE_DIRS}
+  $${OMNIORB_INCLUDE_DIR}
+  $${PROJECT_BINARY_DIR}
+  $${PROJECT_BINARY_DIR}/idl
+  ${includes}
+)
+
+# --- definitions ---
+ADD_DEFINITIONS(
+  $${OMNIORB_DEFINITIONS}
+)
+
+# find additional libraries
+${find_libs}
+
+# libraries to link to
+SET(_link_LIBRARIES
+  $${OMNIORB_LIBRARIES}
+  $${KERNEL_SalomeIDLKernel}
+  $${KERNEL_OpUtil}
+  $${KERNEL_SalomeContainer}
+  $${KERNEL_SalomeDSCContainer}
+  $${KERNEL_SalomeDSCSuperv}
+  $${KERNEL_SalomeDatastream}
+  $${KERNEL_SalomeDSCSupervBasic}
+  $${KERNEL_CalciumC}
+  SalomeIDL${module}
+  ${libs}
+)
+
+# --- headers ---
+
+# header files / no moc processing
+
+SET(${module}_HEADERS
+  ${component}.hxx
+)
+
+# --- sources ---
+
+# sources / static
+SET(${module}_SOURCES
+  ${component}.cxx
+  ${sources}
+)
+
+# --- rules ---
+
+ADD_LIBRARY(${componentlib} $${${module}_SOURCES})
+TARGET_LINK_LIBRARIES(${componentlib} $${_link_LIBRARIES} )
+${target_properties}
+INSTALL(TARGETS ${componentlib} EXPORT $${PROJECT_NAME}TargetGroup DESTINATION $${SALOME_INSTALL_LIBS})
+
+INSTALL(FILES $${${module}_HEADERS} DESTINATION $${SALOME_INSTALL_HEADERS})
 """
-compoEXEMakefile=Template(compoEXEMakefile)
+cmake_src_compo_cpp = Template(cmake_src_compo_cpp)
index 530a1e7a10f7932e1286a317cc421362b92bc98b..e4934c8b5685cc982189cd8fd702110c1ac8170f 100644 (file)
 import os
 from gener import Component, Invalid
 from cpp_tmpl import initService, cxxService, hxxCompo, cxxCompo
-from cpp_tmpl import exeCPP, compoEXEMakefile, compoMakefile
+from cpp_tmpl import exeCPP, cmake_src_compo_cpp
 from yacstypes import corba_rtn_type
 
+try:
+  from string import Template
+except:
+  from compat import Template,set
+
 class CPPComponent(Component):
   """
    A :class:`CPPComponent` instance represents a C++ SALOME component with services given as a list of :class:`Service`
@@ -37,9 +42,12 @@ class CPPComponent(Component):
    :param services: the list of services (:class:`Service`) of the component.
    :param kind: If it is given and has the value "exe", the component will be built as a standalone
       component (executable or shell script). The default is to build the component as a dynamic library.
-   :param libs: gives all the libraries options to add when linking the generated component (-L...).
-   :param rlibs: gives all the runtime libraries options to add when linking the generated component (-R...).
-   :param includes: gives all the include options to add when compiling the generated component (-I...).
+   :param libs: list of the additional libraries. see :class:'Library'
+      If you want to add "libmylib.so", installed in "/path/to/lib" you should use:
+         libs=[Library(name="mylib", path="/path/to/lib"]
+      For more advanced features, see the documentation of cmake / FIND_LIBRARY
+   :param rlibs: semicolon-separated list specifying the rpath to use in installed targets
+   :param includes: additional include directories, separated by spaces.
    :param sources: gives all the external source files to add in the compilation step (list of paths).
    :param exe_path: is only used when kind is "exe" and gives the path to the standalone component.
    :param compodefs: can be used to add extra definition code in the component for example when using a base class
@@ -62,7 +70,7 @@ class CPPComponent(Component):
       >>> c1 = module_generator.CPPComponent('mycompo', services=[s1,], kind="exe",
                                              exe_path="./launch.sh")
   """
-  def __init__(self, name, services=None, libs="", rlibs="", includes="", kind="lib",
+  def __init__(self, name, services=None, libs=[], rlibs="", includes="", kind="lib",
                      exe_path=None, sources=None, inheritedclass="", compodefs="",
                      idls=None,interfacedefs="",inheritedinterface="",addedmethods="",
                      calciumextendedinterface=0):
@@ -85,51 +93,63 @@ class CPPComponent(Component):
       if not self.exe_path:
         raise Invalid("exe_path must be defined for component %s" % self.name)
 
+  def targetProperties(self):
+    """ define the rpath property of the target using self.rlibs
+    return
+      string containing the commands to add to cmake
+    """
+    text=""
+    if self.rlibs.strip() :
+      text="SET_TARGET_PROPERTIES( %sEngine PROPERTIES INSTALL_RPATH %s)\n" % (self.name, self.rlibs)
+    return text
+
+  def libraryName(self):
+    """ Name of the target library
+    """
+    ret=""
+    if self.kind == "lib":
+      ret = self.name + "Engine"
+    elif self.kind == "exe":
+      ret = self.name + "Exelib"
+    else:
+      raise Invalid("Invalid kind of component: %s. Supported kinds are 'lib' and 'exe'" % self.name)
+    return ret
+    
   def makeCompo(self, gen):
     """generate files for C++ component
 
-       return a dict where key is the file name and value is the content of the file
+       return a dict where key is the file name and value is the file content
     """
+    (cmake_text, cmake_vars) = self.additionalLibraries()
     cxxfile = "%s.cxx" % self.name
     hxxfile = "%s.hxx" % self.name
-    if self.kind == "lib":
-      sources = " ".join(map(os.path.basename,self.sources))
-      return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
-              cxxfile:self.makecxx(gen),
-              hxxfile:self.makehxx(gen)
-             }
     if self.kind == "exe":
-      return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
-              self.name+".exe":exeCPP.substitute(compoexe=self.exe_path),
-              cxxfile:self.makecxx(gen, 1),
-              hxxfile:self.makehxx(gen)
-             }
-
-  def getMakefileItems(self,gen):
-    makefileItems={"header":"""
-include $(top_srcdir)/adm_local/make_common_starter.am
-
-AM_CFLAGS=$(SALOME_INCLUDES) -fexceptions
-"""}
-    if self.kind == "lib":
-      makefileItems["lib_LTLIBRARIES"]=["lib"+self.name+"Engine.la"]
-      makefileItems["salomeinclude_HEADERS"]=[self.name+".hxx"]
-      makefileItems["body"]=compoMakefile.substitute(module=gen.module.name,
-                                                     component=self.name,
-                                                     libs=self.libs,
-                                                     rlibs=self.rlibs,
-                                                     sources= " ".join(map(os.path.basename,self.sources)),
-                                                     includes=self.includes)
-    elif self.kind == "exe":
-      makefileItems["lib_LTLIBRARIES"]=["lib"+self.name+"Exelib.la"]
-      makefileItems["salomeinclude_HEADERS"]=[self.name+".hxx"]
-      makefileItems["dist_salomescript_SCRIPTS"]=[self.name+".exe"]
-      makefileItems["body"]=compoEXEMakefile.substitute(module=gen.module.name,
-                                                        component=self.name,
-                                                        libs=self.libs,
-                                                        rlibs=self.rlibs,
-                                                        includes=self.includes)
-    return makefileItems
+      exe_opt = 1
+    else:
+      exe_opt = 0
+    ret = { cxxfile:self.makecxx(gen, exe_opt),
+            hxxfile:self.makehxx(gen)
+          }
+    sources = " ".join(map(os.path.basename,self.sources))
+    cmakelist_content = cmake_src_compo_cpp.substitute(
+                        module = gen.module.name,
+                        component = self.name,
+                        componentlib = self.libraryName(),
+                        includes = self.includes,
+                        sources = sources,
+                        libs = cmake_vars,
+                        find_libs = cmake_text,
+                        target_properties = self.targetProperties())
+    if self.kind == "exe":
+      exe_file = self.name+".exe"
+      install_commande = "\nINSTALL(PROGRAMS %s DESTINATION ${SALOME_INSTALL_BINS})\n" % exe_file
+      cmakelist_content = cmakelist_content + install_commande
+      ret[exe_file] = exeCPP.substitute(compoexe=self.exe_path)
+    pass
+    
+    ret["CMakeLists.txt"] = cmakelist_content
+    
+    return ret
 
   def makehxx(self, gen):
     """return a string that is the content of .hxx file
index 69aa53682f33028455252a1a256ca37bbbadf902..10fbab5671b002f500beff20baa261ae98127803 100644 (file)
@@ -22,38 +22,43 @@ try:
 except:
   from compat import Template,set
 
+# CMakeLists.txt in doc directory
+# template parameters:
+#   module : module name
+#   files : doc source files (.rst)
 docmakefile="""
-include $$(top_srcdir)/adm_local/make_common_starter.am
-
-salomedoc_DATA=html/index.html
-salomeres_DATA = ${others}
-
-html/index.html:
-       make htm
-
-SPHINXOPTS      =
-SOURCEDIR       = $$(srcdir)
-SPHINXBUILD     = sphinx-build
-PAPEROPT_a4     = -D latex_paper_size=a4
-ALLSPHINXOPTS   = -d doctrees $$(PAPEROPT_a4) $$(SPHINXOPTS) $$(SOURCEDIR)
-
-htm:
-       mkdir -p html doctrees
-       $$(SPHINXBUILD) -b html $$(ALLSPHINXOPTS) html
-       @echo
-       @echo "Build finished. The HTML pages are in html."
-
-install-data-local:
-       $$(INSTALL) -d $$(DESTDIR)$$(salomedocdir)
-       cp -rf html/* $$(DESTDIR)$$(salomedocdir) ;
-
-uninstall-local:
-       chmod -R +w $$(DESTDIR)$$(salomedocdir)
-       rm -rf $$(DESTDIR)$$(salomedocdir)/*
-
-clean-local:
-       -rm -rf html latex doctrees
-       if test -d "html"; then rm -rf html ; fi
+INCLUDE($${KERNEL_ROOT_DIR}/salome_adm/cmake_files/SalomeMacros.cmake)
+
+SET(RSTFILES
+  ${files}
+  )
+
+SET(SPHINXOPTS )
+SET(SOURCEDIR $${CMAKE_CURRENT_SOURCE_DIR})
+SET(PAPEROPT_a4 -D latex_paper_size=a4)
+SET(ALLSPHINXOPTS -d doctrees $${PAPEROPT_a4} $${SPHINXOPTS} $${SOURCEDIR})
+
+# install user's documentation
+SALOME_CONFIGURE_FILE(conf.py conf.py)
+
+ADD_CUSTOM_TARGET(htm 
+  COMMAND $${CMAKE_COMMAND} -E make_directory html 
+  COMMAND $${CMAKE_COMMAND} -E make_directory doctrees
+  COMMAND $${SPHINX_EXECUTABLE} -c $${CMAKE_BINARY_DIR}/doc -b html $${ALLSPHINXOPTS} html
+  DEPENDS $${RSTFILES}
+  WORKING_DIRECTORY $${CMAKE_CURRENT_BINARY_DIR}
+  )
+INSTALL(CODE "EXECUTE_PROCESS(COMMAND \\\"$${CMAKE_COMMAND}\\\" --build $${PROJECT_BINARY_DIR} --target htm)")
+INSTALL(DIRECTORY $${CMAKE_CURRENT_BINARY_DIR}/html/ 
+  DESTINATION $${SALOME_INSTALL_DOC}/gui/${module} 
+  USE_SOURCE_PERMISSIONS
+  PATTERN ".buildinfo" EXCLUDE
+  )
+  
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES html)
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES doctrees)
+
+#SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES YACS)
 
 """
 docmakefile=Template(docmakefile)
index 57968afebd63056d0fa9a300aa4d995f54469c9d..be302941d5beb28ea2c1224bd281834bf9a95fab 100644 (file)
@@ -47,10 +47,10 @@ class F77Component(CPPComponent):
    This component is implemented as a dynamic library linked with a user's library "mylib"::
 
       >>> c1 = module_generator.F77Component('mycompo', services=[s1,],
-                                                       libs="-lmylib -Lmydir")
+                                                       libs=[[Library(name="mylib", path=mydir)])
 
   """
-  def __init__(self, name, services=None, libs="", rlibs="", 
+  def __init__(self, name, services=None, libs=[], rlibs="", 
                      kind="lib", exe_path=None, sources=None):
     CPPComponent.__init__(self, name, services, libs=libs, rlibs=rlibs, 
                                 kind=kind, exe_path=exe_path, sources=sources)
index c8ab0e73e89db8e9e208b25f6e785bc8f71a33a7..72efae1c5351e8a2939cc0e4709a9073c010a5c0 100644 (file)
@@ -31,10 +31,8 @@ class Invalid(Exception):
 
 debug=0
 
-from mod_tmpl import resMakefile, makecommon, configure, paco_configure
-from mod_tmpl import mainMakefile, autogen, application
-from mod_tmpl import check_sphinx
-from cata_tmpl import catalog, interface, idl, idlMakefile, parallel_interface
+from mod_tmpl import *
+from cata_tmpl import catalog, interface, idl, parallel_interface
 from cata_tmpl import xml, xml_interface, xml_service
 from cata_tmpl import idlMakefilePaCO_BUILT_SOURCES, idlMakefilePaCO_nodist_salomeinclude_HEADERS
 from cata_tmpl import idlMakefilePACO_salomepython_DATA, idlMakefilePACO_salomeidl_DATA
@@ -42,12 +40,12 @@ from cata_tmpl import idlMakefilePACO_INCLUDES
 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
+#from aster_tmpl import check_aster
 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
-from gui_tmpl import pyguimakefile, pysalomeapp, cppguimakefile, cppsalomeapp
+from gui_tmpl import cmake_py_gui, pysalomeapp, cmake_cpp_gui, cppsalomeapp
 from doc_tmpl import docmakefile, docconf, docsalomeapp
 
 def makedirs(namedir):
@@ -71,15 +69,12 @@ class Module(object):
    :type name: str
    :param components: gives the list of components of the module.
    :param prefix: is the path of the installation directory.
-   :param layout: If given and has the value "monodir", all components
-      will be generated in a single directory. The default is to generate each component in its
-      own directory.
    :param doc: can be used to add an online documentation to the module. It must be a list of file names (sources, images, ...) that will be
       used to build a sphinx documentation (see http://sphinx.pocoo.org, for more information). If not given, the Makefile.am
       and the conf.py (sphinx configuration) files are generated. In this case, the file name extension of source files must be .rst.
       See small examples in Examples/pygui1 and Examples/cppgui1.
    :param gui: can be used to add a GUI to the module. It must be a list of file names (sources, images, qt designer files, ...).
-      If not given, the Makefile.am and SalomeApp.xml are generated. All image files are put in the resources directory of the module.
+      If not given, the CMakeLists.txt and SalomeApp.xml are generated. All image files are put in the resources directory of the module.
       The GUI can be implemented in C++ (file name extension '.cxx') or in Python (file name extension '.py').
       See small examples in Examples/pygui1 and Examples/cppgui1.
 
@@ -90,11 +85,10 @@ class Module(object):
                                                   prefix="./install")
 
   """
-  def __init__(self, name, components=None, prefix="",layout="multidir", doc=None, gui=None):
+  def __init__(self, name, components=None, prefix="", doc=None, gui=None):
     self.name = name
     self.components = components or []
     self.prefix = prefix or "%s_INSTALL" % name
-    self.layout=layout
     self.doc = doc
     self.gui = gui
     try:
@@ -115,11 +109,34 @@ class Module(object):
         raise Invalid("%s is already defined as a component of the module" % compo.name)
       lcompo.add(compo.name)
       compo.validate()
-    if self.gui and self.layout != "multidir":
-      raise Invalid("A module with GUI can not be generated if layout is not multidir")
+
+class Library(object):
+  """
+     A :class:'Library' instance contains the informations of a user library.
+     
+     :param name: name of the library (exemple: "cppunit", "calcul")
+     :param path: path where to find the library (exemple: "/home/user/libs")
+  """
+  
+  def __init__(self, name, path):
+    self.name=name
+    self.path=path
+
+  def findLibrary(self):
+    """
+    return : text for the FIND_LIBRARY command for cmake.
+    Feel free to overload this function for your own needs.
+    """
+    return "FIND_LIBRARY( "+self.cmakeVarName()+" "+self.name+" PATH "+self.path + ")\n"
+    
+  def cmakeVarName(self):
+    """
+    return : name of the cmake variable used by FIND_LIBRARY
+    """
+    return "_userlib_" + self.name.split()[0]
 
 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,
                      inheritedclass="",compodefs="",
                      idls=None,interfacedefs="",inheritedinterface="",addedmethods=""):
@@ -138,6 +155,31 @@ class Component(object):
     self.inheritedinterface=inheritedinterface
     self.addedmethods=addedmethods
 
+  def additionalLibraries(self):
+    """ generate the cmake code for finding the additional libraries
+    return
+      string containing a list of "find_library"
+      string containing a list of cmake variables defined
+    """
+    cmake_text=""
+    cmake_vars=""
+    
+    for lib in self.libs:
+      cmake_text = cmake_text + lib.findLibrary()
+      cmake_vars = cmake_vars + "${" + lib.cmakeVarName() + "}\n  "
+    
+    var_template = Template("$${${name}_SalomeIDL${name}}")
+    for mod in self.depend_modules:
+      if salome_modules[mod]["linklibs"]:
+        cmake_vars = cmake_vars + salome_modules[mod]["linklibs"]
+      else:
+        default_lib = var_template.substitute(name=mod)
+        print "Unknown libraries for module " + mod
+        print "Using default library name " + default_lib
+        cmake_vars = cmake_vars + default_lib + "\n  "
+    
+    return cmake_text, cmake_vars
+
   def validate(self):
     if self.impl not in ValidImpl:
       raise Invalid("%s is not a valid implementation. It should be one of %s" % (self.impl, ValidImpl))
@@ -317,10 +359,14 @@ class Generator(object):
     for component in self.module.components:
       component.setPrerequisites(self.context.get("prerequisites"))
 
+  def sourceDir(self):
+    """ get the name of the source directory"""
+    return self.module.name+"_SRC"
+
   def generate(self):
     """Generate a SALOME source module"""
     module = self.module
-    namedir = module.name+"_SRC"
+    namedir = self.sourceDir()
     force = self.context.get("force")
     update = self.context.get("update")
     paco = self.context.get("paco")
@@ -335,18 +381,6 @@ class Generator(object):
       os.makedirs(namedir)
 
     srcs = {}
-    makefile = "SUBDIRS="
-    makefileItems={"header":"""
-include $(top_srcdir)/adm_local/make_common_starter.am
-AM_CFLAGS=$(SALOME_INCLUDES) -fexceptions
-""",
-                   "salomepython_PYTHON":[],
-                   "dist_salomescript_SCRIPTS":[],
-                   "salomeres_DATA":[],
-                   "lib_LTLIBRARIES":[],
-                   "salomeinclude_HEADERS":[],
-                   "body":"",
-                  }
 
     #get the list of SALOME modules used and put it in used_modules attribute
     def get_dependent_modules(mod,modules):
@@ -358,189 +392,103 @@ AM_CFLAGS=$(SALOME_INCLUDES) -fexceptions
 
     modules = {}
     for compo in module.components:
+      compo.depend_modules = set()
       for serv in compo.services:
         for name, typ in serv.inport + serv.outport + [ ("return",serv.ret) ] :
           mod = moduleTypes[typ]
           if mod:
             get_dependent_modules(mod,modules)
+            compo.depend_modules.add(mod)
 
     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
-      else:
-        srcs.update(fdict)
-        #for src/Makefile.am
-        mdict=compo.getMakefileItems(self)
-        makefileItems["salomepython_PYTHON"]=makefileItems["salomepython_PYTHON"]+mdict.get("salomepython_PYTHON",[])
-        makefileItems["dist_salomescript_SCRIPTS"]=makefileItems["dist_salomescript_SCRIPTS"]+mdict.get("dist_salomescript_SCRIPTS",[])
-        makefileItems["salomeres_DATA"]=makefileItems["salomeres_DATA"]+mdict.get("salomeres_DATA",[])
-        makefileItems["lib_LTLIBRARIES"]=makefileItems["lib_LTLIBRARIES"]+mdict.get("lib_LTLIBRARIES",[])
-        makefileItems["salomeinclude_HEADERS"]=makefileItems["salomeinclude_HEADERS"]+mdict.get("salomeinclude_HEADERS",[])
-        makefileItems["body"]=makefileItems["body"]+mdict.get("body","")+'\n'
+      srcs[compo.name] = fdict
 
-    if module.gui:
+    cmakecontent = ""
+    components_string = "".join(map(lambda x: x.name+" ", module.components))
+
+    if self.module.gui:
       GUIname=module.name+"GUI"
       fdict=self.makeGui(namedir)
       srcs[GUIname] = fdict
-      #for src/Makefile.am
-      makefile = makefile + " " + GUIname
-
-    if self.module.layout == "multidir":
-      srcs["Makefile.am"] = makefile+'\n'
-    else:
-      srcs["Makefile.am"] = self.makeMakefile(makefileItems)
+      components_string = components_string + "\n  " + GUIname
+      
+    cmakecontent = cmake_src.substitute(components=components_string)
+    srcs["CMakeLists.txt"] = cmakecontent
 
     docsubdir=""
     if module.doc:
       docsubdir="doc"
+      cmake_doc="ON"
+    else:
+      cmake_doc="OFF"
 
     #for catalog files
     catalogfile = "%sCatalog.xml" % module.name
 
-    need_boost=0
     if module.gui:
-        need_boost=1
-    for compo in module.components:
-      if hasattr(compo,"calciumextendedinterface") and compo.calciumextendedinterface:
-        need_boost=1
-        break
-
-    #add makefile definitions to make_common_starter.am
-    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'
-
-    adm_local={"make_common_starter.am": common_starter, "check_aster.m4":check_aster}
-    if module.doc:
-      adm_local["check_sphinx.m4"]=check_sphinx
-
-    self.makeFiles({"autogen.sh":autogen,
-                    "Makefile.am":mainMakefile.substitute(docsubdir=docsubdir),
+      cmake_gui="ON"
+    else:
+      cmake_gui="OFF"
+      
+    prefix = os.path.abspath(self.module.prefix)
+    component_libs = "".join(map(lambda x: x.libraryName()+" ",
+                                           module.components))
+    add_modules = "".join(map(lambda x:cmake_find_module.substitute(module=x),
+                                       self.used_modules))
+    self.makeFiles({"CMakeLists.txt":cmake_root_cpp.substitute(
+                                                 module=self.module.name,
+                                                 module_min=self.module.name.lower(),
+                                                 compolibs=component_libs,
+                                                 with_doc=cmake_doc,
+                                                 with_gui=cmake_gui,
+                                                 add_modules=add_modules),
                     "README":"", "NEWS":"", "AUTHORS":"", "ChangeLog":"",
                     "src":srcs,
-                    "resources":{"Makefile.am":resMakefile.substitute(module=module.name), catalogfile:self.makeCatalog()},
-                    "adm_local":adm_local,
+                    "resources":{"CMakeLists.txt":cmake_ressources.substitute(
+                                                        module=self.module.name),
+                                 catalogfile:self.makeCatalog()},
                     }, 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":
-      for compo in module.components:
-        configure_makefiles.append("     src/"+compo.name+"/Makefile")
-
-    if module.gui:
-      configure_makefiles.append("     src/%sGUI/Makefile" % module.name)
-    if module.doc:
-      configure_makefiles.append("     doc/Makefile")
-
-    other_check=""
-    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
-"""
-      other_summary=other_summary+'''echo "  SALOME GUI ............. : $SalomeGUI_ok"
-echo "  Qt ..................... : $qt_ok"
-'''
-      other_require=other_require + """
-      if test "x$SalomeGUI_ok" = "xno"; then
-        AC_MSG_ERROR([SALOME GUI is required],1)
-      fi
-      if test "x$qt_ok" = "xno"; then
-        AC_MSG_ERROR([Qt library is required],1)
-      fi
-"""
-    if module.doc:
-      other_check=other_check+"CHECK_SPHINX\n"
-      other_summary=other_summary+'''echo "  Sphinx ................. : $sphinx_ok"\n'''
-      other_require=other_require + """
-      if test "x$sphinx_ok" = "xno"; then
-        AC_MSG_ERROR([Sphinx documentation generator is required],1)
-      fi
-"""
-
     files={}
     #for idl files
     idlfile = "%s.idl" % module.name
-    paco_config=""
-    PACO_BUILT_SOURCES=""
-    PACO_SALOMEINCLUDE_HEADERS=""
-    PACO_INCLUDES=""
-    PACO_salomepython_DATA=""
-    PACO_salomeidl_DATA=""
-
-    if paco:
-      PACO_BUILT_SOURCES = idlMakefilePaCO_BUILT_SOURCES.substitute(module=module.name)
-      PACO_SALOMEINCLUDE_HEADERS = idlMakefilePaCO_nodist_salomeinclude_HEADERS.substitute(module=module.name)
-      PACO_salomepython_DATA = idlMakefilePACO_salomepython_DATA.substitute(module=module.name)
-      PACO_salomeidl_DATA = idlMakefilePACO_salomeidl_DATA.substitute(module=module.name)
-      PACO_INCLUDES = idlMakefilePACO_INCLUDES
-      paco_config=paco_configure
-
-    files["configure.ac"]=configure.substitute(module=module.name.lower(),
-                                               makefiles='\n'.join(configure_makefiles),
-                                               paco_configure=paco_config,
-                                               modules=configure_modules,
-                                               other_check=other_check,
-                                               other_summary=other_summary,
-                                               other_require=other_require,
-                                              )
 
     #if components have other idls
     other_idls=""
-    other_sks=""
+#    other_sks=""
     for compo in module.components:
       if compo.idls:
         for idl in compo.idls:
           for fidl in glob.glob(idl):
             other_idls=other_idls+os.path.basename(fidl) +" "
-            other_sks=other_sks+os.path.splitext(os.path.basename(fidl))[0]+"SK.cc "
-
-    idlfiles={"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,
-                                                       other_idls=other_idls,other_sks=other_sks,
-                                                       ),
-              idlfile : self.makeidl(),
+#            other_sks=other_sks+os.path.splitext(os.path.basename(fidl))[0]+"SK.cc "
+
+    include_template=Template("$${${module}_ROOT_DIR}/idl/salome")
+    opt_inc="".join(map(lambda x:include_template.substitute(module=x)+"\n  ",
+                                       self.used_modules))
+    link_template=Template("$${${module}_SalomeIDL${module}}")
+    opt_link="".join(map(lambda x:link_template.substitute(module=x)+"\n  ",
+                                       self.used_modules))
+    
+    idlfiles={"CMakeLists.txt":cmake_idl.substitute(module=module.name,
+                                                    extra_idl=other_idls,
+                                                    extra_include=opt_inc,
+                                                    extra_link=opt_link),
+              idlfile         :self.makeidl(),
              }
-    if paco:
-      idlfiles["%s.xml" % module.name]=self.makexml()
 
     files["idl"]=idlfiles
 
     self.makeFiles(files,namedir)
 
-    os.chmod(os.path.join(namedir, "autogen.sh"), 0777)
     #copy source files if any in created tree
     for compo in module.components:
       for src in compo.sources:
-        if self.module.layout=="multidir":
-          shutil.copyfile(src, os.path.join(namedir, "src", compo.name, os.path.basename(src)))
-        else:
-          shutil.copyfile(src, os.path.join(namedir, "src", os.path.basename(src)))
+        shutil.copyfile(src, os.path.join(namedir, "src", compo.name, os.path.basename(src)))
 
       if compo.idls:
         #copy provided idl files in idl directory
@@ -548,20 +496,6 @@ echo "  Qt ..................... : $qt_ok"
           for fidl in glob.glob(idl):
             shutil.copyfile(fidl, os.path.join(namedir, "idl", os.path.basename(fidl)))
 
-    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))
-
-    if self.module.gui:
-      for m4file in ("check_GUI.m4", "check_qt.m4", "check_opengl.m4"):
-        shutil.copyfile(os.path.join(self.gui, "adm_local", "unix", "config_files", m4file),
-                        os.path.join(namedir, "adm_local", m4file))
-
     self.makeDoc(namedir)
     return
 
@@ -570,25 +504,34 @@ echo "  Qt ..................... : $qt_ok"
       return
     rep=os.path.join(namedir,"doc")
     os.makedirs(rep)
+    doc_files=""
     for docs in self.module.doc:
       for doc in glob.glob(docs):
         name = os.path.basename(doc)
+        doc_files = doc_files + name + "\n  "
         shutil.copyfile(doc, os.path.join(rep, name))
 
     d={}
 
-    others=""
     if not self.module.gui:
        #without gui but with doc: create a small SalomeApp.xml in doc directory
        if not os.path.exists(os.path.join(namedir, "doc", "SalomeApp.xml")):
          #create a minimal SalomeApp.xml
          salomeapp=docsalomeapp.substitute(module=self.module.name,lmodule=self.module.name.lower())
          d["SalomeApp.xml"]=salomeapp
-       others="SalomeApp.xml"
 
-    if not os.path.exists(os.path.join(namedir, "doc", "Makefile.am")):
-      #create a minimal makefile.am
-      d["Makefile.am"]=docmakefile.substitute(others=others)
+    if not os.path.exists(os.path.join(namedir, "doc", "CMakeLists.txt")):
+      #create a minimal CMakeLists.txt
+      makefile_txt=docmakefile.substitute(module=self.module.name,
+                                          files=doc_files)
+      if not self.module.gui:
+        txt = 'INSTALL(FILES SalomeApp.xml DESTINATION \
+"${SALOME_%s_INSTALL_RES_DATA}")\n' % self.module.name
+        makefile_txt = makefile_txt + txt
+        pass
+      
+      d["CMakeLists.txt"]=makefile_txt
+      pass
 
     if not os.path.exists(os.path.join(namedir, "doc", "conf.py")):
       #create a minimal conf.py
@@ -619,18 +562,25 @@ echo "  Qt ..................... : $qt_ok"
 
   def makePyGUI(self,namedir):
     d={}
-    if not os.path.exists(os.path.join(namedir, "src", self.module.name+"GUI", "Makefile.am")):
-      #create a minimal makefile.am
-      sources=[]
-      other=[]
+    if not os.path.exists(os.path.join(namedir, "src", self.module.name+"GUI", "CMakeLists.txt")):
+      #create a minimal CMakeLists.txt
+      sources=""
+      other=""
+      ui_files=""
+      ts_files=""
       for srcs in self.module.gui:
         for src in glob.glob(srcs):
           if src[-3:]==".py":
-            sources.append(os.path.basename(src))
+            sources=sources+os.path.basename(src)+"\n  "
+          elif src[-3:]==".ts":
+            ts_files=ts_files+os.path.basename(src)+"\n  "
           else:
-            other.append(os.path.basename(src))
-      makefile=pyguimakefile.substitute(sources=" ".join(sources),other_sources=" ".join(other))
-      d["Makefile.am"]=makefile
+            other=other+os.path.basename(src)+"\n  "
+      makefile=cmake_py_gui.substitute(module=self.module.name,
+                                       scripts=sources,
+                                       ts_resources=ts_files,
+                                       resources=other)
+      d["CMakeLists.txt"]=makefile
 
     if not os.path.exists(os.path.join(namedir, "src", self.module.name+"GUI", "SalomeApp.xml")):
       #create a minimal SalomeApp.xml
@@ -641,27 +591,41 @@ echo "  Qt ..................... : $qt_ok"
 
   def makeCPPGUI(self,namedir):
     d={}
-    if not os.path.exists(os.path.join(namedir, "src", self.module.name+"GUI", "Makefile.am")):
-      #create a minimal makefile.am
-      sources=[]
-      other=[]
-      ui_files=[]
+    if not os.path.exists(os.path.join(namedir, "src", self.module.name+"GUI", "CMakeLists.txt")):
+      #create a minimal CMakeLists.txt
+      sources=""
+      headers=""
+      other=""
+      ui_files=""
+      ts_files=""
       for srcs in self.module.gui:
         for src in glob.glob(srcs):
-          if src[-4:]==".cxx":
-            sources.append(os.path.basename(src))
-          elif src[-2:]==".h":
-            sources.append(os.path.basename(src)[:-2]+"_moc.cxx")
+          if src[-4:]==".cxx" or src[-4:]==".cpp":
+            sources=sources+os.path.basename(src)+"\n  "
+          elif src[-2:]==".h" or src[-4:]==".hxx":
+            headers=headers+os.path.basename(src)+"\n  "
           elif src[-3:]==".ui":
-            ui_files.append("ui_"+os.path.basename(src)[:-3]+".h")
+            ui_files=ui_files+os.path.basename(src)+"\n  "
           elif src[-3:]==".ts":
-            other.append(os.path.basename(src)[:-3]+".qm")
+           ts_files=ts_files+os.path.basename(src)+"\n  "
           else:
-            other.append(os.path.basename(src))
-
-      makefile=cppguimakefile.substitute(sources=" ".join(sources),other_sources=" ".join(other),
-                                         module=self.module.name, uisources= " ".join(ui_files))
-      d["Makefile.am"]=makefile
+            other=other+os.path.basename(src)+"\n  "
+
+      compo_dirs = "".join(map(lambda x: 
+                                 "${PROJECT_SOURCE_DIR}/src/"+x.name+"\n  ",
+                                 self.module.components))
+      compo_dirs = compo_dirs + "${PROJECT_BINARY_DIR}/src/" + self.module.name + "GUI\n"
+      component_libs = "".join(map(lambda x:
+                              x.libraryName()+" ", self.module.components))
+      makefile=cmake_cpp_gui.substitute(module=self.module.name,
+                                    include_dirs=compo_dirs,
+                                    libs=component_libs,
+                                    uic_files=ui_files,
+                                    moc_headers=headers,
+                                    sources=sources,
+                                    resources=other,
+                                    ts_resources=ts_files)
+      d["CMakeLists.txt"]=makefile
 
     if not os.path.exists(os.path.join(namedir, "src", self.module.name+"GUI", "SalomeApp.xml")):
       #create a minimal SalomeApp.xml
@@ -836,46 +800,31 @@ echo "  Qt ..................... : $qt_ok"
           os.makedirs(filename)
         self.makeFiles(content, filename)
 
-  def bootstrap(self):
-    """Execute the first build step (bootstrap autotools with autogen.sh script) : execution of libtool, autoconf, automake"""
-    ier = os.system("cd %s_SRC;sh autogen.sh" % self.module.name)
-    if ier != 0:
-      raise Invalid("bootstrap has ended in error")
-
   def configure(self):
     """Execute the second build step (configure) with installation prefix as given by the prefix attribute of module"""
-    prefix = self.module.prefix
-    paco = self.context.get("paco")
-    mpi = self.context.get("mpi")
-    args = (self.module.name, self.kernel, self.aster)
-    cmd = "cd %s_SRC;./configure --with-kernel=%s --with-aster=%s" % args
-    if self.gui:
-      cmd = cmd + " --with-gui=%s" % self.gui
-    if prefix:
-      prefix = os.path.abspath(prefix)
-      cmd = cmd + " --prefix=%s" % prefix
-    if paco:
-      cmd += " --with-paco=%s" % paco
-    if mpi:
-      cmd += " --with-mpi=%s" % mpi
-
-    ier = os.system(cmd)
+    prefix = os.path.abspath(self.module.prefix)
+
+    self.build_dir = "%s_build" % self.module.name
+    makedirs(self.build_dir)
+    
+    build_sh = "cd %s; cmake ../%s -DCMAKE_INSTALL_PREFIX:PATH=%s"%(self.build_dir, self.sourceDir(), prefix) 
+    ier = os.system(build_sh)
     if ier != 0:
       raise Invalid("configure has ended in error")
 
   def make(self):
     """Execute the third build step (compile and link) : make"""
-    make_command = "make "
+    make_command = "cd %s; make " % self.build_dir
     if self.makeflags:
       make_command += self.makeflags
-    ier = os.system("cd %s_SRC;%s" % (self.module.name, make_command))
+    ier = os.system(make_command)
     if ier != 0:
       raise Invalid("make has ended in error")
 
   def install(self):
     """Execute the installation step : make install """
-    makedirs(self.module.prefix)
-    ier = os.system("cd %s_SRC;make install" % self.module.name)
+    make_command = "cd %s; make install" % self.build_dir
+    ier = os.system(make_command)
     if ier != 0:
       raise Invalid("install has ended in error")
 
@@ -898,7 +847,6 @@ echo "  Qt ..................... : $qt_ok"
 
      >>> g=Generator(m,context)
      >>> g.generate()
-     >>> g.bootstrap()
      >>> g.configure()
      >>> g.make()
      >>> g.install()
index a5e3483e16091f10b6d292f323d04d790fec100a..119a3b5f398d5c3ad0d0ef164a5f6bfb2949fa11 100644 (file)
@@ -22,17 +22,6 @@ try:
 except:
   from compat import Template,set
 
-pyguimakefile="""
-include $$(top_srcdir)/adm_local/make_common_starter.am
-
-# Scripts to be installed
-salomepython_PYTHON= ${sources}
-
-salomeres_DATA =SalomeApp.xml ${other_sources}
-"""
-pyguimakefile=Template(pyguimakefile)
-
-
 pysalomeapp="""
 <document>
   <section name="${module}">
@@ -52,32 +41,6 @@ pysalomeapp="""
 """
 pysalomeapp=Template(pysalomeapp)
 
-cppguimakefile="""
-include $$(top_srcdir)/adm_local/make_common_starter.am
-
-BUILT_SOURCES=${uisources}
-
-lib_LTLIBRARIES= lib${module}.la
-lib${module}_la_SOURCES = ${sources}
-lib${module}_la_CPPFLAGS = $$(SALOME_INCLUDES) $$(GUI_CXXFLAGS) $$(BOOST_CPPFLAGS) $$(QT_INCLUDES) -I$$(top_builddir)/idl
-lib${module}_la_LIBADD   = -L$$(top_builddir)/idl -lSalomeIDL${module}
-
-salomeres_DATA =SalomeApp.xml ${other_sources}
-
-# meta object implementation files generation (moc)
-%_moc.cxx: %.h
-       $$(MOC) $$< -o $$@
-
-# qt forms files generation (uic)
-ui_%.h: %.ui
-       $$(UIC) -o $$@ $$<
-
-# translation (*.qm) files generation (lrelease)
-%.qm: %.ts
-       $$(LRELEASE) $$< -qm $$@
-"""
-cppguimakefile=Template(cppguimakefile)
-
 cppsalomeapp="""
 <document>
   <section name="${module}">
@@ -95,3 +58,142 @@ cppsalomeapp="""
 </document>
 """
 cppsalomeapp=Template(cppsalomeapp)
+
+# CMakeLists.txt for a c++ GUI of the module (src/{module}GUI/CMakeLists.txt)
+# template parameters:
+#   module : module name
+#   include_dirs : additional include directories
+#   libs : libraries to link to
+#   uic_files : .ui files
+#   moc_headers : header files - to be processed by moc
+#   sources : .cxx
+#   resources : resource files
+#   ts_resources : .ts files - to be processed by lrelease
+cmake_cpp_gui = """
+INCLUDE(UseQt4Ext)
+
+# --- options ---
+# additional include directories
+INCLUDE_DIRECTORIES(
+  $${QT_INCLUDES}
+  $${OMNIORB_INCLUDE_DIR}
+  $${KERNEL_INCLUDE_DIRS}
+  $${GUI_INCLUDE_DIRS}
+  $${PROJECT_BINARY_DIR}/idl
+  ${include_dirs}
+)
+
+# additional preprocessor / compiler flags
+ADD_DEFINITIONS(
+  $${QT_DEFINITIONS}
+  $${OMNIORB_DEFINITIONS}
+  $${KERNEL_DEFINITIONS}
+  $${GUI_DEFINITIONS}
+)
+
+# libraries to link to
+SET(_link_LIBRARIES
+  $${QT_LIBRARIES}
+  SalomeIDL${module}
+  ${libs}
+)
+
+# --- resources ---
+
+# resource files / to be processed by uic
+SET(_uic_files
+  ${uic_files}
+)
+
+# --- headers ---
+
+# header files / to be processed by moc
+SET(_moc_HEADERS
+  ${moc_headers}
+)
+
+# header files / uic wrappings
+QT4_WRAP_UI(_uic_HEADERS $${_uic_files})
+
+# --- sources ---
+
+# sources / moc wrappings
+QT4_WRAP_CPP(_moc_SOURCES $${_moc_HEADERS})
+
+
+# sources / static
+SET(_other_SOURCES
+  ${sources}
+)
+
+# sources / to compile
+SET(${module}GUI_SOURCES 
+  $${_other_SOURCES}
+  $${_moc_SOURCES}
+  $${_uic_files}
+)
+
+# --- resources ---
+
+# resource files / to be processed by lrelease
+SET(_ts_files
+  ${ts_resources}
+) 
+
+SET(_res_files
+  SalomeApp.xml
+  ${resources}
+) 
+
+# --- rules ---
+
+ADD_LIBRARY(${module} $${${module}GUI_SOURCES})
+TARGET_LINK_LIBRARIES(${module} $${_link_LIBRARIES} )
+INSTALL(TARGETS ${module} EXPORT $${PROJECT_NAME}TargetGroup DESTINATION $${SALOME_INSTALL_LIBS})
+
+INSTALL(FILES $${_moc_HEADERS} DESTINATION $${SALOME_INSTALL_HEADERS})
+INSTALL(FILES $${_res_files} DESTINATION "$${SALOME_${module}_INSTALL_RES_DATA}")
+QT4_INSTALL_TS_RESOURCES("$${_ts_files}" "$${SALOME_${module}_INSTALL_RES_DATA}")
+"""
+cmake_cpp_gui = Template(cmake_cpp_gui)
+
+# CMakeLists.txt for a python GUI (src/{module}GUI/CMakeLists.txt)
+# template parameters:
+#   module : module name
+#   scripts : .py files
+#   ts_resources : .ts files - to be processed by lrelease
+#   resources : other resource files
+cmake_py_gui = """
+INCLUDE(UseQt4Ext)
+
+# additional include directories
+INCLUDE_DIRECTORIES(
+  $${QT_INCLUDES}
+)
+
+# --- scripts ---
+
+# scripts / static
+SET(_bin_SCRIPTS
+  ${scripts}
+)
+
+# --- resources ---
+
+# resource files / to be processed by lrelease
+SET(_ts_RESOURCES
+  ${ts_resources}
+)
+
+SET(_res_files
+  SalomeApp.xml
+  ${resources}
+)
+
+# --- rules ---
+
+SALOME_INSTALL_SCRIPTS("$${_bin_SCRIPTS}" $${SALOME_INSTALL_SCRIPT_PYTHON})
+INSTALL(FILES $${_res_files} DESTINATION "$${SALOME_${module}_INSTALL_RES_DATA}")
+QT4_INSTALL_TS_RESOURCES("$${_ts_RESOURCES}" "$${SALOME_${module}_INSTALL_RES_DATA}")
+"""
+cmake_py_gui = Template(cmake_py_gui)
index 3a5dc44dca54add176c152fb334475adf8ebeb29..22780eda43de674a5d3442d59255c1448d65b5fe 100644 (file)
@@ -190,16 +190,91 @@ ${body}
 cxxService=Template(cxxService)
 
 
-compoMakefile="""
-
-dist_lib${component}Engine_la_SOURCES = \
-       ${component}_i.cxx
-
-lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl  $$(SALOME_INCLUDES) $$(MPI_INCLUDES) ${includes}
-lib${component}Engine_la_LIBADD   = ${libs} -L$$(top_builddir)/idl -lSalomeIDL${module} $${SALOME_LIBS} -lSalomeMPIContainer -lparamedmemcompo $$(FLIBS)
-
-
+#compoMakefile="""
+#
+#dist_lib${component}Engine_la_SOURCES = \
+#      ${component}_i.cxx
+#
+#lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl  $$(SALOME_INCLUDES) $$(MPI_INCLUDES) ${includes}
+#lib${component}Engine_la_LIBADD   = ${libs} -L$$(top_builddir)/idl -lSalomeIDL${module} $${SALOME_LIBS} -lSalomeMPIContainer -lparamedmemcompo $$(FLIBS)
+#
+#
+#"""
+#
+#compoMakefile=Template(compoMakefile)
+
+
+# CMakeLists.txt in src/<component>
+# template parameters:
+#   module : module name
+#   component : component name
+#   componentlib : name of the target library
+#   includes : additional headers, separated by spaces or \n. can be empty
+#   libs : additional libraries
+#   find_libs : find_library commands
+#   target_properties : additional properties of the target
+cmake_src_compo_hxxpara = """
+# --- options ---
+# additional include directories
+INCLUDE_DIRECTORIES(
+  $${KERNEL_INCLUDE_DIRS}
+  $${OMNIORB_INCLUDE_DIR}
+  $${PROJECT_BINARY_DIR}
+  $${PROJECT_BINARY_DIR}/idl
+  ${includes}
+)
+
+# --- definitions ---
+ADD_DEFINITIONS(
+  $${OMNIORB_DEFINITIONS}
+)
+
+# find additional libraries
+${find_libs}
+
+# libraries to link to
+SET(_link_LIBRARIES
+  $${OMNIORB_LIBRARIES}
+  $${KERNEL_SalomeIDLKernel}
+  $${KERNEL_OpUtil}
+  $${KERNEL_SalomeContainer}
+  $${KERNEL_SalomeDSCContainer}
+  $${KERNEL_SalomeDSCSuperv}
+  $${KERNEL_SalomeDatastream}
+  $${KERNEL_SalomeDSCSupervBasic}
+  $${KERNEL_CalciumC}
+  $${KERNEL_SalomeMPIContainer}
+  $${MED_paramedmemcompo}
+  SalomeIDL${module}
+  ${libs}
+)
+
+# --- headers ---
+
+# header files / no moc processing
+
+SET(${module}_HEADERS
+  ${component}_i.hxx
+)
+
+# --- sources ---
+
+# sources / static
+SET(${module}_SOURCES
+  ${component}_i.cxx
+)
+
+# --- rules ---
+
+ADD_LIBRARY(${componentlib} $${${module}_SOURCES})
+TARGET_LINK_LIBRARIES(${componentlib} $${_link_LIBRARIES} )
+${target_properties}
+
+INSTALL(TARGETS ${componentlib} EXPORT $${PROJECT_NAME}TargetGroup DESTINATION $${SALOME_INSTALL_LIBS})
+
+INSTALL(FILES $${${module}_HEADERS} DESTINATION $${SALOME_INSTALL_HEADERS})
 """
+cmake_src_compo_hxxpara = Template(cmake_src_compo_hxxpara)
 
 #, SALOME_MED::MED_Gen_Driver, SALOME::MultiCommClass
 interfaceidlhxx="""
@@ -210,5 +285,3 @@ ${services}
 """
 interfaceidlhxx=Template(interfaceidlhxx)
 
-
-compoMakefile=Template(compoMakefile)
index 0756f314362f865adab808050c5735ac3d572de6..3ae65c970776fda0778c539f280bfc6ca4acff9e 100644 (file)
@@ -164,17 +164,6 @@ ${body}
 cxxService=Template(cxxService)
 
 
-compoMakefile="""
-
-dist_lib${component}Engine_la_SOURCES = \
-       ${component}_i.cxx
-
-lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl  $$(SALOME_INCLUDES) ${includes}
-lib${component}Engine_la_LIBADD   = ${libs} -L$$(top_builddir)/idl -lSalomeIDL${module} $${SALOME_LIBS} $$(FLIBS)
-
-
-"""
-
 #, SALOME_MED::MED_Gen_Driver, SALOME::MultiCommClass
 interfaceidlhxx="""
   interface ${component}_Gen: ${inherited}
@@ -185,4 +174,75 @@ ${services}
 interfaceidlhxx=Template(interfaceidlhxx)
 
 
-compoMakefile=Template(compoMakefile)
+
+# Makefile
+
+# CMakeLists.txt in src/<component>
+# template parameters:
+#   module : module name
+#   component : component name
+#   componentlib : name of the target library
+#   includes : additional headers, separated by spaces or \n. can be empty
+#   libs : additional libraries
+#   find_libs : find_library commands
+#   target_properties : additional properties of the target
+cmake_src_compo_hxx = """
+# --- options ---
+# additional include directories
+INCLUDE_DIRECTORIES(
+  $${KERNEL_INCLUDE_DIRS}
+  $${OMNIORB_INCLUDE_DIR}
+  $${PROJECT_BINARY_DIR}
+  $${PROJECT_BINARY_DIR}/idl
+  ${includes}
+)
+
+# --- definitions ---
+ADD_DEFINITIONS(
+  $${OMNIORB_DEFINITIONS}
+)
+
+# find additional libraries
+${find_libs}
+
+# libraries to link to
+SET(_link_LIBRARIES
+  $${OMNIORB_LIBRARIES}
+  $${KERNEL_SalomeIDLKernel}
+  $${KERNEL_OpUtil}
+  $${KERNEL_SalomeContainer}
+  $${KERNEL_SalomeDSCContainer}
+  $${KERNEL_SalomeDSCSuperv}
+  $${KERNEL_SalomeDatastream}
+  $${KERNEL_SalomeDSCSupervBasic}
+  $${KERNEL_CalciumC}
+  SalomeIDL${module}
+  ${libs}
+)
+
+# --- headers ---
+
+# header files / no moc processing
+
+SET(${module}_HEADERS
+  ${component}_i.hxx
+)
+
+# --- sources ---
+
+# sources / static
+SET(${module}_SOURCES
+  ${component}_i.cxx
+)
+
+# --- rules ---
+
+ADD_LIBRARY(${componentlib} $${${module}_SOURCES})
+TARGET_LINK_LIBRARIES(${componentlib} $${_link_LIBRARIES} )
+${target_properties}
+
+INSTALL(TARGETS ${componentlib} EXPORT $${PROJECT_NAME}TargetGroup DESTINATION $${SALOME_INSTALL_LIBS})
+
+INSTALL(FILES $${${module}_HEADERS} DESTINATION $${SALOME_INSTALL_HEADERS})
+"""
+cmake_src_compo_hxx = Template(cmake_src_compo_hxx)
index 737d8cda5ff2f52cd6da67031e89cd1ee8e0873b..f49b00434b797dc3ad0227f4274d8ca770642ee1 100644 (file)
@@ -27,7 +27,7 @@ import string
 import fnmatch
 from tempfile import mkstemp
 from gener import Component, Invalid
-from hxx_tmpl import cxxService, hxxCompo, cxxCompo, compoMakefile
+from hxx_tmpl import cxxService, hxxCompo, cxxCompo, cmake_src_compo_hxx
 from module_generator import Service
 from yacstypes import corba_rtn_type,moduleTypes
 from hxx_awk import parse01,parse1,parse2,parse3
@@ -39,6 +39,7 @@ from tempfile import mkdtemp
 from hxx_tmpl_gui import hxxgui_cxx, hxxgui_h, hxxgui_icon_ts
 from hxx_tmpl_gui import hxxgui_message_en, hxxgui_message_fr
 from hxx_tmpl_gui import hxxgui_config, hxxgui_xml_fr, hxxgui_xml_en
+from gener import Library
 
 # ------------------------------------------------------------------------------
 
@@ -54,7 +55,7 @@ class HXX2SALOMEComponent(Component):
 
     hxxfileful = search_file(hxxfile,cpp_path)
     cpplibful = search_file(cpplib,cpp_path)
-    format_error = 'Error in HXX2SALOMEComponent : file %s ot found in %s'
+    format_error = 'Error in HXX2SALOMEComponent : file %s not found in %s'
     assert len(hxxfileful) > 0, format_error %  (hxxfile, cpp_path)
     assert len(cpplibful) > 0, format_error % (cpplib, cpp_path)
     hxxfile = hxxfileful[0]
@@ -302,8 +303,8 @@ class HXX2SALOMEComponent(Component):
            body=code,
            ) )
 
-    Includes="-I${"+name+"CPP_ROOT_DIR}/include"
-    Libs="-L${"+name+"CPP_ROOT_DIR}/lib -l"+name+"CXX"
+    Includes = os.path.join(cpp_path, "include")
+    Libs = [ Library( name=name+"CXX", path=os.path.join(cpp_path, "lib"))]
     Compodefs=""
     Inheritedclass=""
     self.inheritedconstructor=""
@@ -334,9 +335,26 @@ class HXX2SALOMEComponent(Component):
 """
 
     Component.__init__(self, name, services, impl="CPP", libs=Libs,
-                             rlibs="", includes=Includes, kind="lib",
-                             sources=None,inheritedclass=Inheritedclass,
-                             compodefs=Compodefs)
+                             rlibs=os.path.dirname(cpplib), includes=Includes,
+                             kind="lib", sources=None,
+                             inheritedclass=Inheritedclass,compodefs=Compodefs)
+
+# -----------------------------------------------------------------------------      
+  def libraryName(self):
+    """ Name of the target library
+    """
+    return self.name + "Engine"
+    
+# ------------------------------------------------------------------------------
+  def targetProperties(self):
+    """ define the rpath property of the target using self.rlibs
+    return
+      string containing the commands to add to cmake
+    """
+    text=""
+    if self.rlibs.strip() :
+      text="SET_TARGET_PROPERTIES( %sEngine PROPERTIES INSTALL_RPATH %s)\n" % (self.name, self.rlibs)
+    return text
 
 # ------------------------------------------------------------------------------
   def makeCompo(self, gen):
@@ -346,24 +364,36 @@ class HXX2SALOMEComponent(Component):
     """
     cxxfile = "%s_i.cxx" % self.name
     hxxfile = "%s_i.hxx" % self.name
-    return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
+    (cmake_text, cmake_vars) = self.additionalLibraries()
+    
+    cmakelist_content = cmake_src_compo_hxx.substitute(
+                        module = gen.module.name,
+                        component = self.name,
+                        componentlib = self.libraryName(),
+                        includes = self.includes,
+                        libs = cmake_vars,
+                        find_libs = cmake_text,
+                        target_properties = self.targetProperties()
+                        )
+    
+    return {"CMakeLists.txt":cmakelist_content,
             cxxfile:self.makecxx(gen),
             hxxfile:self.makehxx(gen)
            }
 
 # ------------------------------------------------------------------------------
-  def getMakefileItems(self,gen):
-      makefileItems={"header":"""
-include $(top_srcdir)/adm_local/make_common_starter.am
-
-"""}
-      makefileItems["lib_LTLIBRARIES"]=["lib"+self.name+"Engine.la"]
-      makefileItems["salomeinclude_HEADERS"]=["%s_i.hxx" % self.name]
-      makefileItems["body"]=compoMakefile.substitute(module=gen.module.name,
-                                                     component=self.name,
-                                                     libs=self.libs,
-                                                     includes=self.includes)
-      return makefileItems
+#  def getMakefileItems(self,gen):
+#      makefileItems={"header":"""
+#include $(top_srcdir)/adm_local/make_common_starter.am
+#
+#"""}
+#      makefileItems["lib_LTLIBRARIES"]=["lib"+self.name+"Engine.la"]
+#      makefileItems["salomeinclude_HEADERS"]=["%s_i.hxx" % self.name]
+#      makefileItems["body"]=compoMakefile.substitute(module=gen.module.name,
+#                                                     component=self.name,
+#                                                     libs=self.libs,
+#                                                     includes=self.includes)
+#      return makefileItems
 
 # ------------------------------------------------------------------------------
   def makehxx(self, gen):
index 328874caef3590d8b559b290e2b744478dc01c32..5b795850445f0518a22ceaa7c1de012cdfe22a88 100644 (file)
 debug=1
 import os
 from gener import Component, Invalid
-from hxx_para_tmpl import cxxService, hxxCompo, cxxCompo, compoMakefile
+from hxx_para_tmpl import cxxService, hxxCompo, cxxCompo, cmake_src_compo_hxxpara
 from module_generator import Service
 import string
 from tempfile import mkstemp
 from yacstypes import corba_rtn_type,moduleTypes
+from gener import Library
 
 class HXX2SALOMEParaComponent(Component):
   def __init__(self, hxxfile , cpplib , cpp_path ):
@@ -353,8 +354,11 @@ void *th_%(serv_name)s(void *s)
            ) )
         self.thread_func_decl.append(service_definition[serv]["thread_func_decl"])
         self.thread_str_decl.append(service_definition[serv]["thread_str_decl"])
-    Includes="-I${"+name+"CPP_ROOT_DIR}/include"
-    Libs="-L${"+name+"CPP_ROOT_DIR}/lib -l"+cpplibname
+#    Includes="-I${"+name+"CPP_ROOT_DIR}/include"
+    Includes = os.path.join(cpp_path, "include")
+#    Libs="-L${"+name+"CPP_ROOT_DIR}/lib -l"+cpplibname
+#    Libs=[cpplibname+" PATH "+ os.path.join(cpp_path, "lib") ]
+    Libs = [ Library( name=cpplibname, path=os.path.join(cpp_path, "lib"))]
     Compodefs=""
     Inheritedclass=""
     self.inheritedconstructor=""
@@ -368,6 +372,24 @@ void *th_%(serv_name)s(void *s)
                              sources=None,inheritedclass=Inheritedclass,
                              compodefs=Compodefs)
 
+# -----------------------------------------------------------------------------      
+  def libraryName(self):
+    """ Name of the target library
+    """
+    return self.name + "Engine"
+    
+# ------------------------------------------------------------------------------
+  def targetProperties(self):
+    """ define the rpath property of the target using self.rlibs
+    return
+      string containing the commands to add to cmake
+    """
+    text=""
+    if self.rlibs.strip() :
+      text="SET_TARGET_PROPERTIES( %sEngine PROPERTIES INSTALL_RPATH %s)\n" % (self.name, self.rlibs)
+    return text
+
+# ------------------------------------------------------------------------------
   def makeCompo(self, gen):
     """generate files for C++ component
 
@@ -375,23 +397,35 @@ void *th_%(serv_name)s(void *s)
     """
     cxxfile = "%s_i.cxx" % self.name
     hxxfile = "%s_i.hxx" % self.name
-    return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
+    (cmake_text, cmake_vars) = self.additionalLibraries()
+    
+    cmakelist_content = cmake_src_compo_hxxpara.substitute(
+                        module = gen.module.name,
+                        component = self.name,
+                        componentlib = self.libraryName(),
+                        includes = self.includes,
+                        libs = cmake_vars,
+                        find_libs = cmake_text,
+                        target_properties = self.targetProperties()
+                        )
+    
+    return {"CMakeLists.txt":cmakelist_content,
             cxxfile:self.makecxx(gen),
             hxxfile:self.makehxx(gen)
            }
 
-  def getMakefileItems(self,gen):
-      makefileItems={"header":"""
-include $(top_srcdir)/adm_local/make_common_starter.am
-
-"""}
-      makefileItems["lib_LTLIBRARIES"]=["lib"+self.name+"Engine.la"]
-      makefileItems["salomeinclude_HEADERS"]=["%s_i.hxx" % self.name]
-      makefileItems["body"]=compoMakefile.substitute(module=gen.module.name,
-                                                     component=self.name,
-                                                     libs=self.libs,
-                                                     includes=self.includes)
-      return makefileItems
+#  def getMakefileItems(self,gen):
+#      makefileItems={"header":"""
+#include $(top_srcdir)/adm_local/make_common_starter.am
+#
+#"""}
+#      makefileItems["lib_LTLIBRARIES"]=["lib"+self.name+"Engine.la"]
+#      makefileItems["salomeinclude_HEADERS"]=["%s_i.hxx" % self.name]
+#      makefileItems["body"]=compoMakefile.substitute(module=gen.module.name,
+#                                                     component=self.name,
+#                                                     libs=self.libs,
+#                                                     includes=self.includes)
+#      return makefileItems
 
   def makehxx(self, gen):
     """return a string that is the content of .hxx file
index 4fdbb21c9e99be400e9c132b070478ec20425a78..7885659aa970c67b751b3936e505f836bcdd438c 100644 (file)
@@ -33,192 +33,304 @@ ${modules}
 """
 application=Template(application)
 
-autogen="""#!/bin/sh
-
-rm -rf autom4te.cache
-rm -f aclocal.m4 adm_local/ltmain.sh
-
-echo "Running aclocal..."    ;
-aclocal --force -I adm_local || exit 1
-echo "Running autoheader..." ; autoheader --force -I adm_local            || exit 1
-echo "Running autoconf..."   ; autoconf --force                    || exit 1
-echo "Running libtoolize..." ; libtoolize --copy --force           || exit 1
-echo "Running automake..."   ; automake --add-missing --copy       || exit 1
-"""
-
-mainMakefile="""include $$(top_srcdir)/adm_local/make_common_starter.am
-SUBDIRS = idl resources src ${docsubdir}
-ACLOCAL_AMFLAGS = -I adm_local
-"""
-mainMakefile=Template(mainMakefile)
-
-configure="""
-AC_INIT(${module}, 1.0)
-AC_CONFIG_AUX_DIR(adm_local)
-AM_INIT_AUTOMAKE
-AM_CONFIG_HEADER(${module}_config.h)
-
-dnl Check Salome Install
-CHECK_KERNEL
-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
-CHECK_F77
-CHECK_OMNIORB
-CHECK_PACO
-CHECK_MPI
-
-MODULE_NAME=${module}
-AC_SUBST(MODULE_NAME)
-
-AC_CHECK_ASTER
-
-${other_check}
-
-echo
-echo
-echo
-echo "------------------------------------------------------------------------"
-echo "$$PACKAGE $$VERSION"
-echo "------------------------------------------------------------------------"
-echo
-echo "Configuration Options Summary:"
-echo
-echo "  Threads ................ : $$threads_ok"
-echo "  OmniOrb (CORBA) ........ : $$omniORB_ok"
-echo "  OmniOrbpy (CORBA) ...... : $$omniORBpy_ok"
-echo "  Python ................. : $$python_ok"
-echo "  SALOME KERNEL .......... : $$Kernel_ok"
-echo "  PaCO++ ................. : $$PaCO_ok"
-echo "  MPI .................... : $$mpi_ok"
-echo "  Code Aster ............. : $$Aster_ok"
-${other_summary}
-echo
-echo "------------------------------------------------------------------------"
-echo
-
-if test "x$$threads_ok" = "xno"; then
-  AC_MSG_ERROR([Thread is required],1)
-fi
-if test "x$$python_ok" = "xno"; then
-  AC_MSG_ERROR([Python is required],1)
-fi
-if test "x$$omniORB_ok" = "xno"; then
-  AC_MSG_ERROR([OmniOrb is required],1)
-fi
-if test "x$$omniORBpy_ok" = "xno"; then
-  AC_MSG_ERROR([OmniOrbpy is required],1)
-fi
-if test "x$$Kernel_ok" = "xno"; then
-  AC_MSG_ERROR([SALOME KERNEL is required],1)
-fi
-${other_require}
-
-${paco_configure}
-
-AC_CONFIG_FILES([
-        Makefile
-        idl/Makefile
-        resources/Makefile
-        src/Makefile
-${makefiles}
-        ])
-AC_OUTPUT
-"""
-configure=Template(configure)
-
 paco_configure="""\
 if test "x$$PaCO_ok" = "xno"; then
   AC_MSG_ERROR([PaCO++ is required],1)
 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
-
-# Directory for installing idl files
-salomeidldir       = $$(prefix)/idl/salome
-
-# Directory for installing resource files
-salomeresdir       = $$(prefix)/share/salome/resources/$${MODULE_NAME}
-
-# Directories for installing admin files
-admlocaldir       = $$(prefix)/adm_local
-admlocalunixdir     = $$(admlocaldir)/unix
-admlocalm4dir        = $$(admlocaldir)/unix/config_files
-
-# Shared modules installation directory
-sharedpkgpythondir =$$(pkgpythondir)/shared_modules
-
-# Documentation directory
-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) ${other_includes}
+# CMakeLists.txt in root module directory
+# template parameters:
+#   module : name of the module
+#   module_min : module name with only lowercase
+#   compolibs : list of component libraries
+#   with_doc : ON|OFF
+#   with_gui : ON|OFF - module has its own GUI
+#   add_modules : code to find other modules
+cmake_root_cpp = """
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
+
+# You can remove "Fortran" if you don't have any fortran component
+PROJECT(Salome${module} C CXX Fortran)
+
+# Ensure a proper linker behavior:
+CMAKE_POLICY(SET CMP0003 NEW)
+
+# Versioning
+# ===========
+# Project name, upper case
+STRING(TOUPPER $${PROJECT_NAME} PROJECT_NAME_UC)
+
+SET($${PROJECT_NAME_UC}_MAJOR_VERSION 7)
+SET($${PROJECT_NAME_UC}_MINOR_VERSION 4)
+SET($${PROJECT_NAME_UC}_PATCH_VERSION 0)
+SET($${PROJECT_NAME_UC}_VERSION
+  $${$${PROJECT_NAME_UC}_MAJOR_VERSION}.$${$${PROJECT_NAME_UC}_MINOR_VERSION}.$${$${PROJECT_NAME_UC}_PATCH_VERSION})
+SET($${PROJECT_NAME_UC}_VERSION_DEV 1)
+
+# Find KERNEL
+# ===========
+SET(KERNEL_ROOT_DIR $$ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
+IF(EXISTS $${KERNEL_ROOT_DIR})
+  LIST(APPEND CMAKE_MODULE_PATH "$${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
+  INCLUDE(SalomeMacros)
+  FIND_PACKAGE(SalomeKERNEL REQUIRED)
+ELSE(EXISTS $${KERNEL_ROOT_DIR})
+  MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
+ENDIF(EXISTS $${KERNEL_ROOT_DIR})
+
+IF(SALOME_LIGHT_ONLY)
+  MESSAGE(FATAL_ERROR "${module} module can't be built in Light mode (without CORBA)")
+ENDIF()
+
+# Platform setup
+# ==============
+INCLUDE(SalomeSetupPlatform)   # From KERNEL
+# Always build libraries as shared objects:
+SET(BUILD_SHARED_LIBS TRUE)
+# Local macros:
+LIST(APPEND CMAKE_MODULE_PATH "$${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
+
+# User options
+# (some options have already been defined in KERNEL) 
+# ============
+# OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON) #For use in the future
+
+OPTION(SALOME_BUILD_DOC "Generate SALOME ${module} documentation" ${with_doc})
+
+IF(SALOME_BUILD_DOC)
+  FIND_PACKAGE(SalomeSphinx)
+  SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC)
+  #FIND_PACKAGE(SalomeDoxygen)
+  #SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
+ENDIF()
+
+##
+## From KERNEL:
+##
+FIND_PACKAGE(SalomePython REQUIRED)
+FIND_PACKAGE(SalomeOmniORB REQUIRED)
+FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
+  
+# Find GUI
+# ===========
+OPTION(SALOME_GUI_MODULE "Module ${module} has GUI." ${with_gui})
+
+IF(SALOME_GUI_MODULE)
+  SET(GUI_ROOT_DIR $$ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
+  IF(EXISTS $${GUI_ROOT_DIR})
+    LIST(APPEND CMAKE_MODULE_PATH "$${GUI_ROOT_DIR}/adm_local/cmake_files")
+    FIND_PACKAGE(SalomeGUI REQUIRED)
+    ADD_DEFINITIONS($${GUI_DEFINITIONS})
+    INCLUDE_DIRECTORIES($${GUI_INCLUDE_DIRS})
+  ELSE(EXISTS $${GUI_ROOT_DIR})
+    MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
+  ENDIF(EXISTS $${GUI_ROOT_DIR})
+
+  ##
+  ## From GUI:
+  ##
+  FIND_PACKAGE(SalomeCAS REQUIRED)
+  # Qt4
+  FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
+  INCLUDE($${QT_USE_FILE})
+ENDIF(SALOME_GUI_MODULE)
+
+${add_modules}
+
+# Detection summary:
+SALOME_PACKAGE_REPORT_AND_CHECK()
+
+# Directories
+# (default values taken from KERNEL)
+# ===========
+SET(SALOME_INSTALL_BINS "$${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
+SET(SALOME_INSTALL_LIBS "$${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
+SET(SALOME_INSTALL_IDLS "$${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
+SET(SALOME_INSTALL_HEADERS "$${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
+SET(SALOME_INSTALL_SCRIPT_SCRIPTS "$${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH 
+   "Install path: SALOME scripts")
+SET(SALOME_INSTALL_SCRIPT_DATA "$${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH 
+   "Install path: SALOME script data")
+SET(SALOME_INSTALL_SCRIPT_PYTHON "$${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH 
+   "Install path: SALOME Python scripts")
+SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "$${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH 
+   "Install path: SALOME application skeleton - scripts")
+SET(SALOME_INSTALL_APPLISKEL_PYTHON "$${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH 
+   "Install path: SALOME application skeleton - Python")
+SET(SALOME_INSTALL_PYTHON "$${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
+SET(SALOME_INSTALL_PYTHON_SHARED "$${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH 
+   "Install path: SALOME Python shared modules")
+SET(SALOME_INSTALL_CMAKE_LOCAL "$${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH 
+    "Install path: local SALOME CMake files") 
+#SET(SALOME_INSTALL_AMCONFIG_LOCAL "$${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
+#  "Install path: local SALOME config files (obsolete, to be removed)")
+SET(SALOME_INSTALL_RES "$${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
+SET(SALOME_INSTALL_DOC "$${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
+
+# Specific to component:
+SET(SALOME_${module}_INSTALL_RES_DATA "$${SALOME_INSTALL_RES}/${module_min}" CACHE PATH 
+    "Install path: SALOME ${module} specific data")
+
+MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
+MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
+MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS  SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
+MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
+MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
+MARK_AS_ADVANCED(SALOME_${module}_INSTALL_RES_DATA)
+
+# Accumulate environment variables for component module
+SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK $${CMAKE_INSTALL_PREFIX}/$${SALOME_INSTALL_BINS}
+                                                 $${CMAKE_INSTALL_PREFIX}/$${SALOME_INSTALL_PYTHON})
+SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK $${CMAKE_INSTALL_PREFIX}/$${SALOME_INSTALL_LIBS}) 
+
+# Sources 
+# ========
+
+ADD_SUBDIRECTORY(idl)
+#ADD_SUBDIRECTORY(adm_local)
+ADD_SUBDIRECTORY(resources)
+ADD_SUBDIRECTORY(src)
+#ADD_SUBDIRECTORY(bin)
+IF(SALOME_BUILD_DOC)
+  ADD_SUBDIRECTORY(doc)
+ENDIF()
+
+# Header configuration
+# ====================
+SALOME_XVERSION($${PROJECT_NAME})
+#SALOME_CONFIGURE_FILE(HELLO_version.h.in HELLO_version.h INSTALL $${SALOME_INSTALL_HEADERS})
+
+# Configuration export
+# (here only the level 1 prerequisites are exposed)
+# ====================
+INCLUDE(CMakePackageConfigHelpers)
+
+# List of targets in this project we want to make visible to the rest of the world.
+# They all have to be INSTALL'd with the option "EXPORT $${PROJECT_NAME}TargetGroup"
+SET(_$${PROJECT_NAME}_exposed_targets 
+  ${compolibs} SalomeIDL${module}
+)
+
+# Add all targets to the build-tree export set
+EXPORT(TARGETS $${_$${PROJECT_NAME}_exposed_targets}
+  FILE $${PROJECT_BINARY_DIR}/$${PROJECT_NAME}Targets.cmake)
+
+# Create the configuration files:
+#   - in the build tree:
+
+# Ensure the variables are always defined for the configure:
+# !
+IF(SALOME_GUI_MODULE)
+  SET(GUI_ROOT_DIR "$${GUI_ROOT_DIR}")
+ENDIF(SALOME_GUI_MODULE)
+SET(CONF_INCLUDE_DIRS "$${PROJECT_SOURCE_DIR}/include" "$${PROJECT_BINARY_DIR}/include")
+
+# Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
+# SALOME_CONFIGURE_PREPARE() #For use in the future
+
+#CONFIGURE_PACKAGE_CONFIG_FILE($${PROJECT_NAME}Config.cmake.in
+#    $${PROJECT_BINARY_DIR}/$${PROJECT_NAME}Config.cmake
+#    INSTALL_DESTINATION "$${SALOME_INSTALL_CMAKE_LOCAL}"
+#    PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
+#    )
+
+#WRITE_BASIC_PACKAGE_VERSION_FILE($${PROJECT_BINARY_DIR}/$${PROJECT_NAME}ConfigVersion.cmake
+#    VERSION $${$${PROJECT_NAME_UC}_VERSION}
+#    COMPATIBILITY AnyNewerVersion)
+  
+# Install the CMake configuration files:
+#INSTALL(FILES
+#  "$${PROJECT_BINARY_DIR}/$${PROJECT_NAME}Config.cmake"
+#  "$${PROJECT_BINARY_DIR}/$${PROJECT_NAME}ConfigVersion.cmake"
+#  DESTINATION "$${SALOME_INSTALL_CMAKE_LOCAL}")
+
+# Install the export set for use with the install-tree
+#INSTALL(EXPORT $${PROJECT_NAME}TargetGroup DESTINATION "$${SALOME_INSTALL_CMAKE_LOCAL}" 
+#  FILE $${PROJECT_NAME}Targets.cmake)
+"""
+cmake_root_cpp = Template(cmake_root_cpp)
 
-SALOME_LIBS= $${KERNEL_LIBS}
-SALOME_IDL_LIBS= -L$$(KERNEL_ROOT_DIR)/lib/salome -lSalomeIDLKernel
-SALOME_INCLUDES= $${KERNEL_INCLUDES}
+# CMakeLists.txt in resources
+# template parameters:
+#   module : module name
+cmake_ressources = """
+SET(${module}_RESOURCES_FILES
+  ${module}Catalog.xml
+)
 
+INSTALL(FILES $${${module}_RESOURCES_FILES} DESTINATION $${SALOME_${module}_INSTALL_RES_DATA})
 """
-makecommon=Template(makecommon)
-
-resMakefile="""
-include $$(top_srcdir)/adm_local/make_common_starter.am
-DATA_INST = ${module}Catalog.xml
-salomeres_DATA = $${DATA_INST}
-EXTRA_DIST = $${DATA_INST}
+cmake_ressources = Template(cmake_ressources)
+
+# CMakeLists.txt in src
+# template parameters:
+#   components : names of the components, separated by spaces or \n
+cmake_src = """
+SET(SUBDIRS
+  ${components}
+)
+
+FOREACH(dir $${SUBDIRS})
+ ADD_SUBDIRECTORY($${dir})
+ENDFOREACH(dir $${SUBDIRS})
 """
-resMakefile=Template(resMakefile)
-
-check_sphinx="""
-AC_DEFUN([CHECK_SPHINX],[
-
-AC_CHECKING(for sphinx doc generator)
-
-sphinx_ok=yes
-dnl where is sphinx ?
-AC_PATH_PROG(SPHINX,sphinx-build)
-if test "x$SPHINX" = "x"
-then
-  AC_MSG_WARN(sphinx not found)
-  sphinx_ok=no
-fi
-
-dnl Can I load ths sphinx module ?
-dnl This code comes from the ax_python_module macro.
-if test -z $PYTHON;
-then
-   PYTHON="python"
-fi
-PYTHON_NAME=`basename $PYTHON`
-AC_MSG_CHECKING($PYTHON_NAME module: sphinx)
-   $PYTHON -c "import sphinx" 2>/dev/null
-   if test $? -eq 0;
-   then
-     AC_MSG_RESULT(yes)
-     eval AS_TR_CPP(HAVE_PYMOD_sphinx)=yes
-   else
-     AC_MSG_RESULT(no)
-     eval AS_TR_CPP(HAVE_PYMOD_sphinx)=no
-     sphinx_ok=no
-   fi
-
-AM_CONDITIONAL(SPHINX_IS_OK, [test x"$sphinx_ok" = xyes])
-
-])
+cmake_src = Template(cmake_src)
+
+# CMakeLists.txt in idl
+# template parameters:
+#   module : module name
+#   extra_idl : additional idl files
+#   extra_include : additional include paths
+#   extra_link : additional include options
+cmake_idl = """
+INCLUDE(UseOmniORB)  # Provided by KERNEL
+
+INCLUDE_DIRECTORIES(
+  $${OMNIORB_INCLUDE_DIR}
+  $${KERNEL_INCLUDE_DIRS}
+  $${PROJECT_BINARY_DIR}/idl
+)
+
+SET(SalomeIDL${module}_IDLSOURCES
+  ${module}.idl
+  ${extra_idl}
+)
+
+SET(_idl_include_dirs
+  $${KERNEL_ROOT_DIR}/idl/salome
+  ${extra_include}
+)
+
+SET(_idl_link_flags
+  $${KERNEL_SalomeIDLKernel}
+  ${extra_link}
+)
+
+OMNIORB_ADD_MODULE(SalomeIDL${module} "$${SalomeIDL${module}_IDLSOURCES}" "$${_idl_include_dirs}" "$${_idl_link_flags}")
+INSTALL(TARGETS SalomeIDL${module} EXPORT $${PROJECT_NAME}TargetGroup DESTINATION $${SALOME_INSTALL_LIBS})
 """
+cmake_idl = Template(cmake_idl)
+
+#cmake code to find a SALOME module
+# template parameters:
+#   module : module name (GEOM, SMESH, etc)
+cmake_find_module = """
+
+#####################################
+# FIND ${module}
+#####################################
+SET(${module}_ROOT_DIR $$ENV{${module}_ROOT_DIR} CACHE PATH "Path to ${module} module")
+IF(EXISTS $${${module}_ROOT_DIR})
+  LIST(APPEND CMAKE_MODULE_PATH "$${${module}_ROOT_DIR}/adm_local/cmake_files")
+  FIND_PACKAGE(Salome${module} REQUIRED)
+  ADD_DEFINITIONS($${${module}_DEFINITIONS})
+  INCLUDE_DIRECTORIES($${${module}_INCLUDE_DIRS})
+ELSE(EXISTS $${${module}_ROOT_DIR})
+  MESSAGE(FATAL_ERROR "We absolutely need ${module} module, please define ${module}_ROOT_DIR")
+ENDIF(EXISTS $${${module}_ROOT_DIR})
+#####################################
 
+"""
+cmake_find_module = Template(cmake_find_module)
index fab0839dc18dd807758a0ea386300c05648e6f7e..d180e502de37e1f04c8b8f5207d06a3a6dfac1a8 100644 (file)
@@ -22,7 +22,7 @@
 """
 import os
 from gener import Component, Invalid
-from pyth_tmpl import pyinitService, pyService, pyCompoEXE, pyCompo
+from pyth_tmpl import pyinitService, pyService, pyCompoEXE, pyCompo, cmake_src_compo_py
 import textwrap
 from string import split,rstrip,join
 
@@ -77,29 +77,35 @@ class PYComponent(Component):
     if self.kind not in kinds:
       raise Invalid("kind must be one of %s for component %s" % (kinds,self.name))
 
+  def libraryName(self):
+    """ Name of the target library
+        No library for a python component
+    """
+    return ""
+    
   def makeCompo(self, gen):
     """generate component sources as a dictionary containing
        file names (key) and file content (values)
     """
-    pyfile = "%s.py" % self.name
-    sources = " ".join(map(os.path.basename,self.sources))
-    if self.kind == "lib":
-      return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
-              pyfile:self.makepy(gen)
-             }
-    if self.kind == "exe":
-      return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)),
-              self.name+".exe":self.makepyexe(gen),
-             }
-
-  def getMakefileItems(self,gen):
-    makefileItems={"header":"include $(top_srcdir)/adm_local/make_common_starter.am"}
+    pyfile = ""
+    file_content = ""
     if self.kind == "lib":
-      makefileItems["salomepython_PYTHON"]=[self.name+".py"]+self.sources
-    if self.kind == "exe":
-      makefileItems["salomepython_PYTHON"]=self.sources
-      makefileItems["dist_salomescript_SCRIPTS"]=[self.name+".exe"]
-    return makefileItems
+      pyfile = self.name  + ".py"
+      file_content = self.makepy(gen)
+    elif self.kind == "exe":
+      pyfile = self.name + ".exe"
+      file_content = self.makepyexe(gen)
+    else :
+      raise Invalid("Invalid kind ()%s for component %s" % (
+                                    self.kind, self.name))
+    
+    sources = pyfile + "".join(map(lambda x: "\n  " + os.path.basename(x),
+                                   self.sources))
+    cmake_content = cmake_src_compo_py.substitute(sources=sources)
+    
+    return {"CMakeLists.txt":cmake_content,
+            pyfile:file_content
+           }
 
   def makepy(self, gen):
     """generate standard SALOME component source (python module)"""
index 3f9d2fe041a8d81087d26f7b9f7d07d61ad1b9dd..92042a2f164e5ad9020e4016ddd463215d606158 100644 (file)
@@ -132,3 +132,16 @@ pyinitService=Template(pyinitService)
 pyinitCEXEService=pyinitService
 pyinitEXEService=pyinitService
 
+# CMakeLists.txt in src/<component> for a python component
+# template parameters:
+#   sources: source files, separated by spaces
+cmake_src_compo_py="""
+# scripts / static
+SET(_bin_SCRIPTS
+  ${sources}
+)
+
+# --- rules ---
+SALOME_INSTALL_SCRIPTS("$${_bin_SCRIPTS}" $${SALOME_INSTALL_SCRIPT_PYTHON})
+"""
+cmake_src_compo_py=Template(cmake_src_compo_py)
\ No newline at end of file
index 5e9d059a98f6056b8ba0019a87cc61b63b7ad405..a1a30bd4aa294da3b8d0c9994930e9e561c78f90 100644 (file)
 #######################################################################
 salome_modules={}
 
-def add_module(module,idldefs="",makefiledefs="",configdefs=""):
+def add_module(module,idldefs="",linklibs=""):
   """ add a module configuration for other module than KERNEL
 
        :param module: module name (GEOM, SMESH, VISU, ...)
        :type module: string
        :param idldefs:  definition instructions to add to idl files when using this module
        :type idldefs: string
-       :param makefiledefs:  definition instructions to add to Makefile files when using this module
-       :type makefiledefs: string
-       :param configdefs:  instructions to add to configure file when using this module
-       :type configdefs: string
+       :param linklibs:  options to add to _link_LIBRARIES in CMakeLists
+       :type linklibs: string
   """
-  salome_modules[module]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs}
+  salome_modules[module]={"idldefs" : idldefs, "linklibs" : linklibs}
 
 #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
+
+linklibs="""  ${GEOM_SalomeIDLGEOM}
 """
-add_module("GEOM",idldefs,makefiledefs,configdefs)
+add_module("GEOM",idldefs,linklibs)
 
 #module MED
 idldefs="""
 #include "MEDCouplingCorbaServant.idl"
 """
-makefiledefs="""
-#module MED
-MED_IDL_INCLUDES = -I$(MED_ROOT_DIR)/idl/salome
-MED_INCLUDES= -I${MED3HOME}/include -I${MED_ROOT_DIR}/include/salome -DH5_USE_16_API -I${HDF5HOME}/include
-MED_IDL_LIBS= -L$(MED_ROOT_DIR)/lib/salome -lSalomeIDLMED
-MED_LIBS= -L${MED3HOME}/lib -lmed -L${HDF5HOME}/lib -lhdf5 -L${MED_ROOT_DIR}/lib/salome -lSalomeIDLMED -lmedcouplingcorba -lmedcouplingclient 
-SALOME_LIBS += ${MED_LIBS}
-SALOME_IDL_LIBS += ${MED_IDL_LIBS}
-SALOME_INCLUDES += ${MED_INCLUDES}
-IDL_INCLUDES += ${MED_IDL_INCLUDES}
-"""
-configdefs="""
-if test "x${MED_ROOT_DIR}" != "x" && test -d ${MED_ROOT_DIR} ; then
-  AC_MSG_RESULT(Using MED installation in ${MED_ROOT_DIR})
-else
-  AC_MSG_ERROR([Cannot find module MED. Have you set MED_ROOT_DIR ?],1)
-fi
-"""
 
-salome_modules["MED"]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs}
+linklibs="""  ${MED_SalomeIDLMED}
+  ${MED_med}
+  ${MED_medcouplingcorba}
+  ${MED_medcouplingclient}
+"""
+salome_modules["MED"]={"idldefs" : idldefs, "linklibs" : linklibs}
 
 #module SMESH
 idldefs="""
 #include "SMESH_Gen.idl"
 #include "SMESH_Mesh.idl"
 """
-makefiledefs="""
-#module SMESH
-SMESH_IDL_INCLUDES = -I$(SMESH_ROOT_DIR)/idl/salome
-SMESH_INCLUDES= -I$(SMESH_ROOT_DIR)/include/salome
-SMESH_IDL_LIBS= -L$(SMESH_ROOT_DIR)/lib/salome -lSalomeIDLSMESH
-SMESH_LIBS= -L$(SMESH_ROOT_DIR)/lib/salome
-SALOME_LIBS += ${SMESH_LIBS}
-SALOME_IDL_LIBS += ${SMESH_IDL_LIBS}
-SALOME_INCLUDES += ${SMESH_INCLUDES}
-IDL_INCLUDES += ${SMESH_IDL_INCLUDES}
-"""
-configdefs="""
-if test "x${SMESH_ROOT_DIR}" != "x" && test -d ${SMESH_ROOT_DIR} ; then
-  AC_MSG_RESULT(Using SMESH installation in ${SMESH_ROOT_DIR})
-else
-  AC_MSG_ERROR([Cannot find module SMESH. Have you set SMESH_ROOT_DIR ?],1)
-fi
-"""
-
-salome_modules["SMESH"]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs,
-                         "depends":["GEOM","MED"]}
 
-#module VISU
-idldefs="""
-#include "VISU_Gen.idl"
+linklibs="""  ${SMESH_SalomeIDLSMESH}
 """
-makefiledefs="""
-#module VISU
-VISU_IDL_INCLUDES = -I$(VISU_ROOT_DIR)/idl/salome
-VISU_INCLUDES= -I$(VISU_ROOT_DIR)/include/salome
-VISU_IDL_LIBS= -L$(VISU_ROOT_DIR)/lib/salome -lSalomeIDLVISU
-VISU_LIBS= -L$(VISU_ROOT_DIR)/lib/salome
-SALOME_LIBS += ${VISU_LIBS}
-SALOME_IDL_LIBS += ${VISU_IDL_LIBS}
-SALOME_INCLUDES += ${VISU_INCLUDES}
-IDL_INCLUDES += ${VISU_IDL_INCLUDES}
-"""
-configdefs="""
-if test "x${VISU_ROOT_DIR}" != "x" && test -d ${VISU_ROOT_DIR} ; then
-  AC_MSG_RESULT(Using VISU installation in ${VISU_ROOT_DIR})
-else
-  AC_MSG_ERROR([Cannot find module VISU. Have you set VISU_ROOT_DIR ?],1)
-fi
-"""
-
-salome_modules["VISU"]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs}
+salome_modules["SMESH"]={"idldefs" : idldefs, "linklibs" : linklibs,
+                         "depends":["GEOM","MED"]}