Cross-platform C++ library for ccgonow, supporting Android, iOS, macOS, Windows, Linux, and OpenHarmony.
-
ccgonow README
-
ccgonow Documentation
See releases for published versions and changelog for version changes.
- Android SDK:
CCGONOW_ANDROID_SDK-{version}-{release}.aar - iOS Framework:
CCGONOW_IOS_FRAMEWORK-{version}-{release}.zip - macOS Framework:
CCGONOW_MACOS_FRAMEWORK-{version}-{release}.zip - Windows Library:
CCGONOW_WINDOWS_SDK-{version}-{release}.zip - Linux Library:
CCGONOW_LINUX_SDK-{version}-{release}.zip - OpenHarmony HAR:
CCGONOW_OHOS_SDK-{version}-{release}.har
- Release version: Tagged as
v{version}(e.g.,v1.2.3) with suffixrelease - Beta version: Suffix format
beta.{commits}where{commits}is the number of commits since the last tag (e.g.,beta.23) - Dirty beta: Suffix format
beta.{commits}-dirtyfor uncommitted local changes (e.g.,beta.23-dirty)
Install the CCGO build tool:
pip install ccgoFor development (editable install):
cd ccgo
pip install -e .- Android NDK r25c or later
- Set
ANDROID_HOMEandANDROID_NDK_HOMEenvironment variables - Java 11 or later
- Xcode 14.0 or later
- Command Line Tools for Xcode
- Visual Studio 2015 or later
- CMake 3.10 or later
- GCC 7.0 or later
- CMake 3.10 or later
- OHOS SDK API 12 or later
- Set
OHOS_SDK_HOMEenvironment variable - hvigor and ohpm CLI tools
All build commands should be run from the ccgonow/ directory (the inner project directory).
Build Android AAR package with native libraries for multiple architectures:
cd ccgonow
# Build for all architectures (armeabi-v7a, arm64-v8a, x86_64)
ccgo build android
# Build for specific architectures
ccgo build android --arch arm64-v8a,x86_64
# Generate Android Studio project
ccgo build android --ide-projectOutput:
- AAR file:
bin/android/CCGONOW_ANDROID_SDK-{version}-{release}.aar - Archive (with unstripped .so):
bin/android/ARCHIVE_CCGONOW_ANDROID_SDK-{version}-{release}.zip - Build metadata:
bin/android/build_info.json
Build iOS XCFramework supporting both device and simulator:
cd ccgonow
# Build XCFramework (device + simulator)
ccgo build ios
# Generate Xcode project
ccgo build ios --ide-projectOutput:
- XCFramework:
bin/ios/CCGONOW_IOS_FRAMEWORK-{version}-{release}.xcframework/ - Archive:
bin/ios/ARCHIVE_CCGONOW_IOS_FRAMEWORK-{version}-{release}.zip - Build metadata:
bin/ios/build_info.json
Build macOS Framework:
cd ccgonow
# Build universal macOS framework (x86_64 + arm64)
ccgo build macos
# Generate Xcode project
ccgo build macos --ide-projectOutput:
- Framework:
bin/macos/CCGONOW_MACOS_FRAMEWORK-{version}-{release}.framework/ - Archive:
bin/macos/ARCHIVE_CCGONOW_MACOS_FRAMEWORK-{version}-{release}.zip - Build metadata:
bin/macos/build_info.json
Build Windows static library:
cd ccgonow
# Build Release configuration
ccgo build windows
# Build Debug configuration
ccgo build windows --config Debug
# Generate Visual Studio project
ccgo build windows --ide-projectOutput:
- Library directory:
bin/windows/CCGONOW_WINDOWS_SDK-{version}-{release}.dir/ - Archive:
bin/windows/ARCHIVE_CCGONOW_WINDOWS_SDK-{version}-{release}.zip - Build metadata:
bin/windows/build_info.json
Build Linux static library:
cd ccgonow
# Build static library
ccgo build linux
# Generate CodeLite project
ccgo build linux --ide-projectOutput:
- Library directory:
bin/linux/CCGONOW_LINUX_SDK-{version}-{release}.dir/ - Archive:
bin/linux/ARCHIVE_CCGONOW_LINUX_SDK-{version}-{release}.zip - Build metadata:
bin/linux/build_info.json
Build OpenHarmony HAR package:
cd ccgonow
# Build for all architectures (armeabi-v7a, arm64-v8a, x86_64)
ccgo build ohos
# Build for specific architectures
ccgo build ohos --arch arm64-v8aOutput:
- HAR file:
bin/ohos/CCGONOW_OHOS_SDK-{version}-{release}.har - Archive:
bin/ohos/ARCHIVE_CCGONOW_OHOS_SDK-{version}-{release}.zip - Build metadata:
bin/ohos/build_info.json
Run unit tests using GoogleTest framework:
cd ccgonow
# Build and run all tests
ccgo test
# Build and run specific tests with filter
ccgo test --filter "UtilsTest*"
# Build only (without running)
ccgo test --build-only
# Run only (assumes already built)
ccgo test --run-only
# Generate IDE project for tests
ccgo test --ide-project
# Pass additional GoogleTest arguments
ccgo test --gtest-args="--gtest_repeat=3 --gtest_shuffle"Output: cmake_build/Tests/
Run performance benchmarks:
cd ccgonow
# Build and run all benchmarks
ccgo bench
# Build and run specific benchmarks with filter
ccgo bench --filter "StringBench*"
# Build only
ccgo bench --build-only
# Run only
ccgo bench --run-only
# Generate IDE project for benchmarks
ccgo bench --ide-project
# Specify output format (console, json, csv)
ccgo bench --format json
# Pass additional benchmark arguments
ccgo bench --benchmark-args="--benchmark_repetitions=3"Output: cmake_build/Benches/
Generate Doxygen documentation:
cd ccgonow
# Build documentation
ccgo doc
# Build and serve documentation locally on port 8000
ccgo doc --serve
# Serve on custom port
ccgo doc --serve --port 8080Output: cmake_build/Docs/{System}.out/_html/index.html
Publish documentation to GitHub Pages:
# Publish to default branch (from CCGO.toml)
ccgo publish doc
# Publish to specific branch
ccgo publish doc --branch gh-pages
# Force push (overwrite existing)
ccgo publish doc --force
# Open documentation URL after publishing
ccgo publish doc --openPublish Android AAR to Maven repository:
cd ccgonow
ccgo publish androidRequires Maven credentials configured in android/gradle.properties.
Publish HAR to OpenHarmony Package Manager:
cd ccgonow
ccgo publish ohosRequires ohpm CLI to be installed and authenticated.
iOS and macOS frameworks are typically distributed via binary archives in releases. Use CocoaPods or Swift Package Manager for dependency management.
# Auto-generate tag from CCGO.toml version
ccgo tag
# Create specific version tag
ccgo tag v1.2.3
# Create tag with message
ccgo tag v1.2.3 --message "Release version 1.2.3"
# Create tag without pushing
ccgo tag v1.2.3 --no-push
# Delete tag
ccgo tag --delete v1.2.3cd ccgonow
# Clean all build artifacts
ccgo clean
# Clean specific platform
ccgo clean --platform android
# Clean all platforms
ccgo clean --all
# Dry run (show what would be deleted)
ccgo clean --dry-run
# Skip confirmation prompt
ccgo clean --yesAll builds generate a build_info.json file in the output directory containing:
{
"build_metadata": {
"version": "1.0",
"generated_at": "2025-01-24T10:30:00",
"generator": "ccgo"
},
"project": {
"name": "CCGONOW",
"version": "1.0.0"
},
"git": {
"branch": "main",
"revision": "abc123",
"revision_full": "abc123def456...",
"tag": "v1.0.0",
"is_dirty": false,
"remote_url": "/username/repo.git"
},
"build": {
"time": "2025-01-24 10:30:00",
"timestamp": 1706090400,
"platform": "android",
"android": {
"ndk_version": "25.2.9519653",
"stl": "c++_shared",
"min_sdk_version": "21"
}
},
"environment": {
"os": "Darwin",
"os_version": "23.0.0",
"python_version": "3.11.0",
"ccgo_version": "1.0.0"
}
}After cloning the project, initialize git hooks and linting tools:
cd ccgonow
# Pull lint tools submodule
git submodule update --init --recursive
# Install linting tools (run once)
lint/install.sh cppThis sets up:
- cpplint: Google C++ style checker
- cppcheck: Static analysis tool
- lizard: Cyclomatic complexity analyzer
- commit-msg hook: Validates commit message format
The project follows Google C++ Style Guide. Use these tools for formatting:
cd ccgonow
# Format code with clang-format
lint/clangformat_project_scan.sh
# Output: clangformat_lint_detail.txt
# Fix cpplint errors automatically
lint/cpplint_project_error_fix.sh
# Output: cpplint_error_fix_lint_detail.txt
# Scan code with cpplint only
lint/cpplint_project_scan.sh
# Output: cpplint_lint_detail.txtRun static analysis with cppcheck:
cd ccgonow
# Run cppcheck
lint/cppcheck_project_scan.sh
# Output: cppcheck_lint_detail.xmlEnsure functions have cyclomatic complexity < 20:
cd ccgonow
# Check complexity with lizard
lint/cyclomatic_complexity_project_scan.sh
# Output: cyclomatic_complexity_lint_detail.txtFollow Google Angular Style for commit messages:
<type>(<scope>): <short summary>
<body>
<footer>
Type:
feat: New featurefix: Bug fixrefactor: Code refactoringdocs: Documentation changesstyle: Code formattingtest: Test changeschore: Build/tooling changesci: CI/CD changes
Scope: ccgonow|base|net|utils|build|docs|test
Example:
feat(net): add HTTP/2 support
Includes connection pooling and stream multiplexing.
Closes #12393123459
Revert commits:
revert: feat(net): addHTTP/2support
This reverts commit abc123def456.
Reason: Causes memory leak in production.
Project configuration is stored in ccgonow/CCGO.toml:
[project]
name = "ccgonow"
version = "1.0.0"
[build]
verinfo_path = "include/ccgonow/base/"
generate_json_metadata = true
[android]
project_path = "android/main_android_sdk"
merge_libs = []
exclude_libs = []
[[android.export_headers]]
src = "include/ccgonow/api/*.h"
dest = "ccgonow/api"
[ohos]
project_path = "ohos/main_ohos_sdk"
merge_libs = []
exclude_libs = []
[ios]
[[ios.export_headers]]
src = "include/ccgonow/api/*.h"
dest = "ccgonow/api"
[macos]
[[macos.export_headers]]
src = "include/ccgonow/api/*.h"
dest = "ccgonow/api"
[windows]
[[windows.export_headers]]
src = "include/ccgonow/api/*.h"
dest = "ccgonow/api"
[linux]
[[linux.export_headers]]
src = "include/ccgonow/api/*.h"
dest = "ccgonow/api"
[include]
[[include.export_headers]]
src = "include/ccgonow/api/*.h"
dest = "ccgonow/api"
[publish]
pages_branch = "gh-pages"The examples/ directory contains example projects demonstrating usage across various platforms:
- Android: Sample Android app using the AAR
- iOS: Sample iOS app using the XCFramework
- macOS: Sample macOS app using the Framework
- OpenHarmony: Sample OHOS app using the HAR
Copyright 2025 zhlinh and ccgonow Project Authors. All rights reserved.
See LICENSE for details.