How carbonengine/core works
Purpose and Build Entry Points
Carbon Core is a C++ low-level portability library: generic utilities and cross-platform abstractions around system facilities. The primary build entry point is CMakeLists.txt, with selectable platform/build profiles in CMakePresets.json. Public consumption is through headers in include/ and CMake package metadata in carbon-coreConfig.cmake and CcpCoreConfig.cmake.in.
Public Core API Boundary
include/CcpCore.h is the umbrella/core-facing interface, supported by foundational definitions and types in include/CcpDefines.h, include/CcpTypes.h, and include/CcpMacros.h. Implementations reside at repository root, notably CcpCore.cpp and CcpDefines.cpp. Consumers should depend on exported headers rather than root implementation files.
Platform and System Abstractions
The library wraps operating-system-facing concerns behind cross-platform APIs:
• Threading and synchronization: include/CcpThread.h, include/CcpMutex.h, include/CcpSemaphore.h; implementations include CcpThread.cpp and CcpMutex.cpp.
• Process, time, and files: include/CcpProcess.h, include/CcpTime.h, include/CcpFileUtils.h; implementations include CcpProcess.cpp and CcpFileUtils.cpp.
• String conversion has platform-specific implementation paths in StringConversions.cpp and StringConversions.mm, the latter materially indicating macOS/Objective-C++ integration.
Diagnostics, Failure, and Telemetry
Diagnostic infrastructure includes assertions, logging, call stacks, crash-reporting interfaces, statistics, and telemetry. Key boundaries are include/CCPAssert.h, include/CCPLog.h, include/CCPCallstack.h, include/ICrashReporter.h, include/CcpStatistics.h, and include/CcpTelemetry.h; corresponding runtime implementations include CCPAssert.cpp, CCPLog.cpp, CCPCallstack.cpp, CcpStatistics.cpp, and CcpTelemetry.cpp. Crash reporting is abstracted through an interface rather than binding this repository to a named external crash service.
Memory and Utility Primitives
Memory allocation/tracking and reusable data-structure utilities form another foundational layer. Main APIs are include/CCPMemory.h, include/CCPMemoryTracker.h, include/CachedAllocator.h, include/CcpAtomic.h, and include/CcpPairingHeap.h, backed by CCPMemory.cpp, CCPMemoryTracker.cpp, and CcpMemoryTrackerMutex.h. Hashing and secure CRT wrappers are separate core utilities in include/CCPHash.h, include/CcpSecureCrt.h, CCPHash.cpp, and CcpSecureCrt.cpp.
Build, Packaging, and Dependencies
CMake defines targets, configurations, installation, and package export behavior through CMakeLists.txt and central modules such as cmake/CcpBuildConfigurations.cmake, cmake/CcpTargetConfigurations.cmake, and cmake/CcpPackageConfigHelpers.cmake. Dependency resolution uses vcpkg manifests: vcpkg.json and vcpkg-configuration.json. The vendor/ directory is a potential vendored-dependency boundary, but its contents are not represented in the supplied tree.
CI and Documentation
TeamCity is the material CI system, configured under .teamcity/, including universal-build and Perforce publishing workflows in .teamcity/_Self.kt/buildTypes/CreateUniversalBuilds.kt and .teamcity/_Self.kt/buildTypes/PublishToPerforce.kt. Documentation is generated as part of CMake installation when enabled, using Doxygen configuration in doc/Doxyfile.in and CMake integration in cmake/CcpDocsGenerator.cmake; its published entry is documentation/index.html.
Main entry points: CMakeLists.txt CMake Build · CcpCore.cpp Core Runtime · CCPAssert.h Diagnostic APIs · CcpCore.h Public Core API
Components 17
Build & Packaging
- Build Profiles
CMakePresets.json - CMake Build · Defines targets, installation, and exports.
CMakeLists.txt - CMake Modules
cmake/CcpBuildConfigurations.cmake - Dependency Resolution
vcpkg.json - Package Metadata
carbon-coreConfig.cmake
Core Library
- Public Core API · Consumer-facing umbrella and foundational definitions.
include/CcpCore.h - Core Runtime
CcpCore.cpp - Memory & Utilities · Allocation, tracking, atomics, containers, hashing, and secure CRT wrappers.
include/CCPMemory.h
Platform Abstractions
- System Abstractions · Threads, synchronization, processes, time, and file utilities.
include/CcpThread.h - System Runtime
CcpThread.cpp - String Conversion · Uses Objective-C++ on macOS.
StringConversions.mm
Diagnostics
- Diagnostic APIs · Assertions, logs, call stacks, statistics, telemetry, and crash-reporting interface.
include/CCPAssert.h - Diagnostic Runtime
CCPLog.cpp - Crash Reporter Interface · Decouples crash reporting from a provider.
include/ICrashReporter.h
CI & Documentation
- TeamCity Workflows · Builds universal artifacts and publishes to Perforce.
.teamcity/_Self.kt/buildTypes/CreateUniversalBuilds.kt - Documentation Source
doc/Doxyfile.in - Documentation Build
cmake/CcpDocsGenerator.cmake
Connections 17
- Build Profiles → CMake Build: selects profiles
- CMake Modules → CMake Build: configures
- Dependency Resolution → CMake Build: resolves dependencies for
- CMake Build → Public Core API: exports
- CMake Build → Core Runtime: builds
- CMake Build → Package Metadata: installs
- Public Core API → Core Runtime: implemented by
- Memory & Utilities → Core Runtime: supports
- System Abstractions → System Runtime: implemented by
- System Runtime → String Conversion: uses platform path
- Core Runtime → System Abstractions: uses
- Core Runtime → Diagnostic APIs: uses
- Diagnostic APIs → Diagnostic Runtime: implemented by
- Diagnostic APIs → Crash Reporter Interface: abstracts through
- TeamCity Workflows → CMake Build: runs builds
- Documentation Build → Documentation Source: uses configuration
- CMake Build → Documentation Build: invokes during install