[TOC]
This library is designed for object-oriented programming using the C language. It currently contains core, net, concurrent, and ui (not completed) modules. Each module provides demos that are easy to understand and use.
To build the project on Linux, you can specify the architecture or use the default (x86_64):
# Default architecture (x86_64)
./devops.sh build --platform=linux
# Specify architecture (x86_64 or arm)
./devops.sh build --platform=linux --arch=x86_64
./devops.sh build --platform=linux --arch=armThe build output will be placed in the sysroot/linux/<architecture> directory, where <architecture> is either x86_64 or arm.
To build the project on Windows, you can use either native Windows compilation or Linux cross-compilation.
-
Native Windows Compilation: Run the following command on a Windows host:
./devops.sh build --platform=windows --arch=x86_64
-
Linux Cross-Compilation for Windows: Set up the cross-compilation environment on a Linux host and run:
./devops.sh build --platform=windows --arch=x86_64
For details on setting up the Linux cross-compilation environment, refer to the Linux Cross-Compilation Setup Guide.
To build the project for Android, use the following command:
./devops.sh build --platform=android --arch=arm64-v8aBefore building for Android, ensure that the Android NDK is installed. Follow the Installing Android NDK on Ubuntu guide for detailed instructions.
To build the project on macOS, use the following command:
./devops.sh build --platform=macRelease package
To create a release package for Linux, you can specify the architecture or use the default (x86_64):
# Default architecture (x86_64)
./devops.sh release --platform=linux
# Specify architecture (x86_64 or arm)
./devops.sh release --platform=linux --arch=x86_64
./devops.sh release --platform=linux --arch=armThe release package will be created in the packages directory with a name like xtools_linux_<architecture>_v<version>.tar.gz.
Release docker image
sudo ./devops.sh docker --build=fruit-pomegranate --package-path=./packages/xtools_linux_x86_64_v2.15.0.229.tar.gz
sudo docker run -d --name fruit-pomegranate -p 12345:12345 fruit-pomegranate
./sysroot/linux/x86_64/bin/xtools node_cli --host=0.0.0.0 --service=12345 lookup all
To create a release package for Windows, you can specify the architecture (default is x86_64):
# Default architecture (x86_64)
./devops.sh release --platform=windows
# Specify architecture (x86_64)
./devops.sh release --platform=windows --arch=x86_64The release package will be created in the packages directory with a name like xtools_windows_<architecture>_v<version>.zip.
To create a release package for Android, specify the architecture (default is arm64-v8a):
# Default architecture (arm64-v8a)
./devops.sh release --platform=android
# Specify architecture (e.g., arm64-v8a)
./devops.sh release --platform=android --arch=arm64-v8aThe release package will be created in the packages directory with a name like xtools_android_<architecture>_v<version>.zip.
To create a release package for other platforms, use the following command:
# Replace <platform> with mac or android
./devops.sh release --platform=<platform>To deploy the project, use the develop.sh script. This script simplifies the deployment process for various platforms.
To deploy the project to a Linux server, use the following command:
./devops.sh deploy -p=linux --host=<server_ip> --package-path=<path_to_package>This command connects to the deployed service on the specified host (139.159.231.27) and service port (12345) to perform a lookup operation for all available nodes.
<server_ip>: Replace with the IP address of the target Linux server (e.g.,139.159.231.27).<path_to_package>: Replace with the path to the release package (e.g.,./packages/xtools_linux_x86_64_v2.14.0.125.tar.gz).
./devops.sh deploy -p=linux --host=139.159.231.27 --package-path=./packages/xtools_linux_x86_64_v2.15.0.153.tar.gzThis command will deploy the specified package to the Linux server at 139.159.231.27.
After deploying the project to a Linux server, you can verify the deployment using the following command:
./sysroot/linux/x86_64/bin/xtools node_cli --host="139.159.231.27" --service="12345" lookup allTo deploy the project to an Android device, use the following command:
./devops.sh deploy -p=android --package-path=<path_to_package><path_to_package>: Replace with the path to the release package (e.g.,./packages/xtools_android_arm64-v8a_v2.14.0.125.zip).
./devops.sh deploy -p=android --package-path=./packages/xtools_android_arm64-v8a_v2.15.0.128.tar.gzThis command will deploy the specified package to the connected Android device.
The following modules are included in the library. Click on a module name to view its detailed documentation:
- Argument Module: Handles command-line arguments and parameter parsing.
- Attacher Module: Platform-specific module for resource attachment (not available on ARM).
- Concurrent Module: Includes utilities for multithreading and synchronization, such as thread pools and mutexes.
- Core Module: Provides the foundation for object-oriented programming in C, including inheritance, polymorphism, and encapsulation.
- Crypto Module: Provides cryptographic utilities, such as encryption and decryption.
- Database Module: Platform-specific module for database operations (not available on ARM).
- Drivers Module: Provides abstractions for hardware drivers.
- Encoding Module: Handles data encoding and decoding, such as Base64 and JSON.
- Event Module: Supports event-driven programming models, including event registration, dispatching, and handling.
- Net Module: Offers networking capabilities, such as TCP/UDP socket programming and HTTP support.
- Node Module: Manages distributed nodes and their communication.
- Scripts Module: Provides scripting utilities for automation and integration.
- Stub Module: Handles stub generation for remote procedure calls (RPC).
- UI Module: Tools for building graphical user interfaces (under development).
The latest version of the library is available at GitHub.
If you encounter any issues or have questions, feel free to contact me via email at a1an1in@sina.com.
This software is licensed under the LGPL license.
Copyright (c) 2015-2020.