Skip to content

core: Add HarmonyOS platform#4315

Open
sargunv wants to merge 74 commits into
maplibre:mainfrom
sargunv:ohos-research
Open

core: Add HarmonyOS platform#4315
sargunv wants to merge 74 commits into
maplibre:mainfrom
sargunv:ohos-research

Conversation

@sargunv

@sargunv sargunv commented May 31, 2026

Copy link
Copy Markdown
Collaborator

Resolves #3749

Summary

This branch adds support for OpenHarmony (OHOS) and HarmonyOS (HMOS). HMOS is Huawei's commercial OS competing with Android and iOS in China. OHOS is an open source project, making up the core of HMOS and other projects like Oniro.

I've only tested this on HarmonyOS, but since I've stuck to OHOS SDK only, it should work similarly on Oniro too.

Platform

I used existing platform/default sources for most components like storage, text, i18n. The OHOS-specific components include:

  • logging_hilog.cpp maps MapLibre logging to OHOS hilog
  • image.cpp: decodes platform images through OHOS image APIs
  • http_file_source.cpp: implements MapLibre HTTP requests through OHOS libnet_http.so.

Core

I also needed to make a few changes to the core. I carved these out into #4317, #4318, #4319, #4320; see those PRs for details.

Validation

The branch also includes a sample app, bridging a minimal set of APIs to ArkTS and using them in a live interactive map with the MapLibre demo style, OFM Bright, and OFM Liberty.

The sample app is validated on real hardware, a Huawei MatePad Pro MRDI-W00 running HarmonyOS 6.1.0.117, with both Vulkan and OpenGL. The emulator doesn't yet support Vulkan—an upcoming beta release (that I couldn't figure out how to acquire) will but works with OpenGL after the stencil clip-mask workaround mentioned above.

I've also configured CI, using the OHOS SDK from https://github.com/openharmony-rs/ohos-sdk/releases. I'm only building the MapLibre Native library right now in CI, not running any tests, nor building the sample app.

I didn't run iOS/Android/other builds or tests locally, as I assume they're covered in CI.

Process

I used GPT-5.5 in Codex CLI to put together this PR.

  • First, a /goal loop for initial exploration and proof of concept build, commit d8297e9
  • Then, real-time pairing with the agent to squash bugs and fill in gaps, roughly up to 95426f7
  • Then, an evening spent self-reviewing and cleaning up slop, roughly up to e4e6f4c
  • And further smaller polishing, both manual and agent-driven from there

If you'd like to inspect the process, I'd recommend checking ohos-research.md (removed from the draft in 9173b3e) in the commit history, where my agent kept a work log of everything it was doing during the autonomous and pairing phases.

Demo

SVID_20260531_131211_1.mp4

@sargunv

sargunv commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator Author

I carved the core changes out from this PR into #4317, #4318, #4319, and #4320. Once they merge and this branch is updated, the diff here should become platform only.

@github-actions github-actions Bot added the github_actions Pull requests that update GitHub Actions code label Jun 1, 2026
@sargunv

sargunv commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator Author

And I've now swapped out the http file source implementation, and therefore dropped the dependency on the proprietary HarmonyOS SDK. Since we now build with the OpenHarmony SDK only, I added a CI workflow (untested).

Switching to libnet_http.so wasn't too bad; just had to work around the lack of a user data void* like android/darwin/linux use, and carefully manage request callback slots / lifetimes.

Still works great on HarmonyOS. It should now be compatible with Oniro as well, but I haven't actually tested with the Oniro emulator; I'll look into that later.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa4bb353f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread platform/ohos/sample/entry/src/main/cpp/native_module.cpp Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 264dc5acce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread platform/ohos/src/image.cpp Outdated
Comment thread platform/ohos/sample/entry/src/main/cpp/egl_window_backend.cpp Outdated
@sargunv

sargunv commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator Author

latest change: migrated the sample from the legacy ArkTS-created XComponent setup to the newer native-owned component setup recommended by the platform docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Related to build, configuration or CI/CD core Changes that affect the C++ core of MapLibre Native github_actions Pull requests that update GitHub Actions code metal OpenGL Issues related to the OpenGL renderer backend Vulkan

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support OpenHarmony or provide documentation for cross-platform build

2 participants