Skip to content

mcpp: build the library and its preview on six platforms, beside the CMake build - #1

Open
Sunrisepeak wants to merge 4 commits into
mainfrom
feat/mcpp-six-platforms
Open

Sunrisepeak wants to merge 4 commits into
mainfrom
feat/mcpp-six-platforms

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Sep 12, 2026 •

Copy link
Copy Markdown
Owner

Lib-Live2D becomes an mcpp package beside its CMake build — six platforms from mcpp.toml + build.mcpp, the Cubism SDK as a payload instead of a fetched .cache/, the TypeScript bridge bundled without node, the shaders reaching every packaged application through the library's own build program — and the CMake build is not touched. This is the ecosystem-library case for Sunrisepeak/HuxerUI#6, and depends on it: huxerui.huxerui is a git dependency on that PR's head.

What is here (one commit)

File Role
mcpp.toml The library: huxerui.live2d, six platforms, per-platform sources mirroring CMakeLists.txt, the payloads (xim:cubism-sdk-native, xim:cubism-sdk-web, xim:esbuild, xim:glew).
build.mcpp Sources through huxerui.rules; the Cubism headers; GLSL/HLSL embedded as cmake/EmbeddedShaders.cmake does; on the Web, platform/web/bridge.ts bundled by esbuild with the Cubism Web Framework (--alias:@cubism=…, replacing tools/build_web.mjs, cmake/Web.cmake and npm install), the Core script and the bundle as --extern-pre-js, the WebGL shaders deployed under live2d-shaders/.
mcpp/cubism/ huxerui.live2d-cubism: no sources of its own — build.mcpp walks the SDK payload for the row's renderer, links the Core slice (cmake/Cubism.cmake's table), compiles GLEW in on Linux, on Windows compiles CubismRenderer_D3D11.cpp from a copy with MSVC's __m128 member access spelled as a vector subscript (clang has no such members), and on macOS/iOS the 477 Metal shader libraries as build edges deployed under FrameworkMetallibs/. A separate package because the Framework's Objective-C++ is MRC and the library's is ARC.
modules/live2d.cppm import huxerui.live2d; — the header's names, hand-listed; outside src/ because it is API, as HuxerUI's modules/ is.
mcpp/README.md The short version: layout, commands, what stays with CMake.
examples/preview/{mcpp.toml, build.mcpp, src/main.cpp} The preview as an mcpp application; same src/app.cpp and resources/ as the CMake project.
.github/workflows/mcpp.yml Linux (build, smoke run, AppImage), Web (static directory + shaders), macOS (bundle + 477 metallibs), iOS simulator (bundle), Android (APK), Windows (MSI). The repository had no workflow before.
README.md A "Build with mcpp" section.

What the consumer sees

[dependencies]
huxerui.live2d = { git = "https://github.com/HuxerUI/Lib-Live2D.git", tag = "v0.1.0" }

No live2d_configure_app(), no LIVE2D_CUBISM_*_ROOT, no npm install; every format mcpp pack produces carries the shaders because the library deployed them.

Verified locally (Linux)

  • mcpp build — library + live2d-cubism + HuxerUI, 23 s after payloads.
  • examples/preview: mcpp build; the executable runs to HUXERUI_SMOKE_EXIT_MS (exit 0, marker printed); mcpp pack --format appimage → 32.8 MB.
  • Web: mcpp pack --target wasm32-emscripten --format web → index.html, live2d_preview.js (bundled CubismFramework + Live2DCubismCore), .wasm (magic checked), 13.7 MB .data, live2d-shaders/ (13 files — a dependency's mcpp::deploy reaches the application's stage).
  • Android: mcpp pack --target x86_64-linux-android --format apk → lib/x86_64/liblive2d_preview.so, assets/huxerui/resources.bin, assets/huxerui/app/raw/Mao/Mao.model3.json, classes.dex, signed.

CI, honestly

Green: Linux (build, smoke run through the runtime's own quit, AppImage), Web (page + bundled Framework/Core + live2d-shaders/), Android (signed APK), Windows (library + preview + MSI whose File table carries the executable), iOS simulator (builds and bundles with the llvm@20.1.7 pin from HuxerUI#6), macOS (library + preview, 477 metallibs compiled).

What the green does not cover: the macOS and iOS bundles hold the executable only — mcpp 2026.9.13.1 refuses to stage a Mach-O program in every --mode, so neither the metallibs nor HuxerUI's resources reach .app. Both jobs say which state the run is in and assert the bundle contents the day the engine stages.

Not verified / known

  • macOS, iOS, Windows: no machine here; CI only. A device build (aarch64-ios) links but is not signed or installed.
  • Index bridge: xim:glew, xim:esbuild and xim:android-platform@36-r2 are in feat(pkg): esbuild 0.25.12, glew 2.2.0 and android-platform 36-r2 openxlings/xim-pkgindex#834 and not yet in the published index; the Linux, Web and Android jobs bridge them into the synced index copy in a step marked temporary.
  • The library's string catalogue (resources/strings) is not merged into an application's package under mcpp (not read by the library's code today).
  • tests/ (macOS host-contract probes on HuxerUI::testing) stay CMake-only.

Beside the CMake build and without changing it. `mcpp.toml` describes the
library's sources per platform the way CMakeLists.txt does; `build.mcpp`
selects the sources through huxerui.rules, embeds the renderer's GLSL and
HLSL as cmake/EmbeddedShaders.cmake does, and on the Web bundles
platform/web/bridge.ts with the Cubism Web Framework through esbuild and
deploys the WebGL shaders beside the page -- tools/build_web.mjs,
cmake/Web.cmake and the `npm install` step, without node. `src/live2d.cppm`
is the module a consumer imports: `import huxerui.live2d;` names the same
entities as the header.

The Cubism SDK for Native is a package of its own (mcpp/cubism): its
Framework's Objective-C++ is written without ARC while this library's is
written with it, and a package has one flag set. That package walks the
`xim:cubism-sdk-native` payload for the renderer the row uses, links the
Core slice the row needs (cmake/Cubism.cmake's table), compiles GLEW in
from its source payload on Linux, and on macOS and iOS compiles the 477
Metal shader libraries as build edges deployed under FrameworkMetallibs/,
the directory the Framework loads by name. The Web row does not depend on
it.

The preview is three files beside its CMake project (mcpp.toml,
build.mcpp, src/main.cpp) and compiles the same src/app.cpp and
resources/. Every payload -- the two Cubism SDKs, esbuild, GLEW, the
NDK, emsdk, the JDK -- is installed by mcpp on first use; nothing is
fetched by hand.

HuxerUI is taken from Sunrisepeak/HuxerUI at the revision whose mcpp build
serves six rows (PR #6); a published version replaces the git table.

Verified on Linux: the library and the preview build; the preview runs to
its smoke exit and packs as a 33 MB AppImage; the Web directory carries
the page, the launcher with the bundled Framework and Core, the wasm, the
preload data and live2d-shaders/; the x86_64 APK carries
liblive2d_preview.so, the resource package with the Mao model and a
signature. macOS, iOS, Windows and a device are CI's to verify.
@Sunrisepeak
Sunrisepeak force-pushed the feat/mcpp-six-platforms branch from edea2db to 754486e Compare September 13, 2026 06:51
Sunrisepeak and others added 3 commits September 13, 2026 15:28
HuxerUI 4130a23 moves the mcpp:plugins floor to 0.9.1: dist-apk links
the application's res/ as its base, so the preview's APK gets the SDK's
launcher icon, and the two-versions warning on the Android row is gone.

CI: `xlings install -y --use` activates the pinned mcpp in one line.
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.

2 participants