Skip to content

Commit

Permalink
v20.12 changes (#72)
Browse files Browse the repository at this point in the history
* Set SofaPython3 environment

* Set SofaPython3 environment (2)

* Remove SofaPythonX hard dependency

* FIX SoftRobotsConfig.cmake.in
  • Loading branch information
guparan authored Mar 31, 2021
1 parent b473b6c commit 4764389
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 29 deletions.
20 changes: 9 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ find_package(SofaFramework REQUIRED)
find_package(SofaCommon REQUIRED) # SofaRigid
find_package(SofaMisc REQUIRED) # SofaMiscMapping
find_package(SofaSparseSolver REQUIRED)
find_package(SofaConstraint REQUIRED)

option(SOFTROBOTS_IGNORE_ERRORS "Enable this option to ignore the recommendations and generate anyway." OFF)
if(NOT SOFTROBOTS_IGNORE_ERRORS)
Expand Down Expand Up @@ -35,17 +36,16 @@ option(SOFTROBOTS_GAMETRAKCONTROLLER "Enables GameTrak component. It requires HI
option(SOFTROBOTS_ROBOTINOCONTROLLER "Enables Robotino component" OFF)
option(SOFTROBOTS_WITH_CAMERA "Enable this option if you want to use the realsense cameras to perform force sensing, and point cloud processing." OFF)

find_package(SofaPython QUIET)
set(SOFTROBOTS_PYTHON ${SofaPython_FOUND}) # config.h.in
find_package(SofaPython3 QUIET)
sofa_find_package(SofaPython QUIET)
sofa_find_package(SofaPython3 QUIET)

find_package(Qt5 REQUIRED COMPONENTS Network)
if(WIN32)
sofa_copy_libraries(TARGETS Qt5::Network)
endif()
sofa_install_libraries(TARGETS Qt5::Network)

find_package(STLIB QUIET)
sofa_find_package(STLIB QUIET)
if(STLIB_FOUND)
message("-- Found dependency : 'STLIB' plugin .")
else()
Expand Down Expand Up @@ -269,15 +269,13 @@ set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "_d")
target_link_libraries(${PROJECT_NAME} SofaCore SofaConstraint SofaBaseMechanics SofaUserInteraction SofaRigid SofaMiscMapping SofaSparseSolver SofaEngine)
target_link_libraries(${PROJECT_NAME} Qt5::Network)

if(SofaPython_FOUND)
target_link_libraries(${PROJECT_NAME} SofaPython)
# Config files and install rules for pythons scripts
sofa_install_pythonscripts(PLUGIN_NAME ${PROJECT_NAME} PYTHONSCRIPTS_SOURCE_DIR "python")
endif()

sofa_install_pythonscripts(PLUGIN_NAME ${PROJECT_NAME} PYTHONSCRIPTS_SOURCE_DIR "python")
if(SofaPython3_FOUND)
# Config files and install rules for pythons scripts
sofa_install_pythonscripts(PLUGIN_NAME ${PROJECT_NAME} PYTHONSCRIPTS_SOURCE_DIR "python3")
SP3_add_python_package(
SOURCE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python3/softrobots
TARGET_DIRECTORY softrobots
)
endif()

## Install rules for the library and headers; CMake package configurations files
Expand Down
18 changes: 10 additions & 8 deletions SoftRobotsConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

@PACKAGE_INIT@

find_package(SofaFramework REQUIRED)
if(@SofaPython_FOUND@)
find_package(SofaPython)
endif()
if(@STLIB_FOUND@)
find_package(STLIB)
endif()
set(SOFTROBOTS_HAVE_SOFAPYTHON @SOFTROBOTS_HAVE_SOFAPYTHON@)
set(SOFTROBOTS_HAVE_SOFAPYTHON3 @SOFTROBOTS_HAVE_SOFAPYTHON3@)
set(SOFTROBOTS_HAVE_STLIB @SOFTROBOTS_HAVE_STLIB@)

find_package(SofaFramework QUIET REQUIRED)
find_package(SofaCommon QUIET REQUIRED)
find_package(SofaMisc QUIET REQUIRED)
find_package(SofaSparseSolver QUIET REQUIRED)
find_package(SofaConstraint QUIET REQUIRED)

find_package(Qt5 QUIET REQUIRED COMPONENTS Network)
include_directories("${Qt5Network_INCLUDE_DIRS}")

if(NOT TARGET @PROJECT_NAME@)
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
Expand Down
8 changes: 0 additions & 8 deletions src/SoftRobots/component/initSoftRobots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@
#include <sofa/helper/system/PluginManager.h>
using sofa::helper::system::PluginManager;

#ifdef SOFTROBOTS_PYTHON
#include <SofaPython/PythonEnvironment.h>
using sofa::simulation::PythonEnvironment;
#endif

#include <fstream>

namespace sofa
Expand Down Expand Up @@ -69,9 +64,6 @@ void initExternalModule()
PluginManager::getInstance().loadPlugin("STLIB") ;
}

#ifdef SOFTROBOTS_PYTHON
PythonEnvironment::addPythonModulePathsForPluginsByName("SoftRobots");
#endif
//SparseCholeskySolver< CompressedRowSparseMatrix<double>,FullVector<double> > test;
}

Expand Down
5 changes: 3 additions & 2 deletions src/SoftRobots/component/initSoftRobots.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define INITSOFTROBOTS_H


#include <sofa/helper/config.h>
#include <sofa/config.h>

#ifdef SOFA_BUILD_SOFTROBOTS
#define SOFA_TARGET SoftRobots
Expand All @@ -40,7 +40,8 @@
#define SOFA_SOFTROBOTS_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

#cmakedefine SOFTROBOTS_PYTHON
#cmakedefine01 SOFTROBOTS_HAVE_SOFAPYTHON
#cmakedefine01 SOFTROBOTS_HAVE_SOFAPYTHON3


/** \mainpage
Expand Down

0 comments on commit 4764389

Please sign in to comment.