-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·166 lines (140 loc) · 6.72 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
PROJECT(nifty_seg)
cmake_minimum_required(VERSION 2.8)
cmake_policy(VERSION 2.8)
include(CPack)
include(ExternalProject)
SET(NiftySeg_VERSION_MAJOR 0)
SET(NiftySeg_VERSION_MINOR 9)
SET(CMAKE_CXX_FLAGS -Wall)
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" MATCHES "^2\\.6\\.4$")
MARK_AS_ADVANCED(FORCE CMAKE_BACKWARDS_COMPATIBILITY)
ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" MATCHES "^2\\.6\\.4$")
MARK_AS_ADVANCED(CLEAR CMAKE_BACKWARDS_COMPATIBILITY)
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" MATCHES "^2\\.6\\.4$")
#-----------------------------------------------------------------------------
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
add_definitions(-Wall -pedantic)
#-----------------------------------------------------------------------------
SET(ZLIB "z")
#-----------------------------------------------------------------------------
OPTION(BUILD_ALL "To build the LoAd segmentation tool" ON)
OPTION(BUILD_SHARED "Build the libraries as shared." OFF)
OPTION(USE_OPENMP "To use openMP for multi-CPU processing" OFF)
OPTION(INSTALL_NIFTYREG "To download and install NiftyReg. Internet connection is required." OFF)
OPTION(INSTALL_PRIORS "Install prior images. Turn this off if you are really short on disk space" ON)
#-----------------------------------------------------------------------------
IF(BUILD_SHARED)
SET(LIBRARY_TYPE SHARED)
ELSE(BUILD_SHARED)
SET(LIBRARY_TYPE STATIC)
ENDIF(BUILD_SHARED)
IF(USE_OPENMP)
SET(CMAKE_CXX_FLAGS -fopenmp)
ENDIF(USE_OPENMP)
IF(BUILD_SHARED)
SET(LIBRARY_TYPE SHARED)
ELSE(BUILD_SHARED)
SET(LIBRARY_TYPE STATIC)
ENDIF(BUILD_SHARED)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/seg-lib)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/nifti)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/zlib)
SET(INSTALL_PRIORS_DIRECTORY ${CMAKE_INSTALL_PREFIX}/priors)
MARK_AS_ADVANCED(INSTALL_PRIORS_DIRECTORY)
#-----------------------------------------------------------------------------
SUBDIRS(zlib)
SUBDIRS(nifti)
SUBDIRS(seg-lib)
SUBDIRS(seg-apps)
# Install scripts
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/LoAd_brainonly.sh ${CMAKE_BINARY_DIR}/LoAd_brainonly.sh @ONLY )
INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/LoAd_brainonly.sh DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT applications)
# Install priors
IF(INSTALL_PRIORS)
FILE(GLOB PRIOR_FILES priors/*.nii.gz)
INSTALL(PROGRAMS ${PRIOR_FILES} DESTINATION ${INSTALL_PRIORS_DIRECTORY} COMPONENT applications)
ENDIF(INSTALL_PRIORS)
IF(USE_OPENMP)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
ENDIF(USE_OPENMP)
#-----------------------------------------------------------------------------
IF(INSTALL_NIFTYREG)
ExternalProject_Add(niftyreg
SOURCE_DIR ${PROJECT_BINARY_DIR}/niftyreg
PREFIX ${PROJECT_BINARY_DIR}/niftyreg
STAMP_DIR ${PROJECT_BINARY_DIR}/niftyreg/stamps
TMP_DIR ${PROJECT_BINARY_DIR}/niftyreg/stamps
DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/niftyreg
BINARY_DIR ${PROJECT_BINARY_DIR}/niftyreg/build
SVN_REPOSITORY https://niftyreg.svn.sourceforge.net/svnroot/niftyreg/trunk/nifty_reg
TIMEOUT 100
UPDATE_COMMAND ""
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DUSE_SSE=1
BUILD_COMMAND ${CMAKE_BUILD_TOOL}
INSTALL_COMMAND ${CMAKE_BUILD_TOOL} install
)
ENDIF(INSTALL_NIFTYREG)
#-----------------------------------------------------------------------------
IF(DO_PACKAGE)
IF(UNIX)
IF(APPLE)
SET(CPACK_GENERATOR "TZ;TGZ;PackageMaker")
ELSE(APPLE)
SET(CPACK_GENERATOR "TZ;TGZ;DEB")
ENDIF(APPLE)
ENDIF(UNIX)
SET(CPACK_PACKAGE_NAME "NiftySeg")
SET(CPACK_PACKAGE_VENDOR "CMIC-UCL")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NiftySeg - Software for Image Segmentation")
SET(CPACK_PACKAGE_VERSION_MAJOR ${NiftySeg_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${NiftySeg_VERSION_MINOR})
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "NiftySeg")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/images\\\\NiftySeg_logo.png")
SET(CPACK_NSIS_MUI_ICON "${CMake_SOURCE_DIR}/images\\\\NiftySeg_logo.png")
SET(CPACK_NSIS_MUI_UNIICON "${CMake_SOURCE_DIR}/images\\\\NiftySeg_logo.png")
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "unknown")
SET (CMAKE_SYSTEM_PROCESSOR "x86")
ENDIF (CMAKE_SYSTEM_PROCESSOR MATCHES "unknown")
IF(NOT DEFINED CPACK_SYSTEM_NAME)
SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
ENDIF(NOT DEFINED CPACK_SYSTEM_NAME)
IF(${CPACK_SYSTEM_NAME} MATCHES Windows)
IF(CMAKE_CL_64)
SET(CPACK_SYSTEM_NAME Win64-${CMAKE_SYSTEM_PROCESSOR})
ELSE(CMAKE_CL_64)
SET(CPACK_SYSTEM_NAME Win32-${CMAKE_SYSTEM_PROCESSOR})
ENDIF(CMAKE_CL_64)
ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows)
IF(${CPACK_SYSTEM_NAME} MATCHES Darwin AND CMAKE_OSX_ARCHITECTURES)
list(LENGTH CMAKE_OSX_ARCHITECTURES _length)
IF(_length GREATER 1)
SET(CPACK_SYSTEM_NAME Darwin-Universal)
ELSE(_length GREATER 1)
SET(CPACK_SYSTEM_NAME Darwin-${CMAKE_OSX_ARCHITECTURES})
ENDIF(_length GREATER 1)
ENDIF(${CPACK_SYSTEM_NAME} MATCHES Darwin AND CMAKE_OSX_ARCHITECTURES)
#Deb
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "M. Jorge Cardoso, manuel.cardoso@ucl.ac.uk")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "niftyreg (>= 1.2.1)")
#Nsis
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\NiftySeg.exe")
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} NiftySeg")
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\cmic.cs.ucl.ac.uk")
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\cmic.cs.ucl.ac.uk")
SET(CPACK_NSIS_CONTACT "manue.cardoso@ucl.ac.uk")
SET(CPACK_NSIS_MODIFY_PATH ON)
#Apple drag-and-drop
IF(APPLE)
SET(CPACK_BINARY_TBZ2 OFF)
SET(CPACK_BINARY_DRAGNDROP ON)
SET(CPACK_BINARY_PACKAGEMAKER ON)
SET(CPACK_BINARY_STGZ OFF)
ENDIF(APPLE)
INCLUDE(CPack)
ENDIF(DO_PACKAGE)
#-----------------------------------------------------------------------------