-
Notifications
You must be signed in to change notification settings - Fork 6
Third‐party Libraries
GENERATED BY COPILOT - REVIEW IS NEEDED.
This page lists the main third‑party dependencies used by the SDK library (sdk/) and explains which CMake options enable or disable them.
All references are based on:
- Top‑level
CMakeLists.txt sdk/CMakeLists.txt
These are linked into the aditof SDK library unconditionally (no CMake options).
Where: sdk/CMakeLists.txt
target_link_libraries(${PROJECT_NAME} PRIVATE json-c)
# json-c may need libbsd on Linux/Unix systems
if(UNIX AND NOT APPLE)
find_library(BSD_LIBRARY bsd)
if(BSD_LIBRARY)
target_link_libraries(${PROJECT_NAME} PRIVATE ${BSD_LIBRARY})
endif()
endif()
# Add json-c include directories (both source and build for generated headers)
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/third-party/json-c
${CMAKE_BINARY_DIR}/libaditof/dependencies/third-party/json-c
)-
Always used by the core SDK (
aditof). - On non‑macOS Unix,
libbsdis linked if found (see next subsection).
Where: sdk/CMakeLists.txt
target_link_libraries(${PROJECT_NAME} PRIVATE crc32)- CRC32 library built under
dependencies/. -
Always linked into
aditof.
Where: sdk/CMakeLists.txt
if(UNIX AND NOT APPLE)
find_library(BSD_LIBRARY bsd)
if(BSD_LIBRARY)
target_link_libraries(${PROJECT_NAME} PRIVATE ${BSD_LIBRARY})
endif()
endif()- Used only on UNIX (non‑macOS) if the
bsdlibrary is available. - No dedicated CMake option; purely platform‑driven.
Top‑level option:
option(WITH_GLOG_DEPENDENCY "Build with GLOG dependency to be used for logging?" OFF)When WITH_GLOG_DEPENDENCY=ON:
Top level (CMakeLists.txt):
if(WITH_GLOG_DEPENDENCY)
add_definitions(-DUSE_GLOG)
if(WITH_SUBMODULES AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/glog/.git" )
# build glog from submodule
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/glog)
...
endif()
endif()SDK level (sdk/CMakeLists.txt):
if(WITH_GLOG_DEPENDENCY)
# Prevent macro name collisions between custom log.h and glog
add_definitions(-DGLOG_NO_ABBREVIATED_SEVERITIES)
if(NOT WITH_SUBMODULES AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../glog/.git")
find_package(glog 0.3.5 REQUIRED)
else()
target_link_libraries(${PROJECT_NAME} PUBLIC glog)
endif()
endif()Summary:
- Controlled by:
WITH_GLOG_DEPENDENCY(default OFF). - If
ON:-
-DUSE_GLOGand-DGLOG_NO_ABBREVIATED_SEVERITIESare defined. - glog is either:
- Built from the
glogsubmodule (WITH_SUBMODULES=ON), or - Found on the system with
find_package(glog 0.3.5 REQUIRED).
- Built from the
-
These dependencies are only used when the network interface is enabled.
Top‑level options:
option(WITH_NETWORK "Build network interface?" ON)
option(WITH_PROTOBUF_DEPENDENCY "Build with PROTOBUF dependency?" ON)Top‑level behavior:
if(NOT WITH_PROTOBUF_DEPENDENCY)
if(NOT ON_TARGET)
message(FATAL_ERROR "SDK can be built without protobuf only on target builds!")
endif()
else()
add_definitions(-DUSE_PROTOBUF)
if(WITH_NETWORK AND WITH_SUBMODULES AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/protobuf/.git" )
# build protobuf from submodule
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/protobuf/cmake)
endif()
endif()SDK‑level behavior:
if(WITH_NETWORK AND WITH_PROTOBUF_DEPENDENCY)
if(NOT WITH_SUBMODULES AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../protobuf/.git")
find_package(Protobuf 3.9.0 REQUIRED)
else()
target_link_libraries(${PROJECT_NAME} PUBLIC libprotobuf)
endif()
target_sources(${PROJECT_NAME} PRIVATE ${PROTO_HDRS} ${PROTO_SRCS})
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
# Network buffer.proto -> buffer.pb.h / buffer.pb.cc
set(NET_PROTO_HRDS "${CMAKE_CURRENT_SOURCE_DIR}/buffer.pb.h")
set(NET_PROTO_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/buffer.pb.cc")
add_custom_command(OUTPUT ${NET_PROTO_HRDS} ${NET_PROTO_SRCS}
COMMAND protoc buffer.proto
-I ${CMAKE_CURRENT_SOURCE_DIR}/src/connections/network
--cpp_out=.
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
target_sources(${PROJECT_NAME} PRIVATE ${NET_PROTO_HRDS} ${NET_PROTO_SRCS})
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
endif()Summary:
- Used when:
-
WITH_NETWORK=ONandWITH_PROTOBUF_DEPENDENCY=ON(default).
-
- Provides:
-
-DUSE_PROTOBUFdefinition. -
libprotobuffrom:- The
protobufsubmodule (WITH_SUBMODULES=ON), or - A system install via
find_package(Protobuf 3.9.0 REQUIRED).
- The
-
Top‑level configuration for libzmq submodule:
if(WITH_SUBMODULES AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libzmq/.git")
set(BUILD_SHARED OFF CACHE BOOL "Disable shared libs")
set(BUILD_STATIC ON CACHE BOOL "Build Static library")
set(BUILD_TESTS OFF CACHE BOOL "Disable building tests for libzmq")
set(POSITION_INDEPENDENT_CODE 1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libzmq)
unset(POSITION_INDEPENDENT_CODE)
endif()SDK‑level behavior inside the network block:
if ( WITH_NETWORK )
# Include cppzmq headers
set(CPPZMQ_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../cppzmq")
if(NOT WITH_SUBMODULES AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../libzmq/.git")
find_package(ZeroMQ REQUIRED)
else()
include_directories(${CPPZMQ_INSTALL_DIR})
target_link_libraries(${PROJECT_NAME} PUBLIC libzmq-static)
endif()
endif()Summary:
- Used when:
-
WITH_NETWORK=ONandWITH_PROTOBUF_DEPENDENCY=ON(since this is in the network + protobuf block).
-
- Behavior:
- If
WITH_SUBMODULES=ONandlibzmqsubmodule exists:-
libzmq-staticis built and linked. -
cppzmqheaders are included from../cppzmq.
-
- Otherwise:
- A system ZeroMQ install is required (
find_package(ZeroMQ REQUIRED)).
- A system ZeroMQ install is required (
- If
These provide depth processing functionality either via closed‑source or open‑source libraries.
Top‑level options:
option(USE_DEPTH_COMPUTE_OPENSOURCE "Use an open source implementation?" OFF)
option(NXP "Set to ON when building on NXP" OFF)
option(NVIDIA "Set to ON when building on NVIDIA" OFF)ON_TARGET is derived from NXP / NVIDIA:
set(ON_TARGET FALSE)
# if exactly one of NXP/NVIDIA is ON → ON_TARGET = TRUELIBTOFI path setup:
if(${ON_TARGET})
if(USE_DEPTH_COMPUTE_OPENSOURCE)
set(LIBTOFI_LIBDIR_PATH "${CMAKE_BINARY_DIR}/sdk/common/adi/depth-compute-opensource")
else()
if (NOT DEFINED LIBTOFI_LIBDIR_PATH)
set(LIBTOFI_LIBDIR_PATH "${CMAKE_SOURCE_DIR}/../libs")
endif()
endif()
endif()Where: sdk/CMakeLists.txt
set(LIBTOFI_COMPUTE_CLOSED_SOURCE_PATH "${LIBTOFI_LIBDIR_PATH}/libtofi_compute.so")
set(LIBTOFI_CONFIG_CLOSED_SOURCE_PATH "${LIBTOFI_LIBDIR_PATH}/libtofi_config.so")
if ( ON_TARGET AND UNIX )
if (NOT USE_DEPTH_COMPUTE_OPENSOURCE)
add_library(libtofi_compute SHARED IMPORTED)
set_target_properties(libtofi_compute PROPERTIES
IMPORTED_LOCATION "${LIBTOFI_COMPUTE_CLOSED_SOURCE_PATH}"
IMPORTED_NO_SONAME 1
)
add_library(libtofi_config SHARED IMPORTED)
set_target_properties(libtofi_config PROPERTIES
IMPORTED_LOCATION "${LIBTOFI_CONFIG_CLOSED_SOURCE_PATH}"
IMPORTED_NO_SONAME 1
)
target_link_libraries(${PROJECT_NAME} PRIVATE libtofi_compute)
target_link_libraries(${PROJECT_NAME} PRIVATE libtofi_config)
else()
target_link_libraries(${PROJECT_NAME} PRIVATE tofi_compute)
target_link_libraries(${PROJECT_NAME} PRIVATE tofi_config)
endif()
endif()Open‑source depth compute build:
if(USE_DEPTH_COMPUTE_OPENSOURCE AND ON_TARGET)
add_subdirectory(common/adi/depth-compute-opensource)
endif()Summary:
- Used only when building on target (
ON_TARGET=TRUE, i.e. NXP or NVIDIA). - If
USE_DEPTH_COMPUTE_OPENSOURCE=OFF(default on target):- SDK links imported shared libraries:
libtofi_compute.solibtofi_config.so
- These are expected under
LIBTOFI_LIBDIR_PATH.
- SDK links imported shared libraries:
- If
USE_DEPTH_COMPUTE_OPENSOURCE=ON:- SDK builds and links open‑source
tofi_computeandtofi_configfromsdk/common/adi/depth-compute-opensource.
- SDK builds and links open‑source
This is only relevant if Python bindings are enabled.
Top‑level option:
option(WITH_PYTHON "Build python bindings?" ON)Bindings CMake: bindings/python/CMakeLists.txt
add_subdirectory(pybind11)
pybind11_add_module(aditofpython aditofpython.cpp)
target_link_libraries(aditofpython PRIVATE aditof)Summary:
- When
WITH_PYTHON=ON(default), theaditofpythonmodule is built usingpybind11included as a subdirectory underbindings/python/pybind11. - This is separate from the C++ SDK library but part of the overall project.
| CMake option | Default | Affects | Dependencies / Notes |
|---|---|---|---|
WITH_GLOG_DEPENDENCY |
OFF | SDK logging | Enables glog (USE_GLOG), built from submodule or system glog. |
WITH_NETWORK |
ON | Network interface | Enables network code and, together with protobuf, ZeroMQ/Protobuf stack. |
WITH_PROTOBUF_DEPENDENCY |
ON | Network interface | Controls use of Protobuf + ZeroMQ. Adds USE_PROTOBUF when ON. |
WITH_SUBMODULES |
ON | glog, libzmq, protobuf | When ON and submodules exist, uses in‑tree builds instead of system libs. |
USE_DEPTH_COMPUTE_OPENSOURCE |
OFF | Depth compute (ON_TARGET) | Switch between closed‑source libtofi_* and open‑source tofi_*. |
WITH_PYTHON |
ON | Python bindings | Builds aditofpython using embedded pybind11. |
Always used by SDK:
json-ccrc32- Optionally
libbsdon Unix (non‑macOS).
This page should give you a clear view of which external libraries are used and which CMake options control them, in a format suitable for the GitHub Wiki.