From: azv Date: Wed, 21 May 2014 10:53:10 +0000 (+0400) Subject: SketchSolver: porting to Linux (loading of shared libraries) X-Git-Tag: V_0.2~29^2^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0fb55fb5092b38612b54c34339d17e945480d2db;p=modules%2Fshaper.git SketchSolver: porting to Linux (loading of shared libraries) --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 18fbdfc7c..05f077144 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,8 @@ PROJECT (NewGEOM) SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH}) +SET(CMAKE_SHARED_LINKER_FLAGS "${SMAKE_SHARED_LINKER_FLAGS} -Wl,-E") + INCLUDE(Common) INCLUDE(FindQt) INCLUDE(FindBoost) diff --git a/src/Config/Config_ModuleReader.cpp b/src/Config/Config_ModuleReader.cpp index 0291b83b4..e6fdeffde 100644 --- a/src/Config/Config_ModuleReader.cpp +++ b/src/Config/Config_ModuleReader.cpp @@ -99,7 +99,7 @@ void Config_ModuleReader::loadLibrary(const std::string theLibName) Events_Error::send(errorMsg); } #else - void* aModLib = dlopen( aFileName.c_str(), RTLD_LAZY ); + void* aModLib = dlopen( aFileName.c_str(), RTLD_LAZY | RTLD_GLOBAL ); if ( !aModLib ) { std::cerr << "Failed to load " << aFileName.c_str() << std::endl; } diff --git a/src/SketchPlugin/CMakeLists.txt b/src/SketchPlugin/CMakeLists.txt index eb5956ec2..8c2796b0d 100644 --- a/src/SketchPlugin/CMakeLists.txt +++ b/src/SketchPlugin/CMakeLists.txt @@ -26,7 +26,7 @@ SET(PROJECT_LIBRARIES ) ADD_DEFINITIONS(-DSKETCHPLUGIN_EXPORTS ${BOOST_DEFINITIONS}) -ADD_LIBRARY(SketchPlugin SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) +ADD_LIBRARY(SketchPlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS}) TARGET_LINK_LIBRARIES(SketchPlugin ${PROJECT_LIBRARIES} ModelAPI GeomAPI GeomAlgoAPI) INCLUDE_DIRECTORIES( diff --git a/src/SketchPlugin/SketchPlugin_Constraint.h b/src/SketchPlugin/SketchPlugin_Constraint.h index 61cd2bf05..98680830a 100644 --- a/src/SketchPlugin/SketchPlugin_Constraint.h +++ b/src/SketchPlugin/SketchPlugin_Constraint.h @@ -49,11 +49,11 @@ class SketchPlugin_Constraint: public SketchPlugin_Feature { public: /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string& getKind() + SKETCHPLUGIN_EXPORT virtual const std::string& getKind() {static std::string MY_KIND = "SketchConstraint"; return MY_KIND;} /// \brief Returns to which group in the document must be added feature - SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() + SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() {static std::string MY_GROUP = "Sketch"; return MY_GROUP;} /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch) @@ -62,6 +62,7 @@ public: SKETCHPLUGIN_EXPORT virtual const void addSub( const boost::shared_ptr& theFeature) {} +protected: /// \brief Use plugin manager for features creation SketchPlugin_Constraint() {} }; diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h index fe75115e9..57e95f5ba 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h @@ -12,7 +12,7 @@ /** \class SketchPlugin_ConstraintCoincidence * \ingroup DataModel - * \brief Feature for creation of a new constraint which defines equvalence of two points + * \brief Feature for creation of a new constraint which defines equivalence of two points * * These constraint has two attributes: CONSTRAINT_ATTR_POINT_A and CONSTRAINT_ATTR_POINT_B */ diff --git a/src/SketchSolver/CMakeLists.txt b/src/SketchSolver/CMakeLists.txt index 70b9fecbb..20cd14b87 100644 --- a/src/SketchSolver/CMakeLists.txt +++ b/src/SketchSolver/CMakeLists.txt @@ -14,7 +14,6 @@ SET(PROJECT_SOURCES SET(PROJECT_LIBRARIES ${SLVS_LIBRARIES} - SketchPlugin Events ) @@ -29,7 +28,7 @@ INCLUDE_DIRECTORIES( ADD_DEFINITIONS(-DSKETCHSOLVER_EXPORTS ${BOOST_DEFINITIONS}) -ADD_LIBRARY(SketchSolver SHARED +ADD_LIBRARY(SketchSolver MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ) diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 40c545b2c..a41702119 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -525,7 +525,7 @@ XGUI_Module* XGUI_Workshop::loadModule(const QString& theModule) } } #else - void* modLib = dlopen( libName.toLatin1(), RTLD_LAZY ); + void* modLib = dlopen( libName.toLatin1(), RTLD_LAZY | RTLD_GLOBAL ); if ( !modLib ) { err = QString( "Can not load library %1. %2" ).arg( libName ).arg( dlerror() ); } else {