-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SofaMatrix] Put Qt dependent code into an extension (#5234)
* Put Qt related object fro mSofaMatrix into extensions folder * Fix scene test * Update applications/plugins/SofaMatrix/examples/FillReducingOrdering.scn Co-authored-by: Frederick Roy <[email protected]> --------- Co-authored-by: Frederick Roy <[email protected]>
- Loading branch information
Showing
18 changed files
with
234 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,25 +3,12 @@ | |
@PACKAGE_GUARD@ | ||
@PACKAGE_INIT@ | ||
|
||
set(SOFAMATRIX_HAVE_SOFA_GUI_QT @SOFAMATRIX_HAVE_SOFA_GUI_QT@) | ||
set(SOFAMATRIX_HAVE_QT5CORE @SOFAMATRIX_HAVE_QT5CORE@) | ||
set(SOFAMATRIX_HAVE_QT6CORE @SOFAMATRIX_HAVE_QT6CORE@) | ||
|
||
find_package(Sofa.Core QUIET REQUIRED) | ||
find_package(Sofa.Component.Constraint.Lagrangian.Solver QUIET REQUIRED) | ||
find_package(Sofa.Component.LinearSolver.Direct QUIET REQUIRED) | ||
find_package(Eigen3 QUIET REQUIRED) | ||
|
||
if(SOFAMATRIX_HAVE_SOFA_GUI_QT ) | ||
find_package(Sofa.GUI.Qt QUIET REQUIRED) | ||
endif() | ||
if(SOFAMATRIX_HAVE_QT5CORE) | ||
find_package(Qt5 COMPONENTS Core QUIET REQUIRED) | ||
endif() | ||
if(SOFAMATRIX_HAVE_QT6CORE) | ||
find_package(Qt6 COMPONENTS Core CoreTools QUIET) | ||
endif() | ||
|
||
if(NOT TARGET @PROJECT_NAME@) | ||
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]") | ||
endif() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
applications/plugins/SofaMatrix/extensions/Qt/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
cmake_minimum_required(VERSION 3.22) | ||
project(SofaMatrix.Qt VERSION 1.0 LANGUAGES CXX) | ||
|
||
sofa_find_package(Sofa.Core REQUIRED) | ||
sofa_find_package(Sofa.Component.Constraint.Lagrangian.Solver REQUIRED) | ||
sofa_find_package(Sofa.Component.LinearSolver.Direct REQUIRED) | ||
sofa_find_package(Eigen3 REQUIRED) | ||
sofa_find_package(Sofa.GUI.Qt REQUIRED) | ||
|
||
set(SOFA_MODULES | ||
Sofa.Component.Constraint.Lagrangian.Solver | ||
Sofa.Component.LinearSolver.Direct | ||
Sofa.Core | ||
Eigen3::Eigen | ||
Sofa.GUI.Qt | ||
SofaMatrix | ||
) | ||
|
||
set(SOFAMATRIX_SRC_DIR src/SofaMatrix/Qt) | ||
|
||
set(HEADER_FILES | ||
${SOFAMATRIX_SRC_DIR}/config.h.in | ||
${SOFAMATRIX_SRC_DIR}/ComplianceMatrixImage.h | ||
${SOFAMATRIX_SRC_DIR}/GlobalSystemMatrixImage.h | ||
${SOFAMATRIX_SRC_DIR}/BaseMatrixImageProxy.h | ||
) | ||
|
||
set(SOURCE_FILES | ||
${SOFAMATRIX_SRC_DIR}/ComplianceMatrixImage.cpp | ||
${SOFAMATRIX_SRC_DIR}/GlobalSystemMatrixImage.cpp | ||
${SOFAMATRIX_SRC_DIR}/BaseMatrixImageViewerWidget.cpp | ||
${SOFAMATRIX_SRC_DIR}/initSofaMatrixQt.cpp | ||
) | ||
|
||
set(MOC_FILES | ||
) | ||
|
||
set(MOC_HEADER_FILES | ||
${SOFAMATRIX_SRC_DIR}/BaseMatrixImageViewerWidget.h | ||
) | ||
|
||
find_package(Qt6 COMPONENTS Core CoreTools QUIET) | ||
if (NOT Qt6Core_FOUND) | ||
find_package(Qt5 COMPONENTS Core QUIET) | ||
endif() | ||
if(Qt5Core_FOUND) | ||
qt5_wrap_cpp(MOC_FILES ${MOC_HEADER_FILES}) | ||
set(SOFAMATRIX_HAVE_QT5 1) | ||
elseif (Qt6Core_FOUND) | ||
qt6_wrap_cpp(MOC_FILES ${MOC_HEADER_FILES}) | ||
set(SOFAMATRIX_HAVE_QT6 1) | ||
endif() | ||
|
||
# Create the plugin library. | ||
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${MOC_HEADER_FILES} ${MOC_FILES}) | ||
|
||
# Link the plugin library to its dependency(ies). | ||
target_link_libraries(${PROJECT_NAME} PUBLIC ${SOFA_MODULES}) | ||
|
||
sofa_create_package_with_targets( | ||
PACKAGE_NAME ${PROJECT_NAME} | ||
PACKAGE_VERSION ${PROJECT_VERSION} | ||
TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES | ||
INCLUDE_SOURCE_DIR "src" | ||
INCLUDE_INSTALL_DIR ${PROJECT_NAME} | ||
RELOCATABLE "plugins" | ||
) | ||
|
||
# Tests | ||
# If SOFA_BUILD_TESTS exists and is OFF, then these tests will be auto-disabled | ||
# cmake_dependent_option(SOFAMATRIX_BUILD_TESTS "Compile the automatic tests" ON "SOFA_BUILD_TESTS OR NOT DEFINED SOFA_BUILD_TESTS" OFF) | ||
#if(SOFAMATRIX_BUILD_TESTS) | ||
# enable_testing() | ||
# add_subdirectory(SofaMatrix_test) | ||
# endif() |
29 changes: 29 additions & 0 deletions
29
applications/plugins/SofaMatrix/extensions/Qt/SofaMatrix.QtConfig.cmake.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# CMake package configuration file for the plugin @PROJECT_NAME@ | ||
|
||
@PACKAGE_GUARD@ | ||
@PACKAGE_INIT@ | ||
|
||
|
||
|
||
set(SOFAMATRIX_QT_HAVE_QT5 @SOFAMATRIX_HAVE_QT5@) | ||
set(SOFAMATRIX_QT_HAVE_QT6 @SOFAMATRIX_HAVE_QT6@) | ||
|
||
find_package(Sofa.Core QUIET REQUIRED) | ||
find_package(Sofa.Component.Constraint.Lagrangian.Solver QUIET REQUIRED) | ||
find_package(Sofa.Component.LinearSolver.Direct QUIET REQUIRED) | ||
find_package(Eigen3 QUIET REQUIRED) | ||
find_package(Sofa.GUI.Qt QUIET REQUIRED) | ||
find_package(SofaMatrix QUIET REQUIRED) | ||
|
||
if(SOFAMATRIX_QT_HAVE_QT5) | ||
find_package(Qt5 COMPONENTS Core QUIET REQUIRED) | ||
endif() | ||
if(SOFAMATRIX_QT_HAVE_QT6) | ||
find_package(Qt6 COMPONENTS Core CoreTools QUIET) | ||
endif() | ||
|
||
if(NOT TARGET @PROJECT_NAME@) | ||
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]") | ||
endif() | ||
|
||
check_required_components(@PROJECT_NAME@) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
* Contact information: [email protected] * | ||
******************************************************************************/ | ||
#pragma once | ||
#include <SofaMatrix/config.h> | ||
#include <SofaMatrix/Qt/config.h> | ||
#include <sofa/linearalgebra/BaseMatrix.h> | ||
|
||
namespace sofa::type | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
* * | ||
* Contact information: [email protected] * | ||
******************************************************************************/ | ||
#include <SofaMatrix/BaseMatrixImageViewerWidget.h> | ||
#include <SofaMatrix/Qt/BaseMatrixImageViewerWidget.h> | ||
|
||
namespace sofa::gui::qt | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,12 +20,12 @@ | |
* Contact information: [email protected] * | ||
******************************************************************************/ | ||
#pragma once | ||
#include <SofaMatrix/config.h> | ||
#include <SofaMatrix/Qt/config.h> | ||
|
||
#include <QGraphicsView> | ||
#include <sofa/gui/qt/SimpleDataWidget.h> | ||
|
||
#include <SofaMatrix/BaseMatrixImageProxy.h> | ||
#include <SofaMatrix/Qt/BaseMatrixImageProxy.h> | ||
|
||
namespace sofa::gui::qt | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
* * | ||
* Contact information: [email protected] * | ||
******************************************************************************/ | ||
#include <SofaMatrix/ComplianceMatrixImage.h> | ||
#include <SofaMatrix/Qt/ComplianceMatrixImage.h> | ||
#include <sofa/core/ObjectFactory.h> | ||
#include <sofa/simulation/AnimateEndEvent.h> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,10 +20,10 @@ | |
* Contact information: [email protected] * | ||
******************************************************************************/ | ||
#pragma once | ||
#include <SofaMatrix/config.h> | ||
#include <SofaMatrix/Qt/config.h> | ||
|
||
#include <sofa/core/objectmodel/BaseObject.h> | ||
#include <SofaMatrix/BaseMatrixImageProxy.h> | ||
#include <SofaMatrix/Qt/BaseMatrixImageProxy.h> | ||
#include <sofa/component/constraint/lagrangian/solver/ConstraintSolverImpl.h> | ||
|
||
namespace sofa::component::constraintset | ||
|
@@ -35,7 +35,7 @@ namespace sofa::component::constraintset | |
* | ||
* Note that the compliance matrix is dense. It means all the entries will proably be non-zero | ||
*/ | ||
class SOFA_SOFAMATRIX_API ComplianceMatrixImage : public core::objectmodel::BaseObject | ||
class SOFA_SOFAMATRIX_QT_API ComplianceMatrixImage : public core::objectmodel::BaseObject | ||
{ | ||
public: | ||
SOFA_CLASS(ComplianceMatrixImage, core::objectmodel::BaseObject); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
* * | ||
* Contact information: [email protected] * | ||
******************************************************************************/ | ||
#include <SofaMatrix/GlobalSystemMatrixImage.h> | ||
#include <SofaMatrix/Qt/GlobalSystemMatrixImage.h> | ||
#include <sofa/core/ObjectFactory.h> | ||
#include <sofa/core/behavior/LinearSolver.h> | ||
#include <sofa/simulation/AnimateEndEvent.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,10 +20,10 @@ | |
* Contact information: [email protected] * | ||
******************************************************************************/ | ||
#pragma once | ||
#include <SofaMatrix/config.h> | ||
#include <SofaMatrix/Qt/config.h> | ||
|
||
#include <sofa/core/objectmodel/BaseObject.h> | ||
#include <SofaMatrix/BaseMatrixImageProxy.h> | ||
#include <SofaMatrix/Qt/BaseMatrixImageProxy.h> | ||
|
||
#include <sofa/core/behavior/BaseMatrixLinearSystem.h> | ||
|
||
|
@@ -34,7 +34,7 @@ namespace sofa::component::linearsolver | |
* Component to convert a BaseMatrix from the linear solver into an image that can be visualized in the GUI. | ||
* Use GlobalSystemMatrixExporter in order to save an image on the disk. | ||
*/ | ||
class SOFA_SOFAMATRIX_API GlobalSystemMatrixImage : public core::objectmodel::BaseObject | ||
class SOFA_SOFAMATRIX_QT_API GlobalSystemMatrixImage : public core::objectmodel::BaseObject | ||
{ | ||
public: | ||
SOFA_CLASS(GlobalSystemMatrixImage, core::objectmodel::BaseObject); | ||
|
34 changes: 34 additions & 0 deletions
34
applications/plugins/SofaMatrix/extensions/Qt/src/SofaMatrix/Qt/config.h.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/****************************************************************************** | ||
* SOFA, Simulation Open-Framework Architecture * | ||
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * | ||
* * | ||
* This program 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 program 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 program. If not, see <http://www.gnu.org/licenses/>. * | ||
******************************************************************************* | ||
* Authors: The SOFA Team and external contributors (see Authors.txt) * | ||
* * | ||
* Contact information: [email protected] * | ||
******************************************************************************/ | ||
#pragma once | ||
|
||
#include <sofa/config.h> | ||
|
||
#define SOFAMATRIX_QT_VERSION @PROJECT_VERSION@ | ||
|
||
#ifdef SOFA_BUILD_SOFAMATRIX_QT | ||
# define SOFA_TARGET @PROJECT_NAME@ | ||
# define SOFA_SOFAMATRIX_QT_API SOFA_EXPORT_DYNAMIC_LIBRARY | ||
#else | ||
# define SOFA_SOFAMATRIX_QT_API SOFA_IMPORT_DYNAMIC_LIBRARY | ||
#endif | ||
|
Oops, something went wrong.