]> SALOME platform Git repositories - tools/yacsgen.git/blob - Examples/hxx1/component.py
Salome HOME
Merge from V6_main_20120808 08Aug12
[tools/yacsgen.git] / Examples / hxx1 / component.py
1 # Copyright (C) 2009-2012  EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 import os
21 from module_generator import Generator,Module,Service
22 from module_generator import CPPComponent,PYComponent,HXX2SALOMEComponent
23 class Invalid(Exception):
24     pass
25
26 kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
27 gui_root_dir=os.environ["GUI_ROOT_DIR"]
28 yacs_root_dir=os.environ["YACS_ROOT_DIR"]
29 med_root_dir=os.environ["MED_ROOT_DIR"]
30 geom_root_dir=os.environ["GEOM_ROOT_DIR"]
31 prereq_file=os.path.join(kernel_root_dir,"..","env_products.sh")
32 if not os.path.exists(prereq_file):
33     prereq_file=os.path.join(kernel_root_dir,"..","..","env_products.sh")
34 if not os.path.exists(prereq_file):
35     raise Invalid("prerequisite file env_products.sh not found. please replace it manually in component.py")
36
37 #import context from ..
38 context={'update':1,
39          "makeflags":"",
40          "prerequisites":prereq_file,
41          "kernel":kernel_root_dir,
42          "gui":gui_root_dir,
43          "geom":geom_root_dir,
44          "med":med_root_dir,
45          "yacs":yacs_root_dir,
46         }
47
48 cwd=os.getcwd()
49 cpppath=os.path.join(cwd,"COMPONENTCPP_INSTALL")
50
51     
52 # PUT HERE DEFINITIONS OF THE COMPONENTS AND THE SERVICES
53
54
55 os.environ["CALCULCPP_ROOT_DIR"]=cpppath
56 os.environ["MEDCALCCPP_ROOT_DIR"]=cpppath
57 os.environ["TESTMEDCPP_ROOT_DIR"]=cpppath
58 os.environ["ICOCOCPP_ROOT_DIR"]=cpppath
59 os.environ["TESTMEMCPP_ROOT_DIR"]=cpppath
60 c1=HXX2SALOMEComponent("CALCUL.hxx","libCALCULCXX.so" , cpppath )
61 c2=HXX2SALOMEComponent("MEDCALC.hxx","libMEDCALCCXX.so" , cpppath )
62 c3=HXX2SALOMEComponent("TESTMED.hxx","libTESTMEDCXX.so" , cpppath )
63 c4=HXX2SALOMEComponent("ICOCO.hxx","libICOCOCXX.so" , cpppath )
64 c5=HXX2SALOMEComponent("TESTMEM.hxx","libTESTMEMCXX.so" , cpppath )
65
66
67 g=Generator(Module("hxxcompos",components=[c4,c1,c2,c3,c5],prefix="./install"),context)
68 g.generate()
69 g.bootstrap()
70 g.configure()
71 g.make()
72 g.install()
73 g.make_appli("appli",
74              restrict=["KERNEL","GUI","YACS"],
75              altmodules={"GUI":gui_root_dir,
76                          "MED":med_root_dir,
77                          "YACS":yacs_root_dir,
78                          "GEOM":geom_root_dir})
79 cppenv=""" export CALCULCPP_ROOT_DIR=%(cpppath)s
80 export MEDCALCCPP_ROOT_DIR=%(cpppath)s
81 export TESTMEDCPP_ROOT_DIR=%(cpppath)s
82 export ICOCOCPP_ROOT_DIR=%(cpppath)s
83 export TESTMEMCPP_ROOT_DIR=%(cpppath)s"""  % {"cpppath" : cpppath}
84
85 cppenvfile=open("appli/env.d/cppEnv.sh","w")
86 cppenvfile.write(cppenv)
87 cppenvfile.close()
88