From 4d29b50b73dcfc16440462ec13b328394294d986 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Fri, 14 Mar 2025 16:24:12 +0100 Subject: [PATCH 1/6] Fetch in build dir instead of source to avoid lots of cmake errors --- .../Config/cmake/SofaMacrosConfigure.cmake | 93 ++++++++++--------- .../ExternalProjectConfig.cmake.in | 14 --- .../plugins/BeamAdapter/GitConfig.cmake | 4 + .../CGALPlugin/ExternalProjectConfig.cmake.in | 14 --- .../plugins/CGALPlugin/GitConfig.cmake | 4 + .../ExternalProjectConfig.cmake.in | 14 --- .../plugins/CSparseSolvers/GitConfig.cmake | 4 + .../ExternalProjectConfig.cmake.in | 14 --- .../CollisionAlgorithm/GitConfig.cmake | 4 + .../ExternalProjectConfig.cmake.in | 14 --- .../ConstraintGeometry/GitConfig.cmake | 4 + .../Cosserat/ExternalProjectConfig.cmake.in | 14 --- applications/plugins/Cosserat/GitConfig.cmake | 4 + .../ExternalProjectConfig.cmake.in | 14 --- .../ManifoldTopologies/GitConfig.cmake | 4 + .../ExternalProjectConfig.cmake.in | 14 --- .../plugins/MeshSTEPLoader/GitConfig.cmake | 4 + .../ExternalProjectConfig.cmake.in | 14 --- .../ModelOrderReduction/GitConfig.cmake | 4 + .../PSL/ExternalProjectConfig.cmake.in | 14 --- applications/plugins/PSL/GitConfig.cmake | 4 + .../ExternalProjectConfig.cmake.in | 14 --- .../plugins/PluginExample/GitConfig.cmake | 4 + ...alPluginExample.md => GitconfigExample.md} | 6 +- .../ExternalProjectConfig.cmake.in | 14 --- .../plugins/Registration/GitConfig.cmake | 4 + .../STLIB/ExternalProjectConfig.cmake.in | 14 --- applications/plugins/STLIB/GitConfig.cmake | 4 + .../ExternalProjectConfig.cmake.in | 14 --- .../ShapeMatchingPlugin/GitConfig.cmake | 4 + .../Sofa.Metis/ExternalProjectConfig.cmake.in | 14 --- .../plugins/Sofa.Metis/GitConfig.cmake | 4 + .../ExternalProjectConfig.cmake.in | 14 --- .../plugins/SofaHighOrder/GitConfig.cmake | 4 + .../ExternalProjectConfig.cmake.in | 14 --- .../plugins/SofaPython3/GitConfig.cmake | 6 ++ .../ExternalProjectConfig.cmake.in | 14 --- .../plugins/SofaSphFluid/GitConfig.cmake | 4 + .../ExternalProjectConfig.cmake.in | 14 --- .../plugins/SofaValidation/GitConfig.cmake | 4 + .../SoftRobots/ExternalProjectConfig.cmake.in | 14 --- .../plugins/SoftRobots/GitConfig.cmake | 4 + .../Regression/ExternalProjectConfig.cmake.in | 15 --- .../projects/Regression/GitConfig.cmake | 4 + .../Sofa.Qt/ExternalProjectConfig.cmake.in | 15 --- applications/projects/Sofa.Qt/GitConfig.cmake | 4 + .../SofaGLFW/ExternalProjectConfig.cmake.in | 14 --- .../projects/SofaGLFW/GitConfig.cmake | 6 ++ 48 files changed, 148 insertions(+), 371 deletions(-) delete mode 100644 applications/plugins/BeamAdapter/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/BeamAdapter/GitConfig.cmake delete mode 100644 applications/plugins/CGALPlugin/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/CGALPlugin/GitConfig.cmake delete mode 100644 applications/plugins/CSparseSolvers/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/CSparseSolvers/GitConfig.cmake delete mode 100644 applications/plugins/CollisionAlgorithm/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/CollisionAlgorithm/GitConfig.cmake delete mode 100644 applications/plugins/ConstraintGeometry/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/ConstraintGeometry/GitConfig.cmake delete mode 100644 applications/plugins/Cosserat/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/Cosserat/GitConfig.cmake delete mode 100644 applications/plugins/ManifoldTopologies/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/ManifoldTopologies/GitConfig.cmake delete mode 100644 applications/plugins/MeshSTEPLoader/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/MeshSTEPLoader/GitConfig.cmake delete mode 100644 applications/plugins/ModelOrderReduction/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/ModelOrderReduction/GitConfig.cmake delete mode 100644 applications/plugins/PSL/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/PSL/GitConfig.cmake delete mode 100644 applications/plugins/PluginExample/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/PluginExample/GitConfig.cmake rename applications/plugins/PluginExample/{ExternalPluginExample.md => GitconfigExample.md} (71%) delete mode 100644 applications/plugins/Registration/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/Registration/GitConfig.cmake delete mode 100644 applications/plugins/STLIB/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/STLIB/GitConfig.cmake delete mode 100644 applications/plugins/ShapeMatchingPlugin/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/ShapeMatchingPlugin/GitConfig.cmake delete mode 100644 applications/plugins/Sofa.Metis/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/Sofa.Metis/GitConfig.cmake delete mode 100644 applications/plugins/SofaHighOrder/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/SofaHighOrder/GitConfig.cmake delete mode 100644 applications/plugins/SofaPython3/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/SofaPython3/GitConfig.cmake delete mode 100644 applications/plugins/SofaSphFluid/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/SofaSphFluid/GitConfig.cmake delete mode 100644 applications/plugins/SofaValidation/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/SofaValidation/GitConfig.cmake delete mode 100644 applications/plugins/SoftRobots/ExternalProjectConfig.cmake.in create mode 100644 applications/plugins/SoftRobots/GitConfig.cmake delete mode 100644 applications/projects/Regression/ExternalProjectConfig.cmake.in create mode 100644 applications/projects/Regression/GitConfig.cmake delete mode 100644 applications/projects/Sofa.Qt/ExternalProjectConfig.cmake.in create mode 100644 applications/projects/Sofa.Qt/GitConfig.cmake delete mode 100644 applications/projects/SofaGLFW/ExternalProjectConfig.cmake.in create mode 100644 applications/projects/SofaGLFW/GitConfig.cmake diff --git a/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake b/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake index 72d70597eb5..2f024d264f2 100644 --- a/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake +++ b/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake @@ -97,7 +97,8 @@ macro(sofa_add_generic directory name type) set(multiValueArgs) cmake_parse_arguments("ARG" "${optionArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${directory}" AND IS_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/${directory}") + if( EXISTS "${CMAKE_CURRENT_LIST_DIR}/${directory}" AND IS_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/${directory}" + OR EXISTS "${directory}" AND IS_DIRECTORY "${directory}") string(TOUPPER ${type}_${name} option) string(REPLACE "." "_" option ${option}) string(TOLOWER ${type} type_lower) @@ -168,10 +169,20 @@ macro(sofa_add_generic directory name type) endif() endif() else() - message("The ${type_lower} ${name} (${CMAKE_CURRENT_LIST_DIR}/${directory}) does not exist and will be ignored.") + message("ERROR while adding ${type_lower} ${name}: neither ${CMAKE_CURRENT_LIST_DIR}/${directory} nor ${directory} exist. It will thus be ignored.") endif() endmacro() +### Macro to help external projects management +# It produces the correct naming for cmake flag generation and the actual name of the project +macro(get_name_from_source_dir) + get_filename_component(ProjectId ${CMAKE_CURRENT_LIST_DIR} NAME) + string(REPLACE "\." "_" fixed_name ${ProjectId}) + string(TOUPPER ${fixed_name} fixed_name) + + set(inner-project-name ${ProjectId}) + set(inner-project-name-upper ${fixed_name}) +endmacro() ### External projects management # Thanks to http://crascit.com/2015/07/25/cmake-gtest/ @@ -211,6 +222,7 @@ function(sofa_add_generic_external directory name type) # Create option string(REPLACE "\." "_" fixed_name ${name}) string(TOUPPER ${PROJECT_NAME}_FETCH_${fixed_name} fetch_enabled) + string(TOUPPER ${fixed_name} upper_name) if(NOT "${ARG_WHEN_TO_SHOW}" STREQUAL "" AND NOT "${ARG_VALUE_IF_HIDDEN}" STREQUAL "") cmake_dependent_option(${fetch_enabled} "Fetch/update ${name} repository." ${active} "${ARG_WHEN_TO_SHOW}" ${ARG_VALUE_IF_HIDDEN}) else() @@ -219,63 +231,56 @@ function(sofa_add_generic_external directory name type) # Setup fetch directory set(fetched_dir "${CMAKE_BINARY_DIR}/external_directories/fetched/${name}" ) + file(RELATIVE_PATH relative_path "${CMAKE_SOURCE_DIR}" "${directory}") # Fetch if(${fetch_enabled}) message("Fetching ${type_lower} ${name}") - if("${ARG_GIT_REF}" STREQUAL "") - message(SEND_ERROR "One value argument GIT_REF is required when option EXTERNAL is set. This is the name of the branch or the tag checkouted when cloning the subdirectory.") - return() + #Generate temporary folder to store project that will fetch the sources + if(NOT EXISTS ${fetched_dir}-temp) + file(MAKE_DIRECTORY "${fetched_dir}-temp/") endif() - if(NOT EXISTS ${fetched_dir}) - file(MAKE_DIRECTORY "${fetched_dir}/") - endif() - - # Download and unpack at configure time - configure_file(${directory}/ExternalProjectConfig.cmake.in ${fetched_dir}/CMakeLists.txt) - # Copy ExternalProjectConfig.cmake.in in build dir for post-pull recovery in src dir - file(COPY ${directory}/ExternalProjectConfig.cmake.in DESTINATION ${fetched_dir}) - + include(${directory}/GitConfig.cmake) + + + file(WRITE ${fetched_dir}-temp/CMakeLists.txt " + cmake_minimum_required(VERSION 3.22) + include(ExternalProject) + ExternalProject_Add( + ${name} + GIT_REPOSITORY ${${upper_name}_GIT_REPOSITORY} + GIT_TAG ${${upper_name}_GIT_TAG} + SOURCE_DIR ${fetched_dir} + BINARY_DIR \"\" + CONFIGURE_COMMAND \"\" + BUILD_COMMAND \"\" + INSTALL_COMMAND \"\" + TEST_COMMAND \"\" + GIT_CONFIG \"remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*\" + )" + ) - # Execute commands to fetch content - message(" Pulling reference ${ARG_GIT_REF}...") - - file(WRITE "${fetched_dir}/logs.txt" "") # Empty log file execute_process(COMMAND "${CMAKE_COMMAND}" -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -G "${CMAKE_GENERATOR}" . - WORKING_DIRECTORY "${fetched_dir}" - RESULT_VARIABLE generate_exitcode - OUTPUT_VARIABLE generate_logs ERROR_VARIABLE generate_logs) - file(APPEND "${fetched_dir}/logs.txt" "${generate_logs}") + WORKING_DIRECTORY "${fetched_dir}-temp" + RESULT_VARIABLE generate_exitcode + OUTPUT_VARIABLE generate_logs ERROR_VARIABLE generate_logs) + file(APPEND "${fetched_dir}-temp/logs.txt" "${generate_logs}") execute_process(COMMAND "${CMAKE_COMMAND}" --build . - WORKING_DIRECTORY "${fetched_dir}" - RESULT_VARIABLE build_exitcode - OUTPUT_VARIABLE build_logs ERROR_VARIABLE build_logs) - file(APPEND "${fetched_dir}/logs.txt" "${build_logs}") - - if(generate_exitcode EQUAL 0 AND build_exitcode EQUAL 0 AND EXISTS "${directory}/.git") - message(" Success.") - # Add .gitignore for Sofa - file(WRITE "${directory}/.gitignore" "*") - # Recover ExternalProjectConfig.cmake.in from build dir (erased by pull) - file(COPY ${fetched_dir}/ExternalProjectConfig.cmake.in DESTINATION ${directory}) - # Disable fetching for next configure - set(${fetch_enabled} OFF CACHE BOOL "Fetch/update ${name} repository." FORCE) - message(" ${fetch_enabled} is now OFF. Set it back to ON to trigger a new fetch.") - else() - message(SEND_ERROR "Failed to add external repository ${name}." - "\nSee logs in ${fetched_dir}/logs.txt") - endif() + WORKING_DIRECTORY "${fetched_dir}-temp" + RESULT_VARIABLE build_exitcode + OUTPUT_VARIABLE build_logs ERROR_VARIABLE build_logs) + file(APPEND "${fetched_dir}-temp/logs.txt" "${build_logs}") + endif() # Add - if(EXISTS "${directory}/.git" AND IS_DIRECTORY "${directory}/.git") - configure_file(${directory}/ExternalProjectConfig.cmake.in ${fetched_dir}/CMakeLists.txt) + if(EXISTS "${fetched_dir}/.git" AND IS_DIRECTORY "${fetched_dir}/.git") if(NOT ARG_FETCH_ONLY AND "${type}" MATCHES ".*directory.*") - add_subdirectory("${directory}") + add_subdirectory("${fetched_dir}" "${CMAKE_BINARY_DIR}/${relative_path}") elseif(NOT ARG_FETCH_ONLY AND "${type}" MATCHES ".*plugin.*") - sofa_add_subdirectory(plugin "${name}" "${name}" ${active}) + sofa_add_subdirectory(plugin "${fetched_dir}" "${name}" ${active} BINARY_DIR "${CMAKE_BINARY_DIR}/${relative_path}") endif() endif() endfunction() diff --git a/applications/plugins/BeamAdapter/ExternalProjectConfig.cmake.in b/applications/plugins/BeamAdapter/ExternalProjectConfig.cmake.in deleted file mode 100644 index 82bfdff8a90..00000000000 --- a/applications/plugins/BeamAdapter/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(BeamAdapter - GIT_REPOSITORY https://github.com/sofa-framework/BeamAdapter - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/BeamAdapter" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/BeamAdapter/GitConfig.cmake b/applications/plugins/BeamAdapter/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/plugins/BeamAdapter/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/CGALPlugin/ExternalProjectConfig.cmake.in b/applications/plugins/CGALPlugin/ExternalProjectConfig.cmake.in deleted file mode 100644 index 24a5634cf36..00000000000 --- a/applications/plugins/CGALPlugin/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(CGALPlugin - GIT_REPOSITORY https://github.com/sofa-framework/CGALPlugin - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/CGALPlugin" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/CGALPlugin/GitConfig.cmake b/applications/plugins/CGALPlugin/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/plugins/CGALPlugin/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/CSparseSolvers/ExternalProjectConfig.cmake.in b/applications/plugins/CSparseSolvers/ExternalProjectConfig.cmake.in deleted file mode 100644 index 873f2af4e97..00000000000 --- a/applications/plugins/CSparseSolvers/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(CSparseSolvers - GIT_REPOSITORY https://github.com/sofa-framework/CSparseSolvers - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/CSparseSolvers" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/CSparseSolvers/GitConfig.cmake b/applications/plugins/CSparseSolvers/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/plugins/CSparseSolvers/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/CollisionAlgorithm/ExternalProjectConfig.cmake.in b/applications/plugins/CollisionAlgorithm/ExternalProjectConfig.cmake.in deleted file mode 100644 index 1d6cfd5fa5b..00000000000 --- a/applications/plugins/CollisionAlgorithm/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(CollisionAlgorithm - GIT_REPOSITORY https://forge.icube.unistra.fr/sofa/CollisionAlgorithm.git - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/CollisionAlgorithm" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/CollisionAlgorithm/GitConfig.cmake b/applications/plugins/CollisionAlgorithm/GitConfig.cmake new file mode 100644 index 00000000000..10f04c6a8d0 --- /dev/null +++ b/applications/plugins/CollisionAlgorithm/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://forge.icube.unistra.fr/sofa/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/ConstraintGeometry/ExternalProjectConfig.cmake.in b/applications/plugins/ConstraintGeometry/ExternalProjectConfig.cmake.in deleted file mode 100644 index 9dcb490a520..00000000000 --- a/applications/plugins/ConstraintGeometry/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(ConstraintGeometry - GIT_REPOSITORY https://forge.icube.unistra.fr/sofa/ConstraintGeometry.git - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/ConstraintGeometry" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/ConstraintGeometry/GitConfig.cmake b/applications/plugins/ConstraintGeometry/GitConfig.cmake new file mode 100644 index 00000000000..10f04c6a8d0 --- /dev/null +++ b/applications/plugins/ConstraintGeometry/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://forge.icube.unistra.fr/sofa/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/Cosserat/ExternalProjectConfig.cmake.in b/applications/plugins/Cosserat/ExternalProjectConfig.cmake.in deleted file mode 100644 index 47c5d00b0b8..00000000000 --- a/applications/plugins/Cosserat/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(Cosserat - GIT_REPOSITORY https://github.com/SofaDefrost/Cosserat - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/Cosserat" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/Cosserat/GitConfig.cmake b/applications/plugins/Cosserat/GitConfig.cmake new file mode 100644 index 00000000000..ad9990af2ff --- /dev/null +++ b/applications/plugins/Cosserat/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/SofaDefrost/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/ManifoldTopologies/ExternalProjectConfig.cmake.in b/applications/plugins/ManifoldTopologies/ExternalProjectConfig.cmake.in deleted file mode 100644 index 83340879f74..00000000000 --- a/applications/plugins/ManifoldTopologies/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(ManifoldTopologies - GIT_REPOSITORY https://github.com/sofa-framework/ManifoldTopologies - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/ManifoldTopologies" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/ManifoldTopologies/GitConfig.cmake b/applications/plugins/ManifoldTopologies/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/plugins/ManifoldTopologies/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/MeshSTEPLoader/ExternalProjectConfig.cmake.in b/applications/plugins/MeshSTEPLoader/ExternalProjectConfig.cmake.in deleted file mode 100644 index a8f24844c3c..00000000000 --- a/applications/plugins/MeshSTEPLoader/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(MeshSTEPLoader - GIT_REPOSITORY https://github.com/sofa-framework/MeshSTEPLoader - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/MeshSTEPLoader" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/MeshSTEPLoader/GitConfig.cmake b/applications/plugins/MeshSTEPLoader/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/plugins/MeshSTEPLoader/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/ModelOrderReduction/ExternalProjectConfig.cmake.in b/applications/plugins/ModelOrderReduction/ExternalProjectConfig.cmake.in deleted file mode 100644 index f38b32709ea..00000000000 --- a/applications/plugins/ModelOrderReduction/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(ModelOrderReduction - GIT_REPOSITORY https://github.com/SofaDefrost/ModelOrderReduction - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/ModelOrderReduction" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/ModelOrderReduction/GitConfig.cmake b/applications/plugins/ModelOrderReduction/GitConfig.cmake new file mode 100644 index 00000000000..ad9990af2ff --- /dev/null +++ b/applications/plugins/ModelOrderReduction/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/SofaDefrost/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/PSL/ExternalProjectConfig.cmake.in b/applications/plugins/PSL/ExternalProjectConfig.cmake.in deleted file mode 100644 index ce8cc694507..00000000000 --- a/applications/plugins/PSL/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(PSL - GIT_REPOSITORY https://github.com/sofa-framework/PSL - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/PSL" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/PSL/GitConfig.cmake b/applications/plugins/PSL/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/plugins/PSL/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/PluginExample/ExternalProjectConfig.cmake.in b/applications/plugins/PluginExample/ExternalProjectConfig.cmake.in deleted file mode 100644 index 96df21096c5..00000000000 --- a/applications/plugins/PluginExample/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(PluginExample - GIT_REPOSITORY https://github.com/sofa-framework/PluginExample - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/PluginExample" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/PluginExample/GitConfig.cmake b/applications/plugins/PluginExample/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/plugins/PluginExample/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/PluginExample/ExternalPluginExample.md b/applications/plugins/PluginExample/GitconfigExample.md similarity index 71% rename from applications/plugins/PluginExample/ExternalPluginExample.md rename to applications/plugins/PluginExample/GitconfigExample.md index 3222e79cc7a..1f685f5f698 100644 --- a/applications/plugins/PluginExample/ExternalPluginExample.md +++ b/applications/plugins/PluginExample/GitconfigExample.md @@ -1,4 +1,4 @@ -# External PluginExample +# GitConfig PluginExample This example of plugin has been converted to an external repository, and it is used as a showcase of: - how to write a plugin for SOFA (CMake, file structure, code) @@ -6,6 +6,6 @@ This example of plugin has been converted to an external repository, and it is u The content of the plugin is now located at: https://github.com/sofa-framework/PluginExample -The associated *ExternalProjectConfig.cmake.in* describes how to fetch from an repostitory, automatically at the cmake configure time. +The associated *GitConfig.cmake* describes how to fetch from a repository, automatically at the cmake configure time. Finally, one has to declare this plugin in the root CMakefile, where he will declare this plugin as external, using *add_sofa_plugin_external( )* -Once fetched, this directory will be populated with the current code pointed in the *ExternalProjectConfig.cmake.in* file. +Once fetched, this directory will be populated with the current code pointed in the *GitConfig.cmake* file. diff --git a/applications/plugins/Registration/ExternalProjectConfig.cmake.in b/applications/plugins/Registration/ExternalProjectConfig.cmake.in deleted file mode 100644 index 47b16bfff8c..00000000000 --- a/applications/plugins/Registration/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(Registration - GIT_REPOSITORY https://github.com/sofa-framework/Registration - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/Registration" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/Registration/GitConfig.cmake b/applications/plugins/Registration/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/plugins/Registration/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/STLIB/ExternalProjectConfig.cmake.in b/applications/plugins/STLIB/ExternalProjectConfig.cmake.in deleted file mode 100644 index bf4aeb68fc9..00000000000 --- a/applications/plugins/STLIB/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(STLIB - GIT_REPOSITORY https://github.com/SofaDefrost/STLIB - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/STLIB" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/STLIB/GitConfig.cmake b/applications/plugins/STLIB/GitConfig.cmake new file mode 100644 index 00000000000..ad9990af2ff --- /dev/null +++ b/applications/plugins/STLIB/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/SofaDefrost/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/ShapeMatchingPlugin/ExternalProjectConfig.cmake.in b/applications/plugins/ShapeMatchingPlugin/ExternalProjectConfig.cmake.in deleted file mode 100644 index 3536891a608..00000000000 --- a/applications/plugins/ShapeMatchingPlugin/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(ShapeMatchingPlugin - GIT_REPOSITORY https://github.com/sofa-framework/ShapeMatchingPlugin - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/ShapeMatchingPlugin" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/ShapeMatchingPlugin/GitConfig.cmake b/applications/plugins/ShapeMatchingPlugin/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/plugins/ShapeMatchingPlugin/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/Sofa.Metis/ExternalProjectConfig.cmake.in b/applications/plugins/Sofa.Metis/ExternalProjectConfig.cmake.in deleted file mode 100644 index 999b95482f8..00000000000 --- a/applications/plugins/Sofa.Metis/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(Sofa.Metis - GIT_REPOSITORY https://github.com/sofa-framework/Sofa.Metis - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/Sofa.Metis" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/Sofa.Metis/GitConfig.cmake b/applications/plugins/Sofa.Metis/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/plugins/Sofa.Metis/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/SofaHighOrder/ExternalProjectConfig.cmake.in b/applications/plugins/SofaHighOrder/ExternalProjectConfig.cmake.in deleted file mode 100644 index 48c0327a7a8..00000000000 --- a/applications/plugins/SofaHighOrder/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(SofaHighOrder - GIT_REPOSITORY https://github.com/sofa-framework/SofaHighOrder - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/SofaHighOrder" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/SofaHighOrder/GitConfig.cmake b/applications/plugins/SofaHighOrder/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/plugins/SofaHighOrder/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/SofaPython3/ExternalProjectConfig.cmake.in b/applications/plugins/SofaPython3/ExternalProjectConfig.cmake.in deleted file mode 100644 index d8514e56409..00000000000 --- a/applications/plugins/SofaPython3/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(SofaPython3 - GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/SofaPython3" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/SofaPython3/GitConfig.cmake b/applications/plugins/SofaPython3/GitConfig.cmake new file mode 100644 index 00000000000..760302bd9b4 --- /dev/null +++ b/applications/plugins/SofaPython3/GitConfig.cmake @@ -0,0 +1,6 @@ +get_filename_component(ProjectId ${CMAKE_CURRENT_LIST_DIR} NAME) +string(REPLACE "\." "_" fixed_name ${ProjectId}) +string(TOUPPER ${fixed_name} fixed_name) + +set(${fixed_name}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${ProjectId}.git" CACHE STRING "Repository address" ) +set(${fixed_name}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/SofaSphFluid/ExternalProjectConfig.cmake.in b/applications/plugins/SofaSphFluid/ExternalProjectConfig.cmake.in deleted file mode 100644 index 74b21621e47..00000000000 --- a/applications/plugins/SofaSphFluid/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(SofaSphFluid - GIT_REPOSITORY https://github.com/sofa-framework/SofaSphFluid - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/SofaSphFluid" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/SofaSphFluid/GitConfig.cmake b/applications/plugins/SofaSphFluid/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/plugins/SofaSphFluid/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/SofaValidation/ExternalProjectConfig.cmake.in b/applications/plugins/SofaValidation/ExternalProjectConfig.cmake.in deleted file mode 100644 index c03db32905c..00000000000 --- a/applications/plugins/SofaValidation/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(SofaValidation - GIT_REPOSITORY https://github.com/sofa-framework/SofaValidation - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/SofaValidation" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/SofaValidation/GitConfig.cmake b/applications/plugins/SofaValidation/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/plugins/SofaValidation/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/SoftRobots/ExternalProjectConfig.cmake.in b/applications/plugins/SoftRobots/ExternalProjectConfig.cmake.in deleted file mode 100644 index 0b592bcd67c..00000000000 --- a/applications/plugins/SoftRobots/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.22) - -include(ExternalProject) -ExternalProject_Add(SoftRobots - GIT_REPOSITORY https://github.com/SofaDefrost/SoftRobots - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/SoftRobots" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/plugins/SoftRobots/GitConfig.cmake b/applications/plugins/SoftRobots/GitConfig.cmake new file mode 100644 index 00000000000..ad9990af2ff --- /dev/null +++ b/applications/plugins/SoftRobots/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/SofaDefrost/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/projects/Regression/ExternalProjectConfig.cmake.in b/applications/projects/Regression/ExternalProjectConfig.cmake.in deleted file mode 100644 index 9d1b66e6dd3..00000000000 --- a/applications/projects/Regression/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 2.8.2) - -include(ExternalProject) -ExternalProject_Add(Regression - GIT_REPOSITORY https://github.com/sofa-framework/regression - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/projects/Regression" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) - \ No newline at end of file diff --git a/applications/projects/Regression/GitConfig.cmake b/applications/projects/Regression/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/projects/Regression/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/projects/Sofa.Qt/ExternalProjectConfig.cmake.in b/applications/projects/Sofa.Qt/ExternalProjectConfig.cmake.in deleted file mode 100644 index a142386d33f..00000000000 --- a/applications/projects/Sofa.Qt/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 2.8.2) - -include(ExternalProject) -ExternalProject_Add(Regression - GIT_REPOSITORY https://github.com/sofa-framework/Sofa.Qt - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/projects/Sofa.Qt" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) - \ No newline at end of file diff --git a/applications/projects/Sofa.Qt/GitConfig.cmake b/applications/projects/Sofa.Qt/GitConfig.cmake new file mode 100644 index 00000000000..56ae1e087f0 --- /dev/null +++ b/applications/projects/Sofa.Qt/GitConfig.cmake @@ -0,0 +1,4 @@ +get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file + +set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) +set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/projects/SofaGLFW/ExternalProjectConfig.cmake.in b/applications/projects/SofaGLFW/ExternalProjectConfig.cmake.in deleted file mode 100644 index 22d1eaf4f1c..00000000000 --- a/applications/projects/SofaGLFW/ExternalProjectConfig.cmake.in +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.11) - -include(ExternalProject) -ExternalProject_Add(SofaGLFW - GIT_REPOSITORY https://github.com/sofa-framework/SofaGLFW - GIT_TAG origin/@ARG_GIT_REF@ - SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/projects/SofaGLFW" - BINARY_DIR "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - GIT_CONFIG "remote.origin.fetch=+refs/pull/*:refs/remotes/origin/pr/*" -) diff --git a/applications/projects/SofaGLFW/GitConfig.cmake b/applications/projects/SofaGLFW/GitConfig.cmake new file mode 100644 index 00000000000..760302bd9b4 --- /dev/null +++ b/applications/projects/SofaGLFW/GitConfig.cmake @@ -0,0 +1,6 @@ +get_filename_component(ProjectId ${CMAKE_CURRENT_LIST_DIR} NAME) +string(REPLACE "\." "_" fixed_name ${ProjectId}) +string(TOUPPER ${fixed_name} fixed_name) + +set(${fixed_name}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${ProjectId}.git" CACHE STRING "Repository address" ) +set(${fixed_name}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file From 93bdfd341243a7e895d8cdfa46463d785fc03fe1 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Tue, 25 Mar 2025 11:23:25 +0100 Subject: [PATCH 2/6] Use sofa_add_generic in macros instead of sofa_add_subdirectory, because it makes no sense + remove deprecated macros --- .../Config/cmake/SofaMacrosConfigure.cmake | 48 +------------------ 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake b/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake index 2f024d264f2..6f5eca2c807 100644 --- a/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake +++ b/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake @@ -280,7 +280,7 @@ function(sofa_add_generic_external directory name type) if(NOT ARG_FETCH_ONLY AND "${type}" MATCHES ".*directory.*") add_subdirectory("${fetched_dir}" "${CMAKE_BINARY_DIR}/${relative_path}") elseif(NOT ARG_FETCH_ONLY AND "${type}" MATCHES ".*plugin.*") - sofa_add_subdirectory(plugin "${fetched_dir}" "${name}" ${active} BINARY_DIR "${CMAKE_BINARY_DIR}/${relative_path}") + sofa_add_generic("${fetched_dir}" "${name}" plugin DEFAULT_VALUE ${active} BINARY_DIR "${CMAKE_BINARY_DIR}/${relative_path}") endif() endif() endfunction() @@ -336,7 +336,7 @@ macro(sofa_add_subdirectory_modules output_targets) set(missing_targets) foreach(dir ${ARG_DIRECTORIES}) set(subdir_name "${PROJECT_NAME}.${dir}") - sofa_add_subdirectory(module ${dir} ${subdir_name} ON) + sofa_add_generic(${dir} ${subdir_name} module DEFAULT_VALUE ON) if(TARGET ${subdir_name}) list(APPEND ${output_targets} ${subdir_name}) else() @@ -460,47 +460,3 @@ macro(sofa_set_targets_release_only) endmacro() - -####################################################### -################## DEPRECATED MACROS ################## -####################################################### - -macro(sofa_add_collection directory name) - message(WARNING "Deprecated macro 'sofa_add_collection'.\n Use 'sofa_add_subdirectory(collection ${directory} ${name})' instead.") - sofa_add_subdirectory(collection ${ARGV}) -endmacro() - -macro(sofa_add_plugin directory plugin_name) - message(WARNING "Deprecated macro 'sofa_add_plugin'.\n Use 'sofa_add_subdirectory(plugin ${directory} ${plugin_name})' instead.") - sofa_add_subdirectory(plugin ${ARGV}) -endmacro() - -macro(sofa_add_plugin_experimental directory plugin_name) - message(WARNING "Deprecated macro 'sofa_add_plugin_experimental'.\n Use 'sofa_add_subdirectory(plugin ${directory} ${plugin_name} EXPERIMENTAL)' instead.") - sofa_add_subdirectory(plugin ${ARGV} EXPERIMENTAL) -endmacro() - -macro(sofa_add_module directory module_name) - message(WARNING "Deprecated macro 'sofa_add_module'.\n Use 'sofa_add_subdirectory(module ${directory} ${module_name})' instead.") - sofa_add_subdirectory(module ${ARGV}) -endmacro() - -macro(sofa_add_module_experimental directory module_name) - message(WARNING "Deprecated macro 'sofa_add_module_experimental'.\n Use 'sofa_add_subdirectory(module ${directory} ${module_name} EXPERIMENTAL)' instead.") - sofa_add_subdirectory(module ${ARGV} EXPERIMENTAL) -endmacro() - -macro(sofa_add_application directory app_name) - message(WARNING "Deprecated macro 'sofa_add_application'.\n Use 'sofa_add_subdirectory(application ${directory} ${app_name})' instead.") - sofa_add_subdirectory(application ${ARGV}) -endmacro() - -function(sofa_add_subdirectory_external directory name) - message(WARNING "Deprecated macro 'sofa_add_subdirectory_external'.\n Use 'sofa_add_subdirectory(directory ${directory} ${name} EXTERNAL)' instead.") - sofa_add_subdirectory(directory ${ARGV} EXTERNAL) -endfunction() - -function(sofa_add_plugin_external directory name) - message(WARNING "Deprecated macro 'sofa_add_plugin_external'.\n Use 'sofa_add_subdirectory(plugin ${directory} ${name} EXTERNAL)' instead.") - sofa_add_subdirectory(plugin ${ARGV} EXTERNAL) -endfunction() From 3b936b047342550c68860ff9dffa736d95c4d86a Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Fri, 28 Mar 2025 15:20:08 +0100 Subject: [PATCH 3/6] Fix reference handling --- .../plugins/RegressionStateScenes.regression-tests | 11 ++++++++++- examples/RegressionStateScenes.regression-tests | 12 +++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/applications/plugins/RegressionStateScenes.regression-tests b/applications/plugins/RegressionStateScenes.regression-tests index 806192894f1..7fd66a0ade6 100644 --- a/applications/plugins/RegressionStateScenes.regression-tests +++ b/applications/plugins/RegressionStateScenes.regression-tests @@ -2,8 +2,17 @@ # REGRESSION_TEST DOES NOT SUPPORT DASHES ("-") IN SCENE NAMES. # USE UNDERSCORES ("_") INSTEAD. +# The file contains the path to the reference folder. This path should be relative to this folder path. The folder +# should be structured as the folder containig this file and each reference of each scene should have a relative path to +# the reference folder equivalent to the relative path of the corresponding scene in this folder. e.g. for the scene in +# path/to/MyScene.scn, a reference with the same name as the scene should be found in referenceFolder/path/to/ +# --> INFO : a special string can be use while specifying this path: `$REGRESSION_DIR`. If used at the beginning of the +# path, then it will be used as an absolute path with $REGRESSION_DIR replaced by the content of the environment +# variable with the same name. Use this, when the reference are not in the repository containing the examples but +# directly in the repo Regression + ### References relative path ### -../projects/Regression/references/applications/plugins +$REGRESSION_DIR/references/applications/plugins ### MultiThreading ### diff --git a/examples/RegressionStateScenes.regression-tests b/examples/RegressionStateScenes.regression-tests index bd58ec2c3fe..646ab6e43a6 100644 --- a/examples/RegressionStateScenes.regression-tests +++ b/examples/RegressionStateScenes.regression-tests @@ -7,9 +7,19 @@ # WARNING: # REGRESSION_TEST DOES NOT SUPPORT DASHES ("-") IN SCENE NAMES. # USE UNDERSCORES ("_") INSTEAD. +# +# The file contains the path to the reference folder. This path should be relative to this folder path. The folder +# should be structured as the folder containig this file and each reference of each scene should have a relative path to +# the reference folder equivalent to the relative path of the corresponding scene in this folder. e.g. for the scene in +# path/to/MyScene.scn, a reference with the same name as the scene should be found in referenceFolder/path/to/ +# --> INFO : a special string can be use while specifying this path: `$REGRESSION_DIR`. If used at the beginning of the +# path, then it will be used as an absolute path with $REGRESSION_DIR replaced by the content of the environment +# variable with the same name. Use this, when the reference are not in the repository containing the examples but +# directly in the repo Regression + ### References relative path ### -../applications/projects/Regression/references/examples +$REGRESSION_DIR/references/examples ### Demo scenes ### Demos/TriangleSurfaceCutting.scn 100 1e-4 1 1 From 89df11576dce50715f7c4b28862c0c6886f8ab09 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Fri, 28 Mar 2025 17:50:37 +0100 Subject: [PATCH 4/6] Fix topology regression --- examples/RegressionTopologyScenes.regression-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/RegressionTopologyScenes.regression-tests b/examples/RegressionTopologyScenes.regression-tests index a789f64974a..8cae0b9adb3 100644 --- a/examples/RegressionTopologyScenes.regression-tests +++ b/examples/RegressionTopologyScenes.regression-tests @@ -3,7 +3,7 @@ # USE UNDERSCORES ("_") INSTEAD. ### References relative path ### -../applications/projects/Regression/references/examples +$REGRESSION_DIR/references/examples ### Topology scenes ### Component/Topology/Mapping/Tetra2TriangleTopologicalMapping.scn 30 1e-4 1 From 985829ef3f34c8f0919f6fd359ad5d64ecb70e6a Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Wed, 2 Apr 2025 12:04:25 +0200 Subject: [PATCH 5/6] Remove plugisn directory ans set everything in the cmakelist --- .../Config/cmake/SofaMacrosConfigure.cmake | 57 ++++++++++--------- .../plugins/BeamAdapter/GitConfig.cmake | 4 -- .../plugins/CGALPlugin/GitConfig.cmake | 4 -- applications/plugins/CMakeLists.txt | 40 ++++++------- .../plugins/CSparseSolvers/GitConfig.cmake | 4 -- .../CollisionAlgorithm/GitConfig.cmake | 4 -- .../ConstraintGeometry/GitConfig.cmake | 4 -- applications/plugins/Cosserat/GitConfig.cmake | 4 -- .../ManifoldTopologies/GitConfig.cmake | 4 -- .../plugins/MeshSTEPLoader/GitConfig.cmake | 4 -- .../ModelOrderReduction/GitConfig.cmake | 4 -- applications/plugins/PSL/GitConfig.cmake | 4 -- .../plugins/PluginExample/GitConfig.cmake | 4 -- .../plugins/PluginExample/GitconfigExample.md | 11 ---- .../plugins/Registration/GitConfig.cmake | 4 -- applications/plugins/STLIB/GitConfig.cmake | 4 -- .../ShapeMatchingPlugin/GitConfig.cmake | 4 -- .../plugins/Sofa.Metis/GitConfig.cmake | 4 -- .../plugins/SofaHighOrder/GitConfig.cmake | 4 -- .../plugins/SofaPython3/GitConfig.cmake | 6 -- .../plugins/SofaSphFluid/GitConfig.cmake | 4 -- .../plugins/SofaValidation/GitConfig.cmake | 4 -- .../plugins/SoftRobots/GitConfig.cmake | 4 -- applications/projects/CMakeLists.txt | 7 ++- .../projects/Regression/GitConfig.cmake | 4 -- applications/projects/Sofa.Qt/GitConfig.cmake | 4 -- .../projects/SofaGLFW/GitConfig.cmake | 6 -- 27 files changed, 54 insertions(+), 157 deletions(-) delete mode 100644 applications/plugins/BeamAdapter/GitConfig.cmake delete mode 100644 applications/plugins/CGALPlugin/GitConfig.cmake delete mode 100644 applications/plugins/CSparseSolvers/GitConfig.cmake delete mode 100644 applications/plugins/CollisionAlgorithm/GitConfig.cmake delete mode 100644 applications/plugins/ConstraintGeometry/GitConfig.cmake delete mode 100644 applications/plugins/Cosserat/GitConfig.cmake delete mode 100644 applications/plugins/ManifoldTopologies/GitConfig.cmake delete mode 100644 applications/plugins/MeshSTEPLoader/GitConfig.cmake delete mode 100644 applications/plugins/ModelOrderReduction/GitConfig.cmake delete mode 100644 applications/plugins/PSL/GitConfig.cmake delete mode 100644 applications/plugins/PluginExample/GitConfig.cmake delete mode 100644 applications/plugins/PluginExample/GitconfigExample.md delete mode 100644 applications/plugins/Registration/GitConfig.cmake delete mode 100644 applications/plugins/STLIB/GitConfig.cmake delete mode 100644 applications/plugins/ShapeMatchingPlugin/GitConfig.cmake delete mode 100644 applications/plugins/Sofa.Metis/GitConfig.cmake delete mode 100644 applications/plugins/SofaHighOrder/GitConfig.cmake delete mode 100644 applications/plugins/SofaPython3/GitConfig.cmake delete mode 100644 applications/plugins/SofaSphFluid/GitConfig.cmake delete mode 100644 applications/plugins/SofaValidation/GitConfig.cmake delete mode 100644 applications/plugins/SoftRobots/GitConfig.cmake delete mode 100644 applications/projects/Regression/GitConfig.cmake delete mode 100644 applications/projects/Sofa.Qt/GitConfig.cmake delete mode 100644 applications/projects/SofaGLFW/GitConfig.cmake diff --git a/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake b/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake index 6f5eca2c807..895f28d138c 100644 --- a/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake +++ b/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake @@ -196,21 +196,12 @@ endmacro() # FETCH_ONLY = do not "add_subdirectory" the fetched repository # See plugins/SofaHighOrder for example # -function(sofa_add_generic_external directory name type) +function(sofa_add_generic_external name type) set(optionArgs FETCH_ONLY) - set(oneValueArgs DEFAULT_VALUE WHEN_TO_SHOW VALUE_IF_HIDDEN GIT_REF) + set(oneValueArgs DEFAULT_VALUE WHEN_TO_SHOW VALUE_IF_HIDDEN GIT_REF GIT_REPOSITORY) set(multiValueArgs) cmake_parse_arguments("ARG" "${optionArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - # Make directory absolute - if(NOT IS_ABSOLUTE "${directory}") - set(directory "${CMAKE_CURRENT_LIST_DIR}/${directory}") - endif() - if(NOT EXISTS "${directory}") - message("${directory} does not exist and will be ignored.") - return() - endif() - string(TOLOWER ${type} type_lower) # Default value for fetch activation and for plugin activation (if adding a plugin) @@ -219,6 +210,8 @@ function(sofa_add_generic_external directory name type) set(active ON) endif() + set(directory "${CMAKE_CURRENT_LIST_DIR}/${name}") + # Create option string(REPLACE "\." "_" fixed_name ${name}) string(TOUPPER ${PROJECT_NAME}_FETCH_${fixed_name} fetch_enabled) @@ -242,8 +235,8 @@ function(sofa_add_generic_external directory name type) file(MAKE_DIRECTORY "${fetched_dir}-temp/") endif() - include(${directory}/GitConfig.cmake) - + set(${PROJECT_NAME}_GIT_REPOSITORY "${ARG_GIT_REPOSITORY}" CACHE STRING "Repository address" ) + set(${PROJECT_NAME}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) file(WRITE ${fetched_dir}-temp/CMakeLists.txt " cmake_minimum_required(VERSION 3.22) @@ -287,8 +280,7 @@ endfunction() macro(sofa_add_subdirectory type directory name) - set(optionArgs EXTERNAL EXPERIMENTAL) - set(oneValueArgs GIT_REF) + set(optionArgs EXPERIMENTAL) set(multiValueArgs) cmake_parse_arguments("ARG" "${optionArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -300,22 +292,12 @@ macro(sofa_add_subdirectory type directory name) endif() set(default_value OFF) - if(ARG_EXTERNAL) - set(input_value ${ARGV6}) - else() - set(input_value ${ARGV3}) - endif () - + set(input_value ${ARGV3}) if(${input_value}) set(default_value ON) endif() - - if(ARG_EXTERNAL) - sofa_add_generic_external(${directory} ${name} "External ${type_lower}" GIT_REF ${ARG_GIT_REF} DEFAULT_VALUE ${default_value} ${ARGN}) - else() - sofa_add_generic(${directory} ${name} ${type_lower} DEFAULT_VALUE ${default_value} ${ARGN}) - endif() + sofa_add_generic(${directory} ${name} ${type_lower} DEFAULT_VALUE ${default_value} ${ARGN}) if(ARG_EXPERIMENTAL) if(TARGET ${name}) @@ -324,7 +306,28 @@ macro(sofa_add_subdirectory type directory name) endif() endmacro() +macro(sofa_add_external type name) + set(optionArgs EXPERIMENTAL) + set(oneValueArgs GIT_REF GIT_REPOSITORY) + set(multiValueArgs) + cmake_parse_arguments("ARG" "${optionArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(valid_types "application" "project" "plugin" "module" "library" "collection" "directory") + + string(TOLOWER "${type}" type_lower) + if(NOT "${type}" IN_LIST valid_types) + message(SEND_ERROR "Type \"${type}\" is invalid. Valid types are: ${valid_types}.") + endif() + + set(default_value OFF) + set(input_value ${ARGV6}) + if(${input_value}) + set(default_value ON) + endif() + + sofa_add_generic_external(${directory} ${name} "External ${type_lower}" GIT_REF ${ARG_GIT_REF} GIT_REPOSITORY ${ARG_GIT_REPOSITORY} DEFAULT_VALUE ${default_value} ${ARGN}) + +endmacro() macro(sofa_add_subdirectory_modules output_targets) set(optionArgs) diff --git a/applications/plugins/BeamAdapter/GitConfig.cmake b/applications/plugins/BeamAdapter/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/plugins/BeamAdapter/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/CGALPlugin/GitConfig.cmake b/applications/plugins/CGALPlugin/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/plugins/CGALPlugin/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/CMakeLists.txt b/applications/plugins/CMakeLists.txt index b2e399dba41..a58836c2820 100644 --- a/applications/plugins/CMakeLists.txt +++ b/applications/plugins/CMakeLists.txt @@ -10,24 +10,24 @@ endif() sofa_add_subdirectory(plugin CollisionOBBCapsule CollisionOBBCapsule) sofa_add_subdirectory(plugin HeadlessRecorder HeadlessRecorder) -sofa_add_subdirectory(directory SofaHighOrder SofaHighOrder EXTERNAL GIT_REF master) +sofa_add_external(directory SofaHighOrder GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/SofaHighOrder.git) sofa_add_subdirectory(plugin CImgPlugin CImgPlugin) # Define first as it is used by other plugins. sofa_add_subdirectory(plugin ArticulatedSystemPlugin ArticulatedSystemPlugin) sofa_add_subdirectory(plugin SofaEulerianFluid SofaEulerianFluid) -sofa_add_subdirectory(plugin SofaSphFluid SofaSphFluid EXTERNAL GIT_REF master) +sofa_add_external(plugin SofaSphFluid GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/SofaSphFluid.git) sofa_add_subdirectory(plugin MultiThreading MultiThreading ON) sofa_add_subdirectory(plugin DiffusionSolver DiffusionSolver) # Depends on CImgPlugin sofa_add_subdirectory(plugin image image) # Depends on CImgPlugin, DiffusionSolver, MultiThreading (soft) sofa_add_subdirectory(plugin SofaNewmat SofaNewmat) -sofa_add_subdirectory(directory SofaPython3 SofaPython3 EXTERNAL GIT_REF master) -sofa_add_subdirectory(plugin CGALPlugin CGALPlugin EXTERNAL GIT_REF master) # Depends on image -sofa_add_subdirectory(plugin Registration Registration EXTERNAL GIT_REF master) # Depends on image, SofaPython, SofaGui and SofaDistanceGrid +sofa_add_external(directory SofaPython3 GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/SofaPython3.git) +sofa_add_external(plugin CGALPlugin GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/CGALPlugin.git) # Depends on image +sofa_add_external(plugin Registration GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/Registration.git) # Depends on image, SofaPython, SofaGui and SofaDistanceGrid sofa_add_subdirectory(plugin BulletCollisionDetection BulletCollisionDetection) # Depends on Compliant and LMConstraint -sofa_add_subdirectory(plugin MeshSTEPLoader MeshSTEPLoader EXTERNAL GIT_REF master) -sofa_add_subdirectory(plugin PluginExample PluginExample EXTERNAL GIT_REF master) -sofa_add_subdirectory(plugin ManifoldTopologies ManifoldTopologies EXTERNAL GIT_REF master) +sofa_add_external(plugin MeshSTEPLoader GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/MeshSTEPLoader.git) +sofa_add_external(plugin PluginExample GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/PluginExample.git) +sofa_add_external(plugin ManifoldTopologies GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/ManifoldTopologies.git) sofa_add_subdirectory(plugin SixenseHydra SixenseHydra) sofa_add_subdirectory(plugin SofaOpenCL SofaOpenCL) sofa_add_subdirectory(plugin Xitact Xitact) @@ -40,21 +40,21 @@ sofa_add_subdirectory(plugin LeapMotion LeapMotion) sofa_add_subdirectory(plugin Geomagic Geomagic) sofa_add_subdirectory(plugin SofaAssimp SofaAssimp) # ColladaSceneLoader Depends on Flexible and image sofa_add_subdirectory(plugin SofaMatrix SofaMatrix) # Depends on image, CImgPlugin -sofa_add_subdirectory(plugin BeamAdapter BeamAdapter EXTERNAL GIT_REF master) -sofa_add_subdirectory(plugin STLIB STLIB EXTERNAL GIT_REF master) -sofa_add_subdirectory(plugin SoftRobots SoftRobots EXTERNAL GIT_REF master) -sofa_add_subdirectory(plugin Cosserat Cosserat EXTERNAL GIT_REF master) # Cosserat has an optional dependency on SoftRobots -sofa_add_subdirectory(plugin CollisionAlgorithm CollisionAlgorithm EXTERNAL GIT_REF master) -sofa_add_subdirectory(plugin ConstraintGeometry ConstraintGeometry EXTERNAL GIT_REF master) -sofa_add_subdirectory(plugin ShapeMatchingPlugin ShapeMatchingPlugin EXTERNAL GIT_REF master) -sofa_add_subdirectory(plugin CSparseSolvers CSparseSolvers EXTERNAL GIT_REF master) -sofa_add_subdirectory(plugin ModelOrderReduction ModelOrderReduction EXTERNAL GIT_REF master) -sofa_add_subdirectory(plugin Sofa.Metis Sofa.Metis EXTERNAL GIT_REF master) -sofa_add_subdirectory(plugin SofaValidation SofaValidation EXTERNAL GIT_REF master) +sofa_add_external(plugin BeamAdapter GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/BeamAdapter.git) +sofa_add_external(plugin STLIB GIT_REF master GIT_REPOSITORY https://www.github.com/SofaDefrost/STLIB.git) +sofa_add_external(plugin SoftRobots GIT_REF master GIT_REPOSITORY https://www.github.com/SofaDefrost/SoftRobots.git) +sofa_add_external(plugin Cosserat GIT_REF master GIT_REPOSITORY https://www.github.com/SofaDefrost/Cosserat.git) # Cosserat has an optional dependency on SoftRobots +sofa_add_external(plugin CollisionAlgorithm GIT_REF master GIT_REPOSITORY https://forge.icube.unistra.fr/sofa/CollisionAlgorithm.git) +sofa_add_external(plugin ConstraintGeometry GIT_REF master GIT_REPOSITORY https://forge.icube.unistra.fr/sofa/ConstraintGeometry.git) +sofa_add_external(plugin ShapeMatchingPlugin GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/ShapeMatchingPlugin.git) +sofa_add_external(plugin CSparseSolvers GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/CSparseSolvers.git) +sofa_add_external(plugin ModelOrderReduction GIT_REF master GIT_REPOSITORY https://www.github.com/SofaDefrost/ModelOrderReduction.git) +sofa_add_external(plugin Sofa.Metis GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/Sofa.Metis.git) +sofa_add_external(plugin SofaValidation GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/SofaValidation.git) -sofa_add_subdirectory(plugin PSL PSL EXTERNAL GIT_REF master) +sofa_add_external(plugin PSL GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/PSL.git) if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") AND (${CMAKE_SYSTEM_NAME} MATCHES "Linux")) sofa_add_subdirectory(plugin SofaPardisoSolver SofaPardisoSolver) # SofaPardisoSolver is only available under linux with gcc diff --git a/applications/plugins/CSparseSolvers/GitConfig.cmake b/applications/plugins/CSparseSolvers/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/plugins/CSparseSolvers/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/CollisionAlgorithm/GitConfig.cmake b/applications/plugins/CollisionAlgorithm/GitConfig.cmake deleted file mode 100644 index 10f04c6a8d0..00000000000 --- a/applications/plugins/CollisionAlgorithm/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://forge.icube.unistra.fr/sofa/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/ConstraintGeometry/GitConfig.cmake b/applications/plugins/ConstraintGeometry/GitConfig.cmake deleted file mode 100644 index 10f04c6a8d0..00000000000 --- a/applications/plugins/ConstraintGeometry/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://forge.icube.unistra.fr/sofa/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/Cosserat/GitConfig.cmake b/applications/plugins/Cosserat/GitConfig.cmake deleted file mode 100644 index ad9990af2ff..00000000000 --- a/applications/plugins/Cosserat/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/SofaDefrost/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/ManifoldTopologies/GitConfig.cmake b/applications/plugins/ManifoldTopologies/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/plugins/ManifoldTopologies/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/MeshSTEPLoader/GitConfig.cmake b/applications/plugins/MeshSTEPLoader/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/plugins/MeshSTEPLoader/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/ModelOrderReduction/GitConfig.cmake b/applications/plugins/ModelOrderReduction/GitConfig.cmake deleted file mode 100644 index ad9990af2ff..00000000000 --- a/applications/plugins/ModelOrderReduction/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/SofaDefrost/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/PSL/GitConfig.cmake b/applications/plugins/PSL/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/plugins/PSL/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/PluginExample/GitConfig.cmake b/applications/plugins/PluginExample/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/plugins/PluginExample/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/PluginExample/GitconfigExample.md b/applications/plugins/PluginExample/GitconfigExample.md deleted file mode 100644 index 1f685f5f698..00000000000 --- a/applications/plugins/PluginExample/GitconfigExample.md +++ /dev/null @@ -1,11 +0,0 @@ -# GitConfig PluginExample - -This example of plugin has been converted to an external repository, and it is used as a showcase of: - - how to write a plugin for SOFA (CMake, file structure, code) - - how to configure the plugin to be fetchable from CMake. - -The content of the plugin is now located at: https://github.com/sofa-framework/PluginExample - -The associated *GitConfig.cmake* describes how to fetch from a repository, automatically at the cmake configure time. -Finally, one has to declare this plugin in the root CMakefile, where he will declare this plugin as external, using *add_sofa_plugin_external( )* -Once fetched, this directory will be populated with the current code pointed in the *GitConfig.cmake* file. diff --git a/applications/plugins/Registration/GitConfig.cmake b/applications/plugins/Registration/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/plugins/Registration/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/STLIB/GitConfig.cmake b/applications/plugins/STLIB/GitConfig.cmake deleted file mode 100644 index ad9990af2ff..00000000000 --- a/applications/plugins/STLIB/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/SofaDefrost/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/ShapeMatchingPlugin/GitConfig.cmake b/applications/plugins/ShapeMatchingPlugin/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/plugins/ShapeMatchingPlugin/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/Sofa.Metis/GitConfig.cmake b/applications/plugins/Sofa.Metis/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/plugins/Sofa.Metis/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/SofaHighOrder/GitConfig.cmake b/applications/plugins/SofaHighOrder/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/plugins/SofaHighOrder/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/SofaPython3/GitConfig.cmake b/applications/plugins/SofaPython3/GitConfig.cmake deleted file mode 100644 index 760302bd9b4..00000000000 --- a/applications/plugins/SofaPython3/GitConfig.cmake +++ /dev/null @@ -1,6 +0,0 @@ -get_filename_component(ProjectId ${CMAKE_CURRENT_LIST_DIR} NAME) -string(REPLACE "\." "_" fixed_name ${ProjectId}) -string(TOUPPER ${fixed_name} fixed_name) - -set(${fixed_name}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${ProjectId}.git" CACHE STRING "Repository address" ) -set(${fixed_name}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/SofaSphFluid/GitConfig.cmake b/applications/plugins/SofaSphFluid/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/plugins/SofaSphFluid/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/SofaValidation/GitConfig.cmake b/applications/plugins/SofaValidation/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/plugins/SofaValidation/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/plugins/SoftRobots/GitConfig.cmake b/applications/plugins/SoftRobots/GitConfig.cmake deleted file mode 100644 index ad9990af2ff..00000000000 --- a/applications/plugins/SoftRobots/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/SofaDefrost/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/projects/CMakeLists.txt b/applications/projects/CMakeLists.txt index 38605d075b1..5fc82555379 100644 --- a/applications/projects/CMakeLists.txt +++ b/applications/projects/CMakeLists.txt @@ -5,9 +5,10 @@ sofa_add_subdirectory(application Modeler Modeler OFF) sofa_add_subdirectory(application SofaPhysicsAPI SofaPhysicsAPI) -sofa_add_subdirectory(directory SofaGLFW SofaGLFW EXTERNAL GIT_REF master) -sofa_add_subdirectory(plugin Sofa.Qt Sofa.Qt EXTERNAL GIT_REF master OFF) +sofa_add_external(directory SofaGLFW GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/SofaGLFW.git) +sofa_add_external(plugin Sofa.Qt GIT_REF master OFF GIT_REPOSITORY https://www.github.com/sofa-framework/Sofa.Qt.git) sofa_add_subdirectory(application runSofa runSofa ON) -sofa_add_subdirectory(directory Regression Regression EXTERNAL GIT_REF master) +sofa_add_external(directory Regression GIT_REF master GIT_REPOSITORY https://www.github.com/sofa-framework/Regression.git) sofa_add_subdirectory(application sofaProjectExample sofaProjectExample) + diff --git a/applications/projects/Regression/GitConfig.cmake b/applications/projects/Regression/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/projects/Regression/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/projects/Sofa.Qt/GitConfig.cmake b/applications/projects/Sofa.Qt/GitConfig.cmake deleted file mode 100644 index 56ae1e087f0..00000000000 --- a/applications/projects/Sofa.Qt/GitConfig.cmake +++ /dev/null @@ -1,4 +0,0 @@ -get_name_from_source_dir() #This macro will define two variables {inner-project-name} {inner-project-name-upper} from the name of the directory containing this file - -set(${inner-project-name-upper}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${inner-project-name}.git" CACHE STRING "Repository address" ) -set(${inner-project-name-upper}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file diff --git a/applications/projects/SofaGLFW/GitConfig.cmake b/applications/projects/SofaGLFW/GitConfig.cmake deleted file mode 100644 index 760302bd9b4..00000000000 --- a/applications/projects/SofaGLFW/GitConfig.cmake +++ /dev/null @@ -1,6 +0,0 @@ -get_filename_component(ProjectId ${CMAKE_CURRENT_LIST_DIR} NAME) -string(REPLACE "\." "_" fixed_name ${ProjectId}) -string(TOUPPER ${fixed_name} fixed_name) - -set(${fixed_name}_GIT_REPOSITORY "https://www.github.com/sofa-framework/${ProjectId}.git" CACHE STRING "Repository address" ) -set(${fixed_name}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) \ No newline at end of file From 460eb2bb38d9d9a1dcc39d8702a27b59c30f3455 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Wed, 2 Apr 2025 13:58:53 +0200 Subject: [PATCH 6/6] Fix config --- .../framework/Config/cmake/SofaMacrosConfigure.cmake | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake b/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake index 895f28d138c..2038c25a30d 100644 --- a/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake +++ b/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake @@ -228,15 +228,17 @@ function(sofa_add_generic_external name type) # Fetch if(${fetch_enabled}) - message("Fetching ${type_lower} ${name}") + set(${upper_name}_GIT_REPOSITORY "${ARG_GIT_REPOSITORY}" CACHE STRING "Repository address" ) + set(${upper_name}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) + + message("Fetching ${type_lower} ${name} in ${fetched_dir}") + message(STATUS "Checkout reference ${${upper_name}_GIT_TAG} from repository ${${upper_name}_GIT_REPOSITORY} ") #Generate temporary folder to store project that will fetch the sources if(NOT EXISTS ${fetched_dir}-temp) file(MAKE_DIRECTORY "${fetched_dir}-temp/") endif() - set(${PROJECT_NAME}_GIT_REPOSITORY "${ARG_GIT_REPOSITORY}" CACHE STRING "Repository address" ) - set(${PROJECT_NAME}_GIT_TAG "${ARG_GIT_REF}" CACHE STRING "Branch or commit SHA to checkout" ) file(WRITE ${fetched_dir}-temp/CMakeLists.txt " cmake_minimum_required(VERSION 3.22) @@ -266,6 +268,10 @@ function(sofa_add_generic_external name type) OUTPUT_VARIABLE build_logs ERROR_VARIABLE build_logs) file(APPEND "${fetched_dir}-temp/logs.txt" "${build_logs}") + if(NOT generate_exitcode EQUAL 0 OR NOT build_exitcode EQUAL 0) + message(SEND_ERROR "Failed to fetch external repository ${name}." "\nSee logs in ${fetched_dir}/logs.txt") + endif() + endif() # Add