# appkit **Repository Path**: newgolo/appkit ## Basic Information - **Project Name**: appkit - **Description**: appkit是一个基于嵌入式Linux的具有可移植性的C++程序开发框架,其目的是为了加快LInux应用程序的开发速度,解放程序员的大脑和双手,让大家把精力投入到更有意义的事情当中去。 - **Primary Language**: C++ - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 284 - **Forks**: 148 - **Created**: 2018-09-02 - **Last Updated**: 2026-09-11 ## Categories & Tags **Categories**: iot **Tags**: Linux, Cpp, embedme ## README # appkit [中文文档](README.zh.md) ## Introduction appkit is a portable Linux application development library aimed at accelerating application development, improving robustness, and freeing developers to focus on more meaningful work. The project uses a **two-layer architecture**: | Layer | Library | Description | Detailed Docs | |-------|---------|-------------|---------------| | Base | **appkit** | Threads, coroutines, timers, IPC, serial, sockets, state machines, and other foundational components | [sources/appkit/README.md](sources/appkit/README.md) | | Application | **foundation** | Logging, configuration management (JSON/YAML), MQTT, WebSocket, databases (KV/SQLite/shared memory), data compression & encryption, V4L2 video capture, and other high-level components | [sources/foundation/README.md](sources/foundation/README.md) | ### appkit Core Modules Application framework, basic types & utilities, threads, async tasks, coroutines, timers, event notification, file I/O, date & time, string utilities, regular expressions, finite state machines, serial ports, network & sockets, IPC (message queues / shared memory / memory pools / pipes), GPIO control, SPI, plugin loading, signals & slots, command-line parsing, logging & tracing, singletons, atomic containers, unit testing (CppUnit), and more. ### foundation Core Modules fmt-formatted logging macros (app_log), application logger with crash capture (app_logger), JSON config (json_config), YAML config (yaml_config), data compression (LZ4/Zstd), data encryption (XOR/RSA/AES), KV store (LevelDB), SQLite ORM storage (db_storage), shared memory database (shm_db), MQTT client (mqtt_client), WebSocket client & server (web_socket), serial client (serial_client), gRPC interface (grpc_interface), Protobuf helper (proto_helper), HTTP status codes (http_state), input device (input_device), PPS pulse-per-second device (pps_device), V4L2 video capture & output (v4l2_device). ### Integrated Open-Source Libraries spdlog, fmt, nlohmann-json, yaml-cpp, sqlite_orm, LevelDB, simdb, paho.mqtt.c/cpp, IXWebSocket, Botan, lz4, zstd, Google Breakpad, gRPC/Protobuf, cppzmq/zeromq, DIMCli, tinyfsm, kacanopen, libcrc, rtsp-server, and more. Thanks to the authors of these open-source libraries for their selfless contributions! ## Directory Structure ``` appkit/ ├── sources/ │ ├── appkit/ # Base library (26 source files, 27 headers, 12 tests) │ ├── foundation/ # Application library (12 source files, 19 headers, 10 tests) │ └── third_party/ # Third-party dependencies (15 libraries) ├── ws_apps/ # Application demos (test_demos) ├── ws_rospkgs/ # ROS packages (commons, demo_msgs, demo_node) ├── scripts/ # Runtime scripts (setup.bash, systemd services, etc.) ├── prebuilt/ # Prebuilt dependencies (linux-amd64 / linux-arm64) ├── version/ # Version management ├── cmake/ # CMake modules (common, finder, xbuild, etc.) ├── environ/ # Build environment (envsetup, docker, toolchains) ├── host-x64-xbuild.sh # Local non-ROS build script ├── host-x64-rosenv.sh # Local ROS build script ├── docker_cmd.sh # Docker cross-compilation script └── build-config.cmake # Top-level build configuration ``` ## Author For questions, please contact: cblock@126.com ## License This software is licensed under the MIT License. Please comply with the terms. If you use this source code, please retain the README in your project directory. ## Build Instructions ### Requirements - CMake >= 3.16 - C++17 compiler (GCC 9+ / Clang 10+) - Ubuntu 20.04 / 22.04 (recommended) ### System Dependencies (install based on enabled features) ```bash apt install uuid-dev # USE_UUID apt install libv4l-dev # USE_V4L2 apt install libssl-dev # USE_OPENSSL / USE_BOTAN apt install libfmt-dev # USE_FMT apt install libopencv-dev # USE_OPENCV apt install libpcl-dev # USE_LIBPCL ``` ### Local Build (non-ROS, x86_64) Uses the xbuild system, no ROS dependency: ```bash source environ/envsetup.sh xbuild_setup linux-amd64 release xbuild mkdir -p xbuild/linux-amd64-host && cd xbuild/linux-amd64-host mkdir build && cd build cmake .. make install ``` Or use the convenience script: ```bash ./host-x64-xbuild.sh ``` Build output: `xbuild/linux-amd64-host/install`. ### ROS Build Supports both ROS1 (noetic) and ROS2 (humble/jazzy): ```bash # ROS1 sudo apt install ros-noetic-catkin ./host-x64-rosenv.sh -r noetic # ROS2 sudo apt install python3-colcon-common-extensions ``` Build output: `xrosenv/linux-amd64-host`. ### Docker Cross-Compilation (ARM64) Build aarch64 versions using Docker. See [Cross-compilation Dockerfile](environ/docker/Dockerfile-x64-ubuntu20-noetic): ```bash ./docker_cmd.sh xbuild # Build aarch64 non-ROS application ./docker_cmd.sh build # Build aarch64 ROS application ``` ### Optional Build Flags | Flag | Default | Description | |------|---------|-------------| | `USE_UUID` | 0 | UUID support | | `USE_V4L2` | 0 | V4L2 video capture | | `USE_LEVELDB` | 0 | LevelDB KV store | | `USE_WEBSOCKET` | 0 | WebSocket support | | `USE_BOTAN` | 1 | Botan cryptography | | `USE_FFMPEG` | 1 | FFmpeg support | | `USE_SHMDB` | 1 | Shared memory database | | `XBUILD_TEST` | — | Build test programs | Flags are defined in `sources/package.cmake` and can be overridden with cmake `-D`. ## Running Non-ROS application example: ```bash cd xbuild/linux-amd64-host/install source setup.bash test_appkit ``` ## Contributing 1. Fork this repository 2. Create a feature_xxx branch 3. Submit your code 4. Create a Pull Request ## Related Documentation - [AppKit Base Library](sources/appkit/README.md) - [Foundation Application Library](sources/foundation/README.md) - [Third-Party Libraries](sources/third_party/src/README.md)