Skip to content

Add HarmonyOS (OHOS) community triplets #51302

@jobor

Description

@jobor

Summary

Add HarmonyOS / OpenHarmony (OHOS) as a cross-compilation target in vcpkg with community triplets, a toolchain file, and platform detection — similar to existing Android and iOS support.

Motivation

HarmonyOS uses a Clang/LLVM-based NDK-style toolchain for native C/C++ development and is seeing significant adoption. We (The Qt Company) are porting Qt to HarmonyOS and need to cross-compile third-party dependencies for this target. We have a working implementation that we've been using in production:

Proposed changes

vcpkg-tool: Add ohos as a recognized platform identifier for supports expressions (one commit).

vcpkg registry:

  • Toolchain file (scripts/toolchains/ohos.cmake) that delegates to the SDK's native toolchain. Requires setting an environment variable OHOS_SDK_ROOT (SDK with API 12+).
  • Three community triplets: arm64-ohos, arm-ohos, x64-ohos — all producing dynamically linked libraries.
  • Port patches for libraries needing OHOS-specific adjustments (currently: libpng, fontconfig, ICU). This could be contributed separately as well.

Note that we use ohos (not harmonyos) in all identifiers, consistent with the SDK's own naming and keeping triplet names short.

Structurally similar to the Xbox community triplet addition in #29210.

Questions before we submit PRs

  1. Is ohos acceptable as the VCPKG_CMAKE_SYSTEM_NAME / supports term?
  2. Should the vcpkg-tool change be merged first, or can it be coordinated with the registry PR?
  3. Single PR (triplets + toolchain + port patches) or separate PRs?

Ready to submit once we have feedback on the approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions