OGN Build Functions

If your extension has a build step then you will have a premake5.lua file that defines your build projects. The Kit public premake file sources the file ogn_helpers.lua, which defines some helper functions to make setting up a project containing .ogn files much easier.

There are a few functions that are most commonly used by the build process. Here is the documentation for them.

The ogn project configuration information is kept in a table, much the same as how the extension configuration information is kept in a table. You start with the extension information as your base:

local ext = get_current_extension_info()

Then you can either populate all of the ogn project information in one step

local ogn = get_ogn_project_information(ext, "omni/my/extension")

or you can customize your project name and plugin include path by splitting the population into two steps

local ogn = create_ogn_project_information(ext, "omni/my/extension")
ogn.project_path = my_custom_project_name
ogn.plugin_path = "plugin/include"
add_ogn_project_dependencies(ogn)

Both get_ogn_project_information and create_ogn_project_information take an optional third parameter that points to a file containing type definitions described in Type Definition Overrides. In order to use your own custom configuration file you would add in a call to the function that will install it into the build for you:

install_ogn_configuration_file("my_configs/MyTypeConfiguration.json")

Once the configuration is set up in this manner you can use the contents of the table to point your C++ or Python project definitions to the standard locations used by ogn, and then define the project that will generate the code and documentation from your .ogn file definitions

project_ext_ogn(ext, ogn, settings)

The settings parameter is an optional table that can be used to further configure the project definition. If the table entry no_group is present (i.e. settings[“no_group”] is not nil) then the standard build grouping is not defined for this project. Any other non-nil table entries will be treated as being a value to pass to the generator as a Carbonite setting of the form /persistent/omnigraph/generator/SETTING.

Within your project definition you will want to add the common ogn dependencies as determined by the ogn table. The easiest way to do this is in one step with the single call

add_ogn_dependencies(ogn, python_node_directories)
-- e.g. add_ogn_dependencies(ogn, {"python/nodes"})

where python_node_directories is a table of directories in which Python nodes live. You do not have to include the directories for C++ nodes in this list. This function does three things, which you can also call separately if you are using different build flags or wish to structure your build file differently.

-- Define the standard directory and extension dependencies
set_up_ogn_dependencies(ogn)
-- Define the C++-specific flags and link libraries
set_ogn_cpp_flags(ogn)
-- Tell the project where to find the implementation of Python .ogn nodes
link_ogn_python_directories(ogn, python_node_directories)

You can also generate some documentation index files that list all of the nodes in your repo both by category and by extension. Once they are generated they end up in _build/ogn/docs/ where you can include them in some toctree.

project_ogn_docs_index()
.. toctree::
:maxdepth: 1
:glob:

../../../../../_build/ogn/docs/*