Skip to content

Commit

Permalink
[All] Add GIT_REF option for external plugins (sofa-framework#4448)
Browse files Browse the repository at this point in the history
* Add option git_ref to specify which branch to checkout

* forgot about the projects
  • Loading branch information
bakpaul authored Jan 26, 2024
1 parent d3d20a1 commit 5288d25
Show file tree
Hide file tree
Showing 20 changed files with 43 additions and 37 deletions.
12 changes: 9 additions & 3 deletions Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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})

Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
30 changes: 15 additions & 15 deletions applications/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
2 changes: 1 addition & 1 deletion applications/plugins/PSL/ExternalProjectConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
2 changes: 1 addition & 1 deletion applications/plugins/STLIB/ExternalProjectConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
4 changes: 2 additions & 2 deletions applications/projects/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down

0 comments on commit 5288d25

Please sign in to comment.