Skip to content

Add HarmonyOS support#51470

Draft
jobor wants to merge 4 commits intomicrosoft:masterfrom
jobor:add-ohos-support
Draft

Add HarmonyOS support#51470
jobor wants to merge 4 commits intomicrosoft:masterfrom
jobor:add-ohos-support

Conversation

@jobor
Copy link
Copy Markdown
Contributor

@jobor jobor commented Apr 30, 2026

Fixes: #51302

This adds community triplets for HarmonyOS / OpenHarmony and the necessary toolchain file.

jobor added 3 commits April 2, 2026 14:06
Delegates to the SDK's own ohos.toolchain.cmake, located via the
OHOS_SDK_ROOT environment variable. Maps vcpkg architecture and CRT
linkage settings to OHOS equivalents.
Shared library linkage for all three architectures supported by the
OpenHarmony SDK: arm64-v8a, armeabi-v7a, and x86_64.

The environment variable OHOS_SDK_ROOT is passed through, because on
Windows, vcpkg builds in a sanitized environment that strips most
variables. Without VCPKG_ENV_PASSTHROUGH_UNTRACKED the OHOS toolchain
cannot find the SDK, failing at compiler detection.

The triplets only build release variants, because without
VCPKG_BUILD_TYPE, vcpkg generates both debug and release cmake config
files. The debug libraries are not needed for cross-compilation and
their presence causes CMake errors when the debug/lib/ directory is
missing from the install prefix.
Register VCPKG_TARGET_IS_OHOS and map OHOS to the appropriate system
libraries (dl, m, pthread, c++, rt, gcc). OHOS uses musl libc with
LLVM's libc++, not libstdc++.
@BillyONeal
Copy link
Copy Markdown
Member

I'm going to put comments about this over in the tool repo one: microsoft/vcpkg-tool#2004

Drafting this because it would be merged in the context of that and should not be merged as an 'ordinary registry maintenance' change.

@BillyONeal BillyONeal marked this pull request as draft April 30, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add HarmonyOS (OHOS) community triplets

2 participants