Kit App Template | Premake issue with custom OGN while adding ogn dependencies

Operating System:
Windows
Linux
Kit Version:
109 (Kit App Template)
107 (Kit App Template)
106 (Kit App Template)
105 (Launcher)
Kit Template:
USD Composer
USD Explorer
USD Viewer
Custom
GPU Hardware:
A series (Blackwell)
A series (ADA)
A series
50 series
40 series
30 series
GPU Driver:
Latest
Recommended (573.xx)
Other

Work Flow:

Objective
Create an extension for custom Omnigraph C++ Nodes

Test sample - OK!

Following up on this repository with omni.example.cpp.omnigraph_node example

Using the above repository directly, after building/bootstrapping and launching the kit app omni.app.kit.dev.bat seems to work (i.e. the nodes appear in Omnigraph nodes), with some minor issues of trying to drag the node to the Push Graph (e.g. Example Offset Node).

However this is not the preferred workflow, preference would be using kit-app-template version 109.0.2.

In kit-app-template, creating the extension and running .repo.bat build results in the issue mentioned in Error Code below

Somehow premake is not able to get a hold of usd, from my understanding this should be part of packman-repo already and thus its configuration to the applicable version.

And I can see different versions at repo_usd

Tried to also set the USD_ROOT environment variable the with no success, to the 3.11 and 3.12 versions.

\packman-repo\chk\usd.py312.windows-x86_64.stock.release\0.25.02.kit.8-gl.16788+c1c423f2

And also by compiling USD locally and pointing USD_ROOT to that location.

Tried as well to set [repo_usd] usd_root = “” in repo.toml with no success.

Main Issue:

premake5.lua from the omni.example.cpp.omnigraph_node seems to get into this conflict while adding ogn dependencies

add_ogn_dependencies(ogn)

Reproduction Steps:

  1. Clone kit-app-template version 109.0.2
  2. Create a kit application via repo.bat template new (so we can add a dependency of the extension to it)
  3. Create the omni.example.cpp.omnigraph_node extension under kit-app-template/source/extensions
  4. Run repo.bat build for bootstrapping
  5. Error

Error Code:

Selected environment: integ for app version: 109.0.2 with regex:

USD VERSION = nil # Printed the usd_ver just to verify issue

** Error: \kit-app-template_repo\deps\repo_kit_tools\kit-template\premake5-kit.lua(292): Error executing '/kit-app-template/source/extensions/omni.example.cpp.omnigraph_node: /kit-app-template/_build/windows-x86_64/release/kit/dev/premake5-usd.lua:686: attempt to compare nil with string

When creating custom OGN (OmniGraph) nodes in Kit App Template and configuring premake build dependencies, there are several common issues and best practices to follow.

Understanding the Problem

OmniGraph node development requires proper integration between:

  • OGN definition files (.ogn)
  • Generated database files
  • Premake build configuration
  • Extension dependencies

Proper OGN Extension Structure

Your extension should follow this structure:

your_extension/
├── config/
│   └── extension.toml
├── ogn/
│   └── YourCustomNode.ogn       # Node definition
├── nodes/
│   └── YourCustomNodeDatabase.py  # Generated database
└── premake5.lua                  # Build configuration (if using C++)

1. extension.toml Configuration

Make sure your extension.toml includes the necessary OGN dependencies:

[package]
name = "your.extension.name"
version = "1.0.0"

[dependencies]
"omni.graph" = {}
"omni.graph.core" = {}
"omni.graph.tools" = {}  # Important for OGN generation
"omni.graph.nodes" = {}
"omni.usd" = {}

2. Premake5.lua Configuration for OGN Nodes

The key issue is usually in the premake configuration. Here’s a proper setup:

-- premake5.lua for extension with custom OGN nodes

project "your.extension.name"
    kind "SharedLib"
    language "C++"

    -- Include OGN generated files
    includedirs {
        "ogn",
        "_build/target-deps/omni_graph_tools/include",
        "_build/target-deps/omni_graph_core/include"
    }

    files {
        "ogn/**.ogn",          -- OGN definition files
        "ogn/**.cpp",           -- OGN implementation files
        "plugins/**.cpp"        -- Your plugin code
    }

    -- Link against OmniGraph libraries
    links {
        "omni.graph.core",
        "carb"
    }

    -- Add OGN generation as prebuild step
    prebuildcommands {
        "{PYTHON} -m omni.graph.tools.ogn "..
        "--config ogn "..
        "--ext-dir %{cfg.buildtarget.directory}"
    }

3. OGN Node Definition (.ogn file)

Ensure your .ogn file is properly formatted:

{
    "YourCustomNode": {
        "version": 1,
        "categories": "examples",
        "description": "Your custom OGN node",
        "language": "Python",
        "inputs": {
            "input1": {
                "type": "float",
                "description": "Input parameter"
            }
        },
        "outputs": {
            "output1": {
                "type": "float",
                "description": "Output result"
            }
        }
    }
}

4. Common Issues and Fixes

Issue: OGN database files not generated

Solution:

  • Make sure omni.graph.tools extension is enabled
  • Run: python -m omni.graph.tools.ogn --config ./ogn

Issue: Premake can’t find OGN dependencies

Solution:

  • Ensure your build pulls in the correct extension dependencies
  • Check that _build/target-deps contains the omni.graph.* extensions

Issue: Circular dependencies

Solution:

  • Review your dependency chain in extension.toml
  • Remove unnecessary dependencies

Issue: Build fails with missing includes

Solution:

  • Verify includedirs paths in premake5.lua
  • Check that OGN generation ran before compilation

5. Build Process

# 1. Generate OGN database files
python -m omni.graph.tools.ogn --config ./ogn --ext-dir ./

# 2. Run premake to generate build files
./repo build

# 3. Build the extension
./repo build --target your.extension.name

6. Alternative: Pure Python OGN Nodes (No Premake)

If premake is causing issues and you don’t need C++ performance, consider pure Python OGN nodes:

# In your extension.py
import omni.graph.core as og

class YourCustomNodeDatabase(og.Database):
    """Node database interface for your custom node"""
    pass

# Register the node
og.register_node_type(YourCustomNodeDatabase, version=1)

This approach eliminates premake complexity entirely.

7. Debugging Tips

  • Check extension load order: print(omni.ext.get_extension_manager().get_loaded_extensions())
  • Verify OGN tools are available: import omni.graph.tools
  • Look at console output for OGN generation errors
  • Check that generated database files are in nodes/ directory
  • Enable verbose logging: Set /log/level to verbose in settings

8. Related Extensions

  • omni.graph.tools - OGN code generation
  • omni.graph.core - Core OmniGraph functionality
  • omni.graph.ui - Graph editor UI

Additional Resources


@Richard3D Thank you for the explanation, it helps summarize in a nice way that documentation at the bottom of your response which I have been going through already.

However for my specific issue here, the problem was USD not being picked up, that would also happen if I wanted to pull my system ROS installation as a dependency for OGN. This was quite a reverse engineering experience…

FIXED BY

Adding the following lines to \kit-app-template\tools\deps\kit-sdk-deps.packman.xml

  1. add a new filter for usd, ${config} flag represent debug or release (for your final _build\target-deps${platform} folder) ${platform} represents windows or linux
<filter include="usd-${config}" />
  1. add a new dependency for usd in the same file
<dependency name="usd-${config}" linkPath="../../_build/target-deps/usd/${config}" />
  1. Bootstrap by running repo.bat build

Ok great ! I am glad you have it sorted out. A very clever solution.