Page MenuHomePhabricator

0002-Changes-to-bring-SOFA-16.12-in-MITK-superbuild.patch

Authored By
menguy
Sep 6 2017, 4:59 PM
Size
26 KB
Referenced Files
None
Subscribers
None

0002-Changes-to-bring-SOFA-16.12-in-MITK-superbuild.patch

From 5ab71e9a8d35aa376b76517d35916155b0f51a64 Mon Sep 17 00:00:00 2001
From: Pierre-Yves Menguy <p-yves.menguy@udamail.fr>
Date: Fri, 4 Aug 2017 17:14:01 +0200
Subject: [PATCH 2/2] Changes in CMake files to bring SOFA 16.12 in MITK superbuild
Signed-off-by: Pierre-Yves Menguy <p-yves.menguy@udamail.fr>
---
CMakeExternals/PatchSOFA-386a3a7+7568b4.cmake | 282 +++++++++-----------------
CMakeExternals/PatchSOFA-v16.12.cmake | 9 +
CMakeExternals/SOFA.cmake | 42 ++--
CMakeExternals/SOFAConfig.cmake.in | 23 +++
CMakeExternals/sofa-custom.cmake | 23 +++
CMakeLists.txt | 25 ++-
6 files changed, 201 insertions(+), 203 deletions(-)
create mode 100644 CMakeExternals/PatchSOFA-v16.12.cmake
create mode 100644 CMakeExternals/SOFAConfig.cmake.in
create mode 100644 CMakeExternals/sofa-custom.cmake
diff --git a/CMakeExternals/PatchSOFA-386a3a7+7568b4.cmake b/CMakeExternals/PatchSOFA-386a3a7+7568b4.cmake
index 65b801e..b5d4f06 100644
--- a/CMakeExternals/PatchSOFA-386a3a7+7568b4.cmake
+++ b/CMakeExternals/PatchSOFA-386a3a7+7568b4.cmake
@@ -1,104 +1,3 @@
-# Changes of cmake/dependencies.cmake are commented separately below
-
-set(path "cmake/dependencies.cmake")
-file(STRINGS ${path} CONTENTS NEWLINE_CONSUME)
-
-# Comment out add_subdirectory() commands that reference the SOFA applications
-# directory
-
-string(REPLACE "add_subdirectory(\"\${SOFA_A" "#add_subdirectory(\"\${SOFA_A" CONTENTS ${CONTENTS})
-
-# Rename tinyxml to SofaTinyXml since MITK has its own version of tinyxml and
-# the same name lead to linker or runtime errors in the past
-
-string(REPLACE "\"tinyxml\"" "\"SofaTinyXml\"" CONTENTS ${CONTENTS})
-
-# Use MITK's version of Eigen
-string(REPLACE "RegisterProjects(\"eigen\" PATH \"\${SOFA-EXTERNAL_EIGEN_PATH}\" COMPILE_DEFINITIONS SOFA_HAVE_EIGEN2)" "add_library(eigen INTERFACE IMPORTED GLOBAL)\nset_property(TARGET eigen APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES \${SOFA-EXTERNAL_EIGEN_PATH})\nset(GLOBAL_PROJECT_DEPENDENCIES_COMPLETE_eigen 1 CACHE INTERNAL \"\" FORCE)\nlist(APPEND GLOBAL_INCLUDE_DIRECTORIES \"\${SOFA-EXTERNAL_EIGEN_PATH}\")" CONTENTS ${CONTENTS})
-
-configure_file(${TEMPLATE_FILE} ${path} @ONLY)
-
-# Adjust tinyxml references (see above)
-
-set(path "framework/sofa/helper/CMakeLists.txt")
-file(STRINGS ${path} CONTENTS NEWLINE_CONSUME)
-string(REPLACE "tinyxml" "SofaTinyXml" CONTENTS ${CONTENTS})
-configure_file(${TEMPLATE_FILE} ${path} @ONLY)
-
-set(path "modules/sofa/component/SofaBaseVisual/CMakeLists.txt")
-file(STRINGS ${path} CONTENTS NEWLINE_CONSUME)
-string(REPLACE "tinyxml" "SofaTinyXml" CONTENTS ${CONTENTS})
-configure_file(${TEMPLATE_FILE} ${path} @ONLY)
-
-set(path "modules/sofa/component/SofaLoader/CMakeLists.txt")
-file(STRINGS ${path} CONTENTS NEWLINE_CONSUME)
-string(REPLACE "tinyxml" "SofaTinyXml" CONTENTS ${CONTENTS})
-configure_file(${TEMPLATE_FILE} ${path} @ONLY)
-
-set(path "modules/sofa/simulation/common/CMakeLists.txt")
-file(STRINGS ${path} CONTENTS NEWLINE_CONSUME)
-string(REPLACE "tinyxml" "SofaTinyXml" CONTENTS ${CONTENTS})
-configure_file(${TEMPLATE_FILE} ${path} @ONLY)
-
-# Changes of cmake/environment.cmake are commented separately below
-
-set(path "cmake/environment.cmake")
-file(STRINGS ${path} CONTENTS NEWLINE_CONSUME)
-
-# Allow setting SOFA_APPLICATIONS_PLUGINS_DIR from outside
-
-string(REPLACE "S_DIR}/plugins\" CACHE INTERNAL" "S_DIR}/plugins\" CACHE PATH" CONTENTS ${CONTENTS})
-
-# Place binaries and libraries in different subfolders according to the build
-# configuration
-
-string(REPLACE "DEBUG \"\${directory}" "DEBUG \"\${directory}/Debug" CONTENTS ${CONTENTS})
-string(REPLACE "RELEASE \"\${directory}" "RELEASE \"\${directory}/Release" CONTENTS ${CONTENTS})
-string(REPLACE "RELWITHDEBINFO \"\${directory}" "RELWITHDEBINFO \"\${directory}/RelWithDebInfo" CONTENTS ${CONTENTS})
-string(REPLACE "MINSIZEREL \"\${directory}" "MINSIZEREL \"\${directory}/MinSizeRel" CONTENTS ${CONTENTS})
-
-configure_file(${TEMPLATE_FILE} ${path} @ONLY)
-
-# Binary directories in add_subdirectory() regarding external plugins have to be explicitly specified
-
-set(path "cmake/functions.cmake")
-file(STRINGS ${path} CONTENTS NEWLINE_CONSUME)
-string(REPLACE "add_subdirectory(\"\${GLOBAL_PROJECT_PATH_\${projectName}}\")"
-"if(\${GLOBAL_PROJECT_PATH_\${projectName}} MATCHES ^\${CMAKE_SOURCE_DIR}.*)
- add_subdirectory(\"\${GLOBAL_PROJECT_PATH_\${projectName}}\")
- else()
- string(LENGTH \"\${SOFA_APPLICATIONS_PLUGINS_DIR}\" begin)
- string(SUBSTRING \"\${GLOBAL_PROJECT_PATH_\${projectName}}\" \${begin} -1 subdir)
- add_subdirectory(\"\${GLOBAL_PROJECT_PATH_\${projectName}}\" \"\${CMAKE_BINARY_DIR}/applications/plugins\${subdir}\")
- endif()"
-CONTENTS ${CONTENTS})
-configure_file(${TEMPLATE_FILE} ${path} @ONLY)
-
-# Remove SOFA's FindGLEW.cmake since we need the official FindGLEW.cmake to
-# inject the MITK superbuild version of GLEW into SOFA
-
-file(REMOVE "cmake/Modules/FindGLEW.cmake")
-
-# Changes of cmake/externals.cmake are commented separately below
-
-set(path "cmake/externals.cmake")
-file(STRINGS ${path} CONTENTS NEWLINE_CONSUME)
-
-# Enhance GLUT and GLEW finding routine to regard externally injected GLUT and
-# GLEW libraries
-
-string(REPLACE "set(GLUT_LIBRARIES \"freeglut\")" "find_package(GLUT REQUIRED)" CONTENTS ${CONTENTS})
-string(REPLACE "set(GLEW_LIBRARIES \"glew32\")" "find_package(GLEW REQUIRED)" CONTENTS ${CONTENTS})
-string(REPLACE "else()\n set(O" " list(APPEND GLOBAL_INCLUDE_DIRECTORIES \"\${GLUT_INCLUDE_DIRS}\" \"\${GLEW_INCLUDE_DIRS}\")\nelse()\n set(O" CONTENTS ${CONTENTS})
-string(REPLACE "GLUT REQUIRED" "GLUT REQUIRED CONFIG" CONTENTS ${CONTENTS})
-string(REPLACE "GLEW REQUIRED" "GLEW REQUIRED CONFIG" CONTENTS ${CONTENTS})
-
-# Remove Boost binary graph dependency because it is not straight forward to
-# compile on all plattforms and its header-only part is enough
-
-string(REPLACE "graph " "" CONTENTS ${CONTENTS})
-configure_file(${TEMPLATE_FILE} ${path} @ONLY)
-
# Changes of CMakeLists.txt are commented separately below
set(path "CMakeLists.txt")
@@ -127,36 +26,6 @@ string(REPLACE "\nendif()" "\nendif()\n\nconfigure_file(SOFAConfig.cmake.in SOFA
configure_file(${TEMPLATE_FILE} ${path} @ONLY)
-# Do not define snprintf starting with Visual Studio 2015.
-
-set(path "framework/sofa/helper/system/config.h")
-file(STRINGS ${path} CONTENTS NEWLINE_CONSUME)
-string(REPLACE "#define snprintf _snprintf" "#if (_MSC_VER < 1900)\n#define snprintf _snprintf\n#endif" CONTENTS ${CONTENTS})
-configure_file(${TEMPLATE_FILE} ${path} @ONLY)
-
-set(path "extlibs/miniFlowVR/src/ftlm/type.cpp")
-file(STRINGS ${path} CONTENTS NEWLINE_CONSUME)
-string(REPLACE "#define snprintf _snprintf" "#if (_MSC_VER < 1900)\n#define snprintf _snprintf\n#endif" CONTENTS ${CONTENTS})
-configure_file(${TEMPLATE_FILE} ${path} @ONLY)
-
-# Include Eigen/Core in RigidMapping.inl.
-
-set(path "modules/sofa/component/mapping/RigidMapping.inl")
-file(STRINGS ${path} CONTENTS NEWLINE_CONSUME)
-string(REPLACE "#include <cassert>" "#include <cassert>\n#include <Eigen/Core>" CONTENTS ${CONTENTS})
-configure_file(${TEMPLATE_FILE} ${path} @ONLY)
-
-# Use unordered_map instead of hash_map.
-
-set(path "modules/sofa/component/container/SpatialGridContainer.h")
-file(STRINGS ${path} CONTENTS NEWLINE_CONSUME)
-string(REPLACE "hash_map" "unordered_map" CONTENTS ${CONTENTS})
-configure_file(${TEMPLATE_FILE} ${path} @ONLY)
-
-set(path "modules/sofa/component/container/SpatialGridContainer.h")
-file(STRINGS ${path} CONTENTS NEWLINE_CONSUME)
-string(REPLACE "stdext" "std" CONTENTS ${CONTENTS})
-configure_file(${TEMPLATE_FILE} ${path} @ONLY)
# Create SOFAConfig.cmake.in file to make SOFA findable through the config mode
# of find_package()
@@ -164,68 +33,103 @@ configure_file(${TEMPLATE_FILE} ${path} @ONLY)
file(WRITE "SOFAConfig.cmake.in"
"add_definitions(-DSOFA_XML_PARSER_TINYXML;-DTIXML_USE_STL;-DMINI_FLOWVR;-DSOFA_HAVE_BOOST;-DSOFA_HAVE_CSPARSE;-DSOFA_HAVE_DAG;-DSOFA_HAVE_EIGEN2;-DSOFA_HAVE_FREEGLUT;-DSOFA_HAVE_GLEW;-DSOFA_HAVE_METIS)
-set(SOFA_INCLUDE_DIRS \"@SOFA_EXTLIBS_DIR@/csparse;@SOFA_EXTLIBS_DIR@/eigen-3.2.1;@SOFA_EXTLIBS_DIR@/metis-5.1.0/include;@SOFA_EXTLIBS_DIR@/miniFlowVR/include;@SOFA_EXTLIBS_DIR@/newmat;@SOFA_EXTLIBS_DIR@/tinyxml;@SOFA_SRC_DIR@/framework;@SOFA_SRC_DIR@/modules\")
+set(SOFA_INCLUDE_DIRS "@SOFA_EXTLIBS_DIR@/csparse;@SOFA_KERNEL_EXTLIBS_DIR@/eigen-3.2.7;@SOFA_EXTLIBS_DIR@/metis-5.1.0/include;@SOFA_EXTLIBS_DIR@/miniFlowVR/include;@SOFA_KERNEL_EXTLIBS_DIR@/newmat;@SOFA_KERNEL_EXTLIBS_DIR@/tinyxml;@SOFA_KERNEL_SOURCE_DIR@/framework;@SOFA_KERNEL_SOURCE_DIR@/modules;@SOFA_DIR@/modules;@SOFA_DIR@/applications;@SOFA_BUILD_DIR@/include")
+
+# include directories
+# @SOFA_EXTLIBS_DIR@/csparse
+# @SOFA_KERNEL_EXTLIBS_DIR@/eigen-3.2.7
+# @SOFA_EXTLIBS_DIR@/metis-5.1.0/include
+# @SOFA_EXTLIBS_DIR@/miniFlowVR/include
+# @SOFA_KERNEL_EXTLIBS_DIR@/newmat
+# @SOFA_KERNEL_EXTLIBS_DIR@/tinyxml
+# @SOFA_KERNEL_SOURCE_DIR@/framework
+# @SOFA_KERNEL_SOURCE_DIR@/modules
+# @SOFA_DIR@/modules
+# @SOFA_DIR@/applications
+# @SOFA_BUILD_DIR@/include
if(WIN32)
- set(SOFA_LIBRARY_DIRS \"@SOFA_LIB_DIR@\")
- set(version \"_1_0\")
+ set(SOFA_LIBRARY_DIRS "@SOFA_LIB_DIR@")
+ set(version "")
else()
- set(SOFA_LIBRARY_DIRS \"@SOFA_LIB_DIR@/@CMAKE_BUILD_TYPE@\")
- set(version \"\")
+ set(SOFA_LIBRARY_DIRS "@SOFA_LIB_DIR@/@CMAKE_BUILD_TYPE@")
+ set(version "")
endif()
set(SOFA_LIBRARIES
- debug SofaBaseAnimationLoop\${version}d optimized SofaBaseAnimationLoop\${version}
- debug SofaBaseCollision\${version}d optimized SofaBaseCollision\${version}
- debug SofaBaseLinearSolver\${version}d optimized SofaBaseLinearSolver\${version}
- debug SofaBaseMechanics\${version}d optimized SofaBaseMechanics\${version}
- debug SofaBaseTopology\${version}d optimized SofaBaseTopology\${version}
- debug SofaBaseVisual\${version}d optimized SofaBaseVisual\${version}
- debug SofaBoundaryCondition\${version}d optimized SofaBoundaryCondition\${version}
- debug SofaComponentAdvanced\${version}d optimized SofaComponentAdvanced\${version}
- debug SofaComponentBase\${version}d optimized SofaComponentBase\${version}
- debug SofaComponentCommon\${version}d optimized SofaComponentCommon\${version}
- debug SofaComponentGeneral\${version}d optimized SofaComponentGeneral\${version}
- debug SofaComponentMain\${version}d optimized SofaComponentMain\${version}
- debug SofaComponentMisc\${version}d optimized SofaComponentMisc\${version}
- debug SofaConstraint\${version}d optimized SofaConstraint\${version}
- debug SofaCore\${version}d optimized SofaCore\${version}
- debug SofaDefaultType\${version}d optimized SofaDefaultType\${version}
- debug SofaDeformable\${version}d optimized SofaDeformable\${version}
- debug SofaDenseSolver\${version}d optimized SofaDenseSolver\${version}
- debug SofaEigen2Solver\${version}d optimized SofaEigen2Solver\${version}
- debug SofaEngine\${version}d optimized SofaEngine\${version}
- debug SofaEulerianFluid\${version}d optimized SofaEulerianFluid\${version}
- debug SofaExplicitOdeSolver\${version}d optimized SofaExplicitOdeSolver\${version}
- debug SofaExporter\${version}d optimized SofaExporter\${version}
- debug SofaGraphComponent\${version}d optimized SofaGraphComponent\${version}
- debug SofaHaptics\${version}d optimized SofaHaptics\${version}
- debug SofaHelper\${version}d optimized SofaHelper\${version}
- debug SofaImplicitOdeSolver\${version}d optimized SofaImplicitOdeSolver\${version}
- debug SofaLoader\${version}d optimized SofaLoader\${version}
- debug SofaMeshCollision\${version}d optimized SofaMeshCollision\${version}
- debug SofaMisc\${version}d optimized SofaMisc\${version}
- debug SofaMiscCollision\${version}d optimized SofaMiscCollision\${version}
- debug SofaMiscEngine\${version}d optimized SofaMiscEngine\${version}
- debug SofaMiscFem\${version}d optimized SofaMiscFem\${version}
- debug SofaMiscForceField\${version}d optimized SofaMiscForceField\${version}
- debug SofaMiscMapping\${version}d optimized SofaMiscMapping\${version}
- debug SofaMiscSolver\${version}d optimized SofaMiscSolver\${version}
- debug SofaMiscTopology\${version}d optimized SofaMiscTopology\${version}
- debug SofaNonUniformFem\${version}d optimized SofaNonUniformFem\${version}
- debug SofaObjectInteraction\${version}d optimized SofaObjectInteraction\${version}
- debug SofaOpenglVisual\${version}d optimized SofaOpenglVisual\${version}
- debug SofaPreconditioner\${version}d optimized SofaPreconditioner\${version}
- debug SofaRigid\${version}d optimized SofaRigid\${version}
- debug SofaSimpleFem\${version}d optimized SofaSimpleFem\${version}
- debug SofaSimulationCommon\${version}d optimized SofaSimulationCommon\${version}
- debug SofaSimulationGraph\${version}d optimized SofaSimulationGraph\${version}
- debug SofaSimulationTree\${version}d optimized SofaSimulationTree\${version}
- debug SofaSparseSolver\${version}d optimized SofaSparseSolver\${version}
- debug SofaSphFluid\${version}d optimized SofaSphFluid\${version}
- debug SofaTopologyMapping\${version}d optimized SofaTopologyMapping\${version}
- debug SofaUserInteraction\${version}d optimized SofaUserInteraction\${version}
- debug SofaValidation\${version}d optimized SofaValidation\${version}
- debug SofaVolumetricData\${version}d optimized SofaVolumetricData\${version}
- debug SofaTinyXml\${version}d optimized SofaTinyXml\${version}
+ SceneCreator${version}
+ debug SofaBaseCollision${version}_d optimized SofaBaseCollision${version}
+ debug SofaBaseLinearSolver${version}_d optimized SofaBaseLinearSolver${version}
+ debug SofaBaseMechanics${version}_d optimized SofaBaseMechanics${version}
+ debug SofaBaseTopology${version}_d optimized SofaBaseTopology${version}
+ debug SofaBaseVisual${version}_d optimized SofaBaseVisual${version}
+ debug SofaBoundaryCondition${version}_d optimized SofaBoundaryCondition${version}
+ debug SofaComponentAdvanced${version}_d optimized SofaComponentAdvanced${version}
+ debug SofaComponentBase${version}_d optimized SofaComponentBase${version}
+ debug SofaComponentCommon${version}_d optimized SofaComponentCommon${version}
+ debug SofaComponentGeneral${version}_d optimized SofaComponentGeneral${version}
+ debug SofaComponentMisc${version}_d optimized SofaComponentMisc${version}
+ debug SofaConstraint${version}_d optimized SofaConstraint${version}
+ debug SofaCore${version}_d optimized SofaCore${version}
+ debug SofaDefaultType${version}_d optimized SofaDefaultType${version}
+ debug SofaDeformable${version}_d optimized SofaDeformable${version}
+ debug SofaDenseSolver${version}_d optimized SofaDenseSolver${version}
+ debug SofaEigen2Solver${version}_d optimized SofaEigen2Solver${version}
+ debug SofaEngine${version}_d optimized SofaEngine${version}
+ debug SofaEulerianFluid${version}_d optimized SofaEulerianFluid${version}
+ debug SofaExplicitOdeSolver${version}_d optimized SofaExplicitOdeSolver${version}
+ debug SofaExporter${version}_d optimized SofaExporter${version}
+
+ debug SofaGeneralAnimationLoop${version}_d optimized SofaGeneralAnimationLoop${version}
+ debug SofaGeneralDeformable${version}_d optimized SofaGeneralDeformable${version}
+ debug SofaGeneralEngine${version}_d optimized SofaGeneralEngine${version}
+ debug SofaGeneralExplicitOdeSolver${version}_d optimized SofaGeneralExplicitOdeSolver${version}
+ debug SofaGeneralImplicitOdeSolver${version}_d optimized SofaGeneralImplicitOdeSolver${version}
+ debug SofaGeneralLinearSolver${version}_d optimized SofaGeneralLinearSolver${version}
+ debug SofaGeneralLoader${version}_d optimized SofaGeneralLoader${version}
+ debug SofaGeneralMeshCollision${version}_d optimized SofaGeneralMeshCollision${version}
+ debug SofaGeneralObjectInteraction${version}_d optimized SofaGeneralObjectInteraction${version}
+ debug SofaGeneralRigid${version}_d optimized SofaGeneralRigid${version}
+ debug SofaGeneralSimpleFem${version}_d optimized SofaGeneralSimpleFem${version}
+ debug SofaGeneralTopology${version}_d optimized SofaGeneralTopology${version}
+ debug SofaGeneralVisual${version}_d optimized SofaGeneralVisual${version}
+
+ debug SofaGraphComponent${version}_d optimized SofaGraphComponent${version}
+
+ SofaGTestMain${version}
+ debug SofaGuiCommon${version}_d optimized SofaGuiCommon${version}
+ debug SofaGuiMain${version}_d optimized SofaGuiMain${version}
+ debug SofaGuiQt${version}_d optimized SofaGuiQt${version}
+
+ debug SofaHaptics${version}_d optimized SofaHaptics${version}
+ debug SofaHelper${version}_d optimized SofaHelper${version}
+ debug SofaImplicitOdeSolver${version}_d optimized SofaImplicitOdeSolver${version}
+ debug SofaLoader${version}_d optimized SofaLoader${version}
+ debug SofaMeshCollision${version}_d optimized SofaMeshCollision${version}
+ debug SofaMisc${version}_d optimized SofaMisc${version}
+ debug SofaMiscCollision${version}_d optimized SofaMiscCollision${version}
+ debug SofaMiscEngine${version}_d optimized SofaMiscEngine${version}
+ debug SofaMiscFem${version}_d optimized SofaMiscFem${version}
+ debug SofaMiscForceField${version}_d optimized SofaMiscForceField${version}
+ debug SofaMiscMapping${version}_d optimized SofaMiscMapping${version}
+ debug SofaMiscSolver${version}_d optimized SofaMiscSolver${version}
+ debug SofaMiscTopology${version}_d optimized SofaMiscTopology${version}
+ SofaModeler${version}
+ debug SofaNonUniformFem${version}_d optimized SofaNonUniformFem${version}
+ debug SofaObjectInteraction${version}_d optimized SofaObjectInteraction${version}
+ debug SofaOpenglVisual${version}_d optimized SofaOpenglVisual${version}
+ debug SofaPreconditioner${version}_d optimized SofaPreconditioner${version}
+ debug SofaRigid${version}_d optimized SofaRigid${version}
+ debug SofaSimpleFem${version}_d optimized SofaSimpleFem${version}
+ debug SofaSimulationCommon${version}_d optimized SofaSimulationCommon${version}
+ SofaSimulationCore${version}
+ debug SofaSimulationGraph${version}_d optimized SofaSimulationGraph${version}
+ debug SofaSimulationTree${version}_d optimized SofaSimulationTree${version}
+ debug SofaSparseSolver${version}_d optimized SofaSparseSolver${version}
+ debug SofaSphFluid${version}_d optimized SofaSphFluid${version}
+ SofaTest${version}
+ debug SofaTopologyMapping${version}_d optimized SofaTopologyMapping${version}
+ debug SofaUserInteraction${version}_d optimized SofaUserInteraction${version}
+ debug SofaValidation${version}_d optimized SofaValidation${version}
+ debug SofaVolumetricData${version}_d optimized SofaVolumetricData${version}
)")
diff --git a/CMakeExternals/PatchSOFA-v16.12.cmake b/CMakeExternals/PatchSOFA-v16.12.cmake
new file mode 100644
index 0000000..8a0ac22
--- /dev/null
+++ b/CMakeExternals/PatchSOFA-v16.12.cmake
@@ -0,0 +1,9 @@
+# Changes of CMakeLists.txt are commented separately below
+
+
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/sofa-custom.cmake DESTINATION ".")
+file(RENAME sofa-custom.cmake custom.cmake)
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/SOFAConfig.cmake.in DESTINATION ".")
+
diff --git a/CMakeExternals/SOFA.cmake b/CMakeExternals/SOFA.cmake
index 870944f..12a0dcb 100644
--- a/CMakeExternals/SOFA.cmake
+++ b/CMakeExternals/SOFA.cmake
@@ -9,14 +9,17 @@ if(MITK_USE_SOFA)
endif()
set(proj SOFA)
- set(proj_DEPENDENCIES Boost Eigen GLEW)
+ set(proj_DEPENDENCIES Boost Eigen GLEW tinyxml)
set(SOFA_DEPENDS ${proj})
set(preconfigure_cmake_args
-DGLEW_DIR:PATH=${GLEW_DIR}
- -DSOFA-APPLICATION_GENERATERIGID:BOOL=OFF
- -DSOFA-APPLICATION_MODELER:BOOL=OFF
- -DSOFA-APPLICATION_RUNSOFA:BOOL=OFF
+ -DAPPLICATION_GENERATERIGID:BOOL=OFF
+ -DAPPLICATION_MODELER:BOOL=OFF
+ -DAPPLICATION_RUNSOFA:BOOL=OFF
+ -DSOFA_BUILD_TUTORIALS:BOOL=OFF
+ -DSOFA_BUILD_TESTS:BOOL=OFF
+ # Not updated. Useful ? Not sure if Cmake lookup "externals" variables
-DSOFA-EXTERNAL_BOOST:BOOL=ON
-DSOFA-EXTERNAL_BOOST_PATH:PATH=${BOOST_LIBRARYDIR}
-DSOFA-EXTERNAL_CSPARSE:BOOL=ON
@@ -28,10 +31,6 @@ if(MITK_USE_SOFA)
-DSOFA-LIB_GUI_GLUT:BOOL=OFF
-DSOFA-LIB_GUI_QT:BOOL=OFF
-DSOFA-LIB_GUI_QTVIEWER:BOOL=OFF
- -DSOFA-TUTORIAL_COMPOSITE_OBJECT:BOOL=OFF
- -DSOFA-TUTORIAL_MIXED_PENDULUM:BOOL=OFF
- -DSOFA-TUTORIAL_ONE_PARTICLE:BOOL=OFF
- -DSOFA-TUTORIAL_ONE_TETRAHEDRON:BOOL=OFF
)
if(NOT APPLE)
@@ -72,16 +71,19 @@ if(MITK_USE_SOFA)
)
endif()
- set(rev "386a3a7+7568b4")
-
+ set(rev "v16.12")
+
set(SOFA_PATCH_COMMAND ${CMAKE_COMMAND} -DTEMPLATE_FILE:FILEPATH=${MITK_SOURCE_DIR}/CMakeExternals/EmptyFileForPatching.dummy -P ${MITK_SOURCE_DIR}/CMakeExternals/PatchSOFA-${rev}.cmake)
+
set(SOFA_PRECONFIGURE_COMMAND ${CMAKE_COMMAND} -G${gen} ${ep_common_args} ${preconfigure_cmake_args} ${boost_cmake_args} <SOURCE_DIR>)
+ set(SOFA_COPYDIR_COMMAND ${CMAKE_COMMAND} -E copy_directory ${rev} .)
+ set(SOFA_REMOVEDIR_COMMAND ${CMAKE_COMMAND} -E remove_directory ${rev})
if(NOT DEFINED SOFA_DIR)
ExternalProject_Add(${proj}
LIST_SEPARATOR ${sep}
- URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/SOFA-${rev}.tar.gz
- URL_MD5 45ba5a931855f06e30405a60229938ca
+ URL https://github.com/sofa-framework/sofa/archive/${rev}.zip
+ URL_HASH SHA1=8f0c8ac25881d593229360b86906c6f12a8c3d29
PATCH_COMMAND ${SOFA_PATCH_COMMAND}
INSTALL_COMMAND ""
CMAKE_GENERATOR ${gen}
@@ -94,7 +96,20 @@ if(MITK_USE_SOFA)
${ep_common_cache_default_args}
DEPENDS ${proj_DEPENDENCIES}
)
-
+
+ ExternalProject_Add_Step(${proj} copydir
+ COMMAND ${SOFA_COPYDIR_COMMAND}
+ WORKING_DIRECTORY <SOURCE_DIR>
+ DEPENDEES download
+ LOG 1
+ )
+ ExternalProject_Add_Step(${proj} removedir
+ COMMAND ${SOFA_REMOVEDIR_COMMAND}
+ WORKING_DIRECTORY <SOURCE_DIR>
+ DEPENDEES copydir
+ DEPENDERS patch
+ LOG 1
+ )
ExternalProject_Add_Step(${proj} preconfigure
COMMAND ${SOFA_PRECONFIGURE_COMMAND}
WORKING_DIRECTORY <BINARY_DIR>
@@ -107,6 +122,7 @@ if(MITK_USE_SOFA)
# set(SOFA_DIR ${ep_prefix}
ExternalProject_Get_Property(${proj} binary_dir)
set(SOFA_DIR ${binary_dir})
+ mitkFunctionInstallExternalCMakeProject(${proj})
else()
mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
diff --git a/CMakeExternals/SOFAConfig.cmake.in b/CMakeExternals/SOFAConfig.cmake.in
new file mode 100644
index 0000000..d537fe6
--- /dev/null
+++ b/CMakeExternals/SOFAConfig.cmake.in
@@ -0,0 +1,23 @@
+#add_definitions(-DSOFA_XML_PARSER_TINYXML;-DTIXML_USE_STL;-DMINI_FLOWVR;-DSOFA_HAVE_BOOST;-DSOFA_HAVE_CSPARSE;-DSOFA_HAVE_DAG;-DSOFA_HAVE_EIGEN2;-DSOFA_HAVE_FREEGLUT;-DSOFA_HAVE_GLEW;-DSOFA_HAVE_METIS)
+
+list(APPEND CMAKE_PREFIX_PATH "@CMAKE_BINARY_DIR@/cmake")
+list(APPEND CMAKE_PREFIX_PATH "@CMAKE_BINARY_DIR@/extlibs")
+list(APPEND CMAKE_PREFIX_PATH "@CMAKE_BINARY_DIR@/extlibs/csparse")
+list(APPEND CMAKE_PREFIX_PATH "@CMAKE_BINARY_DIR@/extlibs/eigen")
+list(APPEND CMAKE_PREFIX_PATH "@CMAKE_BINARY_DIR@/extlibs/newmat")
+list(APPEND CMAKE_PREFIX_PATH "@CMAKE_BINARY_DIR@/extlibs/QGLViewer")
+list(APPEND CMAKE_PREFIX_PATH "@CMAKE_BINARY_DIR@/extlibs/SuiteSparse")
+list(APPEND CMAKE_PREFIX_PATH "@CMAKE_BINARY_DIR@/extlibs/tinyxml")
+
+set(SOFA_LIBRARY_DIRS "@CMAKE_ARCHIVE_OUTPUT_DIRECTORY@")
+
+
+set(SOFA_LIBRARIES )
+foreach(s @projects@)
+ list(APPEND SOFA_LIBRARIES "debug;${s}_d")
+ list(APPEND SOFA_LIBRARIES "optimized;${s}")
+endforeach()
+
+string(STRIP "${SOFA_LIBRARIES}" SOFA_LIBRARIES)
+
+set(SOFA_INCLUDE_DIRS "@CMAKE_BINARY_DIR@/include;@SOFA_KERNEL_SOURCE_DIR@/framework;@SOFA_KERNEL_SOURCE_DIR@/modules;@SOFA_KERNEL_SOURCE_DIR@/extlibs/eigen-3.2.7;@CMAKE_SOURCE_DIR@/modules;@CMAKE_SOURCE_DIR@/applications")
\ No newline at end of file
diff --git a/CMakeExternals/sofa-custom.cmake b/CMakeExternals/sofa-custom.cmake
new file mode 100644
index 0000000..670bf80
--- /dev/null
+++ b/CMakeExternals/sofa-custom.cmake
@@ -0,0 +1,23 @@
+get_cmake_property(_variableNames VARIABLES)
+set(projects )
+
+# Find all targets names.
+foreach (_variableName ${_variableNames})
+ if(_variableName MATCHES "^Sofa(.+)_BINARY_DIR")
+ string(REGEX REPLACE "_BINARY_DIR" "" module_name ${_variableName})
+ list(APPEND projects ${module_name})
+ endif()
+endforeach()
+
+# remove items that are only "aliases" (SofaBase, SofaAdvanced, etc.)
+set(projectsAliases Base Common Advanced Framework General Gui Simulation)
+foreach (_variableName ${projectsAliases})
+ list(REMOVE_ITEM projects "Sofa${_variableName}")
+endforeach()
+
+# Fix the only target in Sofa that doesn't follow the "_d" pattern in debug.
+set_target_properties(SofaSimulationCore PROPERTIES DEBUG_POSTFIX _d)
+
+set(SOFA_BUILD_TESTS OFF)
+
+configure_file(SOFAConfig.cmake.in SOFAConfig.cmake @ONLY)
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1995409..01b23e5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -273,7 +273,7 @@ mitkFunctionAddExternalProject(NAME ACVD OFF DOC "Use Approximated
mitkFunctionAddExternalProject(NAME CTK ON DEPENDS Qt5 DCMTK DOC "Use CTK in MITK")
mitkFunctionAddExternalProject(NAME Rasqal OFF DEPENDS Raptor2 PCRE ADVANCED)
mitkFunctionAddExternalProject(NAME Redland OFF DEPENDS Rasqal DOC "Use the Redland RDF library")
-mitkFunctionAddExternalProject(NAME SOFA OFF DEPENDS GLUT Eigen Boost DOC "Use Simulation Open Framework Architecture")
+mitkFunctionAddExternalProject(NAME SOFA OFF DEPENDS GLUT Eigen Boost tinyxml DOC "Use Simulation Open Framework Architecture")
mitkFunctionAddExternalProject(NAME VMTK OFF DEPENDS ITK VTK)
mitkFunctionAddExternalProject(NAME DCMQI OFF DEPENDS DCMTK ITK DOC "Use dcmqi in MITK")
mitkFunctionAddExternalProject(NAME MatchPoint OFF ADVANCED DEPENDS ITK DOC "Use the MatchPoint translation image registration library")
@@ -342,6 +342,29 @@ if(MITK_USE_SOFA)
message("> Adding 'chrono' to MITK_USE_Boost_LIBRARIES.")
list(APPEND MITK_USE_Boost_LIBRARIES chrono)
endif()
+
+
+ # Simulation plugin requires boost filesystem library
+ list(FIND MITK_USE_Boost_LIBRARIES filesystem _result)
+ if(_result LESS 0)
+ message("> Adding 'filesystem' to MITK_USE_Boost_LIBRARIES.")
+ list(APPEND MITK_USE_Boost_LIBRARIES filesystem)
+ endif()
+ # Simulation plugin requires boost locale library
+ list(FIND MITK_USE_Boost_LIBRARIES locale _result)
+ if(_result LESS 0)
+ message("> Adding 'locale' to MITK_USE_Boost_LIBRARIES.")
+ list(APPEND MITK_USE_Boost_LIBRARIES locale)
+ endif()
+ # Simulation plugin requires boost date_time library
+ list(FIND MITK_USE_Boost_LIBRARIES date_time _result)
+ if(_result LESS 0)
+ message("> Adding 'date_time' to MITK_USE_Boost_LIBRARIES.")
+ list(APPEND MITK_USE_Boost_LIBRARIES date_time)
+ endif()
+
+
+
set(MITK_USE_Boost_LIBRARIES ${MITK_USE_Boost_LIBRARIES} CACHE STRING "" FORCE)
# Allow setting external SOFA plugins directory and SOFA plugins
set(MITK_USE_SOFA_PLUGINS_DIR ${MITK_USE_SOFA_PLUGINS_DIR} CACHE PATH "External SOFA plugins directory" FORCE)
--
2.8.1.windows.1

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
229240
Default Alt Text
0002-Changes-to-bring-SOFA-16.12-in-MITK-superbuild.patch (26 KB)

Event Timeline