Skip to content
Commits on Source (4)
This diff is collapsed.
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)
This diff is collapsed.
......@@ -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
......
[PLAN]
patient = @PLM_BUILD_TESTING_DIR@/rect-17.mha
target = @PLM_BUILD_TESTING_DIR@/ptv-1.mha
dose_out = @PLM_BUILD_TESTING_DIR@/@PLM_TEST_NAME@.mha
[BEAM]
flavor = f
homo_approx = n
source = 0 -2000 0
isocenter = 0 0 0
aperture_offset = 1500
aperture_origin = -75 -75
aperture_spacing = 3.75 3.75
aperture_resolution = 41 41
aperture_smearing = 5
source_size = 0
[PEAK]
energy=100.00000
spread=1.000000
weight=1.0
[PLAN]
patient = @PLM_BUILD_TESTING_DIR@/rect-17.mha
target = @PLM_BUILD_TESTING_DIR@/ptv-1.mha
dose_out = @PLM_BUILD_TESTING_DIR@/@PLM_TEST_NAME@.mha
[BEAM]
flavor = f
homo_approx = n
source = 0 -2000 0
isocenter = 0 0 0
aperture_offset = 1500
aperture_origin = -75 -75
aperture_spacing = 3.75 3.75
aperture_resolution = 41 41
aperture_smearing = 5
source_size = 0
[PEAK]
energy=100.00000
spread=1.000000
weight=1.0
[PLAN]
patient = @PLM_BUILD_TESTING_DIR@/rect-17.mha
target = @PLM_BUILD_TESTING_DIR@/ptv-1.mha
dose_out = @PLM_BUILD_TESTING_DIR@/@PLM_TEST_NAME@.mha
[BEAM]
flavor = d
homo_approx = n
source = 0 -2000 0
isocenter = 0 0 0
aperture_offset = 1500
aperture_origin = -75 -75
aperture_spacing = 3.75 3.75
aperture_resolution = 41 41
aperture_smearing = 5
source_size = 0
[PLAN]
patient = @PLM_BUILD_TESTING_DIR@/rect-17.mha
target = @PLM_BUILD_TESTING_DIR@/ptv-1.mha
dose_out = @PLM_BUILD_TESTING_DIR@/@PLM_TEST_NAME@.mha
[BEAM]
flavor = d
homo_approx = n
source = 0 -2000 0
isocenter = 0 0 0
aperture_offset = 1500
aperture_origin = -75 -75
aperture_spacing = 3.75 3.75
aperture_resolution = 41 41
aperture_smearing = 5
source_size = 0
[PLAN]
patient = @PLM_BUILD_TESTING_DIR@/rect-17.mha
dose_out = @PLM_BUILD_TESTING_DIR@/@PLM_TEST_NAME@.mha
dose_prescription = 70
[BEAM]
flavor = a
homo_approx = n
source = 0 -2000 0
isocenter = 0 0 0
aperture_origin = -20 -20
aperture_offset = 1500
aperture_spacing = 1 1
aperture_resolution = 41 41
source_size = 0
spot = -5,0,120,6.0,1.5
[PLAN]
patient = @PLM_BUILD_TESTING_DIR@/rect-17.mha
dose_out = @PLM_BUILD_TESTING_DIR@/@PLM_TEST_NAME@.mha
dose_prescription = 70
[BEAM]
flavor = a
homo_approx = n
source = 0 -2000 0
isocenter = 0 0 0
aperture_origin = -20 -20
aperture_offset = 1500
aperture_spacing = 1 1
aperture_resolution = 41 41
source_size = 0
spot = -5,0,120,6.0,1.5
[GLOBAL]
fixed=@PLM_BUILD_TESTING_DIR@/gauss-1.mha
moving=@PLM_BUILD_TESTING_DIR@/gauss-2.mha
[STAGE]
xform=bspline
optim=lbfgsb
impl=plastimatch
threading=single
alg_flavor=c
max_its=5
convergence_tol=3
grad_tol=0.1
grid_spac=30 30 30
res=2 2 2
[GLOBAL]
fixed=@PLM_BUILD_TESTING_DIR@/gauss-1.mha
moving=@PLM_BUILD_TESTING_DIR@/gauss-2.mha
[STAGE]
xform=bspline
optim=lbfgsb
impl=plastimatch
threading=single
alg_flavor=c
max_its=5
convergence_tol=3
grad_tol=0.1
grid_spac=30 30 30
res=2 2 2
[INPUT SETTINGS]
ct=@PLM_BUILD_TESTING_DIR@/lung-1.mha
proj_wed=@PLM_BUILD_TESTING_DIR@/wed-a-proj-wed.rpl
target=@PLM_BUILD_TESTING_DIR@/lung-1-prefix/Tumor.mha
skin=@PLM_BUILD_TESTING_DIR@/lung-1-prefix/Body.mha
[OUTPUT SETTINGS]
proj_ct=@PLM_BUILD_TESTING_DIR@/@PLM_TEST_NAME@-proj-ct.rpl
wed_ct=@PLM_BUILD_TESTING_DIR@/@PLM_TEST_NAME@-wed-ct.mha
[BEAM]
pos=-2270.5 0 0
isocenter=0 0 0
res=1
[APERTURE]
offset=1700
center=49.5 49.5
resolution=100 100
[INPUT SETTINGS]
ct=@PLM_BUILD_TESTING_DIR@/lung-1.mha
proj_wed=@PLM_BUILD_TESTING_DIR@/wed-a-proj-wed.rpl
target=@PLM_BUILD_TESTING_DIR@/lung-1-prefix/Tumor.mha
skin=@PLM_BUILD_TESTING_DIR@/lung-1-prefix/Body.mha
[OUTPUT SETTINGS]
proj_ct=@PLM_BUILD_TESTING_DIR@/@PLM_TEST_NAME@-proj-ct.rpl
wed_ct=@PLM_BUILD_TESTING_DIR@/@PLM_TEST_NAME@-wed-ct.mha
[BEAM]
pos=-2270.5 0 0
isocenter=0 0 0
res=1
[APERTURE]
offset=1700
center=49.5 49.5
resolution=100 100
[INPUT SETTINGS]
ct=@PLM_BUILD_TESTING_DIR@/lung-1.mha
proj_wed=@PLM_BUILD_TESTING_DIR@/wed-a-proj-wed.mha
target=@PLM_BUILD_TESTING_DIR@/lung-1-prefix/Tumor.mha
skin=@PLM_BUILD_TESTING_DIR@/lung-1-prefix/Body.mha
[OUTPUT SETTINGS]
dew_ct=@PLM_BUILD_TESTING_DIR@/@PLM_TEST_NAME@-dew-ct.mha
[BEAM]
pos=-2270.5 0 0
isocenter=0 0 0
res=1
[APERTURE]
offset=1700
center=49.5 49.5
resolution=100 100
[INPUT SETTINGS]
ct=@PLM_BUILD_TESTING_DIR@/lung-1.mha
proj_wed=@PLM_BUILD_TESTING_DIR@/wed-a-proj-wed.mha
target=@PLM_BUILD_TESTING_DIR@/lung-1-prefix/Tumor.mha
skin=@PLM_BUILD_TESTING_DIR@/lung-1-prefix/Body.mha
[OUTPUT SETTINGS]
dew_ct=@PLM_BUILD_TESTING_DIR@/@PLM_TEST_NAME@-dew-ct.mha
[BEAM]
pos=-2270.5 0 0
isocenter=0 0 0
res=1
[APERTURE]
offset=1700
center=49.5 49.5
resolution=100 100
## This script compares a value in a text file against lower and
## upper thresholds
message (STATUS "INFILE is ${INFILE}")
message (STATUS "REGEX is ${REGEX}")
message (STATUS "LOWER_THRESH is ${LOWER_THRESH}")
message (STATUS "UPPER_THRESH is ${UPPER_THRESH}")
file (STRINGS ${INFILE} TEST_OUTPUT REGEX "${REGEX}")
message (STATUS "PARSED VALUE=|${TEST_OUTPUT}|")
string (REGEX MATCH "${REGEX}" TEST_OUTPUT ${TEST_OUTPUT})
set (TEST_OUTPUT ${CMAKE_MATCH_1})
message (STATUS "PARSED_VALUE=|${TEST_OUTPUT}|")
string (LENGTH "${CMAKE_MATCH_1}" MATCH_LENGTH)
if (MATCH_LENGTH GREATER 0
AND NOT CMAKE_MATCH_1 LESS ${LOWER_THRESH}
AND NOT CMAKE_MATCH_1 GREATER ${UPPER_THRESH})
message ("Not an error")
else ()
message (SEND_ERROR "An error")
endif ()
## This script compares a value in a text file against lower and
## upper thresholds
message (STATUS "INFILE is ${INFILE}")
message (STATUS "REGEX is ${REGEX}")
message (STATUS "LOWER_THRESH is ${LOWER_THRESH}")
message (STATUS "UPPER_THRESH is ${UPPER_THRESH}")
file (STRINGS ${INFILE} TEST_OUTPUT REGEX "${REGEX}")
message (STATUS "PARSED VALUE=|${TEST_OUTPUT}|")
string (REGEX MATCH "${REGEX}" TEST_OUTPUT ${TEST_OUTPUT})
set (TEST_OUTPUT ${CMAKE_MATCH_1})
message (STATUS "PARSED_VALUE=|${TEST_OUTPUT}|")
string (LENGTH "${CMAKE_MATCH_1}" MATCH_LENGTH)
if (MATCH_LENGTH GREATER 0
AND NOT CMAKE_MATCH_1 LESS ${LOWER_THRESH}
AND NOT CMAKE_MATCH_1 GREATER ${UPPER_THRESH})
message ("Not an error")
else ()
message (SEND_ERROR "An error")
endif ()
## This script finds a regex in a file and compares the first match
## with an input string
message (STATUS "INFILE is ${INFILE}")
message (STATUS "REGEX is ${REGEX}")
message (STATUS "MATCH_STRING is ${MATCH_STRING}")
file (STRINGS ${INFILE} test_output REGEX "${REGEX}")
message (STATUS "PARSED VALUE=|${test_output}|")
string (REGEX MATCH "${REGEX}" test_output ${test_output})
set (test_output ${CMAKE_MATCH_1})
message (STATUS "PARSED_VALUE=|${test_output}|")
string (LENGTH "${test_output}" match_length)
message (STATUS "LENGTH=${match_length}")
message (STATUS "|${test_output}|${MATCH_STRING}|")
if ("${match_length}" GREATER 0
AND "${test_output}" STREQUAL "${MATCH_STRING}")
message("Not an error")
else ()
message (SEND_ERROR "An error")
endif ()
## This script finds a regex in a file and compares the first match
## with an input string
message (STATUS "INFILE is ${INFILE}")
message (STATUS "REGEX is ${REGEX}")
message (STATUS "MATCH_STRING is ${MATCH_STRING}")
file (STRINGS ${INFILE} test_output REGEX "${REGEX}")
message (STATUS "PARSED VALUE=|${test_output}|")
string (REGEX MATCH "${REGEX}" test_output ${test_output})
set (test_output ${CMAKE_MATCH_1})
message (STATUS "PARSED_VALUE=|${test_output}|")
string (LENGTH "${test_output}" match_length)
message (STATUS "LENGTH=${match_length}")
message (STATUS "|${test_output}|${MATCH_STRING}|")
if ("${match_length}" GREATER 0
AND "${test_output}" STREQUAL "${MATCH_STRING}")
message("Not an error")
else ()
message (SEND_ERROR "An error")
endif ()
## This script runs the speed tests
execute_process (
COMMAND "${PLM_PLASTIMATCH_PATH}/plastimatch"
# OUTPUT_FILE ${PLM_BUILD_TESTING_DIR}/hello.txt
OUTPUT_VARIABLE STDOUT
ERROR_VARIABLE STDOUT
)
message (STATUS "${PLM_PLASTIMATCH_PATH}/plastimatch")
message (STATUS "${STDOUT}")
file (WRITE "${PLM_BUILD_TESTING_DIR}/hello.txt"
"${PLM_PLASTIMATCH_PATH}/plastimatch\n")
file (APPEND "${PLM_BUILD_TESTING_DIR}/hello.txt"
"STDOUT = ${STDOUT}\n")
file (APPEND "${PLM_BUILD_TESTING_DIR}/hello.txt"
"STDERR = ${STDERR}\n")
## This script runs the speed tests
execute_process (
COMMAND "${PLM_PLASTIMATCH_PATH}/plastimatch"
# OUTPUT_FILE ${PLM_BUILD_TESTING_DIR}/hello.txt
OUTPUT_VARIABLE STDOUT
ERROR_VARIABLE STDOUT
)
message (STATUS "${PLM_PLASTIMATCH_PATH}/plastimatch")
message (STATUS "${STDOUT}")
file (WRITE "${PLM_BUILD_TESTING_DIR}/hello.txt"
"${PLM_PLASTIMATCH_PATH}/plastimatch\n")
file (APPEND "${PLM_BUILD_TESTING_DIR}/hello.txt"
"STDOUT = ${STDOUT}\n")
file (APPEND "${PLM_BUILD_TESTING_DIR}/hello.txt"
"STDERR = ${STDERR}\n")
######################################################
## 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)
......@@ -13,7 +88,7 @@ else ()
set (CUDA_PROPAGATE_HOST_FLAGS OFF)
endif ()
# GCS 2012-05-11: We need to propagate cxx flags to nvcc, but
# GCS 2012-05-11: We need to propagate cxx flags to nvcc, but
# the flag -ftest-coverage causes nvcc to barf, so exclude that one
if (CMAKE_COMPILER_IS_GNUCC)
string (REPLACE "-ftest-coverage" "" TMP "${CMAKE_CXX_FLAGS}")
......@@ -56,113 +131,72 @@ if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
endif ()
if (CUDA_CXX_FLAGS)
list (APPEND CUDA_NVCC_FLAGS --compiler-options ${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)
# Try some obvious paths not searched by stock FindCUDA
find_path(CUDA_SDK_ROOT_DIR common/inc/cutil.h
"$ENV{HOME}/NVIDIA_GPU_Computing_SDK/C"
"/usr/local/NVIDIA_GPU_Computing_SDK/C"
)
endif ()
if (CUDA_SDK_ROOT_DIR)
find_path (CUDA_CUT_INCLUDE_DIR
cutil.h
PATHS ${CUDA_SDK_SEARCH_PATH}
PATH_SUFFIXES "common/inc" "C/common/inc"
DOC "Location of cutil.h"
NO_DEFAULT_PATH
)
if (CUDA_CUT_INCLUDE_DIR)
cuda_include_directories (
${CUDA_CUT_INCLUDE_DIR}
# GCS 2012-05-22 -- viscous fluid registration requires CUDA SDK.
if (NOT CUDA_SDK_ROOT_DIR)
# Try some obvious paths not searched by stock FindCUDA
find_path(CUDA_SDK_ROOT_DIR common/inc/cutil.h
"$ENV{HOME}/NVIDIA_GPU_Computing_SDK/C"
"/usr/local/NVIDIA_GPU_Computing_SDK/C"
)
endif ()
endif ()
# JAS 08.25.2010
# Check to make sure nvcc has gcc-4.3 for compiling.
# This script will modify CUDA_NVCC_FLAGS if system default is not gcc-4.3
include (nvcc-check)
# GCS 2017-10-24: Let CUDA work with gcc 6 and CUDA 8
if (CUDA_VERSION_MAJOR EQUAL "8"
AND CMAKE_COMPILER_IS_GNUCC
AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
list (APPEND CUDA_NVCC_FLAGS
--compiler-options -D__GNUC__=5)
endif ()
if (CUDA_SDK_ROOT_DIR)
find_path (CUDA_CUT_INCLUDE_DIR
cutil.h
PATHS ${CUDA_SDK_SEARCH_PATH}
PATH_SUFFIXES "common/inc" "C/common/inc"
DOC "Location of cutil.h"
NO_DEFAULT_PATH
)
if (CUDA_CUT_INCLUDE_DIR)
cuda_include_directories (
${CUDA_CUT_INCLUDE_DIR}
)
endif ()
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")
# JAS 08.25.2010
# Check to make sure nvcc has gcc-4.3 for compiling.
# This script will modify CUDA_NVCC_FLAGS if system default is not gcc-4.3
include (nvcc-check)
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()
# 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 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 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
AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
list (APPEND CUDA_NVCC_FLAGS
--compiler-options -D__GNUC__=5)
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}")