[CMake] Missing <target>_EXPORTS definition in CUDA host compilation

Hancox, James JHancox at tmvse.com
Tue Jun 20 06:03:04 EDT 2017


Hi Robert,

Thanks for taking the time to look into this. Strange that it isn't reproducing for you! I've made a minimal test case that reproduces the bug, and put it on github: 

https://github.com/jameshancox/cmake_example_16993 

I am using:

Visual Studio Professional 2013 Update 5
CUDA 8.0.44
cmake 3.9.0.rc3

The bug is reproducible for both Win32 and x64 generators. 

If you still can't reproduce it, let me know and I'll try to figure out what's going on.

Cheers,
James

-----Original Message-----
From: Robert Maynard [mailto:robert.maynard at kitware.com] 
Sent: 19 June 2017 18:47
To: Hancox, James <JHancox at tmvse.com>
Cc: cmake at cmake.org
Subject: Re: [CMake] Missing <target>_EXPORTS definition in CUDA host compilation

Hi James,

In testing we have not been able to replicate the reported behavior.
We are seeing that the .cu files inside a shared library have the correct export defines setup.

On Mon, Jun 19, 2017 at 8:23 AM, Robert Maynard <robert.maynard at kitware.com> wrote:
> Hi James,
>
> I have created a bug report for this issue, which you can track at:
> https://gitlab.kitware.com/cmake/cmake/issues/16993
>
> On Fri, Jun 16, 2017 at 12:14 PM, Hancox, James <JHancox at tmvse.com> wrote:
>> Hi,
>>
>>
>>
>> I’m trying out the new CUDA support for Visual Studio generators in 
>> Cmake
>> 3.9.0-rc3 (generator Visual Studio 12 2013 Win64), and I think I’ve 
>> found a bug.
>>
>>
>>
>> Our code defines some DLL-export functions in host code in a .cu 
>> file, but it seems that the usual <target>_EXPORTS pre-processor 
>> definition is missing for host code compilation invoked from NVCC. We 
>> have the usual DLL boilerplate defined in a header like so:
>>
>>
>>
>> #ifdef example_target_EXPORTS
>>
>> #define EXAMPLE_TARGET_API _declspec(dllexport)
>>
>> #else
>>
>> #define EXAMPLE_TARGET_API _declspec(dllimport)
>>
>> #endif
>>
>>
>>
>> However in my .cu file, EXAMPLE_TARGET_API is being expanded to 
>> _declspec(dllimport), not _declspec(dllexport) . It would appear that 
>> example_target_EXPORTS is not being declared.
>>
>>
>>
>> Is this intended behaviour, or a bug? If intended behaviour, what is 
>> the mechanism I should be using instead?
>>
>>
>>
>> Many thanks,
>>
>> James Hancox
>>
>>
>> _____________________________________________________________________
>> _ This email has been scanned by the Symantec Email Security.cloud 
>> service.
>> For more information please visit http://www.symanteccloud.com 
>> _____________________________________________________________________
>> _
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For 
>> more information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at 
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com ______________________________________________________________________

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________


More information about the CMake mailing list