Support building in specific modes without a custom triplet.#34482
Support building in specific modes without a custom triplet.#34482teo-tsirpanis wants to merge 3 commits intomicrosoft:masterfrom
Conversation
|
Does not fix #1626. The original issue was about adding subdirs for release/debug. But that issue can probably be closed as not planned. |
| list(APPEND Z_VCPKG_ADDITIONAL_MANIFEST_PARAMS "--x-no-default-features") | ||
| endif() | ||
|
|
||
| if(VCPKG_DEFAULT_BUILD_TYPE STREQUAL "auto") |
There was a problem hiding this comment.
This logic is mostly unnecessary.
The cases are:
Multi Config Generator -> You want both or an override to only use release libs (!windows)
Single Config Generator -> You want one depending on CMAKE_BUILD_TYPE or an override to use release in debug builds. (!windows)
|
Convert this PR to draft since there is no progress. Please ping us if this PR is ready for review again. |
…r is specified. `VCPKG_DEFAULT_BUILD_TYPE` is passed to the port by the `--x-build-type` tool option.
|
Rebuilding the whole world in CI. Maybe it should be limited to a single triplet for a first discussion. |
|
Oops, I updated the branch as a matter of routine. 😟 Can someone with permissions please cancel CI? Thanks and sorry for any disruption. |
Push something like bff8a33 |
|
Thanks! |
This PR introduces the
VCPKG_DEFAULT_BUILD_TYPEoption in the CMake toolchain file, that provides a default value toVCPKG_BUILD_TYPEwhen building the ports.Besides
debugorrelease, this option can also be set toauto. In that case, vcpkg will consider theCMAKE_BUILD_TYPEorCMAKE_CONFIGURATION_TYPESvariables, and if all configurations are known (Debug,Release,RelWithDebInfo,MinSizeRel) and map to onlydebugorrelease, it will build the ports in only that mode. IfVCPKG_DEFAULT_BUILD_TYPEis not specified, or the CMake project is being built in an unknown configuration, the existing behavior is preserved and vcpkg will default to building in both modes.Let's talk about how it works. When
VCPKG_DEFAULT_BUILD_TYPEis specified, its value (after resolvingauto) will be passed to the vcpkg tool via the--x-build-typesetting, introduced in microsoft/vcpkg-tool#1231. The tool will propagateVCPKG_DEFAULT_BUILD_TYPEwhen running the portfile in script mode, andports.cmakewill defaultVCPKG_BUILD_TYPEtoVCPKG_DEFAULT_BUILD_TYPEif the latter is specified. This will happen before the triplet file getsincluded, to allow the triplet to override the build type and maintain compatibility.VCPKG_DEFAULT_BUILD_TYPEis supported only in manifest mode.Fixes #10683
Depends on microsoft/vcpkg-tool#1231