Skip to content

vertexnova/vnecommon

Repository files navigation

VertexNova Common (vnecommon)

CI C++ Standard Header Only License

Header-only library providing common utilities 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

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

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
}

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.