diff --git a/CMakeLists.txt b/CMakeLists.txt index 8eb26b9d..9cb0371f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -35,9 +36,8 @@ 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) @@ -45,7 +45,7 @@ if(WIN32) 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() @@ -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 diff --git a/SoftRobotsConfig.cmake.in b/SoftRobotsConfig.cmake.in index fd16ba66..71ad2ecc 100644 --- a/SoftRobotsConfig.cmake.in +++ b/SoftRobotsConfig.cmake.in @@ -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}/@PROJECT_NAME@Targets.cmake") diff --git a/src/SoftRobots/component/initSoftRobots.cpp b/src/SoftRobots/component/initSoftRobots.cpp index f8058eda..921c6393 100644 --- a/src/SoftRobots/component/initSoftRobots.cpp +++ b/src/SoftRobots/component/initSoftRobots.cpp @@ -33,11 +33,6 @@ #include using sofa::helper::system::PluginManager; -#ifdef SOFTROBOTS_PYTHON -#include -using sofa::simulation::PythonEnvironment; -#endif - #include namespace sofa @@ -69,9 +64,6 @@ void initExternalModule() PluginManager::getInstance().loadPlugin("STLIB") ; } -#ifdef SOFTROBOTS_PYTHON - PythonEnvironment::addPythonModulePathsForPluginsByName("SoftRobots"); -#endif //SparseCholeskySolver< CompressedRowSparseMatrix,FullVector > test; } diff --git a/src/SoftRobots/component/initSoftRobots.h.in b/src/SoftRobots/component/initSoftRobots.h.in index 6c3d7564..16db4add 100644 --- a/src/SoftRobots/component/initSoftRobots.h.in +++ b/src/SoftRobots/component/initSoftRobots.h.in @@ -31,7 +31,7 @@ #define INITSOFTROBOTS_H -#include +#include #ifdef SOFA_BUILD_SOFTROBOTS #define SOFA_TARGET SoftRobots @@ -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