Skip to content
Commits on Source (4)
......@@ -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)
......
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.
##-----------------------------------------------------------------------------
## 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)
......@@ -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
......
......@@ -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
......
######################################################
## Check if nullptr is supported by the compiler
## Returns: HAVE_NULLPTR
######################################################
include (CheckCXXSourceCompiles)
set (NULLPTR_TEST_SOURCE "int main() {(void)nullptr;}")
check_cxx_source_compiles ("${NULLPTR_TEST_SOURCE}" HAVE_NULLPTR)
if (NOT HAVE_NULLPTR)
unset (HAVE_NULLPTR CACHE)
push_var (CMAKE_REQUIRED_FLAGS)
set (CMAKE_REQUIRED_FLAGS "-std=c++11")
check_cxx_source_compiles ("${NULLPTR_TEST_SOURCE}" HAVE_NULLPTR)
pop_var (CMAKE_REQUIRED_FLAGS)
if (HAVE_NULLPTR)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif ()
endif ()
# Detect development libraries for Advantech I/O card.
# These variables are set:
#
# ADVANTECH_FOUND
# ADVANTECH_INCLUDE_DIR
# ADVANTECH_LIBRARIES
#
# Only works on Windows
if (ADVANTECH_INCLUDE_DIR)
# Already in cache, be silent
set (Advantech_FIND_QUIETLY TRUE)
endif ()
FIND_PATH (ADVANTECH_INCLUDE_DIR "Driver.h"
"C:/Program Files/Advantech/Adsapi/Include"
DOC "Path to ADVANTECH include files.")
FIND_PATH (ADVANTECH_LIBRARY_PATH "ADSDEV.lib"
"C:/Program Files/Advantech/Adsapi/Lib"
DOC "Path to ADVANTECH libraries.")
FIND_LIBRARY(ADVANTECH_ADS841_LIB ADS841 ${ADVANTECH_LIBRARY_PATH})
FIND_LIBRARY(ADVANTECH_Adsapi32_LIB Adsapi32 ${ADVANTECH_LIBRARY_PATH})
FIND_LIBRARY(ADVANTECH_Adsapi32bcb_LIB Adsapi32bcb ${ADVANTECH_LIBRARY_PATH})
FIND_LIBRARY(ADVANTECH_Adscomm_LIB Adscomm ${ADVANTECH_LIBRARY_PATH})
FIND_LIBRARY(ADVANTECH_ADSDEV_LIB ADSDEV ${ADVANTECH_LIBRARY_PATH})
FIND_LIBRARY(ADVANTECH_adsdnet_LIB adsdnet ${ADVANTECH_LIBRARY_PATH})
if (ADVANTECH_Adscomm_LIB AND ADVANTECH_Adsapi32_LIB)
set (ADVANTECH_LIBRARIES ${ADVANTECH_Adscomm_LIB} ${ADVANTECH_Adsapi32_LIB})
else ()
set (ADVANTECH_LIBRARIES)
endif ()
INCLUDE (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (Advantech DEFAULT_MSG
ADVANTECH_LIBRARIES ADVANTECH_INCLUDE_DIR)
MARK_AS_ADVANCED (
ADVANTECH_ADS841_LIB
ADVANTECH_Adsapi32_LIB
ADVANTECH_Adsapi32bcb_LIB
ADVANTECH_Adscomm_LIB
ADVANTECH_ADSDEV_LIB
ADVANTECH_adsdnet_LIB)
# Bitflow lib and include path
# These variables are set:
#
# BITFLOW_FOUND
# BITFLOW_INCLUDE_DIR
# BITFLOW_LIBRARIES
#
# Only works on Windows
if (BITFLOW_INCLUDE_DIR)
# Already in cache, be silent
set (Bitflow_FIND_QUIETLY TRUE)
endif ()
FIND_PATH (BITFLOW_SDK_DIR "include/BFApi.h" "C:/BitFlow SDK 4.00"
DOC "Path to Bitflow SDK")
FIND_PATH (BITFLOW_INCLUDE_DIR "BFApi.h"
"${BITFLOW_SDK_DIR}/include"
"C:/BitFlow SDK 4.00/include"
DOC "Path to Bitflow include files")
FIND_PATH (BITFLOW_LIBRARY_PATH "BFD.lib"
"${BITFLOW_SDK_DIR}/lib"
"C:/BitFlow SDK 4.00/lib"
DOC "Path to Bitflow libraries.")
FIND_LIBRARY (BITFLOW_BFD_LIB BFD ${BITFLOW_LIBRARY_PATH})
FIND_LIBRARY (BITFLOW_R2D_LIB R2d ${BITFLOW_LIBRARY_PATH})
FIND_LIBRARY (BITFLOW_DISPSURF_LIB DispSurf ${BITFLOW_LIBRARY_PATH})
if (BITFLOW_BFD_LIB AND BITFLOW_R2D_LIB AND BITFLOW_DISPSURF_LIB)
set (BITFLOW_LIBRARIES
${BITFLOW_BFD_LIB} ${BITFLOW_R2D_LIB} ${BITFLOW_DISPSURF_LIB})
else ()
set (BITFLOW_LIBRARIES)
endif ()
INCLUDE (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (Bitflow DEFAULT_MSG
BITFLOW_LIBRARIES BITFLOW_INCLUDE_DIR)
MARK_AS_ADVANCED (
BITFLOW_INCLUDE_DIR
BITFLOW_LIBRARY_PATH
BITFLOW_BFD_LIB
BITFLOW_R2D_LIB
BITFLOW_DISPSURF_LIB)
# - Wrapper around FindCUDA
macro (set_compute_capabilities)
# JAS 2010.12.09
# Build code for all known compute capabilities by default.
# When developing, it is sometimes nice to turn this off in order
# to speed up the build processes (since you only have 1 GPU in your machine).
if (PLM_CUDA_ALL_DEVICES)
message (STATUS "CUDA Build Level: ALL Compute Capabilities")
if (CUDA_VERSION_MAJOR LESS "7")
message (STATUS " Compute Cap 1: [X]")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_11,code=sm_11
-gencode arch=compute_12,code=sm_12
-gencode arch=compute_13,code=sm_13
)
if (CUDA_VERSION_MINOR LESS "5")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_10,code=sm_10)
endif ()
else()
message (STATUS " Compute Cap 1: [ ]")
endif()
if (CUDA_VERSION_MAJOR GREATER "2" AND CUDA_VERSION_MAJOR LESS "9")
message (STATUS " Compute Cap 2: [X]")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_20,code=sm_20
)
else()
message (STATUS " Compute Cap 2: [ ]")
endif()
if (CUDA_VERSION_MAJOR GREATER "4")
message (STATUS " Compute Cap 3: [X]")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_30,code=sm_30
)
else()
message (STATUS " Compute Cap 3: [ ]")
endif()
if (CUDA_VERSION_MAJOR GREATER "5")
message (STATUS " Compute Cap 5: [X]")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_50,code=sm_50
-gencode arch=compute_50,code=compute_50
)
else()
message (STATUS " Compute Cap 5: [ ]")
endif()
if (CUDA_VERSION_MAJOR GREATER "7")
message (STATUS " Compute Cap 6: [X]")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_60,code=sm_60
-gencode arch=compute_60,code=compute_60
)
else()
message (STATUS " Compute Cap 6: [ ]")
endif()
if (CUDA_VERSION_MAJOR GREATER "8")
message (STATUS " Compute Cap 7: [X]")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_70,code=sm_70
-gencode arch=compute_70,code=compute_70
)
else()
message (STATUS " Compute Cap 7: [ ]")
endif()
else ()
message (STATUS "CUDA Build Level: Build system Compute Capability ONLY!")
endif ()
endmacro ()
if (MINGW)
# Cuda doesn't work with mingw at all
set (CUDA_FOUND FALSE)
......@@ -59,13 +134,18 @@ if (CUDA_CXX_FLAGS)
list (APPEND CUDA_NVCC_FLAGS --compiler-options ${CUDA_CXX_FLAGS})
endif ()
set (CUDA_FOUND ${CUDA_FOUND} CACHE BOOL "Did we find cuda?")
#set (CUDA_FOUND ${CUDA_FOUND} CACHE BOOL "Did we find cuda?")
if (CUDA_FOUND)
message (STATUS "CUDA Version ${CUDA_VERSION}")
else ()
message (STATUS "CUDA Not found")
endif ()
if (CUDA_FOUND)
cuda_include_directories (
${CMAKE_CURRENT_SOURCE_DIR}
)
endif ()
# GCS 2012-05-22 -- viscous fluid registration requires CUDA SDK.
if (NOT CUDA_SDK_ROOT_DIR)
......@@ -95,6 +175,19 @@ endif ()
# This script will modify CUDA_NVCC_FLAGS if system default is not gcc-4.3
include (nvcc-check)
# Make nvcc less whiny
if (CUDA_VERSION_MAJOR GREATER "5")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
--Wno-deprecated-gpu-targets)
endif ()
if (CUDA_VERSION_MAJOR EQUAL "9"
AND CMAKE_COMPILER_IS_GNUCC
AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
list (APPEND CUDA_NVCC_FLAGS
--compiler-options -D__GNUC__=6)
endif ()
# GCS 2017-10-24: Let CUDA work with gcc 6 and CUDA 8
if (CUDA_VERSION_MAJOR EQUAL "8"
AND CMAKE_COMPILER_IS_GNUCC
......@@ -103,66 +196,7 @@ if (CUDA_VERSION_MAJOR EQUAL "8"
--compiler-options -D__GNUC__=5)
endif ()
# JAS 2010.12.09
# Build code for all known compute capabilities by default.
# When developing, it is sometimes nice to turn this off in order
# to speed up the build processes (since you only have 1 GPU in your machine).
set (PLM_CUDA_ALL_DEVICES ON CACHE BOOL
"Generate GPU code for all compute capabilities?")
if (PLM_CUDA_ALL_DEVICES)
message (STATUS "CUDA Build Level: ALL Compute Capabilities")
if (CUDA_VERSION_MAJOR LESS "7")
message (STATUS " >> Generation 1: [X]")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_11,code=sm_11
-gencode arch=compute_12,code=sm_12
-gencode arch=compute_13,code=sm_13
)
if (CUDA_VERSION_MAJOR EQUAL "6")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
--Wno-deprecated-gpu-targets)
if (CUDA_VERSION_MINOR LESS "5")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_10,code=sm_10)
endif ()
else ()
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_10,code=sm_10)
endif ()
else()
message (STATUS " >> Generation 1: [ ]")
endif()
if (CUDA_VERSION_MAJOR GREATER "2")
message (STATUS " >> Generation 2: [X]")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_20,code=sm_20
)
else()
message (STATUS " >> Generation 2: [ ]")
endif()
if (CUDA_VERSION_MAJOR GREATER "4")
message (STATUS " >> Generation 3: [X]")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_30,code=sm_30
)
else()
message (STATUS " >> Generation 3: [ ]")
endif()
if (CUDA_VERSION_MAJOR GREATER "5")
message (STATUS " >> Generation 5: [X]")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-gencode arch=compute_50,code=sm_50
-gencode arch=compute_50,code=compute_50
)
else()
message (STATUS " >> Generation 5: [ ]")
endif()
# Choose compute capabilities
set_compute_capabilities ()
#MESSAGE(STATUS "<<-->>: CUDA_NVCC_FLAGS set to \"${CUDA_NVCC_FLAGS}\"")
else ()
message (STATUS "CUDA Build Level: Build system Compute Capability ONLY!")
endif ()
# - find DCMTK libraries
#
# DCMTK_INCLUDE_DIR - Directories to include to use DCMTK
# DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK
# DCMTK_LIBRARIES - Files to link against to use DCMTK
# DCMTK_FOUND - If false, don't try to use DCMTK
# DCMTK_DIR - (optional) Source directory for DCMTK
......@@ -54,7 +54,7 @@ else ()
message (STATUS "Looking for SSL - not found")
endif ()
find_path (DCMTK_INCLUDE_DIR
find_path (DCMTK_INCLUDE_DIRS
NAMES dcmtk/config/osconfig.h
HINTS
${DCMTK_DIR}/include
......@@ -155,7 +155,7 @@ find_library (DCMTK_ofstd_LIBRARY
/usr/local/dicom/lib
)
if (DCMTK_INCLUDE_DIR
if (DCMTK_INCLUDE_DIRS
AND DCMTK_dcmnet_LIBRARY
AND DCMTK_ofstd_LIBRARY
AND DCMTK_dcmdata_LIBRARY
......@@ -222,8 +222,8 @@ if (DCMTK_INCLUDE_DIR
# Dcmtk must be linked with libwrap if the original package was
# built with libwrap support.
set (NEED_LIBWRAP_CHECK TRUE)
if (EXISTS "${DCMTK_INCLUDE_DIR}/dcmtk/config/osconfig.h")
file (STRINGS "${DCMTK_INCLUDE_DIR}/dcmtk/config/osconfig.h"
if (EXISTS "${DCMTK_INCLUDE_DIRS}/dcmtk/config/osconfig.h")
file (STRINGS "${DCMTK_INCLUDE_DIRS}/dcmtk/config/osconfig.h"
DCMTK_UNDEF_TCPWRAPPER
REGEX "#undef WITH_TCPWRAPPER")
if (NOT ${DCMTK_UNDEF_TCPWRAPPER} STREQUAL "")
......@@ -247,3 +247,4 @@ if (DCMTK_INCLUDE_DIR
set (DCMTK_LIBRARIES ${DCMTK_LIBRARIES} netapi32 ws2_32)
endif ()
endif ()
# - Wrapper around FindDCMTK
## If it is a modern version of DCMTK, such as found in Slicer build,
## it will have a working version of DCMTKConfig.cmake.
## Otherwise we use the old hacked version of FindDCMTK.cmake.
if (DCMTK_DIR)
if (EXISTS "${DCMTK_DIR}/DCMTKConfig.cmake")
find_package (DCMTK NO_MODULE)
endif ()
##-----------------------------------------------------------------------------
## See COPYRIGHT.TXT and LICENSE.TXT for copyright and license information
##-----------------------------------------------------------------------------
if (DCMTK_wrap_FIND_QUIETLY)
list (APPEND DCMTK_EXTRA_ARGS QUIET)
endif ()
if (NOT DCMTK_FOUND)
find_package (DCMTK)
if (DCMTK_wrap_FIND_REQUIRED)
list (APPEND DCMTK_EXTRA_ARGS REQUIRED)
endif ()
# if (DCMTK_DIR AND EXISTS "${DCMTK_DIR}/DCMTKConfig.cmake")
# find_package (DCMTK NO_MODULE ${EXTRA_ARGS})
# else ()
# find_package (DCMTK_legacy ${EXTRA_ARGS})
# endif ()
## Get the version string (?)
if (DCMTK_FOUND)
# Basic version information
if (DCMTK_VERSION_MAJOR)
set (DCMTK_VERSION_STRING "${DCMTK_VERSION_MAJOR}.${DCMTK_VERSION_MINOR}.${DCMTK_VERSION_PATCH}")
endif ()
if (NOT DCMTK_VERSION_STRING)
if (EXISTS "${DCMTK_INCLUDE_DIR}/dcmtk/dcmdata/dcuid.h")
file (STRINGS "${DCMTK_INCLUDE_DIR}/dcmtk/dcmdata/dcuid.h"
DCMTK_VERSION_STRING
REGEX "^#define OFFIS_DCMTK_VERSION_STRING *\"([^\"]*)\"")
endif ()
endif ()
if (NOT DCMTK_VERSION_STRING)
if (EXISTS "${DCMTK_INCLUDE_DIR}/dcmtk/config/osconfig.h")
file (STRINGS "${DCMTK_INCLUDE_DIR}/dcmtk/config/osconfig.h"
DCMTK_VERSION_STRING
REGEX "^#define PACKAGE_VERSION *\"([^\"]*)\"")
endif ()
endif ()
if (NOT DCMTK_VERSION_STRING)
if (EXISTS "${DCMTK_INCLUDE_DIR}/dcmtk/config/cfunix.h")
file (STRINGS "${DCMTK_INCLUDE_DIR}/dcmtk/config/cfunix.h"
DCMTK_VERSION_STRING
REGEX "^#define PACKAGE_VERSION *\"([^\"]*)\"")
endif ()
endif ()
if (DCMTK_VERSION_STRING)
# GCS: The below doesn't seem to work on Mac CMake 2.6.4.
# SET (DCMTK_VERSION_STRING "${CMAKE_MATCH_1}")
string (REGEX REPLACE "[^\"]*\"([^\"]*)\".*" "\\1"
DCMTK_VERSION_STRING "${DCMTK_VERSION_STRING}")
endif ()
find_package (DCMTK NO_MODULE ${EXTRA_ARGS})
if (NOT DCMTK_FOUND)
message (STATUS "Searching for DCMTK using legacy method")
find_package (DCMTK_legacy ${EXTRA_ARGS})
endif ()
if (DCMTK_FOUND)
message (STATUS "DCMTK version ${DCMTK_VERSION_STRING}")
else ()
message (STATUS "DCMTK not found")
endif ()
# The DCMTK 3.6.2 DCMTKConfig.cmake seems to be broken on windows
string (REPLACE "DCMTK_INCLUDE_DIRS-NOTFOUND;" "" DCMTK_INCLUDE_DIRS
"${DCMTK_INCLUDE_DIRS}")