diff --git a/CMakeLists.txt b/CMakeLists.txt index 7faebd91..aa6a6e51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,8 +97,6 @@ if (CollisionOBBCapsule_FOUND) endif() # Config files and install rules for pythons scripts -sofa_install_pythonscripts(PLUGIN_NAME ${PROJECT_NAME} PYTHONSCRIPTS_SOURCE_DIR "python") - find_file(SofaPython3Tools NAMES "SofaPython3/lib/cmake/SofaPython3/SofaPython3Tools.cmake") if(SofaPython3Tools) message("-- Found SofaPython3Tools.") @@ -122,6 +120,42 @@ if(SofaPython3Tools OR SofaPython3_FOUND) ) endif() +############################## +#### EXAMPLE INSTALLATION #### +############################## +# Install examples without copying debug files by default except those listed in example_debug_folder_to_install + +set(example_debug_folder_to_install "others/caduceus" "others/hexaBeam" "softRobots/finger" "softRobots/sofiaLeg") + +set(regex_example_debug_folder_to_install "") +FOREACH(folder ${example_debug_folder_to_install}) + if(NOT "${regex_example_debug_folder_to_install}" STREQUAL "") + string(APPEND regex_example_debug_folder_to_install "|") + endif () + string(APPEND regex_example_debug_folder_to_install ".*/${folder}/reduced/debug/.*") +ENDFOREACH () + +FILE(GLOB_RECURSE all_ressources ${CMAKE_CURRENT_SOURCE_DIR}/examples/*) +FOREACH(file_path ${all_ressources}) + if( file_path MATCHES "${regex_example_debug_folder_to_install}" OR NOT file_path MATCHES ".*/debug/.*" ) + message(${file_path}) + endif () + if( file_path MATCHES "${regex_example_debug_folder_to_install}" OR NOT file_path MATCHES ".*/debug/.*" ) + string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/examples/" "" install_file_path "${file_path}") + if( install_file_path MATCHES ".*/.*" ) + string(FIND "${install_file_path}" "/" last_slash_idx REVERSE) + string(SUBSTRING "${install_file_path}" 0 ${last_slash_idx} install_file_path) + else() + set(install_file_path "") + endif() + install(FILES "${file_path}" + DESTINATION "share/sofa/examples/ModelOrderReduction/${install_file_path}" + COMPONENT resources) + endif() +ENDFOREACH () +############################## + + # Move all resources when install: examples, doc and python files install(FILES "README.md" "LICENSE" DESTINATION .) if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doc") @@ -142,6 +176,7 @@ sofa_create_package_with_targets( INCLUDE_SOURCE_DIR "src" INCLUDE_INSTALL_DIR "ModelOrderReduction" RELOCATABLE "plugins" + NO_AUTO_RESOURCES_INSTALL ) # If SOFA_BUILD_TESTS exists and is OFF, then these tests will be auto-disabled diff --git a/ModelOrderReduction_test/ModelOrderReduction_test.cpp b/ModelOrderReduction_test/ModelOrderReduction_test.cpp index c6a4a2cd..8fa1d03a 100644 --- a/ModelOrderReduction_test/ModelOrderReduction_test.cpp +++ b/ModelOrderReduction_test/ModelOrderReduction_test.cpp @@ -24,7 +24,7 @@ namespace sofa { simulation::Simulation* simulation; /// Create the context for the scene - void SetUp() + void doSetUp() override { root = simulation::getSimulation()->createNewGraph("root"); } @@ -37,7 +37,7 @@ namespace sofa { } /// Unload the scene - void TearDown() + void doTearDown() override { if (root != nullptr) {