From 3516c63ead5298b82d48327b648d4f68c9f43655 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 20 Jan 2025 17:12:48 +0100 Subject: [PATCH 1/3] Use mechanism introduced in https://github.com/sofa-framework/sofa/pull/5230 to install examples files by hand and not install debug files --- CMakeLists.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7faebd9..c8e0849 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,6 +122,23 @@ if(SofaPython3Tools OR SofaPython3_FOUND) ) endif() +#Install examples without copying debug files +FILE(GLOB_RECURSE all_ressources ${CMAKE_CURRENT_SOURCE_DIR}/examples/*) +FOREACH(file_path ${all_ressources}) + if( 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 +159,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 From a1b4189b4ca9e0f1d6bc2d6e8982c8896421453c Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Fri, 31 Jan 2025 14:59:23 +0100 Subject: [PATCH 2/3] Squashed commit of the following: commit f42f8350804b5a4dff660334a86b68e619f041df Merge: 8b4514f 32ab0f4 Author: Hugo Date: Wed Jan 22 10:06:13 2025 +0100 Merge pull request #150 from alxbilger/test Fix tests compilation with respect to SOFA commit 8b4514fd779a2ab5f480d2e8c06aa2344071fc95 Merge: b482378 09d07e3 Author: Olivier Roussel Date: Mon Jan 20 17:08:57 2025 +0100 Merge pull request #151 from olivier-roussel/remove-python2 Remove deprecated python2.7 support commit 09d07e3936eafbc2d457bcb86258b06d686d4004 Author: Olivier Roussel Date: Mon Jan 20 15:34:00 2025 +0100 Remove deprecated python2.7 support commit 32ab0f4e7bddcdaa6832a3bd5491491686579315 Author: Alex Bilger Date: Thu Jan 16 09:34:18 2025 +0100 Fix tests compilation with respect to SOFA --- CMakeLists.txt | 2 -- ModelOrderReduction_test/ModelOrderReduction_test.cpp | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8e0849..0083f8f 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.") diff --git a/ModelOrderReduction_test/ModelOrderReduction_test.cpp b/ModelOrderReduction_test/ModelOrderReduction_test.cpp index c6a4a2c..8fa1d03 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) { From 4bb066bfebfbc47cde1cc92f211bb80e7dc5a347 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Fri, 31 Jan 2025 15:09:26 +0100 Subject: [PATCH 3/3] Update installation regarding discussions --- CMakeLists.txt | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0083f8f..aa6a6e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,10 +120,27 @@ if(SofaPython3Tools OR SofaPython3_FOUND) ) endif() -#Install examples without copying debug files +############################## +#### 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( NOT file_path MATCHES ".*/debug/.*" ) + 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) @@ -136,6 +153,8 @@ FOREACH(file_path ${all_ressources}) COMPONENT resources) endif() ENDFOREACH () +############################## + # Move all resources when install: examples, doc and python files install(FILES "README.md" "LICENSE" DESTINATION .)