Skip to content

Repository files navigation

nativeapi

A cross-platform C++ library providing unified access to native system APIs — windows, tray icons, menus, displays, keyboard, dialogs, storage and more. It also exposes a C ABI that the language bindings are generated from.

Linux macOS Windows

🚧 Work in Progress: this library is under active development.

Language bindings: Flutter · Rust · C#

Installation

Requires CMake 3.10+ and a C++17 compiler. On Linux, install the GTK 3 headers (sudo apt install libgtk-3-dev).

Add the repository to your project and link the nativeapi target:

add_subdirectory(nativeapi)
target_link_libraries(your_app PRIVATE nativeapi)

On Windows, configure with -DNATIVEAPI_ENABLE_WINUI3=ON to use the WinUI 3 backends for menus, dialogs, title bars and notifications — see docs/winui3.md.

Quick Start

#include <iostream>
#include "nativeapi.h"

using namespace nativeapi;

int main() {
  for (const auto& display : DisplayManager::GetInstance().GetAll()) {
    auto size = display->GetSize();
    std::cout << display->GetName() << ": " << size.width << "x" << size.height << "\n";
  }
}

Examples

See examples/. Each directory is a standalone program for one module (C++ and C variants), built together with the library:

cmake -S . -B build
cmake --build build
./build/examples/display_example/display_example

Contributing

This repository is developed from the workspace, which checks out the core library, every binding and the code generator together:

git clone --recursive https://github.com/libnativeapi/workspace.git

Files marked AUTO-GENERATED. DO NOT EDIT. are generated from the C++ headers in nativeapi. To change the API, send a pull request there; maintainers regenerate the bindings.

License

MIT

About

A modern cross-platform C++ library providing seamless, unified access to native system APIs across multiple platforms.

Topics

Resources

Stars

34 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages