Commit 1f5351c4 authored by Gregory Sharp's avatar Gregory Sharp
Browse files

New upstream version 1.7.3+dfsg.1

parent ad976fbe
Loading
Loading
Loading
Loading

CMakeLists.txt

100644 → 100755
+159 −109
Original line number Diff line number Diff line
@@ -8,9 +8,7 @@ project (plastimatch)
## The version here should be equal to the "most recent release"
set (PLM_VERSION_MAJOR "1")
set (PLM_VERSION_MINOR "7")
set (PLM_VERSION_PATCH "0")
#set (PLM_RELEASE_VERSION FALSE)
set (PLM_RELEASE_VERSION TRUE)
set (PLM_VERSION_PATCH "3")

##-----------------------------------------------------------------------------
##  Set up CMake defaults
@@ -67,18 +65,23 @@ sb_variable (CMAKE_BUILD_TYPE)
##-----------------------------------------------------------------------------
##  Define plastimatch configuration variables
##-----------------------------------------------------------------------------
sb_option (PLM_CONFIG_DISABLE_CUDA "Set to ON to build without CUDA" OFF)
option (PLM_CONFIG_DISABLE_DCMTK "Set to ON to build without DCMTK" OFF)
option (PLM_CONFIG_DISABLE_FATM "Set to ON to build without FATM" ON)
option (PLM_CONFIG_DISABLE_MONDOSHOT "Disable building mondoshot" ON)
sb_option (PLM_CONFIG_DISABLE_OPENCL "Set to ON to build without OpenCL" OFF)
sb_option (PLM_CONFIG_DISABLE_OPENMP "Set to ON to build without OpenMP" OFF)
option (PLM_CONFIG_DISABLE_PLASTIMATCH "Disable building plastimatch" OFF)
option (PLM_CONFIG_DISABLE_QT "Set to ON to build without QT" OFF)
sb_option (PLM_CONFIG_DISABLE_SSE2 "Set to ON to build without SSE" OFF)
option (PLM_CONFIG_ENABLE_MATLAB "Set to ON to build Matlab plugins" OFF)

option (PLM_CONFIG_BUILD_QT_PLUGINS "Build QT4 Designer Plugins?" OFF)
sb_option (PLM_CONFIG_ENABLE_CUDA "Set to ON to allow build with CUDA" ON)
option (PLM_CONFIG_ENABLE_DCMTK "Set to ON to allow build with DCMTK" ON)
option (PLM_CONFIG_ENABLE_FATM "Set to ON to allow building fatm" OFF)
option (PLM_CONFIG_ENABLE_MONDOSHOT "Set to ON to allow building mondoshot" OFF)
sb_option (PLM_CONFIG_ENABLE_OPENCL "Set to ON to allow build with OpenCL" ON)
sb_option (PLM_CONFIG_ENABLE_OPENMP "Set to ON to allow build with OpenMP" ON)
sb_option (PLM_CONFIG_ENABLE_OPT4D "Set to ON to allow build with Opt4D" OFF)
option (PLM_CONFIG_ENABLE_PLASTIMATCH "Set to ON to allow building plastimatch" ON)
option (PLM_CONFIG_ENABLE_QT "Set to ON to allow build with QT" ON)
sb_option (PLM_CONFIG_ENABLE_SSE2 "Set to ON to allow build with SSE" ON)
option (PLM_CONFIG_ENABLE_MATLAB "Set to ON to allow build of Matlab plugins" OFF)
sb_option (PLM_CONFIG_ENABLE_VISCOUS
  "Set to ON to allow build of experimental viscous fluid registration algorithm" OFF)
sb_option (PLM_CONFIG_ENABLE_PLASTIMATCH_QT
  "Set to ON to allow build of experimental plastimatch_qt executable" OFF)

option (PLM_CONFIG_BUILD_QT_PLUGINS "Set to ON to allow build of QT4 Designer Plugins" OFF)
sb_option (PLM_CONFIG_DEBIAN_BUILD "Set to ON to configure build for debian" OFF)
option (PLM_CONFIG_LIBRARY_BUILD "Set to ON to build only libraries" OFF)
option (PLM_CONFIG_NOMANIFEST
@@ -89,10 +92,6 @@ option (PLM_CONFIG_ENABLE_SUPERBUILD
# Plastimatch software configuration options
option (PLM_CONFIG_CLANG_COMPLETE
  "Generate .clang_complete for hipster Vim-ers" OFF)
option (PLM_CONFIG_DISABLE_VISCOUS
  "Disable experimental viscous fluid registration algorithm" ON)
option (PLM_CONFIG_ENABLE_PLASTIMATCH_QT
  "Enable experimental plastimatch_qt executable" OFF)
sb_option (PLM_CONFIG_PREFER_PATCHED_ITK
  "Prefer to use the patched version of certain ITK files" ON)
sb_option (PLM_CONFIG_VOL_LIST
@@ -103,12 +102,20 @@ sb_option (PLM_CONFIG_LEGACY_BSPLINE_EXTEND
  "Use legacy code for extending b-spline domain" OFF)
sb_option (PLM_CONFIG_LEGACY_BSPLINE_XFORM_IO
  "Use legacy code for reading and writing b-spline xform files" OFF)
sb_option (PLM_CONFIG_LEGACY_CUDA_DELAYLOAD
  "Use legacy code for verifying CUDA runtime" ON)
sb_option (PLM_CONFIG_LEGACY_DRR_CUDA_TEXTURE
  "Use legacy 1D texture for CUDA DRR generation" OFF)
sb_option (PLM_CONFIG_LEGACY_MI_METRIC
  "For ITK metrics, the legacy implementation of the mi metric is Viola-Wells to Mattes" OFF)
sb_option (PLM_CONFIG_LEGACY_PROJ_GEO
  "Use legacy method for specifying projection geometry" ON)
sb_option (PLM_CONFIG_LEGACY_RAY_TRACE_EXACT
  "Use legacy algorithm for exact ray tracing" OFF)

# Compile and link options
sb_option (PLM_CUDA_ALL_DEVICES
  "Generate GPU code for all compute capabilities?" OFF)
sb_option (BUILD_SHARED_LIBS "Build plastimatch as shared library" OFF)

# Choose whether to build against included and/or superbuild libraries
@@ -133,7 +140,7 @@ sb_option (PLM_CONFIG_INSTALL_LIBRARIES "Include libraries in install" ON)
option (PLM_PACKAGE_32BIT
    "Set this when building 32-bit packages on a 64-bit machine" OFF)
option (PLM_PACKAGE_NSIS "Set to ON when packaging binaries with NSIS" OFF)
option (PLM_PACKAGE_WIX "Set to ON when packaging binaries with WIX" OFF)
option (PLM_PACKAGE_WIX "Set to ON when packaging binaries with WIX" ON)
sb_option (PLM_PACKAGE_LEGACY_CMAKE_CONFIG
    "Use the old code for creating PlastimatchConfig.cmake and friends" OFF)

@@ -144,8 +151,8 @@ endif ()

# Override some options if library build is selected
if (PLM_CONFIG_LIBRARY_BUILD)
  set (PLM_CONFIG_DISABLE_FATM ON)
  set (PLM_CONFIG_DISABLE_MONDOSHOT ON)
  set (PLM_CONFIG_ENABLE_FATM OFF)
  set (PLM_CONFIG_ENABLE_MONDOSHOT OFF)
endif ()

##-----------------------------------------------------------------------------
@@ -267,19 +274,11 @@ find_library (LIBDL_FOUND dl)
## it will have a working version of DCMTKConfig.cmake.
## In this case, we can use the modern find_package variant.
## Otherwise we use the old hacked version of FindDCMTK.cmake.
if (NOT PLM_CONFIG_DISABLE_DCMTK)
if (PLM_CONFIG_ENABLE_DCMTK)
  if (PLM_SYSTEM_DCMTK STREQUAL "YES")
    if (DCMTK_DIR AND EXISTS "${DCMTK_DIR}/DCMTKConfig.cmake")
      find_package (DCMTK NO_MODULE REQUIRED)
    else ()
      find_package (DCMTK_legacy REQUIRED)
    endif ()
    find_package (DCMTK_wrap REQUIRED)
  elseif (PLM_SYSTEM_DCMTK STREQUAL "PREFERRED")
    if (DCMTK_DIR AND EXISTS "${DCMTK_DIR}/DCMTKConfig.cmake")
      find_package (DCMTK NO_MODULE QUIET)
    else ()
      find_package (DCMTK_legacy QUIET)
    endif ()
    find_package (DCMTK_wrap QUIET)
  endif ()

  if (NOT DCMTK_FOUND AND NOT PLM_SYSTEM_DCMTK STREQUAL "YES")
@@ -292,6 +291,8 @@ if (NOT PLM_CONFIG_DISABLE_DCMTK)
      message (STATUS "DCMTK not found.")
    endif ()
  endif ()
else ()
  set (DCMTK_FOUND FALSE)
endif ()

# Workaround for CMake bug in FindDCMTK.  This was fixed some time between
@@ -317,10 +318,10 @@ else ()
  set (MATLAB_FOUND false)
endif ()
find_package (Octave)
if (NOT PLM_CONFIG_DISABLE_OPENCL)
if (PLM_CONFIG_ENABLE_OPENCL)
  find_package (OpenCL)
endif ()
if (NOT PLM_CONFIG_DISABLE_OPENMP)
if (PLM_CONFIG_ENABLE_OPENMP)
  find_package (OpenMP)
endif ()
if (PLM_CONFIG_DEBIAN_BUILD)
@@ -328,8 +329,8 @@ if (PLM_CONFIG_DEBIAN_BUILD)
else ()
  find_package (SQLite)
endif ()
if (NOT PLM_CONFIG_DISABLE_SSE2)
  find_package (SSE)           # SSE Extensions for CPU
if (PLM_CONFIG_ENABLE_SSE2)
  find_package (SSE)
else ()
  set (SSE2_FOUND false)
endif ()
@@ -402,14 +403,14 @@ add_subdirectory (libs/nkidecompress)
##-----------------------------------------------------------------------------
##  Special CUDA processing
##-----------------------------------------------------------------------------
if (PLM_CONFIG_DISABLE_CUDA)
  set (CUDA_FOUND false)
else ()
if (PLM_CONFIG_ENABLE_CUDA)
  find_package (CUDA_wrap)
  set (CUDA_FOUND ${CUDA_FOUND} CACHE BOOL "Did we find cuda?")
  if (CUDA_FOUND)
    cuda_include_directories (${CMAKE_CURRENT_SOURCE_DIR})
  endif ()
else ()
  set (CUDA_FOUND false)
endif ()

##-----------------------------------------------------------------------------
@@ -512,33 +513,38 @@ set (PLM_BASIC_VERSION_STRING
  "${PLM_VERSION_MAJOR}.${PLM_VERSION_MINOR}.${PLM_VERSION_PATCH}")
set (PLASTIMATCH_VERSION_STRING
  "${PLM_VERSION_MAJOR}.${PLM_VERSION_MINOR}.${PLM_VERSION_PATCH}")
if (NOT PLM_RELEASE_VERSION)
  set (PLASTIMATCH_VERSION_STRING "${PLASTIMATCH_VERSION_STRING}-dev")
endif ()
if (EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT_FOUND)
  if (GIT_EXECUTABLE MATCHES "[wW][sS][lL].*")
    set (GIT_EXECUTABLE "wsl;git")
  endif ()
  execute_process (
    COMMAND
    #${GIT_EXECUTABLE} rev-list --first-parent --count HEAD
    ${GIT_EXECUTABLE} describe --always
    ${GIT_EXECUTABLE} ${GIT_EXECUTABLE_EXTRA} describe --always
    WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
    RESULT_VARIABLE git_result
    OUTPUT_VARIABLE git_version
    OUTPUT_VARIABLE git_output
    ERROR_VARIABLE git_error
    OUTPUT_STRIP_TRAILING_WHITESPACE
    )
  if (${git_result} EQUAL 0)
    set (PLASTIMATCH_VERSION_STRING "${PLASTIMATCH_VERSION_STRING} (${git_version})")
    string (REGEX MATCH "[^-]*-([0-9]+)-.*" junk ${git_output})
    set (PLM_VERSION_TWEAK "${CMAKE_MATCH_1}")
    set (PLASTIMATCH_VERSION_STRING "${git_output}")
  endif ()
  message (STATUS "Plastimatch version is ${git_version}")
endif ()
message (STATUS "Plastimatch version is ${PLASTIMATCH_VERSION_STRING}")

##-----------------------------------------------------------------------------
##  ITK
##-----------------------------------------------------------------------------
set (FIND_LIBRARY_USE_LIB64 true)
if (PLM_SYSTEM_ITK STREQUAL "YES")
  find_package (ITK REQUIRED)
  find_package (ITK REQUIRED
    PATHS "/usr/lib64/cmake/InsightToolkit")
elseif (PLM_SYSTEM_ITK STREQUAL "PREFERRED")
  find_package (ITK QUIET)
  find_package (ITK QUIET
    PATHS "/usr/lib64/cmake/InsightToolkit")
endif ()
if (NOT ITK_FOUND AND NOT PLM_SYSTEM_ITK STREQUAL "YES")
  message (STATUS "ITK will be downloaded and built.")
@@ -547,6 +553,7 @@ endif ()

if (ITK_FOUND)
  include (HandleITK)
  include (HandleVXL)
endif ()

##-----------------------------------------------------------------------------
@@ -593,12 +600,12 @@ endif ()
##-----------------------------------------------------------------------------
##  QT
##-----------------------------------------------------------------------------
if (PLM_CONFIG_DISABLE_QT)
  set (QT4_FOUND false)
  set (QT5_FOUND false)
else ()
if (PLM_CONFIG_ENABLE_QT)
  find_package (Qt4 4.6.3 QUIET COMPONENTS QtCore QtGui QtDesigner)
  find_package (Qt5 QUIET COMPONENTS Core Gui Designer Network Widgets)
else ()
  set (QT4_FOUND false)
  set (QT5_FOUND false)
endif ()

if (QT4_FOUND)
@@ -653,10 +660,24 @@ endif ()
##-----------------------------------------------------------------------------
find_package (LibYAML)

##-----------------------------------------------------------------------------
##  Opt4D
##-----------------------------------------------------------------------------
if (PLM_CONFIG_ENABLE_OPT4D)
  set (opt4D_DIR "${opt4D_DIR}" CACHE PATH "Path to opt4D build directory")
  find_package (opt4D)
  if (NOT opt4D_FOUND)
    message (STATUS "Opt4D will be downloaded and built.")
    include (SuperBuild/External_opt4D.cmake)
  endif ()
else ()
  set (opt4D_FOUND FALSE)
endif ()

##-----------------------------------------------------------------------------
##  Configure include files
##-----------------------------------------------------------------------------
set (PLM_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
sb_set (PLM_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})

##-----------------------------------------------------------------------------
##  Subdirectories
@@ -667,10 +688,13 @@ add_subdirectory (src)
##  Additional install files
##-----------------------------------------------------------------------------
if (ITK_FOUND)
  file (GLOB DLLFILES "${ITK_DIR}/bin/release/*.dll")
  set (DLL_PATTERNS "ITKCommon*.dll" "ITKIO*.dll" "ITKOptimizers*.dll" "ITKStatistics*.dll" "ITKTransform*.dll")
  foreach (p ${DLL_PATTERNS})
    file (GLOB DLLFILES "${ITK_DIR}/bin/release/${p}")
    if (DLLFILES)
      install (FILES ${DLLFILES} DESTINATION bin)
    endif ()
  endforeach ()
endif ()

#Add QT dlls to Install
@@ -849,7 +873,7 @@ endif ()
##    ...from within your build directory
##-----------------------------------------------------------------------------
# Choose generator
if (PLM_PACKAGE_WIX)
if (WIN32 AND PLM_PACKAGE_WIX)
  set (CPACK_GENERATOR "WIX")
elseif (PLM_PACKAGE_NSIS)
  set (CPACK_GENERATOR "NSIS")
@@ -867,12 +891,13 @@ set (CPACK_MONOLITHIC_INSTALL 1)
set (CPACK_INSTALL_PREFIX "")
set (CPACK_PACKAGE_CONTACT "plastimatch@googlegroups.com")
set (CPACK_PACKAGE_NAME "plastimatch")
set (CPACK_PACKAGE_INSTALL_DIRECTORY "Plastimatch")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Plastimatch - A Medical Imaging Application")
set (CPACK_PACKAGE_VENDOR "Plastimatch Dev Team")
set (CPACK_PACKAGE_VERSION_MAJOR "${PLM_VERSION_MAJOR}")
set (CPACK_PACKAGE_VERSION_MINOR "${PLM_VERSION_MINOR}")
set (CPACK_PACKAGE_VERSION_PATCH "${PLM_VERSION_PATCH}")
set (CPACK_PACKAGE_VERSION_TWEAK ${PLASTIMATCH_REPOSITORY_VERSION})
set (CPACK_PACKAGE_VERSION_TWEAK "${PLM_VERSION_TWEAK}")
set (CPACK_SOURCE_IGNORE_FILES
  "/\\\\.git"
  "/\\\\.svn"
@@ -893,6 +918,31 @@ set (CPACK_WIX_LICENSE_RTF "${PLM_WINDOWS_INSTALL_DIR}/License.rtf")
set (CPACK_WIX_UI_BANNER  "${PLM_WINDOWS_INSTALL_DIR}/plm_logo.jpg")
set (CPACK_WIX_UI_DIALOG  "${PLM_WINDOWS_INSTALL_DIR}/plm_logo_GUI.jpg")

set (CPACK_WIX_EXTRA_SOURCES
    "${PLM_SOURCE_DIR}/extra/wix/cmake_extra_dialog.wxs"
    "${PLM_SOURCE_DIR}/extra/wix/install_dir.wxs"
    "${PLM_SOURCE_DIR}/extra/wix/start_menu.wxs"
    )
set (CPACK_WIX_PATCH_FILE
    "${PLM_SOURCE_DIR}/extra/wix/patch_path_env.xml"
#    "${PLM_SOURCE_DIR}/extra/wix/patch_start_menu.xml"
    )
set (CPACK_WIX_UI_REF "CMakeUI_InstallDir")
if (CPACK_GENERATOR STREQUAL "WIX")
  set (CPACK_PACKAGE_NAME "Plastimatch")
  if (CPACK_PACKAGE_VERSION_TWEAK AND CPACK_PACKAGE_VERSION_TWEAK GREATER "0")
    set (CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.${CPACK_PACKAGE_VERSION_TWEAK}")
    if (CMAKE_SIZEOF_VOID_P EQUAL 8)
      set (CPACK_SYSTEM_NAME "win64")
    else ()
      set (CPACK_SYSTEM_NAME "win32")
    endif ()
    set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
  endif ()
  set_property (INSTALL "bin/launch_cmd_prompt.bat"
    PROPERTY CPACK_START_MENU_SHORTCUTS "Plastimatch Command Prompt")
endif ()

# ZIP stuff
if (CPACK_GENERATOR STREQUAL "ZIP")
  set (CPACK_SET_DESTDIR ON)
+2 −3
Original line number Diff line number Diff line
Plastimatch and uno-2-3-reg are distributed under BSD-style licenses.
Plastimatch is distributed under a BSD-style license.

Please see src/plastimatch/LICENSE.TXT and src/uno-2-3-reg/LICENSE.txt 
for license details.
Please see src/plastimatch/LICENSE.TXT for details.
+35 −0
Original line number Diff line number Diff line
##-----------------------------------------------------------------------------
##  Download opt4D from internet and compile
##-----------------------------------------------------------------------------
set (proj opt4D)

if(NOT DEFINED git_protocol)
  set(git_protocol "git")
endif()

set (opt4D_GIT_REPOSITORY "${git_protocol}://gitlab.com/gregsharp/opt4D.git")
set (opt4D_GIT_TAG "2e5a9edcdc472c427ccfc2c567499a7405f02e47")

ExternalProject_Add (${proj}
  GIT_REPOSITORY "${opt4D_GIT_REPOSITORY}"
  GIT_TAG ${opt4D_GIT_TAG}
  SOURCE_DIR ${proj}
  BINARY_DIR ${proj}-build
  CMAKE_GENERATOR ${gen}
  CMAKE_ARGS
  -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
  -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
  -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
  -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
  -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
  #    -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
  -DCMAKE_CXX_STANDARD_REQUIRED:BOOL=${CMAKE_CXX_STANDARD_REQUIRED}
  -DCMAKE_CXX_EXTENSIONS:BOOL=${CMAKE_CXX_EXTENSIONS}
  -DBUILD_EXAMPLES:BOOL=OFF
  -DBUILD_SHARED_LIBS:BOOL=ON
  -DBUILD_TESTING:BOOL=OFF
  -DModule_ITKReview:BOOL=ON
  INSTALL_COMMAND ""
  )

set (opt4D_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
+4544 −4523
Original line number Diff line number Diff line
@@ -822,6 +822,7 @@ set_tests_properties (demons-cuda-a-check PROPERTIES DEPENDS demons-cuda-a)
##   drr-d       gauss-4.mha (negative spacing), uniform
##   drr-cuda    gauss-1.mha, uniform
##   drr-opencl  gauss-1.mha, uniform
##   pcmd-drr-a  same as drr-a, but with plastimatch front end
## -------------------------------------------------------------------------
plm_add_test (
  "drr-a"
@@ -943,6 +944,26 @@ set_tests_properties (drr-opencl PROPERTIES DEPENDS gauss-1)
set_tests_properties (drr-opencl-stats PROPERTIES DEPENDS drr-opencl)
set_tests_properties (drr-opencl-check PROPERTIES DEPENDS drr-opencl-stats)

plm_add_test (
  "plm-drr-a"
  ${PLM_PLASTIMATCH_PATH}/plastimatch
  "drr;-a;20;-O;${PLM_BUILD_TESTING_DIR}/plm-drr-a/out_;-I;${PLM_BUILD_TESTING_DIR}/gauss-1.mha"
  )
plm_add_test (
  "plm-drr-a-stats"
  ${PLM_PLASTIMATCH_PATH}/plastimatch
  "stats;${PLM_BUILD_TESTING_DIR}/plm-drr-a/out_0010.pfm"
  )
plmtest_check_interval ("plm-drr-a-check"
  "${PLM_BUILD_TESTING_DIR}/plm-drr-a-stats.stdout.txt"
  "MAX *([-0-9.]*)"
  "0.045"
  "0.055"
  )
set_tests_properties (plm-drr-a PROPERTIES DEPENDS gauss-1)
set_tests_properties (plm-drr-a-stats PROPERTIES DEPENDS plm-drr-a)
set_tests_properties (plm-drr-a-check PROPERTIES DEPENDS plm-drr-a-stats)

## -------------------------------------------------------------------------
## fdk - all tests using fdk filtered backprojection
##   fdk-cpu-a     CPU reconstruction of synthetic data, flavor a
+3 −0
Original line number Diff line number Diff line
@@ -58,6 +58,9 @@ if (OPENCL_FOUND)
  endif ()
endif ()

# OpenCL tests disabled/issue #30
set (RUN_OPENCL_TESTS OFF)

# In ITK 3.20.1 (official release), masked registration is broken
if (NOT ${ITK_VERSION} VERSION_GREATER "3.20.1")
set (CTEST_CUSTOM_TESTS_IGNORE
Loading