Add OHOS (OpenHarmony / HarmonyOS) platform support#2004
Add OHOS (OpenHarmony / HarmonyOS) platform support#2004jobor wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Add OHOS as a recognized platform in vcpkg-tool: - Platform expression identifier "ohos" maps to VCPKG_CMAKE_SYSTEM_NAME "OHOS" - Toolchain file mapping for OHOS to scripts/toolchains/ohos.cmake
There was a problem hiding this comment.
Pull request overview
Adds first-class recognition of the ohos platform (OpenHarmony / HarmonyOS) within vcpkg’s platform expression evaluation and toolchain selection logic, enabling ports/triplets to target OHOS via VCPKG_CMAKE_SYSTEM_NAME=OHOS.
Changes:
- Add
ohosas a recognized platform-expression identifier and evaluate it viaVCPKG_CMAKE_SYSTEM_NAME == "OHOS". - Route
PreBuildInfo::toolchain_file()toscripts/toolchains/ohos.cmakewhencmake_system_nameisOHOS.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/vcpkg/platform-expression.cpp | Adds ohos identifier parsing and evaluation based on VCPKG_CMAKE_SYSTEM_NAME. |
| src/vcpkg/commands.build.cpp | Selects an OHOS-specific toolchain file when cmake_system_name is OHOS. |
| case Identifier::watchos: return true_if_exists_and_equal("VCPKG_CMAKE_SYSTEM_NAME", "watchOS"); | ||
| case Identifier::visionos: | ||
| return true_if_exists_and_equal("VCPKG_CMAKE_SYSTEM_NAME", "visionOS"); | ||
| case Identifier::ohos: return true_if_exists_and_equal("VCPKG_CMAKE_SYSTEM_NAME", "OHOS"); |
There was a problem hiding this comment.
The new ohos identifier behavior isn’t covered by unit tests. Since this file already has Catch2 coverage for platform-expression identifiers, please add a test case that validates ohos evaluates true when VCPKG_CMAKE_SYSTEM_NAME is OHOS (and false for a non-OHOS value).
|
Do you have a screenshot or a photo of the end-to-end scenario working (e.g. You might also want to write a PR adding this to the community supported documentation over in https://github.com/MicrosoftDocs/vcpkg-docs/blob/45b52d047aadf711d377f4e5ae6665282bb21876/vcpkg/concepts/supported-hosts.md?plain=1#L122 |
Sure, here's a screenshot of installing zlib with the arm64-ohos triplet: That's with exactly this branch. If you want, I could also provide vcpkg installation logs from Qt's CI which covers much more libraries, albeit with a few modified ports.
Oh right! Done here: MicrosoftDocs/vcpkg-docs#575 |

This adds the
ohosidentifier for the HamonyOS / OpenHarmony platform.See microsoft/vcpkg#51302 and microsoft/vcpkg#51470