From 227f4de7f884340eabf85888e419e010416943c3 Mon Sep 17 00:00:00 2001 From: rnv Date: Wed, 30 Oct 2019 17:52:49 +0300 Subject: [PATCH] Fix for '17915 [CEA 17912] CurvePlot breaks GUI build on Windows' issue. --- tools/CMakeLists.txt | 4 +++- tools/CurvePlot/src/cpp/CMakeLists.txt | 4 ++++ tools/CurvePlot/src/cpp/CurvePlot.hxx | 17 ++++++++++++++--- tools/CurvePlot/src/cpp/test/CMakeLists.txt | 5 +++++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index a8fd75747..433f80686 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -18,7 +18,6 @@ # ADD_SUBDIRECTORY(dlgfactory) -ADD_SUBDIRECTORY(CurvePlot) ## # Python-based packages, part 1 (generic) @@ -32,6 +31,9 @@ IF(SALOME_USE_PYCONSOLE) SET(PYCONSOLE_INSTALL_RES "${SALOME_GUI_INSTALL_RES_DATA}" CACHE PATH "") ADD_SUBDIRECTORY(../tools/PyConsole) # will bring in PyInterp automatically + + ADD_SUBDIRECTORY(CurvePlot) + ENDIF(SALOME_USE_PYCONSOLE) IF(SALOME_USE_PYVIEWER) diff --git a/tools/CurvePlot/src/cpp/CMakeLists.txt b/tools/CurvePlot/src/cpp/CMakeLists.txt index e35af2def..3f701ebc0 100644 --- a/tools/CurvePlot/src/cpp/CMakeLists.txt +++ b/tools/CurvePlot/src/cpp/CMakeLists.txt @@ -34,6 +34,10 @@ ADD_DEFINITIONS(${PYTHON_DEFINITIONS}) # libraries to link to SET(_link_LIBRARIES ${PYTHON_LIBRARIES} ${GUI_PyInterp}) +IF(TARGET PyInterp) + SET(_link_LIBRARIES ${_link_LIBRARIES} PyInterp) +ENDIF() + # --- headers --- # header files / no moc processing diff --git a/tools/CurvePlot/src/cpp/CurvePlot.hxx b/tools/CurvePlot/src/cpp/CurvePlot.hxx index 92b86802b..67c000a4e 100644 --- a/tools/CurvePlot/src/cpp/CurvePlot.hxx +++ b/tools/CurvePlot/src/cpp/CurvePlot.hxx @@ -22,6 +22,17 @@ #ifndef SRC_CPP_CURVEPLOT_HXX_ #define SRC_CPP_CURVEPLOT_HXX_ +#ifdef WIN32 +# if defined CURVEPLOT_EXPORTS || defined CurvePlot_EXPORTS +# define CURVEPLOT_EXPORT __declspec(dllexport) +# else +# define CURVEPLOT_EXPORT __declspec(dllimport) +# endif +#else // WIN32 +# define CURVEPLOT_EXPORT +#endif // WIN32 + + #include #include @@ -32,9 +43,9 @@ namespace CURVEPLOT /** * This function should be called before doing anything in the CURVEPLOT namespace. */ - void* InitializeCurvePlot(); + CURVEPLOT_EXPORT void* InitializeCurvePlot(); - class ColumnVector + class CURVEPLOT_EXPORT ColumnVector { public: friend class CurvePlot; @@ -75,7 +86,7 @@ namespace CURVEPLOT /** * C++ wrapping of the public API exposed in the Python package curveplot. See doc there. */ - class CurvePlot + class CURVEPLOT_EXPORT CurvePlot { public: static PlotID AddCurve(const ColumnVector & x, const ColumnVector & y, diff --git a/tools/CurvePlot/src/cpp/test/CMakeLists.txt b/tools/CurvePlot/src/cpp/test/CMakeLists.txt index 77d01edb7..50e6ef11a 100644 --- a/tools/CurvePlot/src/cpp/test/CMakeLists.txt +++ b/tools/CurvePlot/src/cpp/test/CMakeLists.txt @@ -31,6 +31,11 @@ ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${QT_DEFINITIONS}) # libraries to link to SET(_link_LIBRARIES ${PYTHON_LIBRARIES} ${GUI_PyInterp} ${QT_LIBRARIES} CurvePlot) +IF(TARGET PyInterp) + SET(_link_LIBRARIES ${_link_LIBRARIES} PyInterp) +ENDIF() + + # --- headers --- SET(_moc_HEADERS -- 2.39.2