Skip to content

Commit

Permalink
ENH: Deduce CudaCommon_VERSION_MAJOR from its CMake existence
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasGandel authored and SimonRit committed Dec 20, 2024
1 parent 0182222 commit 40980dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ else()
endif()

# Propagate cmake options in a header file
# Must be done after the external module configuration to make sure CudaCommon_SOURCE_DIR is defined
# Must be done after the external module configuration to make sure CudaCommon_VERSION is defined
configure_file(${RTK_SOURCE_DIR}/rtkConfiguration.h.in
${RTK_BINARY_DIR}/rtkConfiguration.h)

Expand Down
7 changes: 4 additions & 3 deletions rtkConfiguration.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ using ThreadIdType = itk::ThreadIdType;
# define SLAB_SIZE @RTK_CUDA_PROJECTIONS_SLAB_SIZE@
#endif

// CudaCommon_SOURCE_DIR and cudaCommonConfiguration.h were introduced in CudaCommon 2.0
#cmakedefine CudaCommon_SOURCE_DIR
#ifdef CudaCommon_SOURCE_DIR
// CudaCommon_VERSION_* and cudaCommonConfiguration.h were introduced in CudaCommon 2.0
#cmakedefine CudaCommon_VERSION_MAJOR
#ifdef CudaCommon_VERSION_MAJOR
# undef CudaCommon_VERSION_MAJOR
# include <cudaCommonConfiguration.h>
#endif

Expand Down
6 changes: 3 additions & 3 deletions wrapping/itkCudaImageRTK.wrap
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
if(RTK_USE_CUDA)

if(CudaCommon_SOURCE_DIR)
if(CudaCommon_VERSION_MAJOR)
configure_file("${CudaCommon_SOURCE_DIR}/wrapping/CudaImage.i.init" "${CMAKE_CURRENT_BINARY_DIR}/CudaImageRTK.i" @ONLY)
endif()

function(wrap_CudaImage_swig_ext type px_type)
if(CudaCommon_SOURCE_DIR)
if(CudaCommon_VERSION_MAJOR)
set(CudaImageTypes ${type})
set(PixelType ${px_type})
configure_file(${CudaCommon_SOURCE_DIR}/wrapping/CudaImage.i.in ${CMAKE_CURRENT_BINARY_DIR}/CudaImageRTK.i.temp @ONLY)
Expand Down Expand Up @@ -43,7 +43,7 @@ if(RTK_USE_CUDA)

itk_end_wrap_class()

if(CudaCommon_SOURCE_DIR)
if(CudaCommon_VERSION_MAJOR)
# Add library files to be included at a submodule level and copy them into
# ITK's wrapping typedef directory.
# Another approach is to add CudaImage.i to the WRAPPER_SWIG_LIBRARY_FILES list
Expand Down

0 comments on commit 40980dc

Please sign in to comment.