-- ----------------------------------------------------------------------
-- Set up standard extension information
local ext = get_current_extension_info()

-- ----------------------------------------------------------------------
-- Set up standard OGN information
local ogn = get_ogn_project_information(ext, "omni/my/extension")

-- Put the extension into a top-level group and define the main project
ext.group = "simulation"
project_ext( ext )

-- ----------------------------------------------------------------------
-- Define the plugin project, which contains all of the C++ code
project_ext_plugin( ext, ogn.plugin_project )

    -- ----------------------------------------------------------------------
    -- Add the files to the project, reorganizing to make them easier to find in the Visual Studio project
    add_files("ogn/", ogn.nodes_path)
    add_files("impl", ogn.plugin_path)
    add_files("config", "config")
    add_files("docs", ogn.docs_path)

    -- ----------------------------------------------------------------------
    -- Set up all build dependencies required by the OGN generated code
    add_ogn_dependencies(ogn)

    -- ----------------------------------------------------------------------
    -- Add dependent libraries to the extension link phase
    links {"carb", "vt", "gf", "sdf", "arch", "usd", "tf", "usdUtils", "usdGeom", "usdSkel"}

-- ----------------------------------------------------------------------
-- Create a project for processing the .ogn files to create the generated code.
project_ext_ogn( ext, ogn )


-- ----------------------------------------------------------------------
-- Create a project for providing the Python interface to the extension
project_ext_bindings {
    ext = ext,
    project_name = ogn.python_project,
    module = ogn.bindings_module,
    src = ogn.bindings_path,
    target_subdir = ogn.bindings_target_path
}

    -- ----------------------------------------------------------------------
    -- Add the files to the project, reorganizing to make them easier to find in the Visual Studio project
    add_files("bindings", "bindings")
    add_files("python", "python/*.py")
    add_files("python/_impl", "python/_impl")
    add_files("python/tests", "python/tests")

    -- ----------------------------------------------------------------------
    -- Python bindings have OGN dependencies so set them up here.
    add_ogn_dependencies(ogn, {"python/_impl/nodes"})

    -- ----------------------------------------------------------------------
    -- Copy the init script directly into the build tree to avoid reload conflicts.
    repo_build.prebuild_copy {
        { "python/__init__.py", ogn.python_target_path },
    }
    -- Linking directories allows them to hot reload when files are modified in the source tree
    repo_build.prebuild_link {
        { "python/_impl", ogn.python_target_path.."/_impl" },
        { "python/tests", ogn.python_tests_target_path },
    }
