-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
164 lines (130 loc) · 6.51 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
#File Generated by Hans J. Johnson
#Please contact [email protected] for making enhancments/corrections
PROJECT(NIFTI)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
# Configure Dart testing support.
INCLUDE(${CMAKE_ROOT}/Modules/Dart.cmake)
SUBDIRS(znzlib niftilib)
ADD_DEFINITIONS(-DHAVE_ZLIB)
# add option to build shared libraries. The default is OFF to maintain the
# current build behavior
OPTION ( BUILD_SHARED_LIBS "Toggle building shared libraries")
# Addison Elliott 2017-02-13 Note:
# On Windows MSVC, the default option is to export only the symbols declared
# in the header file for DLL export. The opposite is true for all other compilers
# where they default to export all symbols. The result is that when compiling this
# code with VS, it causes a lib file not to be made. This option fixes that.
# Requires at least CMake 3.4.3
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
if (NOT BUILD_SHARED_LIBS)
add_definitions(-DNIFTILIB_STATIC)
endif (NOT BUILD_SHARED_LIBS)
# Michael Hanke 2007-04-25 Note:
# 'Utilities' is merged into the include install path to be able to easily
# install into any other path if necessary. For the same reason lib, bin and
# include dir for standalone builds are only set if not yet defined.
### USE AS PART OF ITK
IF("${ITK_VERSION_MAJOR}" GREATER 0.0)
# MESSAGE(STATUS "---------------------ITK ZLIB ${ITK_ZLIB_LIBRARIES}")
ADD_DEFINITIONS(-DHAVE_ZLIB)
ADD_DEFINITIONS(-DITKZLIB)
SET(PACKAGE_PREFIX "ITK")
SET(NIFTI_LIBRARY_PROPERTIES ${ITK_LIBRARY_PROPERTIES})
SET(NIFTI_INSTALL_BIN_DIR "${ITK_INSTALL_BIN_DIR_CM24}")
SET(NIFTI_INSTALL_LIB_DIR "${ITK_INSTALL_LIB_DIR_CM24}")
SET(NIFTI_INSTALL_INCLUDE_DIR "${ITK_INSTALL_INCLUDE_DIR_CM24}/Utilities")
SET(NIFTI_ZLIB_LIBRARIES ${ITK_ZLIB_LIBRARIES})
SET(NIFTI_INSTALL_NO_DEVELOPMENT ${ITK_INSTALL_NO_DEVELOPMENT})
SET(NIFTI_INSTALL_NO_LIBRARIES ${ITK_INSTALL_NO_LIBRARIES})
ELSE("${ITK_VERSION_MAJOR}" GREATER 0.0)
SET(CPACK_PACKAGE_VERSION_MAJOR "2")
SET(CPACK_PACKAGE_VERSION_MINOR "0")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
### USE AS STAND ALONE PACKAGE
FIND_PACKAGE(ZLIB)
# MESSAGE(STATUS "---------------------SYSTEM ZLIB ${ZLIB_LIBRARY}")
SET(PACKAGE_PREFIX "")
# Set default shared library version
# This library version will be applied to all libraries in the package
# unless it is not explicitely for a certain lib.
SET(NIFTI_SHAREDLIB_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH} )
STRING( REGEX MATCH "^[0-9]+" NIFTI_SHAREDLIB_SOVERSION ${NIFTI_SHAREDLIB_VERSION})
SET(NIFTI_LIBRARY_PROPERTIES VERSION ${NIFTI_SHAREDLIB_VERSION} SOVERSION ${NIFTI_SHAREDLIB_SOVERSION})
SET(NIFTI_INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin")
SET(NIFTI_INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
SET(NIFTI_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include/nifti")
SET(NIFTI_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
SET(NIFTI_INSTALL_NO_DEVELOPMENT 0)
SET(NIFTI_INSTALL_NO_LIBRARIES 0)
#Needs an if clause and more work before testing can take place.
SUBDIRS(Testing)
SUBDIRS(nifticdf utils)
OPTION(USE_FSL_CODE "If OFF, The copyright of this code is questionable for inclusion with nifti." OFF)
MARK_AS_ADVANCED(USE_FSL_CODE)
# the order of subdirs is important! fsliolob has to preceed examples
# as otherwise FSLIOLIB_SOURCE_DIR is undefined and hence the examples
# will fail to compile
IF(USE_FSL_CODE)
SUBDIRS(fsliolib)
SUBDIRS(examples)
ENDIF(USE_FSL_CODE)
ENABLE_TESTING()
INCLUDE(Dart)
####################################
### Define information necessary for packaging with CPACK (http://www.cmake.org/Wiki/CMake:Packaging_With_CPack)
### The last section is concerned with installing the binaries and making distributions.
INCLUDE(InstallRequiredSystemLibraries)
SET(CPACK_PACKAGE_NAME "NIFTI")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-dev")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Niftilib is a set of i/o libraries for reading and writing files in the nifti-1 data format. nifti-1 is a binary file format for storing medical image data, e.g. magnetic resonance image (MRI) and functional MRI (fMRI) brain images.")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${NIFTI_SOURCE_DIR}/README.md")
#SET(CPACK_RESOURCE_FILE_LICENSE "${NIFTI_SOURCE_DIR}/Copyright.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${NIFTI_SOURCE_DIR}/README.md")
SET(CPACK_PACKAGE_DEFAULT_LOCATION "/opt/${CPACK_PACKAGE_NAME}")
#SET(CPACK_PACKAGE_INSTALL_DIRECTORY "NIFTI ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${NIFTI}")
SET(CPACK_PACKAGING_INSTALL_PREFIX "/")
SET(CPACK_SET_DESTDIR ON)
SET(CPACK_PACKAGE_VENDOR "NIFTI DFWG")
SET(CPACK_SOURCE_GENERATOR "TGZ;TZ")
#SET(CPACK_SOURCE_IGNORE_FILES "/CVS/;/\\.svn/;\\.swp$;\\.#;/#;\\.*~")
SET(CPACK_SOURCE_IGNORE_FILES "")
SET(CPACK_PACKAGE_EXECUTABLES "NIFTI;A program for registering medical images with mutual information.")
IF(WIN32 AND NOT UNIX)
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes.
SET(CPACK_PACKAGE_ICON
"${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe")
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} My Famous
Project")
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.nitrc.org")
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.nitrc.org")
SET(CPACK_NSIS_CONTACT "[email protected]")
SET(CPACK_NSIS_MODIFY_PATH ON)
ELSE(WIN32 AND NOT UNIX)
SET(CPACK_STRIP_FILES OFF)
SET(CPACK_SOURCE_STRIP_FILES OFF)
ENDIF(WIN32 AND NOT UNIX)
IF(APPLE)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
SET(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib)
SET(CMAKE_MACOSX_RPATH ON)
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
ENDIF(APPLE)
INCLUDE(CPack)
ENDIF("${ITK_VERSION_MAJOR}" GREATER 0.0)
IF(NOT DEFINED NIFTI_INSTALL_LIB_DIR)
MESSAGE(FATAL_ERROR "Must set NIFTI_INSTALL_LIB_DIR.")
ENDIF(NOT DEFINED NIFTI_INSTALL_LIB_DIR)
IF(NOT DEFINED NIFTI_INSTALL_BIN_DIR)
MESSAGE(FATAL_ERROR "Must set NIFTI_INSTALL_BIN_DIR.")
ENDIF(NOT DEFINED NIFTI_INSTALL_BIN_DIR)
IF(NOT DEFINED NIFTI_INSTALL_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "Must set NIFTI_INSTALL_INCLUDE_DIR.")
ENDIF(NOT DEFINED NIFTI_INSTALL_INCLUDE_DIR)