Generate CUDA program dlls under Linux - linux

I know that mingw creates a dll file under windows which can be used to create an exe file. We can execute this exe file in windows. I am working on a cuda project under Linux, but have to deliver the product for Windows as well. Is it possible to generate a dll file using some sort of method under windows?

On windows, MinGW is not supported for CUDA development. The only compiler which is officially supported by CUDA is cl.exe which ships with Microsoft Visual Studio.
More details can be found in System Requirements section of CUDA Getting Started Guide.
Here is an MSDN tutorial which describes how to create a C++ DLL using Visual Studio.
For compiling CUDA kernels, you would have to add CUDA Build Rules in the Build Customizations section of the Visual Studio DLL project.

Related

Build Linux-Compatible Executable Using a Visual Studio '19 C++ Project

My understanding is Microsoft added the ability to have the output of a VS project build be a Linux-compatible executable (assuming the code is truly C++) . I added the Linux workload pack to VS19, and changed the Configuration Platform to ARM (is that correct? My only other options are Win32 and x64) . I was then expecting to see an option under Project>Properties>Platform Toolset for "GCC for Windows Subsystem for Linux", but I don't. All I see are two Visual Studio options. Can someone walk me through what other settings I need to change to build this successfully? I'm targeting Ubuntu LTS, if that matters. I'm very new to Linux so if I'm missing something I'd appreciate a heads up.

MSBuild using the wrong cl.exe when building with the 2015 C++ v140 Platform Toolkit

We're currently making a build environment for some of our projects.
In particular we're using VC++ 6.0 and VS2019 to build some of these projects.
When building our C++ project in VS2019 with the Platform Toolkit set to C++ 2015 v140, MSBuild attempts to use the VC++ 6.0 compiler to build the project. If I switch the Toolkit to any other version it builds with the correct cl.exe.
If I remove the VC98 folder that contains cl.exe from the path environment variable I get a cl.exe can't be found error in VS2019.
So I think there's something hardcoding the 2015 toolkit against the VC6.0 cl.exe.
I've tried installing and reinstalling the additional components in the VS Installer but no luck.
Repair of VS2019 didn't fix it either.
I've tried all versions of Visual Studio back to 2013 same issue.
This looks like an MSBuild issue, it's in the wrong location.
Is there any place where I can view the mapping for the toolkits in MSBuild? I couldn't see much in the registry.
The output when I build shows the following, the version is clearly a very old compiler (the VC6.0 one):
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86

MSBuild on Centos returns "The imported project "/Microsoft.Cpp.Default.props" was not found"

I'm trying to build a VS project in CentOS. I installed dotnet-sdk-2.2 via yum install dotnet-sdk-2.2.
When executing dotnet msbuild myproj.vcxproj I get:
Microsoft (R) Build Engine version 16.1.76+g14b0a930a7 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
mtproj.vcxproj(19,3): error MSB4019: The imported project "/Microsoft.Cpp.Default.props"
was not found. Confirm that the path in the <Import> declaration is correct, and that the
file exists on disk.
Googling results with many solutions but for Windows. what can I do to resolve this over Linux/CentOS?
According to your error message it's a C++ project.
Please check this document,the dotnet CLI only supports .NET / .NET Core / .NET Standard projects.
C++ projects are part of the visual studio tooling (c++ workload). The dotnet CLI doesn't contain the visual c++ compiler or the necessary windows SDKs. So it's not supported to build C++ projects directly using dotnet msbuild in Windows, not to speak of CentOS.
To build C++ projects in linux, you can try g++ compiler, you can find many related info about how to use it online.
Also, maybe you can try using GCCBuild to build vcxproj files in Linux. It simple uses same structure of vcxproj but uses GCC to compile and build. Thanks to Roozbeh.

How to add a CMAKE generator to the Linux version of CMAKE?

I am on a Windows machine running the Windows Subsystem for Linux. When I installed the CLI version of CMAKE on the WSL it did not come with any generators for visual studio (i.e. Visual Studio 15 2017 Win64).
How do I add these to the Linux version of CMAKE?
No can do. As per CMake's documentation:
CMake Generators are platform-specific so each may be available only on certain platforms. The cmake(1) command-line tool --help output lists available generators on the current platform.
Even if you built CMake yourself, you wouldn't be able to compile the Visual Studio generators because they rely on the Windows API.

How to add libraries in Visual Studio in a Linux cross-compilation project?

I'm new to Linux (rpi 3) and trying to create a window application on it from my Windows PC with Visual Studio. Creating a console-application is no problem, since it doesn't require any libraries.
And the way I understood it is that there is no real standard Linux library for GUIs like Win32 on Windows, so you need to add external libraries.
I went for QT and downloaded already compiled files from qtrpi.com for the rpi3.
I added the lib path for the linker and the include path for the compiler on the projects properties page, but all I get is
1>/home/pi/projects/WindowProject/main.cpp:2:27: fatal error: QtGui\qwindow.h: No such file or directory
1>#include <QtGui\qwindow.h>
1> ^
What am I missing? This works without a problem on normal projects, only that it wouldn't run, since it is for Linux.

Resources