This README is available in the following languages:
SOUI4 is a lightweight, cross-platform C++ DirectUI framework, continuously developed and maintained for 14 years. The compiled core is about 2MB. The framework design draws inspiration from popular frameworks such as WTL, Android, QT, and Flash. UI presentation is based on XML configuration, with high performance (choose GDI or Skia rendering), rich controls, and flexible extension (supports xml + lua + js), truly separating UI and logic.
Thanks to the built-in swinx layer — a framework that re-implements the Windows API (windows.h / winuser.h / gdi.h …) on non-Windows platforms — the same C++ UI and business code runs on Windows, Linux, macOS, iOS, Android and HarmonyOS (OHOS). Visit the SOUI Official Website.
SOUI4 covers six platforms through swinx:
| Platform | Status | Windowing / Launcher | 2D Backend |
|---|---|---|---|
| Windows | Native | System CRT / Win32 | GDI / Direct2D |
| Linux | Supported | xcb + poll() event loop |
Cairo |
| macOS | Supported | NSApplication (SwinXApplication) |
Core Graphics |
| iOS | Supported | UIApplicationMain (hosted by swinx_ios_entry) |
Core Graphics |
| Android | Supported | JVM launcher, PlatformAPI bridge |
Cairo |
| HarmonyOS (OHOS) | Supported | ArkTS runtime, PlatformAPI bridge |
Cairo |
How swinx is layered per platform:
- Windows does not compile swinx — it uses the system Windows SDK directly.
- Linux / macOS / iOS implement their platform APIs inside swinx and own their own message loop / launcher, so they need no extra bridge.
- Android / HarmonyOS are launched by the JVM / ArkTS runtime and have no launcher of their own; their platform bridges (
clipboard / window / ime / audio / path) are filled into the C structPlatformAPIand registered throughPlatformAPI_Init.
The SOUI render factory (Render_Gdi / Render_Skia / Render_D2d) is uniform across platforms; cross-platform projects typically use Render_Skia + ImgDecoder_Stb. Mobile builds additionally provide SModalView (a modal-dialog implementation that replaces SHostDialog, since mobile runtimes cannot spin up their own message loop) and inertial fling scrolling on SPanel.
If you are new to SOUI, you can download the statically compiled demo.exe for a quick try (no need for source code or dependencies, just download and run).
Steps:
- Click the badge above to enter the page
- Click any link after the green circle
- Scroll down to find the
Artifactssection - Download and extract
PC_Demoto run
For more demo cases, visit the DEMO repository:
- https://github.com/soui4-demo Each demo is in a separate repository, clone as needed.
SOUI requires basic knowledge of C++ and Win32. Please ensure you are familiar with these skills. For more details, see the official documentation.
The latest souieditor is integrated in the demos folder. Build the demo to get souieditor.
- JavaScript export version for client development. Repository: soui4js
- Supports Windows, Linux, macOS.
- Python3 version for client development. Repository: soui4py
- Supports Windows, Linux, macOS.
- Latest Online Tutorial (most complete, updated regularly)
- Tutorial Source Code (host locally with http server)
- Author's Blog
- Author's Bilibili Video Tutorials
- Use CMake to generate project files, open with Visual Studio, and compile
- Or use mingw32/64:
mkdir build && cd build && cmake .. && make -j8
- Pull submodule swinx:
git submodule update --init - Install dependencies:
sudo apt install cmake git build-essential gdb libxcb1-dev libgl1-mesa-dev freeglut3-dev - Build:
mkdir build && cd build && cmake .. && make -j8
- Pull submodule swinx:
git submodule update --init - Install Homebrew (China mirror recommended)
- Install homebrew-core and homebrew-cask:
brew tap homebrew/core && brew tap homebrew/cask - Install tools and dependencies:
brew install cmake ninja pkgconf glfw3 glew - Build:
mkdir build && cd build && cmake .. -G Ninja && ninja -j8
- Pull submodule swinx:
git submodule update --init - Generate an Xcode project and build with Xcode:
mkdir build && cd build && cmake .. -G Xcode -DCMAKE_SYSTEM_NAME=iOS - The app entry is hosted by
swinx_ios_entry(), which wrapsUIApplicationMain; the C++_tWinMainis dispatched on the main thread after launch.
- Requires the HarmonyOS SDK and DevEco Studio.
- The native layer lives under
entry/src/main/cpp; UI resources are loaded directly from the HAPrawfiledirectory throughNativeResourceManager(no copy to the sandbox). - Build the OHOS module from DevEco Studio (or the
hvigorCLI).
See contributors.md
See LICENSE-en.md