Skip to content

Commit 4d7d949

Browse files
committed
Merge remote-tracking branch 'sofa-framework/master' into v20.12-guparan
# Conflicts: # Plugin/CMakeLists.txt # Plugin/PluginConfig.cmake.in # Plugin/src/SofaPython3/Prefab.cpp # SofaPython3Config.cmake.in # bindings/CMakeLists.txt # bindings/Sofa/tests/Core/PythonRestShapeForceField.py # examples/example-forcefield.py
2 parents 110c062 + cce9754 commit 4d7d949

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1073
-242
lines changed

.github/workflows/macos.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Download SOFA nightly build
3131
run: |
3232
curl --output sofa.zip -L \
33-
https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries-v20.12/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/MacOS/*zip*/MacOS.zip
33+
https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/MacOS/*zip*/MacOS.zip
3434
3535
- name: Install SOFA nightly build
3636
run: |
@@ -108,7 +108,7 @@ jobs:
108108
- name: Download SOFA nightly build
109109
run: |
110110
curl --output sofa.zip -L \
111-
https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries-v20.12/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/MacOS/*zip*/MacOS.zip
111+
https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/MacOS/*zip*/MacOS.zip
112112
113113
- name: Install SOFA nightly build
114114
run: |

.github/workflows/ubuntu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- name: Download SOFA nightly build
4646
run: |
4747
curl --output sofa.zip -L \
48-
https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries-v20.12/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/Linux/*zip*/Linux.zip
48+
https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/Linux/*zip*/Linux.zip
4949
5050
- name: Install SOFA nightly build
5151
run: |
@@ -123,7 +123,7 @@ jobs:
123123
- name: Download SOFA nightly build
124124
run: |
125125
curl --output sofa.zip -L \
126-
https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries-v20.12/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/Linux/*zip*/Linux.zip
126+
https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/Linux/*zip*/Linux.zip
127127
128128
- name: Install SOFA nightly build
129129
run: |

Plugin/CMakeLists.txt

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,24 @@ set(SOURCE_FILES
2424
)
2525

2626
if(SP3_BUILD_TEST)
27-
list(APPEND HEADER_FILES
28-
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaPython3/PythonTest.h
29-
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaPython3/PythonTestExtractor.h
30-
)
31-
list(APPEND SOURCE_FILES
32-
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaPython3/PythonTest.cpp
33-
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaPython3/PythonTestExtractor.cpp
34-
)
27+
find_package(Sofa.Testing REQUIRED)
28+
if(Sofa.Testing_FOUND)
29+
list(APPEND HEADER_FILES
30+
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaPython3/PythonTest.h
31+
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaPython3/PythonTestExtractor.h
32+
)
33+
list(APPEND SOURCE_FILES
34+
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaPython3/PythonTest.cpp
35+
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaPython3/PythonTestExtractor.cpp
36+
)
37+
else()
38+
message(WARNING "Sofa.Testing has not been found, SofaPython3 tests cannot be built.")
39+
endif(Sofa.Testing_FOUND)
3540
endif(SP3_BUILD_TEST)
3641

3742
find_package(pybind11 CONFIG REQUIRED)
3843
find_package(SofaFramework REQUIRED)
39-
find_package(SofaSimulation REQUIRED)
44+
find_package(SofaSimulationGraph REQUIRED)
4045

4146
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES})
4247
add_library(SofaPython3::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
@@ -46,6 +51,10 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE "-DSOFA_BUILD_SOFAPYTHON3")
4651
target_link_libraries(${PROJECT_NAME} PUBLIC SofaCore SofaDefaultType SofaSimulationCore SofaSimulationGraph SofaHelper)
4752
target_link_libraries(${PROJECT_NAME} PUBLIC pybind11::module pybind11::embed)
4853

54+
if(SP3_BUILD_TEST AND Sofa.Testing_FOUND)
55+
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Testing)
56+
endif()
57+
4958
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME SofaPython3)
5059

5160
if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")

Plugin/PluginConfig.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
find_package(pybind11 CONFIG REQUIRED)
66
find_package(SofaFramework REQUIRED)
7-
find_package(SofaSimulation REQUIRED)
7+
find_package(SofaSimulationGraph REQUIRED)
88

99
# If we are importing this config file and the target is not yet there this is indicating that
1010
# target is an imported one. So we include it

Plugin/src/SofaPython3/Prefab.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ using sofa::core::objectmodel::Event;
4343

4444
void Prefab::init()
4545
{
46-
Inherit1::init(sofa::core::ExecParams::defaultInstance());
46+
Inherit1::init(sofa::core::execparams::defaultInstance());
4747
m_is_initialized = true;
4848
reinit();
4949
}
@@ -64,13 +64,13 @@ void Prefab::reinit()
6464
clearLoggedMessages();
6565

6666
/// remove everything in the node.
67-
execute<sofa::simulation::DeleteVisitor>(sofa::core::ExecParams::defaultInstance());
67+
execute<sofa::simulation::DeleteVisitor>(sofa::core::execparams::defaultInstance());
6868

6969
doReInit();
7070

7171
/// Beurk beurk beurk
7272
sofa::simulation::getSimulation()->initNode(this);
73-
execute<VisualInitVisitor>(nullptr);
73+
execute<VisualInitVisitor>(sofa::core::execparams::defaultInstance());
7474
}
7575

7676
void Prefab::doReInit()

Plugin/src/SofaPython3/PythonEnvironment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
#include <vector>
2424
#include <string>
25-
25+
#include <sofa/helper/logging/FileInfo.h>
2626

2727
/// Fixes compile errors:
2828
/// removing all slots macros is necessary if embedded in a Qt project

Plugin/src/SofaPython3/PythonFactory.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ using sofa::core::objectmodel::MouseEvent;
5151
using sofa::core::objectmodel::ScriptEvent;
5252
using sofa::core::objectmodel::Event;
5353

54+
#include <sofa/core/topology/Topology.h>
55+
5456
#include <sofa/defaulttype/DataTypeInfo.h>
5557

5658
/// Bind the python's attribute error

Plugin/src/SofaPython3/PythonTestExtractor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <SofaPython3/PythonTestExtractor.h>
2222
#include <SofaPython3/PythonEnvironment.h>
2323

24+
#include <sofa/helper/logging/Messaging.h>
2425
#include <sofa/helper/system/FileSystem.h>
2526
#include <sofa/helper/StringUtils.h>
2627
#include <sofa/helper/system/SetDirectory.h>

Plugin/src/SofaPython3/SceneLoaderPY3.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <SofaSimulationGraph/DAGNode.h>
2525
using sofa::simulation::graph::DAGNode;
2626

27-
#include <sofa/helper/ArgumentParser.h>
2827
#include <SofaPython3/PythonEnvironment.h>
2928
#include <SofaPython3/SceneLoaderPY3.h>
3029
#include <SofaPython3/PythonFactory.h>
@@ -33,9 +32,11 @@ using sofa::simulation::graph::DAGNode;
3332
#include <pybind11/embed.h>
3433
namespace py = pybind11;
3534

36-
using namespace sofa::core::objectmodel;
35+
#include <sofa/helper/system/SetDirectory.h>
3736
using sofa::helper::system::SetDirectory;
3837

38+
using namespace sofa::core::objectmodel;
39+
3940
MSG_REGISTER_CLASS(sofapython3::SceneLoaderPY3, "SofaPython3::SceneLoader")
4041

4142
PYBIND11_DECLARE_HOLDER_TYPE(Base, sofa::core::sptr<Base>, true)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ NB: This plugin cannot be build through in-build process when the old SofaPython
2020

2121
### Out-of-tree build
2222
This plugin should compile with out-of-tree builds.
23-
You might need to add the Sofa's installation path to the CMake prefix path. If you compiled Sofa in directory _$SOFA_ROOT/build_, consider doing an install step (make install, ninja install, etc.) and adding this installation path (example `cmake -DCMAKE_PREFIX_PATH=$SOFA_ROOT/build/install ..`).
23+
You might need to add the Sofa's installation path to the CMake prefix path. If you compiled Sofa in directory _$SOFA_ROOT/build_, consider doing an install step (make install, ninja install, etc.) and adding this installation path (example `cmake -DCMAKE_PREFIX_PATH=$SOFA_ROOT/build/install/lib/cmake ..`).
2424

2525
### Changing the python path
2626
The compilation of SofaPython3 plugin and bindings are tied to the python core library found during the CMake stage.

0 commit comments

Comments
 (0)