diff --git a/cmake/FindCUDA_wrap.cmake b/cmake/FindCUDA_wrap.cmake index 40275bba9..d2de422a0 100755 --- a/cmake/FindCUDA_wrap.cmake +++ b/cmake/FindCUDA_wrap.cmake @@ -112,8 +112,9 @@ endif () # 14-5-2016 PAOLO: WORKAROUND GCC 6.1 AND CUDA 7.5 INCOMPATIBILITY if (CMAKE_COMPILER_IS_GNUCC - AND (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)) - set (CUDA_CXX_FLAGS "${CUDA_CXX_FLAGS},-std=c++98") + AND (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0) + AND (NOT CUDA_VERSION_MAJOR VERSION_GREATER 7)) + set (CUDA_CXX_FLAGS "${CUDA_CXX_FLAGS},-std=c++98") endif () # ITK headers cannot be processed by nvcc, so we define @@ -181,19 +182,25 @@ if (CUDA_FOUND) --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 + # Let CUDA work with unsupported (too new) gcc versions + # Note: CUDA 10 cannot be used with gcc 10 or greater. 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) + elseif (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) + elseif (CUDA_VERSION_MAJOR EQUAL "10" + AND CMAKE_COMPILER_IS_GNUCC) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0) + list (APPEND CUDA_NVCC_FLAGS + --compiler-options -D__GNUC__=8) + # For gcc 10, let it fail. + endif() endif () # Choose compute capabilities diff --git a/libs/ransac/RANSAC.h b/libs/ransac/RANSAC.h index 15667488e..c454bc5d0 100644 --- a/libs/ransac/RANSAC.h +++ b/libs/ransac/RANSAC.h @@ -145,8 +145,13 @@ class RANSAC : public Object { return false; } }; - - static ITK_THREAD_RETURN_TYPE RANSACThreadCallback( void *arg ); + static +#if ITK_VERSION_MAJOR >= 5 + ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION +#else + ITK_THREAD_RETURN_TYPE +#endif + RANSACThreadCallback( void *arg ); //number of threads used in computing the RANSAC hypotheses unsigned int numberOfThreads; diff --git a/libs/ransac/RANSAC.txx b/libs/ransac/RANSAC.txx index b0f628e4b..1149ce61c 100644 --- a/libs/ransac/RANSAC.txx +++ b/libs/ransac/RANSAC.txx @@ -150,7 +150,7 @@ double RANSAC::Compute( std::vector ¶meters, template #if ITK_VERSION_MAJOR >= 5 -itk::ITK_THREAD_RETURN_TYPE +ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION #else ITK_THREAD_RETURN_TYPE #endif diff --git a/src/plastimatch/base/direction_cosines.h b/src/plastimatch/base/direction_cosines.h index 11f61eda4..26af47024 100644 --- a/src/plastimatch/base/direction_cosines.h +++ b/src/plastimatch/base/direction_cosines.h @@ -8,7 +8,9 @@ #include #include -#include "itk_image.h" +#ifndef PLM_CUDA_COMPILE +#include "itk_direction_type.h" +#endif #include "plm_math.h" #define DIRECTION_COSINES_IDENTITY_THRESH 1e-9 @@ -25,7 +27,9 @@ class PLMBASE_API Direction_cosines { public: Direction_cosines (); Direction_cosines (const float *dm); +#ifndef PLM_CUDA_COMPILE Direction_cosines (const DirectionType& itk_dc); +#endif ~Direction_cosines (); public: @@ -45,7 +49,9 @@ class PLMBASE_API Direction_cosines { float* get_matrix (); const float* get_inverse () const; void set (const float dc[]); +#ifndef PLM_CUDA_COMPILE void set (const DirectionType& itk_dc); +#endif bool set_from_string (std::string& str); bool is_identity (); std::string get_string () const; diff --git a/src/plastimatch/base/itk_direction_type.h b/src/plastimatch/base/itk_direction_type.h new file mode 100644 index 000000000..a60bee266 --- /dev/null +++ b/src/plastimatch/base/itk_direction_type.h @@ -0,0 +1,11 @@ +/* ----------------------------------------------------------------------- + See COPYRIGHT.TXT and LICENSE.TXT for copyright and license information + ----------------------------------------------------------------------- */ +#ifndef _itk_direction_type_h_ +#define _itk_direction_type_h_ + +#include "itkMatrix.h" + +typedef itk::Matrix < double, 3, 3 > DirectionType; + +#endif diff --git a/src/plastimatch/base/itk_image.h b/src/plastimatch/base/itk_image.h index 2c633948f..51f55c001 100644 --- a/src/plastimatch/base/itk_image.h +++ b/src/plastimatch/base/itk_image.h @@ -7,13 +7,13 @@ #include "plmbase_config.h" #include "plm_int.h" +#include "itk_direction_type.h" #include "itk_image_type.h" class Plm_image_header; class Volume_header; /* Other types */ -typedef itk::Matrix < double, 3, 3 > DirectionType; typedef itk::Index < 3 > IndexType; typedef itk::Point < double, 3 > OriginType; typedef itk::ImageRegion < 3 > RegionType; diff --git a/src/plastimatch/register/registration.cxx b/src/plastimatch/register/registration.cxx index dcc956056..0e40db7d9 100644 --- a/src/plastimatch/register/registration.cxx +++ b/src/plastimatch/register/registration.cxx @@ -587,7 +587,7 @@ Registration::run_main_thread () static #if ITK_VERSION_MAJOR >= 5 -itk::ITK_THREAD_RETURN_TYPE +ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION #else ITK_THREAD_RETURN_TYPE #endif