Skip to content

Commit 1213b8b

Browse files
author
Matevz Morato
committed
Refactor the options into sensible groups
1 parent 0d9ce06 commit 1213b8b

File tree

1 file changed

+57
-51
lines changed

1 file changed

+57
-51
lines changed

cmake/depthaiOptions.cmake

Lines changed: 57 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,46 @@
1+
# ==================================
2+
# DepthAI Build Options (organized)
3+
# ==================================
4+
5+
# ---------- Platform‑based defaults ----------
6+
7+
# Detect 32‑bit Linux for default CURL support
8+
if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND UNIX)
9+
set(DEPTHAI_DEFAULT_CURL_SUPPORT OFF)
10+
else()
11+
set(DEPTHAI_DEFAULT_CURL_SUPPORT ON)
12+
endif()
13+
14+
# ---------- Core Feature Toggles (private) -------------
115
option(DEPTHAI_ENABLE_LIBUSB "Enable usage of libusb and interaction with USB devices" ON)
216
option(DEPTHAI_ENABLE_APRIL_TAG "Enable AprilTag node (not available for Windows)" ON)
3-
option(DEPTHAI_RTABMAP_SUPPORT "Enable optional RTABMap support" OFF)
4-
option(DEPTHAI_BASALT_SUPPORT "Enable optional Basalt support" OFF)
517
option(DEPTHAI_ENABLE_PROTOBUF "Enable Protobuf support" ON)
6-
option(DEPTHAI_BUILD_PYTHON "Build python bindings" OFF)
7-
option(DEPTHAI_BUILD_TESTS "Build tests" OFF)
18+
option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT})
19+
option(DEPTHAI_ENABLE_KOMPUTE "Enable Kompute support" OFF)
20+
option(DEPTHAI_ENABLE_MP4V2 "Enable video recording using the MP4V2 library" ON)
21+
22+
# ---------- Optional Features (public) -------------
823
option(DEPTHAI_OPENCV_SUPPORT "Enable optional OpenCV support" ON)
9-
OPTION(DEPTHAI_ENABLE_KOMPUTE "Enable Kompute support" OFF)
24+
option(DEPTHAI_XTENSOR_SUPPORT "Enable optional xtensor support" ON)
1025
option(DEPTHAI_PCL_SUPPORT "Enable optional PCL support" OFF)
26+
27+
option(DEPTHAI_RTABMAP_SUPPORT "Enable optional RTABMap support" OFF)
28+
option(DEPTHAI_BASALT_SUPPORT "Enable optional Basalt support" OFF)
29+
30+
# Build Behaviour
1131
option(DEPTHAI_MERGED_TARGET "Enable merged target build" ON)
12-
option(DEPTHAI_NEW_FIND_PYTHON "Use new FindPython module" ON)
32+
option(DEPTHAI_BUILD_PYTHON "Build python bindings" OFF)
33+
option(DEPTHAI_BUILD_TESTS "Build tests" OFF)
34+
option(DEPTHAI_BUILD_EXAMPLES "Build examples - Requires OpenCV library to be installed" OFF)
35+
option(DEPTHAI_BUILD_DOCS "Build documentation - requires doxygen to be installed" OFF)
1336
option(DEPTHAI_BUILD_ZOO_HELPER "Build the Zoo helper" OFF)
14-
option(DEPTHAI_ENABLE_MP4V2 "Enable video recording using the MP4V2 library" ON)
15-
option(DEPTHAI_XTENSOR_SUPPORT "Enable optional xtensor support" ON)
37+
option(DEPTHAI_NEW_FIND_PYTHON "Use new FindPython module" ON)
38+
option(DEPTHAI_INSTALL "Enable install target for depthai-core targets" ON)
1639

17-
#VCPKG related options
40+
# ---------- Dependency Management -------------
1841
option(DEPTHAI_BOOTSTRAP_VCPKG "Automatically bootstrap VCPKG" ON)
19-
# DepthAI uses VCPKG internally, to fetch its private dependencies, but not for the public interface dependencies by default
20-
# (OpenCV, PCL, etc.)
21-
# This is to avoid conflicts with the system installed libraries when downstream libraries use DepthAI.
22-
option(DEPTHAI_VCPKG_INTERNAL_ONLY "Use VCPKG internally, but not for libraries on the interface" ON)
42+
option(DEPTHAI_VCPKG_INTERNAL_ONLY "Use VCPKG internally, but not for interface libraries" ON)
43+
2344
set(USE_EXTERNAL_INTERFACE_LIBS_DEFAULT ON)
2445
if(DEPTHAI_VCPKG_INTERNAL_ONLY)
2546
set(USE_EXTERNAL_INTERFACE_LIBS_DEFAULT OFF)
@@ -29,34 +50,29 @@ option(DEPTHAI_JSON_EXTERNAL "Use external nlohmann_json library" ${USE_EXTERNAL
2950
option(DEPTHAI_LIBNOP_EXTERNAL "Use external libnop library" ${USE_EXTERNAL_INTERFACE_LIBS_DEFAULT})
3051
option(DEPTHAI_XTENSOR_EXTERNAL "Use external xtensor library" ${USE_EXTERNAL_INTERFACE_LIBS_DEFAULT})
3152

32-
if(NOT DEPTHAI_OPENCV_SUPPORT)
33-
set(DEPTHAI_MERGED_TARGET OFF CACHE BOOL "Enable merged target build" FORCE)
34-
endif()
53+
# ---------- Platform / Compiler Tweaks ---------
3554

55+
# AprilTag node support
3656
set(DEPTHAI_HAS_APRIL_TAG ${DEPTHAI_ENABLE_APRIL_TAG})
3757
if(WIN32)
3858
message(STATUS "AprilTag node is not supported on Windows")
3959
set(DEPTHAI_HAS_APRIL_TAG OFF)
4060
endif()
4161

42-
# Enable backward stack printing on crash
62+
# Disable merged target when OpenCV is disabled
63+
if(NOT DEPTHAI_OPENCV_SUPPORT)
64+
set(DEPTHAI_MERGED_TARGET OFF CACHE BOOL "Enable merged target build" FORCE)
65+
endif()
66+
67+
# Backward stacktrace printing
4368
if(ANDROID OR EMSCRIPTEN)
4469
# Backward not supported currently on Android
4570
set(DEPTHAI_ENABLE_BACKWARD OFF CACHE BOOL "" FORCE)
4671
else()
4772
option(DEPTHAI_ENABLE_BACKWARD "Enable stacktrace printing on crash using Backward" ON)
4873
endif()
4974

50-
# Check if on 32 bit linux - default without CURL support
51-
if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND UNIX)
52-
set(DEPTHAI_DEFAULT_CURL_SUPPORT OFF)
53-
else()
54-
set(DEPTHAI_DEFAULT_CURL_SUPPORT ON)
55-
endif()
56-
57-
option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT})
58-
59-
75+
# ---------- Remote connection options
6076
if(DEPTHAI_ENABLE_PROTOBUF)
6177
option(DEPTHAI_ENABLE_REMOTE_CONNECTION "Enable Remote Connection support" ON)
6278
if(DEPTHAI_ENABLE_CURL AND DEPTHAI_HAVE_OPENCV_SUPPORT)
@@ -70,34 +86,24 @@ else()
7086
message(STATUS "Remote Connection support disabled because Protobuf support is disabled.")
7187
endif()
7288

73-
# Additional options
74-
option(DEPTHAI_CLANG_FORMAT "Enable clang-format target" ON)
75-
option(DEPTHAI_CLANG_TIDY "Enable clang-tidy checks during compilation" OFF)
76-
option(DEPTHAI_SANITIZE "Enable Address and Undefined sanitizers for library, examples and tests" OFF)
77-
78-
# Should install depthai core libraries
79-
option(DEPTHAI_INSTALL "Enable install target for depthai-core targets" ON)
80-
81-
82-
# Debug option
83-
set(DEPTHAI_XLINK_LOCAL "" CACHE STRING "Path to local XLink source to use instead of Hunter")
84-
set(DEPTHAI_BOOTLOADER_SHARED_LOCAL "" CACHE STRING "Path to local depthai-bootloader-shared source to use instead of submodule")
85-
86-
87-
# First specify options
88-
option(DEPTHAI_BUILD_EXAMPLES "Build examples - Requires OpenCV library to be installed" OFF)
89-
option(DEPTHAI_BUILD_DOCS "Build documentation - requires doxygen to be installed" OFF)
90-
91-
# Specify support for FW
92-
option(DEPTHAI_ENABLE_DEVICE_FW "Enable MyriadX Device FW" ON)
93-
option(DEPTHAI_ENABLE_DEVICE_BOOTLOADER_FW "Enable MyriadX Device Bootloader FW" ON)
94-
option(DEPTHAI_ENABLE_DEVICE_RVC3_FW "Enable RVC3 Device FW" OFF)
95-
option(DEPTHAI_ENABLE_DEVICE_RVC4_FW "Enable RVC4 Device FW" ON)
96-
9789
if(DEPTHAI_ENABLE_REMOTE_CONNECTION)
9890
option(DEPTHAI_EMBED_FRONTEND "Embed frontend resources into library" ON)
9991
else()
10092
option(DEPTHAI_EMBED_FRONTEND "Embed frontend resources into library" OFF)
10193
endif()
10294

95+
# ---------- Embedded firmware ---------------------------
96+
option(DEPTHAI_ENABLE_DEVICE_FW "Enable MyriadX Device FW" ON)
97+
option(DEPTHAI_ENABLE_DEVICE_BOOTLOADER_FW "Enable MyriadX Device Bootloader FW" ON)
98+
option(DEPTHAI_ENABLE_DEVICE_RVC3_FW "Enable RVC3 Device FW" OFF)
99+
option(DEPTHAI_ENABLE_DEVICE_RVC4_FW "Enable RVC4 Device FW" ON)
103100
option(DEPTHAI_BINARIES_RESOURCE_COMPILE "Compile Depthai device side binaries into library" ON)
101+
102+
# ---------- Development Aids -------------------
103+
option(DEPTHAI_CLANG_FORMAT "Enable clang-format target" ON)
104+
option(DEPTHAI_CLANG_TIDY "Enable clang-tidy checks during compilation" OFF)
105+
option(DEPTHAI_SANITIZE "Enable Address and Undefined sanitizers for library, examples and tests" OFF)
106+
107+
# Local override paths
108+
set(DEPTHAI_XLINK_LOCAL "" CACHE STRING "Path to local XLink source to use instead of Hunter")
109+
set(DEPTHAI_BOOTLOADER_SHARED_LOCAL "" CACHE STRING "Path to local depthai-bootloader-shared source to use instead of submodule")

0 commit comments

Comments
 (0)