Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] Visual Studio (not vscode) remote build with conan packages #17337

Open
1 task done
quidstone opened this issue Nov 18, 2024 · 2 comments
Open
1 task done
Assignees

Comments

@quidstone
Copy link

What is your question?

Hi,

I am working on an application which is primarily on Linux. We have moved to conan packaging recently. I am exploring Visual Studio IDE. Now, I am using the remote build option of VS. What it does, as I understand is, copy all files required from the windows filesystem (source has to be in windows fs, for some reason) to a destination folder in linux and then issue the command like cmake, cmake build/install there. Now, we have two versions, before conan(the monolith, built with cmake) and after conan (slightly modular, built with conan install/build/export-pkg/create).

How do I make it happen that, the conan packages VS can copy over to Linux and build? P.S. I tried building the monolith, it worked.

To my understanding, the hurdles are,

  1. Conan fetches platform specific packages. So, from windows machine it might fetch windows specific packages and fail as all our packages are Linux specific.
  2. When integrated with conan, the project stops being a CMake project in the face of it (not sure), though it is there inside. I am saying this because we lose the ability to issue cmake commands, right? I might be wrong.

I am using,

  1. the latest conan version,
  2. Ubuntu 22
  3. windows 11

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded memsharded self-assigned this Nov 18, 2024
@memsharded
Copy link
Member

Hi @quidstone

Thanks for your question.

I don't know how the Visual Studio remote build works.

Conan fetches platform specific packages. So, from windows machine it might fetch windows specific packages and fail as all our packages are Linux specific.

You can easily override that, simply by defining a linux profile, you can use --profile=mylinuxprofile, to download the dependencies for Linux instead of Windows one.
There are some limitations to this approach, for example if there are recipes that have system_requirements() to install system packages, it will obviously not work in the Windows host.

Then the packages are installed in the Conan cache, typically <userhome>/.conan2, but I think this folder will not be copied to the Linux remote by default. Maybe it is possible to define with CONAN_HOME env-var some folder for the cache that will be copied to the remote Linux

When integrated with conan, the project stops being a CMake project in the face of it (not sure), though it is there inside. I am saying this because we lose the ability to issue cmake commands, right? I might be wrong.

Not really, the consumer project is still a regular CMake project, that find dependencies with find_package(). The only special thing is that the packages will be found in the Conan cache. But I suspect this will be an issue also for any other external dependencies to the project? But it is a cmake project, the most typical flow is actually something like:

conan install ....
cmake --preset ... # regular CMake project
cmake --build --preset ... # regular project build

Maybe the deployers like https://blog.conan.io/2023/05/23/Conan-agnostic-deploy-dependencies.html could help in this scenario, but those have some limitations, not sure if it will work in this scenario

@quidstone
Copy link
Author

hi @memsharded,

Thank you for the reply. Let me try and I will update if I can manage to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants