From eb8cd5566bc667daec7874ed9f681d59b2198914 Mon Sep 17 00:00:00 2001 From: Viktor UZLOV Date: Tue, 9 Nov 2021 17:24:56 +0300 Subject: [PATCH] bos #26460 Add SSL mode --- CMakeLists.txt | 1 + resources/CMakeLists.txt | 3 +- src/ATOMSOLV/ATOMSOLV.cxx | 23 ++++---- src/ATOMSOLV/ATOMSOLV.hxx | 29 ++++++++-- src/ATOMSOLV/ATOMSOLV_Component_Generator.cxx | 57 +++++++++++++++++++ src/ATOMSOLV/ATOMSOLV_Component_Generator.hxx | 28 +++++++++ src/ATOMSOLV/CMakeLists.txt | 3 + src/ATOMSOLVGUI/ATOMSOLVGUI.cxx | 19 ++++++- src/ATOMSOLVGUI/CMakeLists.txt | 2 + .../ATOMSOLV_SalomeSessionless.py | 28 +++++++++ src/ATOMSOLV_SWIG/AtomsolvHelper.cxx | 31 ++++++++++ src/ATOMSOLV_SWIG/AtomsolvHelper.h | 22 +++++++ src/ATOMSOLV_SWIG/AtomsolvHelper.i | 27 +++++++++ src/ATOMSOLV_SWIG/CMakeLists.txt | 56 ++++++++++++++++++ src/CMakeLists.txt | 2 +- 15 files changed, 312 insertions(+), 19 deletions(-) create mode 100644 src/ATOMSOLV/ATOMSOLV_Component_Generator.cxx create mode 100644 src/ATOMSOLV/ATOMSOLV_Component_Generator.hxx create mode 100644 src/ATOMSOLV_SWIG/ATOMSOLV_SalomeSessionless.py create mode 100644 src/ATOMSOLV_SWIG/AtomsolvHelper.cxx create mode 100644 src/ATOMSOLV_SWIG/AtomsolvHelper.h create mode 100644 src/ATOMSOLV_SWIG/AtomsolvHelper.i create mode 100644 src/ATOMSOLV_SWIG/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 95f8d64..3be6dac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,6 +75,7 @@ FIND_PACKAGE(SalomePythonLibs REQUIRED) FIND_PACKAGE(SalomeOmniORB REQUIRED) FIND_PACKAGE(SalomeOmniORBPy REQUIRED) FIND_PACKAGE(SalomePThread REQUIRED) +FIND_PACKAGE(SalomeSWIG REQUIRED) # Find GUI # =========== diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index 3e18cdf..395889d 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -33,4 +33,5 @@ INSTALL(FILES ${ATOMSOLV_RESOURCES_FILES} DESTINATION ${SALOME_ATOMSOLV_INSTALL_ MESSAGE(STATUS "Creation of ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml @ONLY) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml DESTINATION ${SALOME_ATOMSOLV_INSTALL_RES_DATA}) \ No newline at end of file +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml DESTINATION ${SALOME_ATOMSOLV_INSTALL_RES_DATA}) +SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeAppSL.xml INSTALL ${SALOME_ATOMSOLV_INSTALL_RES_DATA}) diff --git a/src/ATOMSOLV/ATOMSOLV.cxx b/src/ATOMSOLV/ATOMSOLV.cxx index 9149fa2..8931104 100644 --- a/src/ATOMSOLV/ATOMSOLV.cxx +++ b/src/ATOMSOLV/ATOMSOLV.cxx @@ -26,12 +26,13 @@ using namespace std; -ATOMSOLV::ATOMSOLV(CORBA::ORB_ptr orb, +ATOMSOLV_Abstract::ATOMSOLV_Abstract(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, const char *instanceName, - const char *interfaceName) : - Engines_Component_i(orb, poa, contId, instanceName, interfaceName) + const char *interfaceName, + bool withRegistry) : + Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, withRegistry) { MESSAGE("activate object"); _thisObj = this ; @@ -39,11 +40,11 @@ ATOMSOLV::ATOMSOLV(CORBA::ORB_ptr orb, myData = new ATOMSOLV_ORB::TMoleculeList(); } -ATOMSOLV::~ATOMSOLV() +ATOMSOLV_Abstract::~ATOMSOLV_Abstract() { } -CORBA::Boolean ATOMSOLV::setData( const ATOMSOLV_ORB::TMoleculeList& theData ) +CORBA::Boolean ATOMSOLV_Abstract::setData( const ATOMSOLV_ORB::TMoleculeList& theData ) { const int n = theData.length(); ATOMSOLV_ORB::TMoleculeList_var data = new ATOMSOLV_ORB::TMoleculeList(); @@ -57,10 +58,10 @@ CORBA::Boolean ATOMSOLV::setData( const ATOMSOLV_ORB::TMoleculeList& theData ) return (bool)n; } -CORBA::Boolean ATOMSOLV::getData( ATOMSOLV_ORB::TMoleculeList_out outData ) +CORBA::Boolean ATOMSOLV_Abstract::getData( ATOMSOLV_ORB::TMoleculeList_out outData ) { ATOMSOLV_ORB::TMoleculeList* data = myData; - // printf( " -- ATOMSOLV::getData() length = %d\n", data->length() ); + // printf( " -- ATOMSOLV_Abstract::getData() length = %d\n", data->length() ); const int n = data->length(); outData = new ATOMSOLV_ORB::TMoleculeList(); outData->length( n ); @@ -69,7 +70,7 @@ CORBA::Boolean ATOMSOLV::getData( ATOMSOLV_ORB::TMoleculeList_out outData ) return true; } -CORBA::Boolean ATOMSOLV::processData() +CORBA::Boolean ATOMSOLV_Abstract::processData() { ATOMSOLV_ORB::TMoleculeList* data = myData; for ( int i = 0, n = data->length(); i < n; i++ ) @@ -77,7 +78,7 @@ CORBA::Boolean ATOMSOLV::processData() return true; } -char* ATOMSOLV::getVersion() +char* ATOMSOLV_Abstract::getVersion() { #if defined(ATOMSOLV_DEVELOPMENT) return CORBA::string_dup(ATOMSOLV_VERSION_STR"dev"); @@ -97,8 +98,8 @@ extern "C" { MESSAGE("PortableServer::ObjectId * ATOMSOLVEngine_factory()"); SCRUTE(interfaceName); - ATOMSOLV * myATOMSOLV - = new ATOMSOLV(orb, poa, contId, instanceName, interfaceName); + ATOMSOLV_Session * myATOMSOLV + = new ATOMSOLV_Session(orb, poa, contId, instanceName, interfaceName); return myATOMSOLV->getId() ; } } diff --git a/src/ATOMSOLV/ATOMSOLV.hxx b/src/ATOMSOLV/ATOMSOLV.hxx index 863b030..4d32142 100644 --- a/src/ATOMSOLV/ATOMSOLV.hxx +++ b/src/ATOMSOLV/ATOMSOLV.hxx @@ -38,18 +38,19 @@ #endif -class ATOMSOLV_EXPORT ATOMSOLV: +class ATOMSOLV_EXPORT ATOMSOLV_Abstract: public POA_ATOMSOLV_ORB::ATOMSOLV_Gen, public Engines_Component_i { public: - ATOMSOLV(CORBA::ORB_ptr orb, + ATOMSOLV_Abstract(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, const char *instanceName, - const char *interfaceName); - virtual ~ATOMSOLV(); + const char *interfaceName, + bool withRegistry = true); + virtual ~ATOMSOLV_Abstract(); CORBA::Boolean setData( const ATOMSOLV_ORB::TMoleculeList& theData ); CORBA::Boolean getData( ATOMSOLV_ORB::TMoleculeList_out outData ); @@ -60,6 +61,26 @@ private: ATOMSOLV_ORB::TMoleculeList* myData; }; +class ATOMSOLV_EXPORT ATOMSOLV_Session : public ATOMSOLV_Abstract +{ +public: + ATOMSOLV_Session( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId* contId, + const char* instanceName, + const char* interfaceName):ATOMSOLV_Abstract(orb,poa,contId,instanceName,interfaceName,true) { } +}; + +class ATOMSOLV_EXPORT ATOMSOLV_No_Session : public ATOMSOLV_Abstract +{ +public: + ATOMSOLV_No_Session( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId* contId, + const char* instanceName, + const char* interfaceName):ATOMSOLV_Abstract(orb,poa,contId,instanceName,interfaceName,false) { } +}; + extern "C" ATOMSOLV_EXPORT PortableServer::ObjectId * ATOMSOLVEngine_factory(CORBA::ORB_ptr orb, diff --git a/src/ATOMSOLV/ATOMSOLV_Component_Generator.cxx b/src/ATOMSOLV/ATOMSOLV_Component_Generator.cxx new file mode 100644 index 0000000..188c20f --- /dev/null +++ b/src/ATOMSOLV/ATOMSOLV_Component_Generator.cxx @@ -0,0 +1,57 @@ +// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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, 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 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "ATOMSOLV_Component_Generator.hxx" + +#include "ATOMSOLV.hxx" +#include "SALOME_Container_i.hxx" +#include "SALOME_KernelServices.hxx" + +#include + +static Engines::EngineComponent_var _unique_compo; + +Engines::EngineComponent_var RetrieveATOMSOLVInstance() +{ + constexpr char COMPO_NAME[]="ATOMSOLV"; + if (CORBA::is_nil(_unique_compo)) + { + CORBA::ORB_var orb; + { + int argc(0); + orb = CORBA::ORB_init(argc, nullptr); + } + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var poa = PortableServer::POA::_narrow(obj); + PortableServer::POAManager_var pman = poa->the_POAManager(); + CORBA::PolicyList policies; + policies.length(0); + auto *cont(KERNEL::getContainerSA()); + PortableServer::ObjectId *conId(cont->getCORBAId()); + // + pman->activate(); + // + ATOMSOLV_No_Session *servant = new ATOMSOLV_No_Session(orb, poa, conId, "ATOMSOLV_inst_2", COMPO_NAME); + PortableServer::ObjectId *zeId = servant->getId(); + CORBA::Object_var zeRef = poa->id_to_reference(*zeId); + KERNEL::RegisterCompo(COMPO_NAME,zeRef); + _unique_compo = Engines::EngineComponent::_narrow(zeRef); + } + return _unique_compo; +} diff --git a/src/ATOMSOLV/ATOMSOLV_Component_Generator.hxx b/src/ATOMSOLV/ATOMSOLV_Component_Generator.hxx new file mode 100644 index 0000000..46ede1b --- /dev/null +++ b/src/ATOMSOLV/ATOMSOLV_Component_Generator.hxx @@ -0,0 +1,28 @@ +// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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, 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 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#pragma once + +#include "ATOMSOLV.hxx" + +#include "SALOMEconfig.h" + +#include CORBA_SERVER_HEADER(ATOMSOLV) + +ATOMSOLV_EXPORT Engines::EngineComponent_var RetrieveATOMSOLVInstance(); diff --git a/src/ATOMSOLV/CMakeLists.txt b/src/ATOMSOLV/CMakeLists.txt index 9ba740d..c2a31e2 100644 --- a/src/ATOMSOLV/CMakeLists.txt +++ b/src/ATOMSOLV/CMakeLists.txt @@ -38,6 +38,7 @@ ADD_DEFINITIONS( SET(_link_LIBRARIES ${ATOMGEN_SalomeIDLATOMGEN} ${KERNEL_SalomeContainer} + ${KERNEL_SalomeKernelHelpers} SalomeIDLATOMSOLV ) @@ -46,6 +47,7 @@ SET(_link_LIBRARIES # header files / no moc processing SET(ATOMSOLV_HEADERS ATOMSOLV.hxx + ATOMSOLV_Component_Generator.hxx ) # --- sources --- @@ -53,6 +55,7 @@ SET(ATOMSOLV_HEADERS # sources / static SET(ATOMSOLV_SOURCES ATOMSOLV.cxx + ATOMSOLV_Component_Generator.cxx ) # --- rules --- diff --git a/src/ATOMSOLVGUI/ATOMSOLVGUI.cxx b/src/ATOMSOLVGUI/ATOMSOLVGUI.cxx index fa0cefa..3206e8f 100644 --- a/src/ATOMSOLVGUI/ATOMSOLVGUI.cxx +++ b/src/ATOMSOLVGUI/ATOMSOLVGUI.cxx @@ -22,6 +22,7 @@ #include "ATOMSOLVGUI_Displayer.h" #include "ATOMSOLVGUI_Selection.h" #include "ATOMSOLVGUI_TransparencyDlg.h" +#include "ATOMSOLV_Component_Generator.hxx" #include @@ -36,6 +37,9 @@ #include #include +#include "SALOME_NamingService_Abstract.hxx" +#include "SALOME_KernelServices.hxx" + #include #include #include @@ -72,7 +76,18 @@ void ATOMSOLVGUI::InitATOMSOLVGen( SalomeApp_Application* app ) if ( !app ) myEngine = ATOMSOLV_ORB::ATOMSOLV_Gen::_nil(); else { - Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer", "ATOMSOLV" ); + SALOME_NamingService_Abstract *ns = SalomeApp_Application::namingService(); + Engines::EngineComponent_var comp; + if(ns->IsTrueNS()) + { + comp = app->lcc()->FindOrLoad_Component( "FactoryServer", "ATOMSOLV" ); + } + else + { + comp = RetrieveATOMSOLVInstance(); + CORBA::Object_var comp2 = CORBA::Object::_narrow(comp); + KERNEL::RegisterCompo("ATOMSOLV",comp2); + } ATOMSOLV_ORB::ATOMSOLV_Gen_ptr atomGen = ATOMSOLV_ORB::ATOMSOLV_Gen::_narrow(comp); ASSERT( !CORBA::is_nil( atomGen ) ); myEngine = atomGen; @@ -256,7 +271,7 @@ void ATOMSOLVGUI::OnRetrieveData() ATOMSOLV_ORB::ATOMSOLV_Gen_var engine = GetATOMSOLVGen(); SalomeApp_Application* app = getApp(); if ( !CORBA::is_nil( engine ) && app ) { - Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServerPy","ATOMGEN" ); + Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer","ATOMGEN" ); ATOMGEN_ORB::ATOMGEN_Gen_var atomGen = ATOMGEN_ORB::ATOMGEN_Gen::_narrow( comp ); SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); if ( !CORBA::is_nil( atomGen ) && appStudy ) { diff --git a/src/ATOMSOLVGUI/CMakeLists.txt b/src/ATOMSOLVGUI/CMakeLists.txt index 5d74ec5..460aa11 100644 --- a/src/ATOMSOLVGUI/CMakeLists.txt +++ b/src/ATOMSOLVGUI/CMakeLists.txt @@ -31,6 +31,7 @@ INCLUDE_DIRECTORIES( ${OMNIORB_INCLUDE_DIR} ${PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR}/idl + ${CMAKE_CURRENT_SOURCE_DIR}/../ATOMSOLV ) # additional preprocessor / compiler flags @@ -46,6 +47,7 @@ SET(_link_LIBRARIES ${GUI_LightApp} ${GUI_SalomeApp} ${ATOMGEN_SalomeIDLATOMGEN} + ATOMSOLVEngine SalomeIDLATOMSOLV ) diff --git a/src/ATOMSOLV_SWIG/ATOMSOLV_SalomeSessionless.py b/src/ATOMSOLV_SWIG/ATOMSOLV_SalomeSessionless.py new file mode 100644 index 0000000..769415d --- /dev/null +++ b/src/ATOMSOLV_SWIG/ATOMSOLV_SalomeSessionless.py @@ -0,0 +1,28 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE +# +# 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, 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +def buildInstance(orb): + import AtomsolvHelper + atomsolv_ior = AtomsolvHelper.BuildATOMSOLVInstance() + import ATOMSOLV_ORB + import CORBA + orb=CORBA.ORB_init(['']) + atomsolv = orb.string_to_object(atomsolv_ior) + return atomsolv, orb diff --git a/src/ATOMSOLV_SWIG/AtomsolvHelper.cxx b/src/ATOMSOLV_SWIG/AtomsolvHelper.cxx new file mode 100644 index 0000000..2cd6aa4 --- /dev/null +++ b/src/ATOMSOLV_SWIG/AtomsolvHelper.cxx @@ -0,0 +1,31 @@ +// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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, 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 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "AtomsolvHelper.h" + +#include "SALOME_KernelServices.hxx" + +#include "ATOMSOLV_Component_Generator.hxx" + +std::string BuildATOMSOLVInstance() +{ + Engines::EngineComponent_var zeRef = RetrieveATOMSOLVInstance(); + CORBA::String_var ior = KERNEL::getORB()->object_to_string(zeRef); + return std::string(ior.in()); +} diff --git a/src/ATOMSOLV_SWIG/AtomsolvHelper.h b/src/ATOMSOLV_SWIG/AtomsolvHelper.h new file mode 100644 index 0000000..357c293 --- /dev/null +++ b/src/ATOMSOLV_SWIG/AtomsolvHelper.h @@ -0,0 +1,22 @@ +// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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, 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 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include + +std::string BuildATOMSOLVInstance(); diff --git a/src/ATOMSOLV_SWIG/AtomsolvHelper.i b/src/ATOMSOLV_SWIG/AtomsolvHelper.i new file mode 100644 index 0000000..8da221b --- /dev/null +++ b/src/ATOMSOLV_SWIG/AtomsolvHelper.i @@ -0,0 +1,27 @@ +// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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, 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 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +%module AtomsolvHelper + +%include "std_string.i" + +%inline +{ + std::string BuildATOMSOLVInstance(); +} diff --git a/src/ATOMSOLV_SWIG/CMakeLists.txt b/src/ATOMSOLV_SWIG/CMakeLists.txt new file mode 100644 index 0000000..e96f672 --- /dev/null +++ b/src/ATOMSOLV_SWIG/CMakeLists.txt @@ -0,0 +1,56 @@ +# Copyright (C) 2012-2021 CEA/DEN, EDF R&D, OPEN CASCADE +# +# 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, 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 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +include(${SWIG_USE_FILE}) + +include_directories( + ${KERNEL_INCLUDE_DIRS} + ${PROJECT_BINARY_DIR}/idl + ${PROJECT_SOURCE_DIR}/src/ATOMSOLV +) + +SET(_bin_SCRIPTS + ATOMSOLV_SalomeSessionless.py +) + +# additional preprocessor / compiler flags +ADD_DEFINITIONS(${OMNIORB_DEFINITIONS} ) + +# SWIG wrapping +SET(AtomsolvHelper_HEADERS AtomsolvHelper.h AtomsolvHelper.i) +SET(AtomsolvHelper_SOURCES AtomsolvHelper.cxx ${AtomsolvHelper_HEADERS}) +SET_SOURCE_FILES_PROPERTIES(AtomsolvHelper.i PROPERTIES CPLUSPLUS ON) +SET_SOURCE_FILES_PROPERTIES(AtomsolvHelper.i PROPERTIES SWIG_FLAGS "-py3") +SET_SOURCE_FILES_PROPERTIES(AtomsolvHelper_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H") +SET(_swig_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/AtomsolvHelper.py ) +IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_MODULE(AtomsolvHelper python ${AtomsolvHelper_SOURCES}) +ELSE() + SWIG_ADD_LIBRARY(AtomsolvHelper LANGUAGE python SOURCES ${AtomsolvHelper_SOURCES}) +ENDIF() +SWIG_LINK_LIBRARIES(AtomsolvHelper ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} ATOMSOLVEngine ${KERNEL_SalomeKernelHelpers} ${KERNEL_SalomeDS} ) +SWIG_CHECK_GENERATION(AtomsolvHelper) +IF(WIN32) + SET_TARGET_PROPERTIES(_AtomsolvHelper PROPERTIES DEBUG_OUTPUT_NAME _AtomsolvHelper_d) +ENDIF(WIN32) +install(TARGETS _AtomsolvHelper DESTINATION ${SALOME_INSTALL_LIBS}) +install(FILES ${AtomsolvHelper_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) +SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_AtomsolvHelper_REAL_NAME}") + +SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_PYTHON} DEF_PERMS) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 36fb22f..4dbfe2e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,7 +21,7 @@ # Common packages ## SET(SUBDIRS_COMMON - ATOMSOLV ATOMSOLVGUI + ATOMSOLV ATOMSOLVGUI ATOMSOLV_SWIG ) SET(SUBDIRS -- 2.30.2