Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
52d0abd
Rename method of bending controller
Jan 5, 2022
8d8d0cb
Add documentation to CosseratBeamControllers
Jan 5, 2022
6222303
Add skeleton for a 'smooth' insertion controller
Jan 5, 2022
af8ab5d
Update from master branch
Jan 5, 2022
14d46cc
[Plasticity] Add distinctive plastic parameters for each beam element
Feb 2, 2022
1b03955
[Plasticity] Add example scenes for the plastic model
Feb 2, 2022
83933fe
Update from master
Feb 2, 2022
b4339af
[Plasticity] Finish removing scenes/ following master branch
Feb 2, 2022
2398284
[Plasticity] Update CosseratBeamControllers with previous modifications
Feb 2, 2022
0a30ac0
[Plasticity] Add example scene to test smooth insertion controller
Feb 2, 2022
3545f37
[Plasticity] Fix test scene for smooth insertion controller
Feb 2, 2022
ac4467c
I add a new functionality in BeamHookeLawForceField. This makes it po…
Apr 19, 2022
c8f3b1d
This commit gives the possibility to simulate nonlinear Cosserat beam…
Apr 19, 2022
18aa49c
This commit gives the possibility to simulate nonlinear Cosserat beam…
Apr 19, 2022
2b91673
Remove nonfunctional scenes
Apr 25, 2022
86574b6
Update Cosserat beam creator methods
Apr 25, 2022
326485d
Add callback for dynamic control
Apr 25, 2022
221b727
Fix minor typo
Apr 25, 2022
1cb6e52
Update and clean example scenes for plasticity
Apr 25, 2022
928d0fa
Update from master
Apr 25, 2022
5b304e0
Update from master branch
Apr 25, 2022
5063432
Remove plasticity code from master
Apr 25, 2022
c0c92e1
Clean and update example scenes for plasticity
Apr 26, 2022
1c08705
Remove old example scenes for plasticity
Apr 26, 2022
94d6dca
Remove doc on plasticity simulation
Apr 26, 2022
964c8e9
new scenes
May 23, 2022
11e261c
add new scenes for tests
May 23, 2022
ad75451
adding a new example for testing the non linear strain of the algorithm
May 25, 2022
9951923
adding a new example for testing the non linear strain of the algorithm
May 25, 2022
eede8f5
update the plugin CMakeLists
adagolodjo May 30, 2022
c822f90
update comments
Jun 16, 2022
ff925da
add new classe CosseratState
Jun 16, 2022
9b94af0
Update from master
Jun 16, 2022
2f5e108
Update from master
Jun 16, 2022
1b895d7
Update from master
Jun 17, 2022
eb0cc1d
updating the cosserat state module
adagolodjo Jun 17, 2022
63e26fa
fix tipo
Jun 24, 2022
94edb96
[All] CLEAN the plugin architecture and includes
guparan Jun 24, 2022
3b99af0
Merge pull request #38 from SofaDefrost/cosseratState
damienmarchal Jun 24, 2022
5e6951b
Remove old config.h files
guparan Jun 24, 2022
fa1039d
Revert "Cosserat state"
damienmarchal Jun 24, 2022
78c2506
Merge pull request #40 from SofaDefrost/revert-38-cosseratState
damienmarchal Jun 24, 2022
9361168
A bit more cleaning
guparan Jun 24, 2022
9af4109
Merge pull request #39 from guparan/massive_clean
adagolodjo Jun 24, 2022
2b2f890
[DevPlasticity] fix '{' typo
Jun 28, 2022
05f4778
Update from master
Jun 28, 2022
f6afa9f
Update from master
Jun 28, 2022
ebbfd64
some modification
adagolodjo Jun 29, 2022
d1d1a02
update code to compute the bounding box for the visual part
adagolodjo Jun 30, 2022
bf607dc
update code to compute the bounding box for the visual part
adagolodjo Jun 30, 2022
41b6202
Merge branch 'master' into cosseratState
adagolodjo Jun 30, 2022
5c572d4
update code to compute the bounding box for the visual part
adagolodjo Jun 30, 2022
7da8e71
Merge pull request #41 from SofaDefrost/cosseratState
adagolodjo Jun 30, 2022
9c5ea80
Update from master
Jul 4, 2022
c961282
Update from master
Jul 4, 2022
2b15394
Update from master
Jul 4, 2022
90851ff
Update from Master
Jul 4, 2022
cfcfaa6
[DevPlasticity] Update test files after master modifications
Jul 4, 2022
52d3051
Merge pull request #37 from Camille-K/dev_remove_plasticity_from_master
adagolodjo Jul 6, 2022
5665b58
clean examples
adagolodjo Jul 6, 2022
d4d4af8
Merge pull request #42 from SofaDefrost/cosseratState
adagolodjo Jul 6, 2022
f7ac6fb
clean examples
adagolodjo Jul 7, 2022
18b4814
clean examples
adagolodjo Jul 8, 2022
f44a144
clean examples
adagolodjo Jul 8, 2022
54a4f0e
Merge pull request #45 from SofaDefrost/cosseratState
adagolodjo Jul 12, 2022
0351825
cleanning
Jul 19, 2022
514a9f4
Move the initialize() function from init() to reinit() in order to be…
adagolodjo Jul 20, 2022
1651ccd
change direct solver to iterative one in PCS_Example1 scene
Jul 22, 2022
00defae
Merge branch 'cosseratState' of github.com:SofaDefrost/plugin.Cossera…
Jul 22, 2022
aa1c53b
Merge pull request #46 from SofaDefrost/cosseratState
adagolodjo Jul 22, 2022
86ad664
building new scene for needle exemple
Jul 28, 2022
ee4c411
Merge pull request #47 from SofaDefrost/cosseratState
adagolodjo Jul 28, 2022
c26aaa2
building new scene for needle exemple
Jul 29, 2022
d25c259
building new scene for needle exemple
Jul 29, 2022
35bec65
Merge pull request #48 from SofaDefrost/cosseratState
adagolodjo Jul 29, 2022
b887ad2
building new scene for needle exemple
Jul 29, 2022
9efe5e2
Merge pull request #49 from SofaDefrost/cosseratState
adagolodjo Jul 29, 2022
0db7896
update
adagolodjo Jul 31, 2022
58a160d
fix conflit
adagolodjo Sep 1, 2022
f676deb
Merge pull request #51 from SofaDefrost/cosseratState
adagolodjo Sep 1, 2022
fe071d4
update needle insertion scene
Sep 1, 2022
524d19f
Merge branch 'cosseratState' of github.com:SofaDefrost/plugin.Cossera…
Sep 1, 2022
6a81a1a
update needle insertion scene
Sep 1, 2022
30c25fb
update the needle insertion scene
adagolodjo Sep 1, 2022
8cf77b4
update the scene
adagolodjo Sep 2, 2022
8a5bdf9
Merge branch 'master' into cosseratState
adagolodjo Sep 7, 2022
84ed64b
Fix error
Sep 12, 2022
7ca0b53
[Plasticity] Make some plasticity variables inherited
Sep 12, 2022
c93abd8
Add visualisation method for beam segments
Sep 12, 2022
0a470e7
clean the code
adagolodjo Sep 15, 2022
dc20880
Update from master
Sep 30, 2022
c085b1b
[DevPlasticity] Fix errors in last commit
Oct 3, 2022
b2e154c
[DevPlasticity] Change field name to avoid amibguity
Oct 3, 2022
67016e2
"working on needle insertion"
adagolodjo Oct 14, 2022
76b6e19
Merge pull request #52 from SofaDefrost/cosseratState
adagolodjo Oct 17, 2022
f4e081a
add constraint point to needle insertion process strep1
adagolodjo Nov 3, 2022
4c34d02
add constraint point to needle insertion process strep1
adagolodjo Nov 3, 2022
492669d
add constraint point to needle insertion process strep2
adagolodjo Nov 4, 2022
6fe5a49
[CoaxialModel] Add threshold for double comparison in BaseCosserat
Nov 7, 2022
462c308
[CoaxialModel] Update beam visualisation
Nov 7, 2022
f1e5eab
add constraint point to needle insertion process strep3
adagolodjo Nov 7, 2022
92b1a41
add constraint point to needle insertion process strep4
adagolodjo Nov 8, 2022
94e0e59
Compilation without compatibility layer
alxbilger Nov 9, 2022
e2fe7ec
Fix build output
alxbilger Nov 9, 2022
dc60444
Merge pull request #54 from alxbilger/compat
damienmarchal Nov 10, 2022
c7ed187
Merge pull request #56 from alxbilger/fixbuildoutput
damienmarchal Nov 10, 2022
372a91d
Implement SofaPython3 bindings for PointsManager. Update imports acco…
ScheiklP Nov 10, 2022
fb27108
last modif for the paper
adagolodjo Nov 14, 2022
1adfc08
working in cosserat python binding
adagolodjo Nov 14, 2022
44873f2
working in cosserat python binding
adagolodjo Nov 15, 2022
8ae6529
Merge remote-tracking branch 'ScheiklP/cosseratState' into cosseratState
adagolodjo Nov 15, 2022
8beb810
clean code
adagolodjo Nov 15, 2022
7a416b4
Add binding inside cosserat
adagolodjo Nov 18, 2022
3a922cb
last step for adding point in state binding
adagolodjo Nov 21, 2022
f0f5d31
Create constraint points inside the volume
adagolodjo Nov 23, 2022
bbf271e
Update from master
Nov 24, 2022
8958806
last modif
adagolodjo Nov 29, 2022
4be2f0d
fix bug
adagolodjo Dec 6, 2022
91362fa
fix compilation issue
adagolodjo Dec 7, 2022
b55408e
fix compilation issue
adagolodjo Dec 8, 2022
e036aa7
fix compilation issue
adagolodjo Dec 8, 2022
bc28522
Replace the deprecated sofa::type::vector3 by sofa::type::vec3 (#58)
damienmarchal Dec 9, 2022
c0d413c
update code and fix bugs
adagolodjo Dec 12, 2022
d44e6f0
[DevPlasticity] Fix bug in beam index / frame computation
Dec 12, 2022
be009f3
[DevPlasticity] Update from master
Dec 12, 2022
65d1d6c
update plugin according to changes in SOFA 22.~12
adagolodjo Dec 12, 2022
3a67f39
fix the problem related the crush inside the DifferentialMultiMapping
adagolodjo Dec 13, 2022
f4814f5
Needle insertion module using cosserat model
adagolodjo Dec 14, 2022
d5424ec
last modif
adagolodjo Dec 21, 2022
57b7a3b
In needle module, compute violation using free position
adagolodjo Jan 6, 2023
6a31413
Merge pull request #59 from SofaDefrost/fixComputeViolation
adagolodjo Jan 6, 2023
7007a0e
Fix Windows compilation
alxbilger Jan 11, 2023
3d4ec94
Remove ci with Sofa v21.12 as it is no longer compatible
alxbilger Jan 11, 2023
2fb72ad
Merge pull request #60 from alxbilger/fixwindows
damienmarchal Jan 11, 2023
de9ff4d
Try to fix SofaPython3 install
alxbilger Jan 11, 2023
83a3f48
Remove softrobots references
alxbilger Jan 11, 2023
d83e70e
Add dependency
alxbilger Jan 11, 2023
9995eca
Merge pull request #61 from alxbilger/ciupdate
hugtalbot Jan 11, 2023
719ee02
Update from master
Jan 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 48 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,50 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019]
sofa_branch: [master, v21.12]
os: [ubuntu-20.04, macos-11, windows-2019]
sofa_branch: [master]
python_version: ['3.8']

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: (Mac) Workaround for homebrew
shell: bash
if: runner.os == 'macOS'
run: |
rm -f /usr/local/bin/2to3
rm -f /usr/local/bin/idle3
rm -f /usr/local/bin/pydoc3
rm -f /usr/local/bin/python3
rm -f /usr/local/bin/python3-config
rm -f /usr/local/bin/2to3-3.11
rm -f /usr/local/bin/idle3.11
rm -f /usr/local/bin/pydoc3.11
rm -f /usr/local/bin/python3.11
rm -f /usr/local/bin/python3.11-config

- name: Setup SOFA and environment
id: sofa
uses: sofa-framework/sofa-setup-action@v4
with:
sofa_root: ${{ github.workspace }}/sofa
sofa_version: ${{ matrix.sofa_branch }}
sofa_scope: 'standard'
sofa_with_sofapython3: 'false'
python_version: '${{ matrix.python_version }}'

- name: Install SofaPython3
shell: bash
run: |
SofaPython3_ROOT="$GITHUB_WORKSPACE/SofaPython3"
mkdir -p "${{ runner.temp }}/sp3_tmp/zip" "${{ runner.temp }}/sp3_tmp/binaries" "$SofaPython3_ROOT"
url="https://github.com/sofa-framework/SofaPython3/releases/download"
url="${url}/release-master-nightly/SofaPython3_master-nightly_python-${{ matrix.python_version }}_for-SOFA-${{ matrix.sofa_branch }}_${{ runner.os }}.zip"
echo "Getting SofaPython3 from $url"
curl --output "${{ runner.temp }}/sp3_tmp/SofaPython3.zip" -L $url
unzip -qq "${{ runner.temp }}/sp3_tmp/SofaPython3.zip" -d "${{ runner.temp }}/sp3_tmp/binaries"
mv "${{ runner.temp }}"/sp3_tmp/binaries/SofaPython3_*/* "$SofaPython3_ROOT"
echo "SofaPython3_ROOT=$SofaPython3_ROOT" | tee -a $GITHUB_ENV
echo "SofaPython3_DIR=$SofaPython3_ROOT/lib/cmake/SofaPython3" | tee -a $GITHUB_ENV

- name: Checkout source code
uses: actions/checkout@v2
Expand All @@ -35,27 +67,26 @@ jobs:
- name: Build and install
shell: bash
run: |
cmake_options="-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
-DCMAKE_PREFIX_PATH="$SOFA_ROOT/lib/cmake" \
-DPYTHON_ROOT=$PYTHON_ROOT -DPython_ROOT=$PYTHON_ROOT \
-DPYTHON_EXECUTABLE=$PYTHON_EXE -DPython_EXECUTABLE=$PYTHON_EXE"
if [ -e "$(command -v ccache)" ]; then
cmake_options="$cmake_options -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
fi
cmake_options="$(echo $cmake_options)" # prettify

if [[ "$RUNNER_OS" == "Windows" ]]; then
cmd //c "${{ steps.sofa.outputs.vs_vsdevcmd }} \
&& cd /d $WORKSPACE_BUILD_PATH \
&& cmake \
-GNinja \
-DCMAKE_PREFIX_PATH="$SOFA_ROOT/lib/cmake" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
../src \
&& cmake $cmake_options ../src \
&& ninja install"
else
cd "$WORKSPACE_BUILD_PATH"
ccache -z
cmake \
-GNinja \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
../src
cmake $cmake_options ../src
ninja install
echo ${CCACHE_BASEDIR}
ccache -s
Expand Down Expand Up @@ -137,4 +168,4 @@ jobs:
fail_on_unmatched_files: true
files: |
artifacts/CosseratPlugin_*_Linux.zip
artifacts/CosseratPlugin_*_Windows.zip
artifacts/CosseratPlugin_*_Windows.zip
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ Untitled*.ipynb
TAGS
python/
scenes/
.DS_Store/
.DS_Store
.vscode/
.vscode
198 changes: 89 additions & 109 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,14 @@
cmake_minimum_required(VERSION 3.12)
project(CosseratPlugin VERSION 21.12.0)

# set (COSSERAT_VERSION ${PROJECT_VERSION})
include(cmake/environment.cmake)

find_package(SofaFramework REQUIRED)
find_package(SofaUserInteraction REQUIRED)
find_package(SofaBaseMechanics REQUIRED)
find_package(SofaConstraint REQUIRED)
find_package(SofaRigid REQUIRED)
find_package(SofaMiscMapping REQUIRED)
find_package(SofaEngine REQUIRED)
find_package(SofaSparseSolver REQUIRED)

sofa_find_package(Sofa.GL QUIET)
sofa_find_package(SofaBaseTopology REQUIRED)

# option(COSSERAT_IGNORE_ERRORS "Enable this option to ignore the recommendations and generate anyway." ON)

# if(NOT COSSERAT_IGNORE_ERRORS)
# if(NOT PLUGIN_SOFAPYTHON AND NOT PLUGIN_SOFAPYTHON3)
# message(SEND_ERROR "
# You should not use the plugin Cosserat without enabling PLUGIN_SOFAPYTHON or PLUGIN_SOFAPYTHON3.
# Since all the scenes to test this plugin are using one of this two plugins.
# To fix this error you can either follow the recommendation or enable COSSERAT_IGNORE_ERRORS.")
# endif()
# endif()

# set(COSSERAT_PYTHON ${SofaPython_FOUND}) # config.h.in
find_package(Sofa.Config REQUIRED)
sofa_find_package(Sofa.Component.Constraint.Lagrangian.Model REQUIRED)
sofa_find_package(Sofa.Component.StateContainer REQUIRED)
sofa_find_package(Sofa.Component.Mapping.NonLinear REQUIRED)
sofa_find_package(Sofa.GL REQUIRED)
sofa_find_package(Sofa.Component.Topology.Container.Dynamic REQUIRED)

sofa_find_package(STLIB QUIET)
if(STLIB_FOUND)
Expand All @@ -36,117 +17,120 @@ else()
message("-- The highly recommended 'STLIB' plugin is missing. You can compile Cosserat but some of the provided python examples will not work. ")
endif()

set(HEADER_FILES
src/initCosserat.h
src/mapping/BaseCosserat.h
src/mapping/BaseCosserat.inl
src/mapping/DiscreteCosseratMapping.h
src/mapping/DiscreteCosseratMapping.inl
src/mapping/DiscreteDynamicCosseratMapping.h
src/mapping/DiscreteDynamicCosseratMapping.inl
src/mapping/ProjectionEngine.h
src/mapping/ProjectionEngine.inl
src/mapping/DifferenceMultiMapping.h
src/mapping/DifferenceMultiMapping.inl
src/mapping/RigidDistanceMapping.h
src/mapping/RigidDistanceMapping.inl
src/forcefield/BeamHookeLawForceField.h
src/forcefield/BeamHookeLawForceField.inl
src/forcefield/BeamPlasticLawForceField.h
src/forcefield/BeamPlasticLawForceField.inl
src/forcefield/CosseratInternalActuation.h
src/forcefield/CosseratInternalActuation.inl
src/constraint/CosseratSlidingConstraint.h
src/constraint/CosseratSlidingConstraint.inl
src/mapping/LegendrePolynomialsMapping.h
src/mapping/LegendrePolynomialsMapping.inl
set(SRC_ROOT_DIR src/${PROJECT_NAME})

set(HEADER_FILES
${SRC_ROOT_DIR}/config.h.in
${SRC_ROOT_DIR}/mapping/BaseCosserat.h
${SRC_ROOT_DIR}/mapping/BaseCosserat.inl
${SRC_ROOT_DIR}/mapping/DiscreteCosseratMapping.h
${SRC_ROOT_DIR}/mapping/DiscreteCosseratMapping.inl
${SRC_ROOT_DIR}/mapping/DiscreteDynamicCosseratMapping.h
${SRC_ROOT_DIR}/mapping/DiscreteDynamicCosseratMapping.inl
${SRC_ROOT_DIR}/mapping/ProjectionEngine.h
${SRC_ROOT_DIR}/mapping/ProjectionEngine.inl
${SRC_ROOT_DIR}/mapping/DifferenceMultiMapping.h
${SRC_ROOT_DIR}/mapping/DifferenceMultiMapping.inl
${SRC_ROOT_DIR}/mapping/RigidDistanceMapping.h
${SRC_ROOT_DIR}/mapping/RigidDistanceMapping.inl
${SRC_ROOT_DIR}/engine/PointsManager.h
${SRC_ROOT_DIR}/engine/PointsManager.inl
${SRC_ROOT_DIR}/forcefield/BeamHookeLawForceField.h
${SRC_ROOT_DIR}/forcefield/BeamHookeLawForceField.inl
${SRC_ROOT_DIR}/forcefield/BeamPlasticLawForceField.h
${SRC_ROOT_DIR}/forcefield/BeamPlasticLawForceField.inl
${SRC_ROOT_DIR}/forcefield/CosseratInternalActuation.h
${SRC_ROOT_DIR}/forcefield/CosseratInternalActuation.inl
${SRC_ROOT_DIR}/constraint/CosseratSlidingConstraint.h
${SRC_ROOT_DIR}/constraint/CosseratSlidingConstraint.inl
${SRC_ROOT_DIR}/mapping/LegendrePolynomialsMapping.h
${SRC_ROOT_DIR}/mapping/LegendrePolynomialsMapping.inl
${SRC_ROOT_DIR}/constraint/CosseratNeedleSlidingConstraint.h
${SRC_ROOT_DIR}/constraint/CosseratNeedleSlidingConstraint.inl
)

set(SOURCE_FILES
src/initCosserat.cpp
src/mapping/BaseCosserat.cpp
src/mapping/DiscreteCosseratMapping.cpp
src/mapping/DiscreteDynamicCosseratMapping.cpp
src/mapping/ProjectionEngine.cpp
src/mapping/DifferenceMultiMapping.cpp
src/mapping/RigidDistanceMapping.cpp
src/forcefield/BeamHookeLawForceField.cpp
src/forcefield/BeamPlasticLawForceField.cpp
src/forcefield/CosseratInternalActuation.cpp
src/constraint/CosseratSlidingConstraint.cpp
src/mapping/LegendrePolynomialsMapping.cpp
${SRC_ROOT_DIR}/initCosseratPlugin.cpp
${SRC_ROOT_DIR}/mapping/BaseCosserat.cpp
${SRC_ROOT_DIR}/mapping/DiscreteCosseratMapping.cpp
${SRC_ROOT_DIR}/mapping/DiscreteDynamicCosseratMapping.cpp
${SRC_ROOT_DIR}/mapping/ProjectionEngine.cpp
${SRC_ROOT_DIR}/mapping/DifferenceMultiMapping.cpp
${SRC_ROOT_DIR}/mapping/RigidDistanceMapping.cpp
${SRC_ROOT_DIR}/engine/PointsManager.cpp
${SRC_ROOT_DIR}/forcefield/BeamHookeLawForceField.cpp
${SRC_ROOT_DIR}/forcefield/BeamPlasticLawForceField.cpp
${SRC_ROOT_DIR}/forcefield/CosseratInternalActuation.cpp
${SRC_ROOT_DIR}/constraint/CosseratSlidingConstraint.cpp
${SRC_ROOT_DIR}/mapping/LegendrePolynomialsMapping.cpp
${SRC_ROOT_DIR}/constraint/CosseratNeedleSlidingConstraint.cpp
)


set(README_FILE "Cosserat.txt" )

find_package(SoftRobots QUIET)
sofa_find_package(SoftRobots QUIET)
if(SoftRobots_FOUND)
list(APPEND HEADER_FILES
src/constraint/CosseratActuatorConstraint.h
src/constraint/CosseratActuatorConstraint.inl
# src/constraint/CosseratUnilateralInteractionConstraint.h
# src/constraint/CosseratUnilateralInteractionConstraint.inl

src/constraint/CosseratNeedleSlidingConstraint.h
src/constraint/CosseratNeedleSlidingConstraint.inl
src/constraint/QPSlidingConstraint.h
src/constraint/QPSlidingConstraint.inl
${SRC_ROOT_DIR}/constraint/CosseratActuatorConstraint.h
${SRC_ROOT_DIR}/constraint/CosseratActuatorConstraint.inl
# ${SRC_ROOT_DIR}/constraint/CosseratUnilateralInteractionConstraint.h
# ${SRC_ROOT_DIR}/constraint/CosseratUnilateralInteractionConstraint.inl


${SRC_ROOT_DIR}/constraint/QPSlidingConstraint.h
${SRC_ROOT_DIR}/constraint/QPSlidingConstraint.inl
)
list(APPEND SOURCE_FILES
src/constraint/CosseratActuatorConstraint.cpp
src/constraint/CosseratNeedleSlidingConstraint.cpp
# src/constraint/CosseratUnilateralInteractionConstraint.cpp
src/constraint/QPSlidingConstraint.cpp
${SRC_ROOT_DIR}/constraint/CosseratActuatorConstraint.cpp

#${SRC_ROOT_DIR}/constraint/CosseratUnilateralInteractionConstraint.cpp
${SRC_ROOT_DIR}/constraint/QPSlidingConstraint.cpp
)
endif()

file(GLOB_RECURSE RESOURCE_FILES "*.md" "*.psl" "*.py" "*.pyscn" "*.py3scn" "*.scn" "*.ah")

IF(WIN32)
add_definitions(-D_WINSOCKAPI_)
ENDIF(WIN32)
if(WIN32)
add_definitions(-D_WINSOCKAPI_)
endif()

add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${DOC_FILES} ${RESOURCE_FILES} )

target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>")
target_include_directories(${PROJECT_NAME} PUBLIC "$<INSTALL_INTERFACE:include>")

set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DSOFA_BUILD_COSSERAT")
set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "_d")
target_link_libraries(${PROJECT_NAME} Sofa.Helper SofaCore SofaConstraint SofaBaseMechanics SofaUserInteraction SofaRigid SofaMiscMapping SofaSparseSolver SofaEngine)
target_link_libraries(${PROJECT_NAME}
Sofa.Component.Constraint.Lagrangian.Model
Sofa.Component.StateContainer
Sofa.Component.Mapping.NonLinear
Sofa.GL
Sofa.Component.Topology.Container.Dynamic
)

if(Sofa.GL_FOUND)
target_link_libraries(${PROJECT_NAME} Sofa.GL)
endif()

if(SoftRobots_FOUND)
target_link_libraries(${PROJECT_NAME} SoftRobots)
message("-- Found dependency : 'SoftRobots' plugin .")
message("-- Found dependency: 'SoftRobots' plugin.")
endif()

sofa_install_pythonscripts(PLUGIN_NAME ${PROJECT_NAME} PYTHONSCRIPTS_SOURCE_DIR "python")
find_file(SofaPython3Tools NAMES "SofaPython3/lib/cmake/SofaPython3/SofaPython3Tools.cmake")

find_file(SofaPython3Tools NAMES "SofaPython3/lib/cmake/SofaPython3/SofaPython3Tools.cmake")
if(SofaPython3Tools)
message("-- Found SofaPython3Tools. Python3 packages will be installed.")
message("-- Found SofaPython3Tools.")
include(${SofaPython3Tools})
set(SP3_PYTHON_PACKAGES_DIRECTORY "python3/site-packages")
else()
# try again with the find_package mechanism
find_package(SofaPython3 QUIET)
endif()

if(SofaPython3Tools OR SofaPython3_FOUND)
SP3_add_python_package(
SOURCE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python3/cosserat
TARGET_DIRECTORY cosserat
)
message("-- Found SofaPython3_FOUND. Python3 packages will be installed.")
message("-- Python3 packages will be installed.")
set(SP3_PYTHON_PACKAGES_DIRECTORY "python3/site-packages")
# SP3_add_python_package(
# SOURCE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python3/cosserat
# TARGET_DIRECTORY cosserat
# )
add_subdirectory(${SRC_ROOT_DIR}/Binding)
endif()

#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/CosseratPlugin/Binding)

## Install rules for the library and headers; CMake package configurations files
sofa_create_package_with_targets(
PACKAGE_NAME ${PROJECT_NAME}
Expand All @@ -157,15 +141,11 @@ sofa_create_package_with_targets(
RELOCATABLE "plugins"
)

# find_package(GTest CONFIG QUIET)
# if (NOT GTest_FOUND)
# # This find_package needs to be executed at MOST once, else it will fails on the second call
# find_package(GMock QUIET)
# endif ()

option(COSSERAT_BUILD_TESTS "Build unit tests" OFF )
if(COSSERAT_BUILD_TESTS)
add_subdirectory(Tests)
# Tests
# If SOFA_BUILD_TESTS exists and is OFF, then these tests will be auto-disabled
cmake_dependent_option(COSSERATPLUGIN_BUILD_TESTS "Compile the tests" OFF "SOFA_BUILD_TESTS OR NOT DEFINED SOFA_BUILD_TESTS" OFF)
if(COSSERATPLUGIN_BUILD_TESTS)
add_subdirectory(tests)
endif()

include(cmake/packaging.cmake)
22 changes: 19 additions & 3 deletions CosseratPluginConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
# CMake package configuration file for the CosseratPlugin plugin
# CMake package configuration file for the plugin @PROJECT_NAME@

@PACKAGE_GUARD@
@PACKAGE_INIT@

find_package(SofaFramework REQUIRED)
set(COSSERATPLUGIN_HAVE_SOFA_GL @COSSERATPLUGIN_HAVE_SOFA_GL@)
set(COSSERATPLUGIN_HAVE_SOFTROBOTS @COSSERATPLUGIN_HAVE_SOFTROBOTS@)

check_required_components(CosseratPlugin)
find_package(Sofa.Component.Constraint.Lagrangian.Model QUIET REQUIRED)
find_package(Sofa.Component.StateContainer QUIET REQUIRED)
find_package(Sofa.Component.Mapping.NonLinear QUIET REQUIRED)
find_package(Sofa.GL QUIET REQUIRED)
find_package(Sofa.Component.Topology.Container.Dynamic QUIET REQUIRED)

if(COSSERATPLUGIN_HAVE_SOFTROBOTS)
find_package(SoftRobots QUIET REQUIRED)
endif()

if(NOT TARGET @PROJECT_NAME@)
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
endif()

check_required_components(@PROJECT_NAME@)
Loading