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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
|
#---------------------------------------------------------------------
project(elxCore)
#---------------------------------------------------------------------
# Define lists of files in the subdirectories.
set(KernelFilesForExecutables
Kernel/elxMainBase.cxx
Kernel/elxMainBase.h
Kernel/elxElastixMain.cxx
Kernel/elxElastixMain.h
Kernel/elxTransformixMain.cxx
Kernel/elxTransformixMain.h
)
set(KernelFilesForComponents
Kernel/elxElastixBase.cxx
Kernel/elxElastixBase.h
Kernel/elxElastixTemplate.h
Kernel/elxElastixTemplate.hxx
Kernel/elxIterationInfo.cxx
Kernel/elxIterationInfo.h
Kernel/elxlog.h
Kernel/elxlog.cxx
)
set(InstallFilesForExecutables
Install/elxComponentLoader.cxx
Install/elxComponentLoader.h
)
set(InstallFilesForComponents
Install/elxComponentDatabase.cxx
Install/elxComponentDatabase.h
Install/elxComponentInstaller.h
Install/elxConversion.cxx
Install/elxConversion.h
Install/elxBaseComponent.cxx
Install/elxBaseComponent.h
Install/elxBaseComponentSE.h
Install/elxBaseComponentSE.hxx
Install/elxInstallAllComponents.h
Install/elxInstallFunctions.h
Install/elxMacro.h
Install/elxIncludes.h
)
set(ConfigurationFiles
Configuration/elxConfiguration.cxx
Configuration/elxConfiguration.h
)
set(ComponentBaseClassFiles
ComponentBaseClasses/elxFixedImagePyramidBase.h
ComponentBaseClasses/elxImageSamplerBase.h
ComponentBaseClasses/elxInterpolatorBase.h
ComponentBaseClasses/elxMetricBase.h
ComponentBaseClasses/elxMovingImagePyramidBase.h
ComponentBaseClasses/elxOptimizerBase.h
ComponentBaseClasses/elxRegistrationBase.h
ComponentBaseClasses/elxResampleInterpolatorBase.h
ComponentBaseClasses/elxResamplerBase.h
ComponentBaseClasses/elxTransformBase.h
ComponentBaseClasses/elxFixedImagePyramidBase.hxx
ComponentBaseClasses/elxImageSamplerBase.hxx
ComponentBaseClasses/elxInterpolatorBase.hxx
ComponentBaseClasses/elxMetricBase.hxx
ComponentBaseClasses/elxMovingImagePyramidBase.hxx
ComponentBaseClasses/elxOptimizerBase.hxx
ComponentBaseClasses/elxRegistrationBase.hxx
ComponentBaseClasses/elxResampleInterpolatorBase.hxx
ComponentBaseClasses/elxResamplerBase.hxx
ComponentBaseClasses/elxTransformBase.hxx
)
set(ProgressCommandFiles
elxProgressCommand.cxx
elxProgressCommand.h
)
#---------------------------------------------------------------------
# Construct source groups for nice visualisation in Visual Studio.
source_group("Install" FILES
${InstallFilesForComponents}
${InstallFilesForExecutables}
)
source_group("Kernel" FILES
${KernelFilesForComponents}
${KernelFilesForExecutables}
)
source_group("Configuration" FILES ${ConfigurationFiles})
source_group("ComponentBaseClasses" FILES ${ComponentBaseClassFiles})
source_group("ProgressCommand" FILES ${ProgressCommandFiles})
#---------------------------------------------------------------------
configure_file(
elxVersionMacros.h.in
elxVersionMacros.h)
if(NOT ELASTIX_NO_INSTALL_DEVELOPMENT)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/elxVersionMacros.h
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/Core
COMPONENT Development
)
endif()
#---------------------------------------------------------------------
# Originally based on the answer by Naszta at
# https://stackoverflow.com/questions/6526451/how-to-include-git-commit-number-into-a-c-executable
find_package(Git)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 --format=%cd
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE ELX_GIT_REVISION_DATE
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE ELX_GIT_REVISION_SHA
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
configure_file(elxGitRevisionInfo.h.in elxGitRevisionInfo.h @ONLY)
#---------------------------------------------------------------------
# Create the elxCore library.
add_library(elxCore STATIC
${KernelFilesForComponents}
${InstallFilesForComponents}
${ConfigurationFiles}
${ComponentBaseClassFiles}
${ProgressCommandFiles}
)
elastix_export_target(elxCore)
#---------------------------------------------------------------------
# Link against other libraries.
target_link_libraries(elxCore
elxCommon
param # Needed for elxConfiguration
# ${ITK_LIBRARIES}
)
# Support #include <double-conversion.h>, which is either in the root of the
# ITK install directory (its "install prefix"), or at the following location
# of the ITK source tree (which is the parent directory of "{ITK_CMAKE_DIR}"):
target_include_directories(elxCore PRIVATE
${ITK_CMAKE_DIR}/../Modules/ThirdParty/DoubleConversion/src/double-conversion)
elastix_export_target(elxCommon)
elastix_export_target(param)
#---------------------------------------------------------------------
# Define the mevis dcm tiff lib to which we should link.
set(mevisdcmtifflib mevisdcmtiff)
set(ELASTIX_TARGET_LINK_LIBRARIES
param
elxCommon
elxCore
${mevisdcmtifflib}
${AllComponentLibs}
${ITK_LIBRARIES}
)
if(ELASTIX_USE_OPENCL)
set(ELASTIX_TARGET_LINK_LIBRARIES ${ELASTIX_TARGET_LINK_LIBRARIES} elxOpenCL)
endif()
#---------------------------------------------------------------------
# Create the elastix executable and library.
if(ELASTIX_BUILD_EXECUTABLE)
add_executable(elastix_exe
Main/elastix.cxx
Main/elastix.h
Main/elxMainExeUtilities.cxx
Main/elxMainExeUtilities.h
Kernel/elxMainBase.cxx
Kernel/elxMainBase.h
Kernel/elxElastixMain.cxx
Kernel/elxElastixMain.h
${InstallFilesForExecutables}
)
set_target_properties(elastix_exe PROPERTIES OUTPUT_NAME elastix)
target_compile_definitions(elastix_exe PRIVATE ELX_CMAKE_VERSION="${CMAKE_VERSION}")
target_link_libraries(elastix_exe ${ELASTIX_TARGET_LINK_LIBRARIES})
endif()
# The library type (STATIC or SHARED) is determined by the parameter
# BUILD_SHARED_LIBS.
add_library(elastix_lib
Main/elxLibUtilities.cxx
Main/elxLibUtilities.h
Main/elxParameterObject.cxx
Main/elxParameterObject.h
Main/elastixlib.cxx
Main/elastixlib.h
Kernel/elxMainBase.cxx
Kernel/elxMainBase.h
Kernel/elxElastixMain.cxx
Kernel/elxElastixMain.h
${InstallFilesForExecutables}
)
set_target_properties(elastix_lib PROPERTIES OUTPUT_NAME elastix)
target_compile_definitions(elastix_lib PRIVATE ELX_CMAKE_VERSION="${CMAKE_VERSION}")
target_link_libraries(elastix_lib ${ELASTIX_TARGET_LINK_LIBRARIES})
#---------------------------------------------------------------------
# Create the transformix executable.
if(ELASTIX_BUILD_EXECUTABLE)
add_executable(transformix_exe
Main/transformix.cxx
Main/elastix.h
Main/elxMainExeUtilities.cxx
Main/elxMainExeUtilities.h
Kernel/elxMainBase.cxx
Kernel/elxMainBase.h
Kernel/elxTransformixMain.cxx
Kernel/elxTransformixMain.h
${InstallFilesForExecutables}
)
set_target_properties(transformix_exe PROPERTIES OUTPUT_NAME transformix)
target_compile_definitions(transformix_exe PRIVATE ELX_CMAKE_VERSION="${CMAKE_VERSION}")
target_link_libraries(transformix_exe ${ELASTIX_TARGET_LINK_LIBRARIES})
endif()
# The library type (STATIC or SHARED) is determined by the parameter
# BUILD_SHARED_LIBS.
add_library(transformix_lib
Main/elxLibUtilities.cxx
Main/elxLibUtilities.h
Main/elxParameterObject.cxx
Main/elxParameterObject.h
Main/transformixlib.cxx
Main/transformixlib.h
Kernel/elxMainBase.cxx
Kernel/elxMainBase.h
Kernel/elxTransformixMain.cxx
Kernel/elxTransformixMain.h
${InstallFilesForExecutables}
)
set_target_properties(transformix_lib PROPERTIES OUTPUT_NAME transformix)
target_link_libraries(transformix_lib ${ELASTIX_TARGET_LINK_LIBRARIES})
set(ELASTIX_LIBRARIES elastix_lib transformix_lib PARENT_SCOPE)
#---------------------------------------------------------------------
# Define the install directory for elastix and transformix.
if(ELASTIX_BUILD_EXECUTABLE AND NOT WIN32)
# Tell the executables where to find the required .so files.
set_target_properties(elastix_exe transformix_exe
PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:${ITK_DIR}")
endif()
if(ELASTIX_BUILD_EXECUTABLE AND NOT ELASTIX_NO_INSTALL_EXECUTABLES)
install(TARGETS elastix_exe transformix_exe
ARCHIVE DESTINATION ${ELASTIX_ARCHIVE_DIR}
LIBRARY DESTINATION ${ELASTIX_LIBRARY_DIR}
RUNTIME DESTINATION ${ELASTIX_RUNTIME_DIR}
COMPONENT Executables)
endif()
# Install all header files.
if(NOT ELASTIX_NO_INSTALL_DEVELOPMENT)
install(DIRECTORY
${elastix_SOURCE_DIR}/Common
${elastix_SOURCE_DIR}/Core
${elastix_SOURCE_DIR}/Components
DESTINATION ${ELASTIX_INCLUDE_DIR}
COMPONENT Development
FILES_MATCHING PATTERN "*.h" PATTERN "*.hxx")
install(FILES
${elastix_BINARY_DIR}/elxInstallComponentFunctionCalls.h
${elastix_BINARY_DIR}/elxInstallComponentFunctionDeclarations.h
${elastix_BINARY_DIR}/elxSupportedImageTypes.h
${elastix_BINARY_DIR}/ITKFactoryRegistration/itkImageIOFactoryRegisterManager.h
${elastix_BINARY_DIR}/ITKFactoryRegistration/itkTransformIOFactoryRegisterManager.h
DESTINATION ${ELASTIX_INCLUDE_DIR}
COMPONENT Development)
endif()
#---------------------------------------------------------------------
# The Core/Install directory contains a CMakeLists file for
# defining the elastix compilation types.
add_subdirectory(Install)
|