Skip to content

vertexnova/vnecommon

Repository files navigation

VertexNova Common

Common utilities for VertexNova projects

CI C++ Standard Header Only License


About

Header-only library providing platform detection, macros, and base classes (e.g. NonCopyable) for VertexNova projects.

Features

  • Platform Detection - Macros for Windows, macOS, iOS, visionOS, Android, Linux, Web
  • Compiler Detection - MSVC, GCC, Clang identification
  • Architecture Detection - x64, x86, ARM64, ARM
  • Assertions - Debug-only assertions with messages
  • Utility Macros - Force inline, branch hints, unused variable marking
  • NonCopyable / NonMovable / NonCopyableNonMovable - Base classes to disable copy and/or move; inherit privately

Headers

Header Description
vertexnova/common/common.h Main include (includes all headers)
vertexnova/common/platform.h Platform, compiler, architecture detection
vertexnova/common/macros.h Assertions and utility macros
vertexnova/common/noncopyable.h NonCopyable, NonMovable, NonCopyableNonMovable base classes

Usage

Add as a submodule:

git submodule add git@github.com:vertexnova/vnecommon.git libs/vnecommon

In your CMakeLists.txt:

add_subdirectory(libs/vnecommon)
target_link_libraries(your_target PRIVATE vne::common)

In your C++ code:

#include "vertexnova/common/common.h"

void example() {
    VNE_ASSERT_MSG(ptr != nullptr, "Pointer must not be null");
    VNE_UNUSED(some_variable);

#if defined(VNE_PLATFORM_MACOS)
    // macOS-specific code
#endif
}

// Disable copy/move via base classes (inherit privately)
class UniqueResource : private vertexnova::NonCopyable { /* ... */ };
class Singleton : private vertexnova::NonCopyableNonMovable { /* ... */ };

Building

macOS / Linux

# Debug build with examples
./scripts/build_macos.sh

# Release build
./scripts/build_macos.sh --release

# Clean build
./scripts/build_macos.sh --clean

Windows

# Debug build with examples
python scripts/build_windows.py

# Release build
python scripts/build_windows.py --release

# Clean build
python scripts/build_windows.py --clean

CMake Direct

cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=ON
cmake --build build --config Release

Requirements

  • C++20 or later
  • CMake 3.16 or later
  • Python 3.8+ (for Windows build script)

License

Apache License 2.0 — See LICENSE for details.


Part of the VertexNova project