[Insight-users] Reconfiguration with ITK_USE_GPU=ON results in recompilation of GPU-specific libraries
Ali Uneri
auneri at gmail.com
Wed Oct 31 16:08:56 EDT 2012
Hi,
The issue described in the subject line is minor, but is undesirable
particularly in projects that use the external projects module of CMake.
Reconfiguration touches certain files that then require the associated
targets to rebuild, which propagates to other external projects that depend
on ITK.
The problem is a side effect of the following function (see line 38 of the
referenced file).
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE}_
"${${GPUFILTER_KERNELNAME}_KernelString}")
http://itk.org/gitweb?p=ITK.git;a=blob;f=CMake/itkOpenCL.cmake;h=dafdd97bd57106cbee9e38e60fb4c02fd431cbb5;hb=HEAD#l38
One quick solution would be as follows.
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE}_
"${${GPUFILTER_KERNELNAME}_KernelString}")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE}
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE}_
${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE}
DEPENDS ${OPENCL_FILE})
where the "file write" operation uses a temporary file, which then is
copied to the actual location ONLY IF the original source has been
touched/modified. A cleaner approach might involve issuing the write itself
in "add_custom_command" using "echo" or a similar function.
Hope this is of use,
Ali Uneri
Johns Hopkins University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121031/c339edc7/attachment.htm>
More information about the Insight-users
mailing list