Skip to content

Commit 1442e14

Browse files
committed
Add DrawEM_BUILD_N4 and DrawEM_ATLASES options, use ExternalProject_Add_Step to move extracted folder
1 parent 37a94ad commit 1442e14

File tree

2 files changed

+30
-19
lines changed

2 files changed

+30
-19
lines changed

Atlases.cmake

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
1-
cmake_minimum_required(VERSION 2.7)
1+
set(ATLASES_URL "https://biomedic.doc.ic.ac.uk/brain-development/downloads/dHCP/atlases-dhcp-structural-pipeline-v1.zip")
2+
set(ATLASES_MD5 "77e924bc17a4906f5814874009f5eca6")
3+
set(ATLASES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/atlases")
24

3-
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
5+
set(option_default_value ON)
6+
if (IS_DIRECTORY "${ATLASES_DIR}")
7+
set(option_default_value OFF)
8+
endif ()
9+
option(DrawEM_ATLASES "Whether to download DrawEM atlases during build step" ${option_default_value})
410

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

8-
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/atlases)
9-
ExternalProject_Add(atlases
10-
URL ${ATLAS_URL}
11-
URL_MD5 ${ATLAS_MD5}
12-
PREFIX atlases
13-
CONFIGURE_COMMAND ""
14-
BUILD_COMMAND ""
15-
INSTALL_COMMAND ""
16-
)
13+
include(ExternalProject)
1714

18-
add_custom_target(atlases_move ALL
19-
${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/atlases/src/atlases ${CMAKE_CURRENT_SOURCE_DIR}/atlases
20-
)
15+
ExternalProject_Add(atlases
16+
URL ${ATLASES_URL}
17+
URL_MD5 ${ATLASES_MD5}
18+
PREFIX atlases
19+
CONFIGURE_COMMAND ""
20+
BUILD_COMMAND ""
21+
INSTALL_COMMAND ""
22+
)
2123

22-
ADD_DEPENDENCIES(atlases_move atlases)
23-
endif()
24+
ExternalProject_Add_Step(atlases rename
25+
COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/atlases/src/atlases" "${ATLASES_DIR}"
26+
COMMENT "Move extracted atlases to source directory"
27+
DEPENDEES download
28+
)
29+
30+
endif ()

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,9 @@ endif ()
2626

2727
mirtk_configure_module()
2828

29-
add_subdirectory(ThirdParty/ANTs)
29+
option(DrawEM_BUILD_N4 "Whether to build ANTs N4 from sources included in DrawEM" ON)
30+
if (DrawEM_BUILD_N4)
31+
add_subdirectory(ThirdParty/ANTs)
32+
endif()
33+
3034
include(Atlases.cmake)

0 commit comments

Comments
 (0)