Aurora CInterop

Aurora CInterop

C libraries providing common functionality of Aurora OS for all languages ​​in which FFI is available.

EN | RU

Aurora CInterop

C libraries providing common functionality of Aurora OS for all languages in which FFI is available. The library is developed for Kotlin cinterop.

Features

  • C interface in a single format.
  • Simplifying complex interfaces.
  • Standardization of interaction with OS.
  • Ability to control a single public interface.
  • Unified code base for various OS interfaces.
  • Single center for implement interactions with any frameworks.
  • Cross-compile: arm64, x64.
  • Cross-platform build.

Libs

Build

  1. Install Docker.
  2. Install Aurora SDK (BT).
  3. Install Rust, rustup toolchain install 1.97.1.
  4. Install Cross.
  5. Install Aurora CLI.
  6. Install Aurora Maven.

Pull submodules:

git submodule update --init --recursive

Run build:

./scripts/build.sh

Run tests:

./scripts/tests.sh

Run formatters:

./scripts/format.sh

VS Code

You can add paths to the settings.json for work:

{
    "rust-analyzer.cargo.extraEnv": {
        "LIBDIR_3RD_PARTY": "${userHome}/.m2/repository/3rd_party",
        "LD_LIBRARY_PATH": "${userHome}/.aurora-sysroot/x86_64/usr/lib",
        "PKG_CONFIG_SYSROOT_DIR": "${userHome}/.aurora-sysroot/x86_64",
        "PKG_CONFIG_LIBDIR": "${userHome}/.aurora-sysroot/x86_64/usr/lib",
        "PKG_CONFIG_PATH": "${userHome}/.aurora-sysroot/x86_64/usr/lib/pkgconfig",
    },
    "rust-analyzer.cargo.features": [ "headers" ]
}

If you need to work with C++ files in VS Code, first build the project (see Build), then add c_cpp_properties.json for the C/C++ extension. This config is only for the C/C++ extension — if the clangd extension is enabled, disable it, since the two extensions conflict:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "${workspaceFolder}/target/**/out/cxxbridge/include",
                "${workspaceFolder}/target/**/out/cxxbridge/crate",
                "${workspaceFolder}/target/**/out/qxxbridge/include",
                "${workspaceFolder}/*/cxx/include",
                "${userHome}/.aurora-sysroot/x86_64/usr/include",
                "${userHome}/.aurora-sysroot/x86_64/usr/include/glib-2.0",
                "${userHome}/.aurora-sysroot/x86_64/usr/lib/glib-2.0/include",
                "${userHome}/.aurora-sysroot/x86_64/usr/include/streamcamera",
                "${userHome}/.aurora-sysroot/x86_64/usr/include/RuntimeManager",
                "${userHome}/.aurora-sysroot/x86_64/usr/include/qt5",
                "${userHome}/.aurora-sysroot/x86_64/usr/include/qt5/QtCore",
                "${userHome}/.aurora-sysroot/x86_64/usr/include/qt5/QtNetwork",
                "${userHome}/.aurora-sysroot/x86_64/usr/include/qt5/QtDBus",
                "${userHome}/.aurora-sysroot/x86_64/usr/include/qt5/QtPositioning",
                "${userHome}/.aurora-sysroot/x86_64/usr/include/qt5/QtSensors",
                "${userHome}/.aurora-sysroot/x86_64/usr/include/qt5/QtFeedback",
                "${userHome}/.aurora-sysroot/x86_64/usr/include/qt5/QtCrypto"
            ],
            "compilerPath": "/usr/bin/g++",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "linux-gcc-x64"
        }
    ],
    "version": 4
}