From ee67091b477d6e59d5cc3f26e7fedf17411dd1fa Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Wed, 23 Aug 2023 14:19:49 +0200 Subject: [PATCH 1/4] Update according to SOFA changes --- CMakeLists.txt | 6 +-- ShapeMatchingPluginConfig.cmake.in | 2 +- examples/ConstraintRotationFinder.scn | 40 ++++++++++++------- examples/RotationFinder.scn | 33 ++++++++++----- examples/ShapeMatchingForceField.scn | 25 ++++++++---- .../ShapeMatchingForceField.inl | 1 - .../ShapeMatchingRotationFinder.inl | 4 +- src/ShapeMatchingPlugin/config.h.in | 8 +++- .../initShapeMatchingPlugin.cpp | 4 +- 9 files changed, 81 insertions(+), 42 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7232200..a959ad1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,8 @@ project(ShapeMatchingPlugin LANGUAGES CXX) set(SHAPEMATCHINGPLUGIN_SRC "src/${PROJECT_NAME}") +find_package(Sofa.Core REQUIRED) + set(HEADER_FILES ${SHAPEMATCHINGPLUGIN_SRC}/config.h.in ${SHAPEMATCHINGPLUGIN_SRC}/initShapeMatchingPlugin.h @@ -18,10 +20,8 @@ set(SOURCE_FILES ${SHAPEMATCHINGPLUGIN_SRC}/ShapeMatchingForceField.cpp ) -find_package(SofaBaseLinearSolver REQUIRED) - add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) -target_link_libraries(${PROJECT_NAME} PUBLIC SofaBaseLinearSolver) +target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Core) sofa_create_package_with_targets( PACKAGE_NAME ${PROJECT_NAME} diff --git a/ShapeMatchingPluginConfig.cmake.in b/ShapeMatchingPluginConfig.cmake.in index cecf64c..f81e5af 100644 --- a/ShapeMatchingPluginConfig.cmake.in +++ b/ShapeMatchingPluginConfig.cmake.in @@ -2,7 +2,7 @@ @PACKAGE_INIT@ -find_package(SofaBaseLinearSolver QUIET REQUIRED) +find_package(Sofa.Core QUIET REQUIRED) if(NOT TARGET @PROJECT_NAME@) include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") diff --git a/examples/ConstraintRotationFinder.scn b/examples/ConstraintRotationFinder.scn index 27d7d68..5d6e272 100644 --- a/examples/ConstraintRotationFinder.scn +++ b/examples/ConstraintRotationFinder.scn @@ -1,23 +1,35 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - diff --git a/examples/RotationFinder.scn b/examples/RotationFinder.scn index 661e9d2..57ebd4b 100644 --- a/examples/RotationFinder.scn +++ b/examples/RotationFinder.scn @@ -1,18 +1,29 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - + diff --git a/examples/ShapeMatchingForceField.scn b/examples/ShapeMatchingForceField.scn index eae0392..9523132 100644 --- a/examples/ShapeMatchingForceField.scn +++ b/examples/ShapeMatchingForceField.scn @@ -1,16 +1,27 @@ - - - - - + + + + + + + + + + + + + + + + - + - + diff --git a/src/ShapeMatchingPlugin/ShapeMatchingForceField.inl b/src/ShapeMatchingPlugin/ShapeMatchingForceField.inl index 64a0b20..947db37 100644 --- a/src/ShapeMatchingPlugin/ShapeMatchingForceField.inl +++ b/src/ShapeMatchingPlugin/ShapeMatchingForceField.inl @@ -27,7 +27,6 @@ #include #include #include -#include namespace sofa::component::forcefield { diff --git a/src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.inl b/src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.inl index 0b64e37..718cb46 100644 --- a/src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.inl +++ b/src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.inl @@ -558,7 +558,7 @@ void ShapeMatchingRotationFinder::draw(const core::visual::VisualPara vparams->drawTool()->disableLighting(); - std::vector vertices; + std::vector vertices; std::vector colors; for (unsigned int i=0 ; i::draw(const core::visual::VisualPara vparams->drawTool()->disableLighting(); - std::vector vertices; + std::vector vertices; std::vector colors; float r, g, b; diff --git a/src/ShapeMatchingPlugin/config.h.in b/src/ShapeMatchingPlugin/config.h.in index fbfc0d3..cbcde01 100644 --- a/src/ShapeMatchingPlugin/config.h.in +++ b/src/ShapeMatchingPlugin/config.h.in @@ -31,4 +31,10 @@ # define SOFA_SHAPEMATCHINGPLUGIN_API SOFA_EXPORT_DYNAMIC_LIBRARY #else # define SOFA_SHAPEMATCHINGPLUGIN_API SOFA_IMPORT_DYNAMIC_LIBRARY -#endif \ No newline at end of file +#endif + +namespace shapematching +{ + constexpr const char* MODULE_NAME = "@PROJECT_NAME@"; + constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@"; +} diff --git a/src/ShapeMatchingPlugin/initShapeMatchingPlugin.cpp b/src/ShapeMatchingPlugin/initShapeMatchingPlugin.cpp index 4343458..623ccfd 100644 --- a/src/ShapeMatchingPlugin/initShapeMatchingPlugin.cpp +++ b/src/ShapeMatchingPlugin/initShapeMatchingPlugin.cpp @@ -53,12 +53,12 @@ namespace sofa::component const char* getModuleName() { - return "ShapeMatchingPlugin"; + return shapematching::MODULE_NAME; } const char* getModuleVersion() { - return "1.0"; + return shapematching::MODULE_VERSION; } const char* getModuleLicense() From 41d372bb988bb03814d3a0f30d60c77ea69ca2bb Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Wed, 23 Aug 2023 14:24:47 +0200 Subject: [PATCH 2/4] Update CI --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 842d4df..26b05a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,13 +12,13 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, macos-10.15, windows-2019] - sofa_branch: [master, v21.12] + os: [ubuntu-20.04, macos-11, windows-2019] + sofa_branch: [master] steps: - name: Setup SOFA and environment id: sofa - uses: sofa-framework/sofa-setup-action@v3.0 + uses: sofa-framework/sofa-setup-action@v4 with: sofa_root: ${{ github.workspace }}/sofa sofa_version: ${{ matrix.sofa_branch }} From 226dae1a1dd99f674bf05fa4335bd855e23ef889 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Wed, 23 Aug 2023 14:25:42 +0200 Subject: [PATCH 3/4] Don't fail --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26b05a9..6b58a4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,7 +93,7 @@ jobs: with: name: ${{ github.ref_name }} tag_name: release-${{ github.ref_name }} - fail_on_unmatched_files: true + fail_on_unmatched_files: false files: | artifacts/ShapeMatchingPlugin_*_Linux.zip artifacts/ShapeMatchingPlugin_*_Windows.zip From 64599197d3ef222a2f797621dee235c3f700cbb8 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Wed, 23 Aug 2023 14:51:49 +0200 Subject: [PATCH 4/4] floating point type --- src/ShapeMatchingPlugin/ShapeMatchingForceField.cpp | 4 ++-- src/ShapeMatchingPlugin/ShapeMatchingForceField.h | 2 +- src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.cpp | 4 ++-- src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ShapeMatchingPlugin/ShapeMatchingForceField.cpp b/src/ShapeMatchingPlugin/ShapeMatchingForceField.cpp index 57adbc2..681f3ad 100644 --- a/src/ShapeMatchingPlugin/ShapeMatchingForceField.cpp +++ b/src/ShapeMatchingPlugin/ShapeMatchingForceField.cpp @@ -31,9 +31,9 @@ namespace sofa::component::forcefield using namespace sofa::defaulttype; int ShapeMatchingForceFieldClass = core::RegisterObject("Meshless deformations based on shape matching") -.add< ShapeMatchingForceField >() +.add< ShapeMatchingForceField >() ; -template class SOFA_SHAPEMATCHINGPLUGIN_API ShapeMatchingForceField; +template class SOFA_SHAPEMATCHINGPLUGIN_API ShapeMatchingForceField; } // namespace sofa::component::forcefield diff --git a/src/ShapeMatchingPlugin/ShapeMatchingForceField.h b/src/ShapeMatchingPlugin/ShapeMatchingForceField.h index 2e1cb19..df03096 100644 --- a/src/ShapeMatchingPlugin/ShapeMatchingForceField.h +++ b/src/ShapeMatchingPlugin/ShapeMatchingForceField.h @@ -71,7 +71,7 @@ class ShapeMatchingForceField : public core::behavior::ForceField }; #if !defined(SOFA_COMPONENT_FORCEFIELD_SHAPEMATCHINGFORCEFIELD_CPP) -extern template class SOFA_SHAPEMATCHINGPLUGIN_API ShapeMatchingForceField; +extern template class SOFA_SHAPEMATCHINGPLUGIN_API ShapeMatchingForceField; #endif // !defined(SOFA_COMPONENT_FORCEFIELD_SHAPEMATCHINGFORCEFIELD_CPP) } // namespace sofa::component::forcefield diff --git a/src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.cpp b/src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.cpp index 78eb4c6..04fa8e4 100644 --- a/src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.cpp +++ b/src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.cpp @@ -39,10 +39,10 @@ using namespace sofa::defaulttype; // Register in the Factory int ShapeMatchingRotationFinderClass = core::RegisterObject("ShapeMatchingRotationFinder") -.add< ShapeMatchingRotationFinder< Vec3dTypes > >() +.add< ShapeMatchingRotationFinder< Vec3Types > >() .addAlias("RotationFinder") ; -template class SOFA_SHAPEMATCHINGPLUGIN_API ShapeMatchingRotationFinder< defaulttype::Vec3dTypes >; +template class SOFA_SHAPEMATCHINGPLUGIN_API ShapeMatchingRotationFinder< defaulttype::Vec3Types >; } // namespace sofa::component::container diff --git a/src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.h b/src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.h index 0afe259..1f994bd 100644 --- a/src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.h +++ b/src/ShapeMatchingPlugin/ShapeMatchingRotationFinder.h @@ -117,7 +117,7 @@ class ShapeMatchingRotationFinder : public sofa::core::behavior::RotationFinder< }; #if !defined(SOFA_COMPONENT_CONTAINER_SHAPEMATCHINGROTATIONFINDER_CPP) -extern template class SOFA_SHAPEMATCHINGPLUGIN_API ShapeMatchingRotationFinder< defaulttype::Vec3dTypes >; +extern template class SOFA_SHAPEMATCHINGPLUGIN_API ShapeMatchingRotationFinder< defaulttype::Vec3Types >; #endif } // namespace sofa::component::container