From 50c7c4e2d186cf4367fc4d52fa2559289f71d807 Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 17 Jan 2017 11:23:55 +0300 Subject: [PATCH] Issue #1896: Inspect SALOME modules before loading of XML configurations --- src/Config/CMakeLists.txt | 22 ++++++++++++++++++++++ src/Config/ConfigAPI.i | 14 ++++++++++++++ src/Config/Config_swig.h | 12 ++++++++++++ src/Config/plugins.xml.in | 2 +- src/Model/Model_Session.cpp | 3 ++- src/SHAPERGUI/SHAPERGUI.cpp | 10 ---------- src/SHAPERGUI/SHAPERGUI.h | 3 --- 7 files changed, 51 insertions(+), 15 deletions(-) create mode 100644 src/Config/ConfigAPI.i create mode 100644 src/Config/Config_swig.h diff --git a/src/Config/CMakeLists.txt b/src/Config/CMakeLists.txt index 5e0123e9c..831f62020 100644 --- a/src/Config/CMakeLists.txt +++ b/src/Config/CMakeLists.txt @@ -2,6 +2,8 @@ INCLUDE(Common) INCLUDE(XMLProcessing) +FIND_PACKAGE(SWIG REQUIRED) +INCLUDE(${SWIG_USE_FILE}) INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Events ${PYTHON_INCLUDE_DIR}) @@ -46,6 +48,23 @@ SET(PROJECT_SOURCES Config_Translator.cpp ) +SET(CMAKE_SWIG_FLAGS -threads -Wall) +SET_SOURCE_FILES_PROPERTIES(ConfigAPI.i PROPERTIES CPLUSPLUS ON) +SET_SOURCE_FILES_PROPERTIES(ConfigAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow") +SET(SWIG_SCRIPTS + ${CMAKE_CURRENT_BINARY_DIR}/ConfigAPI.py +) +SET(SWIG_LINK_LIBRARIES + Config + ${PYTHON_LIBRARIES} +) +SWIG_ADD_MODULE(ConfigAPI python ConfigAPI.i ${PROJECT_HEADERS}) +SWIG_LINK_LIBRARIES(ConfigAPI ${SWIG_LINK_LIBRARIES}) +IF(WIN32) + SET_TARGET_PROPERTIES(_ConfigAPI PROPERTIES DEBUG_OUTPUT_NAME _ConfigAPI_d) +ENDIF(WIN32) + + SET(XML_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/plugins.xml dataModel.xml @@ -106,3 +125,6 @@ CONFIGURE_FILE( INSTALL(TARGETS Config DESTINATION ${SHAPER_INSTALL_BIN}) INSTALL(FILES ${XML_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}) + +INSTALL(TARGETS _ConfigAPI DESTINATION ${SHAPER_INSTALL_SWIG}) +INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION ${SHAPER_INSTALL_SWIG}) diff --git a/src/Config/ConfigAPI.i b/src/Config/ConfigAPI.i new file mode 100644 index 000000000..26d5fc3c5 --- /dev/null +++ b/src/Config/ConfigAPI.i @@ -0,0 +1,14 @@ +/* Config.i */ + +%module ConfigAPI +%{ + #include "Config_swig.h" +%} + +// to avoid error on this +#define CONFIG_EXPORT + +%include "typemaps.i" +%include "std_string.i" + +%include "Config_ModuleReader.h" diff --git a/src/Config/Config_swig.h b/src/Config/Config_swig.h new file mode 100644 index 000000000..00c8ae22c --- /dev/null +++ b/src/Config/Config_swig.h @@ -0,0 +1,12 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: Config_swig.h +// Created: Jan 16, 2017 +// Author: Vitaly SMETANNIKOV + +#ifndef SRC_CONFIG_SWIG_H_ +#define SRC_CONFIG_SWIG_H_ + + #include "Config_ModuleReader.h" + +#endif /* SRC_CONFIG_SWIG_H_ */ diff --git a/src/Config/plugins.xml.in b/src/Config/plugins.xml.in index e2b18a79c..2969b9da6 100644 --- a/src/Config/plugins.xml.in +++ b/src/Config/plugins.xml.in @@ -13,7 +13,7 @@ - + @DEFAULT_SOLVER@