-1

I have an existing MSBuild project. I want to compile that for Linux ARM 64. I'm using vcpkg package manager becuase CMake is too difficult to maintain.

The lanuage i'm writing in is C++.

I'm using Visual Studio Community 2022. My question is: How can I compile an existing MSBuild project for Linux, inside Windows by using Visual Studio Community 2022 or other?

euraad
  • 2,467
  • 5
  • 30
  • 51
  • 2
    do you have a question? – 463035818_is_not_an_ai Jun 23 '23 at 09:44
  • vcpkg and cmake are not exchangeable tools. Cmake can do what vcpkg does, but not vice versa. Cmake can also instead use vcpkg instead of its own built-in functionality. – sweenish Jun 23 '23 at 09:47
  • @sweenish So you recommend to include a CMakeLists.txt into my project? How many CMakeLists.txt do I need to have? – euraad Jun 23 '23 at 10:00
  • 1
    I recommended nothing. I was pointing out a false assumption in your text. – sweenish Jun 23 '23 at 10:14
  • I disagree with your statement that CMake is too difficult to maintain. I find CMake remarkably simple to use. Your question is about an existing MSBuild project. Show what you have tried and the problem. – John Hanley Jun 24 '23 at 01:35

1 Answers1

2

For C++ cross-platform development, you can use the WSL(Windows Subsystem for Linux).

Windows Subsystem for Linux (WSL) lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dual-boot setup.

Four steps for setting up a WSL development environment:

In order to compile your c++ code on WSL/Linux, you need to install the libraries you depend on firstly on WSL/Linux. You can also use vcpkg on WSL to manage your c++ packages, but you should install the vcpkg on WSL/Linux firstly, not the vcpkg on Windows that you used now. So you can install vcpkg on WSL/Linux firstly, then use the vcpkg to install libraries you depend on. In order to let CMake to find the libraries from vcpkg, refer to CMake Integration.

And you must learn to use CMake to organize your project. Here is a step-by-step guide for using CMake.

Tom
  • 177
  • 7
  • I have tried that. The problem is that I need to have libraries for Linux inside Windows. And if I'm using #ifndef(_WIN32) etc, then the windows choise is going to be compiled for linux. – euraad Jul 08 '23 at 11:12
  • @euraad If you use the progresses above, you need to **install your libraries on the WSL/Linux**, you can install vcpkg on WSL/Linux first, then install your libraries via vcpkg, and do some configuration to let CMake can find your libraries installed by vcpkg. When you begin to compile your code, the Visual Studio 2022 will copy your code to WSL/Linux, then use the environment and libraries on the WSL/Linux, rather than use your libraries on Windows. – Tom Jul 10 '23 at 01:57