Salome HOME
Copyright update 2022
[tools/yacsgen.git] / Examples / parahxx1 / components.py
1 # Copyright (C) 2009-2022  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, or (at your option) any later version.
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,HXX2SALOMEParaComponent
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 SALOME_ROOT=os.getenv("SALOME_DIR")
31 prereq_file=os.path.join(SALOME_ROOT, "salome_prerequisites.sh")
32
33 if not os.path.exists(prereq_file):
34     prereq_file=os.path.join(kernel_root_dir,"..","..","env_products.sh")
35 if not os.path.exists(prereq_file):
36     raise Invalid("prerequisite file env_products.sh not found. please replace it manually in component.py")
37
38 context={'update':1,
39          "makeflags":"",
40          "prerequisites":prereq_file,
41          "kernel":kernel_root_dir,
42          "gui":gui_root_dir,
43          "med":med_root_dir,
44          "yacs":yacs_root_dir,
45         }
46
47 cwd=os.getcwd()
48 cpppath=os.path.join(cwd,"..","mpi1","mpilib")
49     
50 # PUT HERE DEFINITIONS OF THE COMPONENTS AND THE SERVICES
51
52 c1=HXX2SALOMEParaComponent("mylibmpi.h","libmylibmpi.so" , cpppath )
53
54 g=Generator(Module("hxxcompos",components=[c1],prefix="./install"),context)
55 g.generate()
56 g.configure()
57 g.make()
58 g.install()
59 g.make_appli("appli",
60              restrict=["KERNEL","GUI","YACS","MED"],
61              sys_modules=SYS_MODULES
62             )