-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
159 lines (132 loc) · 6.79 KB
/
CMakeLists.txt
File metadata and controls
159 lines (132 loc) · 6.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20...3.25)
# Workaround for older CMake policy compatibility in dependencies
set(CMAKE_POLICY_VERSION_MINIMUM 3.5 CACHE STRING "Minimum CMake policy version")
include(cmake/IsaacTeleopVersion.cmake)
isaac_teleop_read_version("${CMAKE_CURRENT_SOURCE_DIR}/VERSION" ISAAC_TELEOP_VERSION ISAAC_TELEOP_PYPROJECT_VERSION)
# ==============================================================================
# Install Prefix Setup (must be before HunterGate)
# ==============================================================================
# Set default install prefix early, before HunterGate which may affect
# CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
if(NOT DEFINED CMAKE_INSTALL_PREFIX OR CMAKE_INSTALL_PREFIX STREQUAL "" OR CMAKE_INSTALL_PREFIX MATCHES "^/usr/local")
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/install" CACHE PATH "Install prefix" FORCE)
endif()
# OAK camera plugin uses Hunter/DepthAI; optional so builds like teleop_ros2 can skip it.
option(BUILD_PLUGIN_OAK_CAMERA "Build OAK camera plugin (uses Hunter/DepthAI)" OFF)
# ==============================================================================
# HunterGate Setup (must be before project())
# Defines BUILD_PLUGINS option and initializes Hunter for DepthAI dependencies
include(cmake/SetupHunter.cmake)
project(IsaacTeleop VERSION ${ISAAC_TELEOP_VERSION} LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# ==============================================================================
# Python Version Configuration (SINGLE SOURCE OF TRUTH)
# ==============================================================================
# All Python-related configurations should reference this variable.
# To change the Python version, only modify this line:
set(ISAAC_TELEOP_PYTHON_VERSION "3.11" CACHE STRING "Python version for Isaac Teleop")
message(STATUS "Configuring for Python ${ISAAC_TELEOP_PYTHON_VERSION}")
# ==============================================================================
# Configure Python via uv BEFORE any dependencies are added
# This ensures all subdirectories (including openxr-sdk) use the managed Python
include(cmake/SetupPython.cmake)
# Set default build type to Release if not specified
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()
# Note: CMAKE_INSTALL_PREFIX is set early (before HunterGate) to avoid issues
# with CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT being affected by Hunter's
# internal project() call.
# Options
# Note: BUILD_PLUGINS is defined in cmake/SetupHunter.cmake before project()
# Note: BUILD_PYTHON_BINDINGS is defined in cmake/SetupPython.cmake
option(BUILD_EXAMPLES "Build examples" ON)
option(BUILD_EXAMPLE_TELEOP_ROS2 "Build only the teleop_ros2 example (e.g. for Docker)" OFF)
option(BUILD_TESTING "Build unit tests" ON)
option(BUILD_VIZ "Build Televiz visualization module (requires Vulkan)" OFF)
option(ENABLE_EXPERIMENTAL_WINDOWS_BUILD "Enable experimental Windows build support (source code only)" OFF)
# Note: This is used to check if the CloudXR bundle is available to be bundled with Isaac Teleop.
# When enabled, build will fail if the CloudXR runtime SDK is not available.
# TODO: Make this default to ON for Linux builds when the CloudXR runtime SDK is publicly available.
option(ENABLE_CLOUDXR_BUNDLE_CHECK "Enable CloudXR bundle check" OFF)
## Enforce clang-format on Linux builds by default
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(_clang_default ON)
else()
set(_clang_default OFF)
endif()
option(ENABLE_CLANG_FORMAT_CHECK "Fail build if clang-format changes would be applied (Linux default ON)" ${_clang_default})
# Windows support warning
if(WIN32)
if(NOT ENABLE_EXPERIMENTAL_WINDOWS_BUILD)
message(FATAL_ERROR
"================================================================================\n"
"Windows is not officially supported!\n"
"If you want to build anyway for development/testing purposes, add:\n"
" -DENABLE_EXPERIMENTAL_WINDOWS_BUILD=ON\n"
"Use at your own risk!\n"
"================================================================================\n"
)
else()
# Create a function to print the warning cleanly
function(print_windows_warning)
message(STATUS "")
message(STATUS "================================================================================")
message(STATUS "⚠️ EXPERIMENTAL WINDOWS BUILD ENABLED - USE AT YOUR OWN RISK ⚠️")
message(STATUS "")
message(STATUS "You have enabled experimental Windows build support.")
message(STATUS "The source code will compile but there is NO guarantee of any functionality.")
message(STATUS "This is for development and testing purposes only!")
message(STATUS "================================================================================")
endfunction()
# Defer the warning to the end of configuration so it's highly visible
cmake_language(DEFER CALL print_windows_warning)
endif()
endif()
# Build dependencies (OpenXR SDK, etc.)
add_subdirectory(deps)
# Enable CTest at top level so tests from subdirectories are discoverable
if(BUILD_TESTING)
# Make sure to call this after `deps` is added so that Catch2 is available
enable_testing()
endif()
# Build interfaces (headers)
add_subdirectory(deps/cloudxr/openxr_extensions)
# Build core modules (OXR and DEVICEIO)
add_subdirectory(src/core)
# Build retargeters (pure Python, sibling of src/core)
add_subdirectory(src/retargeters)
# Build Televiz visualization module (sibling of src/core).
# src/viz/CMakeLists.txt orchestrates its own sub-modules and tests.
if(BUILD_VIZ)
add_subdirectory(src/viz)
endif()
# Build examples if requested
if(BUILD_EXAMPLES)
add_subdirectory(examples/oxr)
add_subdirectory(examples/retargeting)
add_subdirectory(examples/teleop_session_manager)
add_subdirectory(examples/teleop_ros2)
add_subdirectory(examples/schemaio)
add_subdirectory(examples/native_openxr)
elseif(BUILD_EXAMPLE_TELEOP_ROS2)
add_subdirectory(examples/teleop_ros2)
endif()
# Build plugins if requested
if(BUILD_PLUGINS)
# Build plugin utilities
add_subdirectory(src/plugins/plugin_utils)
add_subdirectory(src/plugins/controller_synthetic_hands)
add_subdirectory(src/plugins/generic_3axis_pedal)
add_subdirectory(src/plugins/manus)
if(BUILD_PLUGIN_OAK_CAMERA)
add_subdirectory(src/plugins/oak)
endif()
endif()
# Formatting enforcement (runs on Linux by default)
include(cmake/ClangFormat.cmake)