Project setup c

From NVIDIA-Omniverse/ovrtx · View interactive version

Project setup c is an AI agent skill from the GitHub repository NVIDIA-Omniverse/ovrtx. Setting up a new CMake C/C++ project that uses ovrtx. Use when user asks to create a new C project, set up CMake with ovrtx, scaffold a C++ app, or configure build dependencies.

How to use this skill

Skill file

Project Setup (C)

When to Use

Use this skill when the user asks to create a new C project, set up CMake with ovrtx, scaffold a C++ app, or configure build dependencies.

Inputs

Resolve inputs in this order: existing repository files and referenced snippets, explicit user request, then broader agent context.

Prerequisites

Instructions

  1. Identify the requested project type, platform, package source, and expected run command.
  2. Read the minimal example and setup snippets before writing scaffolding.
  3. Use the repository's existing Python or CMake conventions instead of inventing a new layout.
  4. Include renderer creation and first-frame validation only after the project dependency setup is complete.
  5. When changing code, run the narrow example setup or docs test whenever practical.

Output Format

Scripts

This skill has no scripts.

Limitations

Overview

ovrtx provides a C API with a CMake config for easy integration. The recommended approach uses CMake FetchContent to download the ovrtx binary package from GitHub Releases. A convenience macro in ovrtx.cmake handles fetching, finding, and runtime setup.

Project Structure

my-ovrtx-app/
  CMakeLists.txt
  cmake/
    ovrtx.cmake       # Copy from examples/c/cmake/ovrtx.cmake
  main.cpp

CMakeLists.txt

Source: examples/c/minimal/CMakeLists.txt snippet project-setup

Source (continued): examples/c/minimal/CMakeLists.txt snippet linking-models

The canonical example builds both loader models with ovstage attached. For an

ovrtx-only application, omit the ovstage link target and setup call. The

ovstage package is still required at configure time because ovrtx.h includes

ovstage headers; ovrtx_fetch() fetches it.

ovrtx.cmake

Copy examples/c/cmake/ovrtx.cmake into your project's cmake/ directory. The key macro it provides:

Update the FetchContent_Declare URL inside ovrtx.cmake to point to the appropriate GitHub Releases package for your platform.

Minimal main.cpp

Source: examples/c/minimal/main.cpp snippet check-error-helper

Source (continued): examples/c/minimal/main.cpp snippet create-renderer

Source (continued): examples/c/minimal/main.cpp snippet load-usd-and-wait

See the full minimal example for the complete flow including step, fetch, map, and cleanup.

Build and Run

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
./build/my-ovrtx-app

Runtime Packaging

The ovrtx binary distribution includes runtime dependencies under bin/:

bin/
  libovrtx-dynamic.so / ovrtx-dynamic.dll
  cache/
  library/
  libs/
  mdl/
  plugins/
  rendering-data/
  usd_plugins/

Static loader (model #1). Link

ovrtx::ovrtx_static and pass the package root to ovrtx_create_renderer() via

ovrtx_config_entry_binary_package_root_path(). Build the path from

OVX_CONFIG_EXECUTABLE_DIR_TOKEN "/ovrtx" so the loader resolves it against the

running executable's directory at runtime. ovrtx_setup_runtime() stages the

matching side-by-side ovrtx/ link pointing at the package bin/, keeping the

exe directory self-contained without baking an absolute path into the binary:

Source: examples/c/minimal/main.cpp snippet create-renderer

Shared loader (model #2). Link ovrtx::ovrtx; the operating system loads

only the forwarding loader. The loader opens the ovrtx runtime on the first

initialization call. ovrtx expects the bin/

runtime directories (cache/, library/, libs/, mdl/, plugins/,

rendering-data/, usd_plugins/) next to ovrtx-dynamic.dll /

libovrtx-dynamic.so, and ovrtx_setup_runtime() configures rpath (Linux) or

copies DLLs + creates junctions (Windows). In this mode binary_package_root_path

is only needed when your install/deploy layout breaks apart the default bin/

structure. The config-entry pattern is identical either way:

Source: tests/docs/c/test_support_api.cpp snippet doc-version-and-config-c

Headers

| Header | Purpose |

|--------|---------|

| <ovrtx/ovrtx.h> | Main API: create/destroy renderer, add USD, step, fetch results, map output |

| <ovrtx/ovrtx_types.h> | All type definitions (handles, structs, enums) |

| <ovrtx/ovrtx_config.h> | Config entry builders (ovrtx_config_entry_* helpers) |

Troubleshooting

In Attached Mode (ovrtx 0.4+)

Attached mode pairs independent ovrtx and ovstage packages. Use the same model

for both unless your deployment has a specific reason to mix them:

ovstage::ovstage_static. Pass each package root in its initialization config.

Each loader opens its runtime on the first initialization call.

The operating system resolves the two small loader libraries; neither imports

OpenUSD. Each loader opens its runtime on the first initialization call.

For both models, call ovrtx_register_schema_paths() before the first

ovstage_initialize() / ovstage_create_instance() if ovstage may initialize

first. The call only publishes discovery paths; it does not load the renderer or

OpenUSD. The minimal example demonstrates both link models and this ordering:

ovrtx and ovstage must come from the same release train (matched usd_ms ABI);

a single USD runtime in attach mode still needs on-hardware confirmation.

Source: examples/c/minimal/CMakeLists.txt snippet linking-models

Source (continued): examples/c/minimal/main.cpp snippet create-renderer

See docs/core/ovstage_integration.rst for the attached-mode overview and

examples/c/minimal/ for a complete attach-mode project.

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.