Skip to content

Commit

Permalink
Add DrawEM_BUILD_N4 and DrawEM_ATLASES options, use ExternalProject_A…
Browse files Browse the repository at this point in the history
…dd_Step to move extracted folder
  • Loading branch information
aschuh-hf committed Dec 24, 2019
1 parent 37a94ad commit 1442e14
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
43 changes: 25 additions & 18 deletions Atlases.cmake
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
cmake_minimum_required(VERSION 2.7)
set(ATLASES_URL "https://biomedic.doc.ic.ac.uk/brain-development/downloads/dHCP/atlases-dhcp-structural-pipeline-v1.zip")
set(ATLASES_MD5 "77e924bc17a4906f5814874009f5eca6")
set(ATLASES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/atlases")

include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
set(option_default_value ON)
if (IS_DIRECTORY "${ATLASES_DIR}")
set(option_default_value OFF)
endif ()
option(DrawEM_ATLASES "Whether to download DrawEM atlases during build step" ${option_default_value})

set(ATLAS_URL "https://biomedic.doc.ic.ac.uk/brain-development/downloads/dHCP/atlases-dhcp-structural-pipeline-v1.zip")
set(ATLAS_MD5 77e924bc17a4906f5814874009f5eca6)
if (DrawEM_ATLASES)

if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/atlases)
ExternalProject_Add(atlases
URL ${ATLAS_URL}
URL_MD5 ${ATLAS_MD5}
PREFIX atlases
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
include(ExternalProject)

add_custom_target(atlases_move ALL
${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/atlases/src/atlases ${CMAKE_CURRENT_SOURCE_DIR}/atlases
)
ExternalProject_Add(atlases
URL ${ATLASES_URL}
URL_MD5 ${ATLASES_MD5}
PREFIX atlases
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)

ADD_DEPENDENCIES(atlases_move atlases)
endif()
ExternalProject_Add_Step(atlases rename
COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/atlases/src/atlases" "${ATLASES_DIR}"
COMMENT "Move extracted atlases to source directory"
DEPENDEES download
)

endif ()
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ endif ()

mirtk_configure_module()

add_subdirectory(ThirdParty/ANTs)
option(DrawEM_BUILD_N4 "Whether to build ANTs N4 from sources included in DrawEM" ON)
if (DrawEM_BUILD_N4)
add_subdirectory(ThirdParty/ANTs)
endif()

include(Atlases.cmake)

0 comments on commit 1442e14

Please sign in to comment.