-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCMakeLists.txt
138 lines (102 loc) · 3.66 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
SET(BEAST_PACKAGE_VERSION_MAJOR 1)
SET(BEAST_PACKAGE_VERSION_MINOR 15)
SET(BEAST_PACKAGE_VERSION_PATCH 00)
IF(NOT MINC_TOOLKIT_BUILD)
PROJECT(mincbeast)
ENABLE_TESTING()
INCLUDE(CTest)
# Packaging defines
SET(CPACK_PACKAGE_VERSION_MAJOR ${BEAST_PACKAGE_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${BEAST_PACKAGE_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${BEAST_PACKAGE_VERSION_PATCH})
INCLUDE(CPack)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 OLD)
endif(COMMAND cmake_policy)
FIND_PACKAGE( LIBMINC )
OPTION(USE_NIFTI "Use niftiio library" ON)
OPTION(USE_DMALLOC "Use dmalloc library to debug memory leaks" OFF)
IF(USE_NIFTI)
SET(NIFTI_ROOT "/usr/local/bic" CACHE PATH "niftiio library base")
ENDIF(USE_NIFTI)
ENDIF(NOT MINC_TOOLKIT_BUILD)
SET(PACKAGE "mincbeast")
SET(PACKAGE_BUGREPORT "[email protected]")
SET(PACKAGE_NAME "mincbeast")
SET(PACKAGE_VERSION "${BEAST_PACKAGE_VERSION_MAJOR}.${BEAST_PACKAGE_VERSION_MINOR}.${BEAST_PACKAGE_VERSION_PATCH}")
SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
#setup variables only needed inside scripts
SET(version ${PACKAGE_VERSION})
SET(long_version ${PACKAGE_STRING})
SET(VERSION "${PACKAGE_VERSION}")
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
# check for prereqs
# INCLUDE(CheckFunctionExists)
INCLUDE(CheckIncludeFiles)
# CHECK_FUNCTION_EXISTS(finite HAVE_FINITE)
# CHECK_FUNCTION_EXISTS(isfinite HAVE_ISFINITE)
CHECK_INCLUDE_FILES(float.h HAVE_FLOAT_H)
CHECK_INCLUDE_FILES(sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILES(values.h HAVE_VALUES_H)
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILES(dirent.h HAVE_DIRENT_H)
CHECK_INCLUDE_FILES(memory.h HAVE_MEMORY_H)
CHECK_INCLUDE_FILES(malloc.h HAVE_MALLOC_H)
CHECK_INCLUDE_FILES(stdlib.h HAVE_STDLIB_H)
CHECK_INCLUDE_FILES(fcntl.h HAVE_FCNTL_H)
CHECK_INCLUDE_FILES(vfork.h HAVE_VFORK_H)
CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H)
CHECK_INCLUDE_FILES(string.h HAVE_STRING_H)
CHECK_INCLUDE_FILES(strings.h HAVE_STRINGS_H)
CHECK_INCLUDE_FILES(math.h HAVE_MATH_H)
SET(BEAST_LIBRARY_PREFIX "${CMAKE_INSTALL_PREFIX}/share/beast-library-1.0")
# others
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include )
SET(BEAST_SRC
alloc.c beast_lib.c distance_patch.c moments.c nlm_utils.c nlmfilter.c nlmsegFuzzy.c label.c ParseArgv.c
)
IF(LIBMINC_FOUND)
INCLUDE( ${LIBMINC_USE_FILE} )
SET(BEAST_SRC ${BEAST_SRC} mincio.c)
ADD_DEFINITIONS( -DHAVE_MINC )
ENDIF(LIBMINC_FOUND)
IF(USE_NIFTI)
ADD_DEFINITIONS( -DHAVE_NIFTI )
LINK_LIBRARIES(niftiio znz z m)
SET(BEAST_SRC ${BEAST_SRC} niftiio.c)
LINK_DIRECTORIES(
"${NIFTI_ROOT}/lib${LIB_SUFFIX}"
)
INCLUDE_DIRECTORIES(
"${NIFTI_ROOT}/include/nifti"
)
ENDIF(USE_NIFTI)
IF(USE_DMALLOC)
ADD_DEFINITIONS( -DUSE_DMALLOC -DDMALLOC_FUNC_CHECK )
LINK_LIBRARIES(dmalloc)
ENDIF(USE_DMALLOC)
ADD_LIBRARY(beast STATIC
${BEAST_SRC}
)
TARGET_LINK_LIBRARIES(beast ${VOLUME_IO_LIBRARIES} ${LIBMINC_LIBRARIES} )
ADD_EXECUTABLE(mincbeast
mincbeast.c
)
TARGET_LINK_LIBRARIES(mincbeast beast m)
IF(LIBMINC_FOUND AND USE_NIFTI)
ADD_EXECUTABLE(minc2nifti
minc2nifti.c
)
TARGET_LINK_LIBRARIES(minc2nifti beast)
ENDIF(LIBMINC_FOUND AND USE_NIFTI)
ADD_SUBDIRECTORY (scripts)
INSTALL(TARGETS
mincbeast
RUNTIME DESTINATION bin )
# VF: now this will be in a separate project
# INSTALL(DIRECTORY free_database/
# DESTINATION share/mincbeast_free )
# TODO download and create average models