From: azv Date: Tue, 4 Feb 2020 12:17:31 +0000 (+0300) Subject: Flexible behavior of Dump feature configured in CMake X-Git-Tag: V9_5_0a1~34 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ba131d6558e6a88a156e63c78f6dcc8ba0bb569c;p=modules%2Fshaper.git Flexible behavior of Dump feature configured in CMake --- diff --git a/src/ExchangePlugin/CMakeLists.txt b/src/ExchangePlugin/CMakeLists.txt index 3c6692e59..83a6dd570 100644 --- a/src/ExchangePlugin/CMakeLists.txt +++ b/src/ExchangePlugin/CMakeLists.txt @@ -77,7 +77,21 @@ SET(PROJECT_LIBRARIES ) SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES}) +# default dump approaches (will be set if not initialized) +SET(PYTHONDUMP_NAMING ON CACHE BOOL "Dump named references to shapes") +SET(PYTHONDUMP_GEO ON CACHE BOOL "Dump references to shapes by the geometric properties") +SET(PYTHONDUMP_WEAK OFF CACHE BOOL "Dump weak named references to shapes") + ADD_DEFINITIONS(-DEXCHANGEPLUGIN_EXPORTS) +IF(${PYTHONDUMP_NAMING}) + ADD_DEFINITIONS(-DEXCHANGEPLUGIN_DUMP_NAMING) +ENDIF() +IF(${PYTHONDUMP_GEO}) + ADD_DEFINITIONS(-DEXCHANGEPLUGIN_DUMP_GEO) +ENDIF() +IF(${PYTHONDUMP_WEAK}) + ADD_DEFINITIONS(-DEXCHANGEPLUGIN_DUMP_WEAK) +ENDIF() ADD_LIBRARY(ExchangePlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES} ${TEXT_RESOURCES}) TARGET_LINK_LIBRARIES(ExchangePlugin ${PROJECT_LIBRARIES}) diff --git a/src/ExchangePlugin/ExchangePlugin_Dump.cpp b/src/ExchangePlugin/ExchangePlugin_Dump.cpp index cf78b9b8c..097042a28 100644 --- a/src/ExchangePlugin/ExchangePlugin_Dump.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Dump.cpp @@ -29,6 +29,24 @@ #include +#ifdef EXCHANGEPLUGIN_DUMP_NAMING +static const bool THE_DUMP_NAMING = true; +#else +static const bool THE_DUMP_NAMING = false; +#endif + +#ifdef EXCHANGEPLUGIN_DUMP_GEO +static const bool THE_DUMP_GEO = true; +#else +static const bool THE_DUMP_GEO = false; +#endif + +#ifdef EXCHANGEPLUGIN_DUMP_WEAK +static const bool THE_DUMP_WEAK = true; +#else +static const bool THE_DUMP_WEAK = false; +#endif + ExchangePlugin_Dump::ExchangePlugin_Dump() { @@ -48,9 +66,9 @@ void ExchangePlugin_Dump::initAttributes() data()->addAttribute(WEAK_NAMING_DUMP_ID(), ModelAPI_AttributeBoolean::typeId()); // default values - boolean(TOPOLOGICAL_NAMING_DUMP_ID())->setValue(true); - boolean(GEOMETRIC_DUMP_ID())->setValue(true); - boolean(WEAK_NAMING_DUMP_ID())->setValue(false); + boolean(TOPOLOGICAL_NAMING_DUMP_ID())->setValue(THE_DUMP_NAMING); + boolean(GEOMETRIC_DUMP_ID())->setValue(THE_DUMP_GEO); + boolean(WEAK_NAMING_DUMP_ID())->setValue(THE_DUMP_WEAK); } void ExchangePlugin_Dump::execute()