Hi Ehsan,

${PROJECT_NAME} simply takes the content of project(MyName). Therefore,
cmake replaces ${PROJECT_NAME} with MyName. I never tried to include
CUDA into a plugin but only into a module. Do you want to include it
into a module or a plugin? [1] might help you with this decision.

According to your error output your module should be named ModuleName
which is not a very good name for a module. Try to find a fitting name
for the module, create a module with this name and adapt the snippet I
sent you last time to the new module name.


Best

Martin


[1] http://docs.mitk.org/2016.11/ModularizationPage.html

On 12.10.2017 10:18, Ehsan Golkar wrote:
> Thanks a lot for your replying Martin,
> 
> 
> I have one question regarding to you code, from your code I get below error
> 
> nvcc fatal : A single input file is required for a non-link phase when an
> outputfile is specified
> CMake Error at ModuleName_CUDA_generated_testcuda.cu.o.cmake:206 (message):
> 
> So what do you put as  a ${PROJECT_NAME} in MITK_CREATE_MODULE? whatever  I
> put here regarding to my plugin project name, I get the above error
> I really appreciate your help
> 
> regards
> 
> On Tue, Oct 10, 2017 at 10:21 AM, Martin Klemm <martin.kl...@hs-offenburg.de
>> wrote:
> 
>> Hi favour888,
>>
>> here is an example of one of my modules that uses CUDA. It is probably
>> not the nicest way but it works like this:
>>
>>
>> --- CMakeLists.txt of module ---
>>
>> project(ModuleName)
>>
>> #define source files
>> set(SOURCE_FILES CUDAFILE.cu)
>> set(HEADER_FILES CUDAFILE.h)
>>
>> #create library
>> cuda_add_library(ModuleName_CUDA STATIC ${SOURCE_FILES} ${HEADER_FILES})
>>
>> #mark some variables as advanced to hide them in the gui (these are
>> generated by CUDA)
>> MARK_AS_ADVANCED(CUDA_BUILD_CUBIN)
>> MARK_AS_ADVANCED(CUDA_BUILD_EMULATION)
>> MARK_AS_ADVANCED(CUDA_HOST_COMPILER)
>> MARK_AS_ADVANCED(CUDA_SDK_ROOT_DIR)
>> MARK_AS_ADVANCED(CUDA_VERBOSE_BUILD)
>> MARK_AS_ADVANCED(CUDA_SEPARABLE_COMPILATION)
>>
>> #module
>> set(COMPILER_VERSION "VC12")
>> MITK_CREATE_MODULE(${PROJECT_NAME}
>>     DEPENDS MitkCore
>>     PACKAGE_DEPENDS Qt5|Core
>>     ADDITIONAL_LIBS ModuleName_CUDA glew
>> )
>>
>> # group in subfolders
>> set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER "modules")
>>
>>
>> --- CMakeLists.txt of project ---
>>
>> # Find CUDA package (for module ModuleName[_CUDA])
>> set(CUDA_TOOLKIT_ROOT_DIR C:/repo/cuda/7.0 CACHE PATH "Toolkit location")
>> find_package(CUDA REQUIRED)
>>
>>
>>
>> Best
>>
>> Martin
>>
>>
>> On 10.10.2017 09:28, favour888 wrote:
>>> The MITK (ver: 2014) do not support CUDA feature; however, it should be
>>> possible to add "cuda_add_executable" or "cuda_add_library" to the
>> source of
>>> Cmake file for any cuda  .cu file to be compiled inside MITK.  Anyone can
>>> help how to do it?
>>> any example ?
>>>
>>> Thanks
>>>
>>>
>>>
>>> --
>>> Sent from: http://mitk-users.1123740.n5.nabble.com/
>>>
>>> ------------------------------------------------------------
>> ------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> mitk-users mailing list
>>> mitk-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/mitk-users
>>>
>>
>> --
>>
>>
>> Martin Klemm
>> Hochschule Offenburg
>> Badstraße 24
>> 77652 Offenburg
>> Tel. +49 781 / 205 - 4681
>> Fax. +49 781 / 205 - 45 4681
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> mitk-users mailing list
>> mitk-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/mitk-users
>>
>>
> 

-- 


Martin Klemm
Hochschule Offenburg
Badstraße 24
77652 Offenburg
Tel. +49 781 / 205 - 4681
Fax. +49 781 / 205 - 45 4681

<<attachment: martin_klemm.vcf>>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to