Skip to content

Commit

Permalink
Improving Holohub installation (nvidia-holoscan#506)
Browse files Browse the repository at this point in the history
* Installing extensions and operators similar to Holoscan

Signed-off-by: Julien Jomier <[email protected]>

* Fixing install path and setting default to source by default

Signed-off-by: Julien Jomier <[email protected]>

* Reverting to using CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.

Signed-off-by: Julien Jomier <[email protected]>

* Fixing installation paths

Signed-off-by: Julien Jomier <[email protected]>

* Fix GXF extensions path

Signed-off-by: Julien Jomier <[email protected]>

---------

Signed-off-by: Julien Jomier <[email protected]>
  • Loading branch information
jjomier authored Oct 8, 2024
1 parent b02dfcb commit faeffd9
Show file tree
Hide file tree
Showing 23 changed files with 62 additions and 82 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,7 +14,7 @@
# limitations under the License.

cmake_minimum_required(VERSION 3.20.1)
project(Holohub-internal CXX)
project(Holohub CXX)

# set CMAKE_MODULE_PATH
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
Expand Down Expand Up @@ -45,7 +45,8 @@ endif()

# Set the default data directory
set(HOLOHUB_DATA_DIR "${CMAKE_BINARY_DIR}/data" CACHE PATH "Data Download directory")
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:/opt/nvidia/holoscan/lib/")
set(CMAKE_INSTALL_RPATH
"\$ORIGIN:\$ORIGIN/../../../lib:\$ORIGIN/../../lib:/opt/nvidia/holoscan/lib/")

# Build the applications
add_subdirectory(applications)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
---
extensions:
- gxf_extensions/deltacast_videomaster/libgxf_videomaster.so
- lib/gxf_extensions/libgxf_videomaster.so

replayer:
basename: "surgical_video"
Expand Down
25 changes: 3 additions & 22 deletions applications/endoscopy_tool_tracking/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,29 +156,10 @@ endif()
# Install application and dependencies into the install/ directory for packaging
install(
TARGETS endoscopy_tool_tracking
DESTINATION endoscopy_tool_tracking_cpp
COMPONENT "holohub-apps"
DESTINATION bin/endoscopy_tool_tracking/cpp
)

file(READ "${CMAKE_CURRENT_SOURCE_DIR}/endoscopy_tool_tracking.yaml" APP_YAML_FILE)
string(REPLACE "gxf_extensions/lstm_tensor_rt_inference/" "" APP_YAML_FILE "${APP_YAML_FILE}")
file(WRITE "${CMAKE_BINARY_DIR}/packaging/cpp/endoscopy_tool_tracking.yaml" "${APP_YAML_FILE}")

install(
FILES ${CMAKE_BINARY_DIR}/packaging/cpp/endoscopy_tool_tracking.yaml
DESTINATION endoscopy_tool_tracking_cpp
COMPONENT "holohub-apps"
FILES endoscopy_tool_tracking.yaml
DESTINATION bin/endoscopy_tool_tracking/cpp
)

install(
DIRECTORY ${CMAKE_BINARY_DIR}/gxf_extensions/lstm_tensor_rt_inference/
DESTINATION endoscopy_tool_tracking_cpp
FILES_MATCHING PATTERN "*.so"
PATTERN "CMakeFiles" EXCLUDE)

install(
FILES
${CMAKE_BINARY_DIR}/operators/lstm_tensor_rt_inference/liblstm_tensor_rt_inference.so
${CMAKE_BINARY_DIR}/operators/tool_tracking_postprocessor/libtool_tracking_postprocessor.so
DESTINATION endoscopy_tool_tracking_cpp
COMPONENT "holohub-apps")
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ resources:
gpuMemory: 1Gi

extensions:
- gxf_extensions/lstm_tensor_rt_inference/libgxf_lstm_tensor_rt_inference.so
- lib/gxf_extensions/libgxf_lstm_tensor_rt_inference.so
# Uncomment the following extension when using deltacast as a source
# - gxf_extensions/deltacast_videomaster/libgxf_videomaster.so
# - lib/gxf_extensions/libgxf_videomaster.so
# Uncomment the following extension when using yuan as source
# - gxf_extensions/yuan_qcap/libgxf_qcap_source.so
# - lib/gxf_extensions/libgxf_qcap_source.so

source: "replayer" # "replayer" or "aja" or "deltacast" or "yuan"
visualizer: "holoviz" # "holoviz" or "vtk"
Expand Down
31 changes: 3 additions & 28 deletions applications/endoscopy_tool_tracking/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,35 +67,10 @@ endif()
# Install application and dependencies into the install/ directory for packaging
install(
FILES endoscopy_tool_tracking.py
DESTINATION endoscopy_tool_tracking_python
COMPONENT "holohub-apps"
DESTINATION bin/endoscopy_tool_tracking/python
)

file(READ "${CMAKE_CURRENT_SOURCE_DIR}/endoscopy_tool_tracking.yaml" APP_YAML_FILE)
string(REPLACE "gxf_extensions/lstm_tensor_rt_inference/" "" APP_YAML_FILE "${APP_YAML_FILE}")
file(WRITE "${CMAKE_BINARY_DIR}/packaging/python/endoscopy_tool_tracking.yaml" "${APP_YAML_FILE}")

install(
FILES ${CMAKE_BINARY_DIR}/packaging/python/endoscopy_tool_tracking.yaml
DESTINATION endoscopy_tool_tracking_python
COMPONENT "holohub-apps"
FILES endoscopy_tool_tracking.yaml
DESTINATION bin/endoscopy_tool_tracking/python
)

install(
DIRECTORY ${CMAKE_BINARY_DIR}/gxf_extensions/lstm_tensor_rt_inference/
DESTINATION endoscopy_tool_tracking_python
FILES_MATCHING PATTERN "*.so"
PATTERN "CMakeFiles" EXCLUDE
)

install(
FILES
${CMAKE_BINARY_DIR}/operators/lstm_tensor_rt_inference/liblstm_tensor_rt_inference.so
${CMAKE_BINARY_DIR}/operators/tool_tracking_postprocessor/libtool_tracking_postprocessor.so
DESTINATION endoscopy_tool_tracking_python
COMPONENT "holohub-apps"
)

install(
DIRECTORY ${CMAKE_BINARY_DIR}/python/lib/holohub
DESTINATION endoscopy_tool_tracking_python)
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ resources:
gpuMemory: 1Gi

extensions:
- gxf_extensions/lstm_tensor_rt_inference/libgxf_lstm_tensor_rt_inference.so
- gxf_extensions/yuan_qcap/libgxf_qcap_source.so
- lib/gxf_extensions/libgxf_lstm_tensor_rt_inference.so
- lib/gxf_extensions/libgxf_qcap_source.so

visualizer: "holoviz" # "holoviz" or "vtk"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extensions:
- libgxf_cuda.so
- libgxf_multimedia.so
- libgxf_serialization.so
- gxf_extensions/lstm_tensor_rt_inference/libgxf_lstm_tensor_rt_inference.so
- lib/gxf_extensions/libgxf_lstm_tensor_rt_inference.so

replayer:
basename: "surgical_video"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
---
extensions:
- gxf_extensions/lstm_tensor_rt_inference/libgxf_lstm_tensor_rt_inference.so
- lib/gxf_extensions/libgxf_lstm_tensor_rt_inference.so


replayer:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extensions:
- libgxf_videodecoderio.so
- libgxf_videoencoder.so
- libgxf_videoencoderio.so
- ../../../../gxf_extensions/lstm_tensor_rt_inference/libgxf_lstm_tensor_rt_inference.so
- ../../../../lib/gxf_extensions/libgxf_lstm_tensor_rt_inference.so

record_output: true # Setting this to `false` disables H264 encoding of output and recording it to the file.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
---
extensions:
- gxf_extensions/lstm_tensor_rt_inference/libgxf_lstm_tensor_rt_inference.so
- lib/gxf_extensions/libgxf_lstm_tensor_rt_inference.so

record_output: true # Setting this to `false` disables H264 encoding of output and recording it to the file.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
---
extensions:
- gxf_extensions/emergent_source/libgxf_emergent_source.so
- lib/gxf_extensions/libgxf_emergent_source.so

# Modify the width/height and framerate for the camera used
# Current is for Emergent HB-5000-SB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
---
extensions:
- gxf_extensions/emergent_source/libgxf_emergent_source.so
- lib/gxf_extensions/libgxf_emergent_source.so

emergent:
width: 4200
Expand Down
17 changes: 6 additions & 11 deletions applications/object_detection_torch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,11 @@ if(BUILD_TESTING)
)
endif()

# Install application and dependencies into the install/ directory for packaging
install(
TARGETS object_detection_torch
DESTINATION object_detection_torch
COMPONENT "holohub-apps"
# Install application
install(TARGETS object_detection_torch
DESTINATION bin/object_detection_torch
)

install(
FILES
"${object_detection_torch_BINARY_DIR}/object_detection_torch.yaml"
DESTINATION object_detection_torch
COMPONENT "holohub-apps"
)
install(FILES object_detection_torch.yaml
DESTINATION bin/object_detection_torch
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
---
extensions:
- gxf_extensions/deltacast_videomaster/libgxf_videomaster.so
- lib/gxf_extensions/libgxf_videomaster.so

source: "replayer" # Valid values "replayer", "aja" or "videomaster"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
---
extensions:
- gxf_extensions/deltacast_videomaster/libgxf_videomaster.so
- lib/gxf_extensions/libgxf_videomaster.so

source: "replayer" # Valid values "replayer", "aja" or "videomaster"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
---
extensions:
- gxf_extensions/deltacast_videomaster/libgxf_videomaster.so
- lib/gxf_extensions/libgxf_videomaster.so

source: "replayer" # Valid values "replayer", "aja" or "videomaster"

Expand Down
7 changes: 6 additions & 1 deletion dev_container
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ build_and_run() {
local extra_run_args=""
local run_app=1
local install=""
local configure_args=""

# Parse CLI arguments next
while [[ $# -gt 0 ]]; do
Expand Down Expand Up @@ -924,7 +925,7 @@ build_and_run() {
;;
--build_args)
if [[ -n "$2" ]]; then
extra_build_args="--configure-args '$2'"
configure_args="${configure_args} '$2'"
shift 2
else
echo "Error: --build_args requires a value"
Expand Down Expand Up @@ -1011,6 +1012,10 @@ build_and_run() {
container_build_args+=" --docker_file ${docker_file}"
fi

if [[ -n "${configure_args}" ]]; then
extra_build_args+=" --configure-args ${configure_args}"
fi

if [[ -z "$image_name" ]]; then
if [[ -n "${docker_file}" ]] && [[ "${docker_file}" != "${SCRIPT_DIR}/Dockerfile" ]]; then
image_name="holohub:${app_name}"
Expand Down
3 changes: 3 additions & 0 deletions gxf_extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/gxf_extensions)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/gxf_extensions)

add_holohub_extension(deltacast_videomaster)
add_holohub_extension(emergent_source)
add_holohub_extension(lstm_tensor_rt_inference)
Expand Down
7 changes: 6 additions & 1 deletion gxf_extensions/lstm_tensor_rt_inference/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ project(gxf_lstm_tensor_rt_inference)
find_package(holoscan REQUIRED CONFIG
PATHS "/opt/nvidia/holoscan" "/workspace/holoscan-sdk/install")

# Create library
# Create library
add_library(gxf_lstm_tensor_rt_inference_lib SHARED
tensor_rt_inference.cpp
tensor_rt_inference.hpp
Expand All @@ -45,3 +45,8 @@ add_library(gxf_lstm_tensor_rt_inference SHARED
target_link_libraries(gxf_lstm_tensor_rt_inference
PUBLIC gxf_lstm_tensor_rt_inference_lib
)

install(TARGETS gxf_lstm_tensor_rt_inference_lib
gxf_lstm_tensor_rt_inference
DESTINATION lib/gxf_extensions
)
8 changes: 8 additions & 0 deletions operators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,11 @@ add_holohub_operator(XrTransformOp)
add_holohub_operator(yuan_qcap DEPENDS EXTENSIONS yuan_qcap)


# install
install(
DIRECTORY "${CMAKE_BINARY_DIR}/python/lib/holohub"
DESTINATION python/lib
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
PATTERN "__pycache__" EXCLUDE
)
4 changes: 4 additions & 0 deletions operators/lstm_tensor_rt_inference/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ target_include_directories(lstm_tensor_rt_inference INTERFACE ${CMAKE_CURRENT_SO
if(HOLOHUB_BUILD_PYTHON)
add_subdirectory(python)
endif()

# Installation
install(TARGETS lstm_tensor_rt_inference)

3 changes: 3 additions & 0 deletions operators/tool_tracking_postprocessor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ target_include_directories(tool_tracking_postprocessor INTERFACE ${CMAKE_CURRENT
if(HOLOHUB_BUILD_PYTHON)
add_subdirectory(python)
endif()

install(TARGETS tool_tracking_postprocessor)

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
---
extensions:
- gxf_extensions/lstm_tensor_rt_inference/libgxf_lstm_tensor_rt_inference.so
- lib/gxf_extensions/libgxf_lstm_tensor_rt_inference.so

aja:
width: 1920
Expand Down

0 comments on commit faeffd9

Please sign in to comment.