1

I have a custom port that can require 1 of 4 incompatible dependencies, Is there a way to sensibly do this using VCPKG? So that it is clear in the .json why I am using a particular dependency?

Where I have 2 alternate bare-metal dependencies that can change based on the exact arm processor used.

And I have the 3rd/4th option which are on an rtos platform using 1/2 different arm processors.

"name": "some-dependency"
"version": "0.4.0",
"dependencies": [
   "dep1",
   {
      "name": "dep2a",
      "platform" : "bare-metal & cortex-a7" // Something like this would be nice, but doesn't work.
   },
   {
      "name": "dep2b",
      "platform" : "bare-metal & cortex-a8" //Something like this would be nice, but doesn't work.
   },
   {
      "name": "dep2c",
      "platform" : "freertos"
   },
   {
     "name": "vcpkg-cmake",
     "host": true
   },
   {
     "name": "vcpkg-cmake-config",
     "host": true
   }
]

4
  • Add them as separate features. Commented Nov 15, 2024 at 22:37
  • @Osyotr is there a way to do that and make it clear that they are mutually exclusive.. IE if I included feature 1 & Feature 2 I want an error message that says "Cannot use Feature 1/ Feature 2 at the same time"... Commented Nov 18, 2024 at 19:36
  • 1
    Hmm I think it's possible to add your own platform expressions using VCPKG_DEP_INFO_OVERRIDE_VARS learn.microsoft.com/en-us/vcpkg/users/…. Commented Nov 18, 2024 at 21:25
  • That is a great find! Make that an answer and it has my vote. Commented Nov 18, 2024 at 21:48

1 Answer 1

2

There's a triplet variable VCPKG_DEP_INFO_OVERRIDE_VARS (docs) that allows you to override the default set of terms used for platform expression evaluation.

In custom triplet:

set(VCPKG_DEP_INFO_OVERRIDE_VARS "bare-metal;cortex-a7")

In vcpkg manifest:

"dependencies": [
  {
    "name": "dep2a",
    "platform" : "bare-metal & cortex-a7"
  }
]

PS: I've assumed that you've meant bare-metal & cortex-a7 instead of bare-metal | coretex-a7. If not, just drop bare-metal from the triplet.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.