diff --git a/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake b/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake index acb4d2d31b7..0c69342ab15 100644 --- a/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake +++ b/Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake @@ -187,7 +187,7 @@ endmacro() # function(sofa_add_generic_external directory name type) set(optionArgs FETCH_ONLY) - set(oneValueArgs DEFAULT_VALUE WHEN_TO_SHOW VALUE_IF_HIDDEN) + set(oneValueArgs DEFAULT_VALUE WHEN_TO_SHOW VALUE_IF_HIDDEN GIT_REF) set(multiValueArgs) cmake_parse_arguments("ARG" "${optionArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -223,6 +223,11 @@ function(sofa_add_generic_external directory name type) 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() + endif() + if(NOT EXISTS ${fetched_dir}) file(MAKE_DIRECTORY "${fetched_dir}/") endif() @@ -275,7 +280,7 @@ endfunction() macro(sofa_add_subdirectory type directory name) set(optionArgs EXTERNAL EXPERIMENTAL) - set(oneValueArgs) + set(oneValueArgs GIT_REF) set(multiValueArgs) cmake_parse_arguments("ARG" "${optionArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -291,8 +296,9 @@ macro(sofa_add_subdirectory type directory name) set(default_value ON) endif() + if(ARG_EXTERNAL) - sofa_add_generic_external(${directory} ${name} "External ${type_lower}" DEFAULT_VALUE ${default_value} ${ARGN}) + 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() diff --git a/applications/plugins/BeamAdapter/ExternalProjectConfig.cmake.in b/applications/plugins/BeamAdapter/ExternalProjectConfig.cmake.in index 5aa30f64ba1..88d1964e2a6 100644 --- a/applications/plugins/BeamAdapter/ExternalProjectConfig.cmake.in +++ b/applications/plugins/BeamAdapter/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.11) include(ExternalProject) ExternalProject_Add(BeamAdapter GIT_REPOSITORY https://github.com/sofa-framework/BeamAdapter - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/BeamAdapter" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/plugins/CGALPlugin/ExternalProjectConfig.cmake.in b/applications/plugins/CGALPlugin/ExternalProjectConfig.cmake.in index c87a29bb1af..9c2696cbf87 100644 --- a/applications/plugins/CGALPlugin/ExternalProjectConfig.cmake.in +++ b/applications/plugins/CGALPlugin/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.11) include(ExternalProject) ExternalProject_Add(CGALPlugin GIT_REPOSITORY https://github.com/sofa-framework/CGALPlugin - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/CGALPlugin" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/plugins/CMakeLists.txt b/applications/plugins/CMakeLists.txt index ba0a49e6d0f..6a893fc483f 100644 --- a/applications/plugins/CMakeLists.txt +++ b/applications/plugins/CMakeLists.txt @@ -9,7 +9,7 @@ endif() sofa_add_subdirectory(plugin CollisionOBBCapsule CollisionOBBCapsule) -sofa_add_subdirectory(directory SofaHighOrder SofaHighOrder EXTERNAL) +sofa_add_subdirectory(directory SofaHighOrder SofaHighOrder EXTERNAL GIT_REF master) sofa_add_subdirectory(plugin CImgPlugin CImgPlugin) # ON by default and first as it is used by other plugins. sofa_add_subdirectory(plugin ArticulatedSystemPlugin ArticulatedSystemPlugin ON) @@ -22,15 +22,15 @@ sofa_add_subdirectory(plugin DiffusionSolver DiffusionSolver) # Depends on CImgP 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) -sofa_add_subdirectory(plugin CGALPlugin CGALPlugin EXTERNAL) # Depends on image -sofa_add_subdirectory(plugin Registration Registration EXTERNAL) # Depends on image, SofaPython, SofaGui and SofaDistanceGrid +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_subdirectory(plugin BulletCollisionDetection BulletCollisionDetection) # Depends on Compliant and LMConstraint sofa_add_subdirectory(plugin ExternalBehaviorModel ExternalBehaviorModel OFF WHEN_TO_SHOW "SOFA_ENABLE_LEGACY_HEADERS" VALUE_IF_HIDDEN OFF) -sofa_add_subdirectory(plugin InvertibleFVM InvertibleFVM EXTERNAL) +sofa_add_subdirectory(plugin InvertibleFVM InvertibleFVM EXTERNAL GIT_REF master) sofa_add_subdirectory(plugin MeshSTEPLoader MeshSTEPLoader) -sofa_add_subdirectory(plugin PluginExample PluginExample EXTERNAL) -sofa_add_subdirectory(plugin ManifoldTopologies ManifoldTopologies EXTERNAL) +sofa_add_subdirectory(plugin PluginExample PluginExample EXTERNAL GIT_REF master) +sofa_add_subdirectory(plugin ManifoldTopologies ManifoldTopologies EXTERNAL GIT_REF master) sofa_add_subdirectory(plugin SixenseHydra SixenseHydra) sofa_add_subdirectory(plugin SofaOpenCL SofaOpenCL) sofa_add_subdirectory(plugin Xitact Xitact) @@ -45,16 +45,16 @@ 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 ON) # Depends on image, CImgPlugin -sofa_add_subdirectory(plugin BeamAdapter BeamAdapter EXTERNAL) -sofa_add_subdirectory(plugin STLIB STLIB EXTERNAL) -sofa_add_subdirectory(plugin SoftRobots SoftRobots EXTERNAL) -sofa_add_subdirectory(plugin CollisionAlgorithm CollisionAlgorithm EXTERNAL) -sofa_add_subdirectory(plugin ConstraintGeometry ConstraintGeometry EXTERNAL) -sofa_add_subdirectory(plugin ShapeMatchingPlugin ShapeMatchingPlugin EXTERNAL) -sofa_add_subdirectory(plugin CSparseSolvers CSparseSolvers EXTERNAL) +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 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 PSL PSL EXTERNAL) +sofa_add_subdirectory(plugin PSL PSL EXTERNAL GIT_REF master) 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/ExternalProjectConfig.cmake.in b/applications/plugins/CSparseSolvers/ExternalProjectConfig.cmake.in index 989dbe70379..bf0b64b9e25 100644 --- a/applications/plugins/CSparseSolvers/ExternalProjectConfig.cmake.in +++ b/applications/plugins/CSparseSolvers/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.11) include(ExternalProject) ExternalProject_Add(CSparseSolvers GIT_REPOSITORY https://github.com/sofa-framework/CSparseSolvers - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/CSparseSolvers" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/plugins/CollisionAlgorithm/ExternalProjectConfig.cmake.in b/applications/plugins/CollisionAlgorithm/ExternalProjectConfig.cmake.in index 372f6dbf768..d3c343a415a 100644 --- a/applications/plugins/CollisionAlgorithm/ExternalProjectConfig.cmake.in +++ b/applications/plugins/CollisionAlgorithm/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.11) include(ExternalProject) ExternalProject_Add(CollisionAlgorithm GIT_REPOSITORY https://github.com/courtecuisse/CollisionAlgorithm.git - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/CollisionAlgorithm" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/plugins/ConstraintGeometry/ExternalProjectConfig.cmake.in b/applications/plugins/ConstraintGeometry/ExternalProjectConfig.cmake.in index 4c10f3667bf..b91fe26f047 100644 --- a/applications/plugins/ConstraintGeometry/ExternalProjectConfig.cmake.in +++ b/applications/plugins/ConstraintGeometry/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.11) include(ExternalProject) ExternalProject_Add(ConstraintGeometry GIT_REPOSITORY https://github.com/courtecuisse/ConstraintGeometry.git - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/ConstraintGeometry" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/plugins/InvertibleFVM/ExternalProjectConfig.cmake.in b/applications/plugins/InvertibleFVM/ExternalProjectConfig.cmake.in index e3a5812dc20..e5e17538b36 100644 --- a/applications/plugins/InvertibleFVM/ExternalProjectConfig.cmake.in +++ b/applications/plugins/InvertibleFVM/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.2) include(ExternalProject) ExternalProject_Add(InvertibleFVM GIT_REPOSITORY https://github.com/sofa-framework/InvertibleFVM - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/InvertibleFVM" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/plugins/ManifoldTopologies/ExternalProjectConfig.cmake.in b/applications/plugins/ManifoldTopologies/ExternalProjectConfig.cmake.in index 94d5f942f6f..8146ab01c2c 100644 --- a/applications/plugins/ManifoldTopologies/ExternalProjectConfig.cmake.in +++ b/applications/plugins/ManifoldTopologies/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.11) include(ExternalProject) ExternalProject_Add(ManifoldTopologies GIT_REPOSITORY https://github.com/sofa-framework/ManifoldTopologies - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/ManifoldTopologies" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/plugins/PSL/ExternalProjectConfig.cmake.in b/applications/plugins/PSL/ExternalProjectConfig.cmake.in index f63a0e8a7a2..1ec08590cee 100644 --- a/applications/plugins/PSL/ExternalProjectConfig.cmake.in +++ b/applications/plugins/PSL/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.11) include(ExternalProject) ExternalProject_Add(PSL GIT_REPOSITORY https://github.com/sofa-framework/PSL - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/PSL" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/plugins/PluginExample/ExternalProjectConfig.cmake.in b/applications/plugins/PluginExample/ExternalProjectConfig.cmake.in index d0a67e5b63c..21e5d458439 100644 --- a/applications/plugins/PluginExample/ExternalProjectConfig.cmake.in +++ b/applications/plugins/PluginExample/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.11) include(ExternalProject) ExternalProject_Add(PluginExample GIT_REPOSITORY https://github.com/sofa-framework/PluginExample - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/PluginExample" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/plugins/Registration/ExternalProjectConfig.cmake.in b/applications/plugins/Registration/ExternalProjectConfig.cmake.in index 549b35faee0..768f1708ae2 100644 --- a/applications/plugins/Registration/ExternalProjectConfig.cmake.in +++ b/applications/plugins/Registration/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.11) include(ExternalProject) ExternalProject_Add(Registration GIT_REPOSITORY https://github.com/sofa-framework/Registration - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/Registration" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/plugins/STLIB/ExternalProjectConfig.cmake.in b/applications/plugins/STLIB/ExternalProjectConfig.cmake.in index 4a31917ad70..dbf37a68576 100644 --- a/applications/plugins/STLIB/ExternalProjectConfig.cmake.in +++ b/applications/plugins/STLIB/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.11) include(ExternalProject) ExternalProject_Add(STLIB GIT_REPOSITORY https://github.com/SofaDefrost/STLIB - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/STLIB" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/plugins/ShapeMatchingPlugin/ExternalProjectConfig.cmake.in b/applications/plugins/ShapeMatchingPlugin/ExternalProjectConfig.cmake.in index 3fbe8291ebd..8a6b093ddf8 100644 --- a/applications/plugins/ShapeMatchingPlugin/ExternalProjectConfig.cmake.in +++ b/applications/plugins/ShapeMatchingPlugin/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.11) include(ExternalProject) ExternalProject_Add(ShapeMatchingPlugin GIT_REPOSITORY https://github.com/sofa-framework/ShapeMatchingPlugin - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/ShapeMatchingPlugin" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/plugins/SofaHighOrder/ExternalProjectConfig.cmake.in b/applications/plugins/SofaHighOrder/ExternalProjectConfig.cmake.in index 7824bce591b..b21792528d9 100644 --- a/applications/plugins/SofaHighOrder/ExternalProjectConfig.cmake.in +++ b/applications/plugins/SofaHighOrder/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.2) include(ExternalProject) ExternalProject_Add(SofaHighOrder GIT_REPOSITORY https://github.com/sofa-framework/SofaHighOrder - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/SofaHighOrder" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/plugins/SofaPython3/ExternalProjectConfig.cmake.in b/applications/plugins/SofaPython3/ExternalProjectConfig.cmake.in index 1eebd415fc3..965cff02750 100644 --- a/applications/plugins/SofaPython3/ExternalProjectConfig.cmake.in +++ b/applications/plugins/SofaPython3/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.11) include(ExternalProject) ExternalProject_Add(SofaPython3 GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/SofaPython3" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/plugins/SoftRobots/ExternalProjectConfig.cmake.in b/applications/plugins/SoftRobots/ExternalProjectConfig.cmake.in index 566d848f869..88e6563933c 100644 --- a/applications/plugins/SoftRobots/ExternalProjectConfig.cmake.in +++ b/applications/plugins/SoftRobots/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.11) include(ExternalProject) ExternalProject_Add(SoftRobots GIT_REPOSITORY https://github.com/SofaDefrost/SoftRobots - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/plugins/SoftRobots" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/projects/CMakeLists.txt b/applications/projects/CMakeLists.txt index 8669b0a1415..e7cb9c14e21 100644 --- a/applications/projects/CMakeLists.txt +++ b/applications/projects/CMakeLists.txt @@ -13,7 +13,7 @@ sofa_add_subdirectory(application SofaGuiGlut SofaGuiGlut OFF) sofa_add_subdirectory(application runSofa runSofa ON) sofa_add_subdirectory(application sofaOPENCL sofaOPENCL OFF) -sofa_add_subdirectory(directory Regression Regression EXTERNAL) -sofa_add_subdirectory(directory SofaGLFW SofaGLFW EXTERNAL) +sofa_add_subdirectory(directory Regression Regression EXTERNAL GIT_REF master) +sofa_add_subdirectory(directory SofaGLFW SofaGLFW EXTERNAL GIT_REF master) sofa_add_subdirectory(application sofaProjectExample sofaProjectExample) sofa_add_subdirectory(application sofaInfo sofaInfo) diff --git a/applications/projects/Regression/ExternalProjectConfig.cmake.in b/applications/projects/Regression/ExternalProjectConfig.cmake.in index 6653d4075ff..9d1b66e6dd3 100644 --- a/applications/projects/Regression/ExternalProjectConfig.cmake.in +++ b/applications/projects/Regression/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.2) include(ExternalProject) ExternalProject_Add(Regression GIT_REPOSITORY https://github.com/sofa-framework/regression - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/projects/Regression" BINARY_DIR "" CONFIGURE_COMMAND "" diff --git a/applications/projects/SofaGLFW/ExternalProjectConfig.cmake.in b/applications/projects/SofaGLFW/ExternalProjectConfig.cmake.in index fd3922006de..22d1eaf4f1c 100644 --- a/applications/projects/SofaGLFW/ExternalProjectConfig.cmake.in +++ b/applications/projects/SofaGLFW/ExternalProjectConfig.cmake.in @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.11) include(ExternalProject) ExternalProject_Add(SofaGLFW GIT_REPOSITORY https://github.com/sofa-framework/SofaGLFW - GIT_TAG origin/master + GIT_TAG origin/@ARG_GIT_REF@ SOURCE_DIR "${CMAKE_SOURCE_DIR}/applications/projects/SofaGLFW" BINARY_DIR "" CONFIGURE_COMMAND ""