Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio cross-compilation to Linux

Visual Studio 2015 has brought with itself a cross-platform support for native C++ projects. In this context cross-platform means Windows, Android and iOS.
New Visual Studio now officially supports CLang and GCC tool-chains along with its own compiler. However it doesn't support cross-compilation to Linux.
Which, in turn, means that one still have to maintain at least two different projects in different IDEs to get native library binaries for all major operating systems.

Is this possible to "cheat" on Visual Studio and enable Linux targeting by modifying parameters of native Android project and/or by modifying NDK installation?
After all, Visual Studio just invokes NDK tools through a command line...

like image 863
JeB Avatar asked Oct 11 '15 18:10

JeB


1 Answers

Before Windows 10 Anniversary Upgrade it was possible to cross-compile to Linux from within VS with Visual C++ for Linux Development extension.
However, you still had to setup a Linux machine (either real one or VM) since this extension supports Remote build & debugging only.

Windows 10 Anniversary Upgrade has introduced Windows Subsystem for Linux, which:

lets developers run Linux environments -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a virtual machine

Thanks to this great feature happy owners of Windows 10 can easily setup remote cross-compilation to their localhost.

You can get the details either in official Microsoft blog post or here.

like image 52
JeB Avatar answered Oct 10 '22 00:10

JeB