Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion modules/template/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ def remove_empty_dirs(root: str = ".") -> None:

# Copy CMake helpers from the HoloHub clone so the module builds standalone:
# - HoloHubConfigHelpers.cmake: add_holohub_application/operator/package gating
# - holohub_configure_deb.cmake: deb packaging helper used by the root CMakeLists
# - holohub_configure_deb.cmake: deb packaging helper used by the root
# CMakeLists. Brings a companion asset:
# - Config.cmake.in: package-config template the helper feeds to
# configure_package_config_file() when EXPORT_NAME is set, so
# downstream find_package(<module>) resolves the exported targets
# - pybind11_add_holohub_module.cmake: fetches pybind11 at the HSDK-pinned
# version + ABI-aligned target. Brings two companion assets:
# - pybind11/__init__.py: per-operator __init__ template configured by
Expand All @@ -102,6 +106,7 @@ def remove_empty_dirs(root: str = ".") -> None:
for _rel in (
("cmake", "HoloHubConfigHelpers.cmake"),
("cmake", "modules", "holohub_configure_deb.cmake"),
("cmake", "modules", "Config.cmake.in"),
("cmake", "pybind11_add_holohub_module.cmake"),
):
_src = _holohub_root.joinpath(*_rel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ target_link_libraries({{ cookiecutter.operator_slug }} PRIVATE holoscan::core)

install(FILES {{ cookiecutter.operator_slug }}.hpp DESTINATION include/{{ cookiecutter.operator_slug }})

# Add the operator to an export set. The package layer installs the set and
# generates the CMake config — see holohub_configure_deb(... EXPORT_NAME ...) in
# pkg/{{ cookiecutter.module_repo_name }}/CMakeLists.txt — so downstream projects
# can find_package({{ cookiecutter.module_repo_name }}) and link
# holoscan::{{ cookiecutter.operator_slug }}.
install(TARGETS {{ cookiecutter.operator_slug }}
EXPORT holoscan_{{ cookiecutter.module_slug }}_targets)
Comment thread
tbirdso marked this conversation as resolved.

add_subdirectory(python)
{% else %}# Pure Python operator — copy source into the Python package tree.
configure_file(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ holohub_configure_deb(
VENDOR "{% if cookiecutter.affiliation %}{{ cookiecutter.affiliation }}{% else %}NVIDIA{% endif %}"
CONTACT "{{ cookiecutter.contact_email }}"
DEPENDS "holoscan (>= {{ cookiecutter.holoscan_version }})"
EXPORT_NAME "holoscan_{{ cookiecutter.module_slug }}_targets"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The target is only being created when we have C++, right?
https://github.com/tbirdso/holohub/blob/cf3022a8441e7d711a4e12740e2a81e2e3d32e60/modules/template/%7B%7Bcookiecutter.module_repo_name%7D%7D/operators/%7B%7Bcookiecutter.operator_slug%7D%7D/CMakeLists.txt#L20-L21

However, the export statement here is unconditional and would be exported even when we have Python only. Should we make it conditional to the C++ language? Thanks

)
Loading