From: Ovidiu Mircescu Date: Tue, 15 Apr 2014 09:55:54 +0000 (+0200) Subject: Fixed regression when creating executable components. X-Git-Tag: V7_5_0a1~4^2~2^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d8d93a09ddaa950c792a722a019208127a7a2e26;p=tools%2Fyacsgen.git Fixed regression when creating executable components. Executable components were not killed at the end of the Salome session. --- diff --git a/module_generator/cpp_tmpl.py b/module_generator/cpp_tmpl.py index ea1d561..97ead5b 100644 --- a/module_generator/cpp_tmpl.py +++ b/module_generator/cpp_tmpl.py @@ -36,6 +36,8 @@ ${CalciumInterface} #include #include +#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); diff --git a/module_generator/cppcompo.py b/module_generator/cppcompo.py index 709b680..e4934c8 100644 --- a/module_generator/cppcompo.py +++ b/module_generator/cppcompo.py @@ -123,7 +123,11 @@ class CPPComponent(Component): (cmake_text, cmake_vars) = self.additionalLibraries() cxxfile = "%s.cxx" % self.name hxxfile = "%s.hxx" % self.name - ret = { cxxfile:self.makecxx(gen), + if self.kind == "exe": + 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)) @@ -146,7 +150,6 @@ class CPPComponent(Component): ret["CMakeLists.txt"] = cmakelist_content return ret - def makehxx(self, gen): """return a string that is the content of .hxx file