-# Copyright (C) 2009-2012 EDF R&D
+# Copyright (C) 2009-2015 EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
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 ):
) )
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=""
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
"""
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
servicesimpl="\n".join(services),
thread_impl=self.thread_impl % {"module":gen.module.name} )
+ def getIdlInterfaces(self):
+ services = self.getIdlServices()
+ from hxx_tmpl import interfaceidlhxx
+ Inherited=""
+ Inherited="SALOME_MED::ParaMEDMEMComponent"
+ return interfaceidlhxx.substitute(component=self.name,inherited=Inherited, services="\n".join(services))
+
+ def getIdlDefs(self):
+ idldefs="""#include "ParaMEDMEMComponent.idl"\n"""
+ if self.interfacedefs:
+ idldefs = idldefs + self.interfacedefs
+ return idldefs
+
+ def getDependentModules(self):
+ """ This component depends on "MED" because it inherits from ParaMEDMEMComponent
+ """
+ depend_modules = Component.getDependentModules(self)
+ depend_modules.add("MED")
+ return depend_modules