xmake installing vcpkg packages individually breaks vcpkg version resolving
Xmake Version
2.8.3
Operating System Version and Architecture
Windows 10 Enterprise 19044.3570, MacOS, Linux
Describe Bug
xmake issues one vcpkg command per vcpkg:: package added in a "add_requires" clause. This breaks inter-dependencies between versions as each package you add gets the package versions resolved without considering what versions are specified by ther vcpkg:: requirements.
Example:
add_requires(
"vcpkg::fmt", -- Installs 10.0.0 (latest)
"vcpkg::spdlog" -- Installs 1.12.0 (latest)
)
add_requires(
"vcpkg::fmt 9.1.0", -- Installs 9.1.0
"vcpkg::spdlog" -- Installs 1.12.0 (latest), but also installs fmt 10.0.0
)
add_requires(
"vcpkg::fmt 10.0.0", -- Installs 10.0.0
"vcpkg::spdlog 1.12.0" -- Installs 1.12.0, but also installs fmt 7.1.3 (actually fails to build)
)
This makes it impossible to specify versions of vcpkg packages if you have any packages that has dependencies.
vcpkg can not make an informed discision on which version of a dependency to install.
A solution to this would be to generate a vcpkg.json file based on the full add_requires, including versions and let vcpkg do a proper version matching for all dependencies.
Right now we are forced to use "latest" on all packages except for two where we really need to use an older version to make it compile on all our target platforms.
Expected Behavior
add_requires(
"vcpkg::fmt", -- Installs 10.0.0 (latest)
"vcpkg::spdlog" -- Installs 1.12.0 (latest)
)
add_requires(
"vcpkg::fmt 9.1.0", -- Installs 9.1.0
"vcpkg::spdlog" -- Installs 1.12.0 (latest), leave fmt at 9.1.0
)
add_requires(
"vcpkg::fmt 10.0.0", -- Installs 10.0.0
"vcpkg::spdlog 1.12.0" -- Installs 1.12.0, leaves fmt at 10.0.0
)
This could be accomplished by generating a vcpkg.json with the required dependencies and versions as vpkg would then have full information of what versions to install.
Project Configuration
see bug/expected behaviour
Additional Information and Error Logs
n/a
Cascading dependencies from third-party package managers are not supported at this time; you can use packages from xmake-repo, which is fully supported. add_requires("spdlog")
I will try that. What about adding support for users to add their own vcpkg.json file and using that together with xmake?
I will try that. What about adding support for users to add their own vcpkg.json file and using that together with xmake?
this is a great idea