Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
52 changes: 23 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ option(NVIDIA "Set to ON when building on NVIDIA" ON)
if (WITH_NETWORK)
option(WITH_SUBMODULES "Use submodules to build the library" ON)
option(WITH_PROTOBUF_DEPENDENCY "Build with PROTOBUF dependency?" ON)
option(WITH_GLOG_DEPENDENCY "Build with GLOG dependency to be used for logging?" ON)
else()
option(WITH_SUBMODULES "Use submodules to build the library" OFF)
option(WITH_PROTOBUF_DEPENDENCY "Build with PROTOBUF dependency?" OFF)
option(WITH_GLOG_DEPENDENCY "Build with GLOG dependency to be used for logging?" OFF)
endif()
option(WITH_OFFLINE "Build offline interface?" ON)
option(WITH_COMMAND_LINE_TOOLS "Build with command line tools?" ON)
Expand All @@ -44,28 +42,28 @@ set(SOM_TYPE "Dual" CACHE STRING "Which SoM SDK is building for?")
################################## Git ########################################
include(FindGit OPTIONAL)
if (GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --show-toplevel
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE ADITOFSDK_GIT_REPO
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)

if ("${ADITOFSDK_GIT_REPO}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE ADITOFSDK_GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE TOFSDK_GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --show-toplevel
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE ADITOFSDK_GIT_REPO
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)

if ("${ADITOFSDK_GIT_REPO}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE ADITOFSDK_GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE TOFSDK_GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
if (WITH_SUBMODULES)
add_definitions(-DWITH_SUBMODULES)
message("Updating submodules")
Expand Down Expand Up @@ -139,10 +137,6 @@ if (WITH_OFFLINE)
add_definitions(-DHAS_OFFLINE)
endif()

if(WITH_GLOG_DEPENDENCY)
add_definitions(-DUSE_GLOG)
endif()

if(NOT WITH_PROTOBUF_DEPENDENCY)
if(NOT ON_TARGET)
message(FATAL_ERROR "SDK can be built without protobuf only on target builds!")
Expand All @@ -153,7 +147,7 @@ endif()

if(${ON_TARGET})
if(USE_DEPTH_COMPUTE_OPENSOURCE)
set(LIBTOFI_LIBDIR_PATH "${CMAKE_BINARY_DIR}/libaditof/sdk/common/adi/depth-compute-opensource")
set(LIBTOFI_LIBDIR_PATH "${CMAKE_BINARY_DIR}/libaditof/sdk/common/adi/depth-compute-opensource")
else()
if (NOT DEFINED LIBTOFI_LIBDIR_PATH)
set(LIBTOFI_LIBDIR_PATH "${CMAKE_SOURCE_DIR}/../libs")
Expand Down
18 changes: 4 additions & 14 deletions apps/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,8 @@ add_executable(${PROJECT_NAME} server.cpp ${PROTO_HDRS} ${PROTO_SRCS})

target_include_directories(${PROJECT_NAME} PRIVATE ${GENERATED_PROTO_FILES_DIR})

# Glog
if(WITH_GLOG_DEPENDENCY)
if(NOT WITH_SUBMODULES OR NOT EXISTS "${LIBADITOF_SUBMODULE_PATH}/glog/.git")
find_package(glog 0.3.5 REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC glog::glog)
else()
target_link_libraries(${PROJECT_NAME} PUBLIC glog)
endif()
endif()

# Protobuf
if(NOT WITH_SUBMODULES AND NOT EXISTS "${LIBADITOF_SUBMODULE_PATH}/protobuf/.git")
if(NOT WITH_SUBMODULES AND NOT EXISTS "${LIBADITOF_SUBMODULE_PATH}/dependencies/third-party/protobuf/.git")
find_package(Protobuf 3.9.0 REQUIRED)
else()
target_link_libraries(${PROJECT_NAME} PUBLIC libprotobuf)
Expand All @@ -35,11 +25,11 @@ set(NET_PROTO_HRDS "${CMAKE_BINARY_DIR}/buffer.pb.h")
target_link_libraries(${PROJECT_NAME} PRIVATE aditof)

# ZMQ
set(CPPZMQ_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../libaditof/cppzmq")
set(LIBZMQ_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../libaditof/libzmq/include")
set(CPPZMQ_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../libaditof/dependencies/third-party/cppzmq")
set(LIBZMQ_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../libaditof/dependencies/third-party/libzmq/include")

# Check if submodule exists, and build the library
if(NOT WITH_SUBMODULES AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../libaditof/libzmq/.git")
if(NOT WITH_SUBMODULES AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../libaditof/dependencies/third-party/libzmq/.git")
find_package(ZeroMQ REQUIRED)
include_directories(${ZeroMQ_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${ZeroMQ_LIBRARIES})
Expand Down
7 changes: 3 additions & 4 deletions ci/azure/inside_docker.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/bash

git config --global --add safe.directory /ToF/libaditof
git config --global --add safe.directory /ToF/libaditof/glog
git config --global --add safe.directory /ToF/libaditof/protobuf
git config --global --add safe.directory /ToF/libaditof/libzmq
git config --global --add safe.directory /ToF/libaditof/cppzmq
git config --global --add safe.directory /ToF/libaditof/dependencies/third-party/protobuf
git config --global --add safe.directory /ToF/libaditof/dependencies/third-party/libzmq
git config --global --add safe.directory /ToF/libaditof/dependencies/third-party/cppzmq
git config --global --add safe.directory /libaditof/dependencies/third-party/gtest

project_dir=$1
Expand Down
1 change: 0 additions & 1 deletion cmake/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ which will generate all the necessary recipes for building and installing. Usefu
| WITH_ROS2 | on/off | off | Build the ROS2 bindings. |
| WITH_NETWORK | on/off | off | Build the network interface for a Linux or Windows host build; use **off** for building on the target. |
| WITH_OFFLINE | on/off | off | Build the offline mode. No hardware is required. |
| WITH_GLOG_DEPENDENCY | on/off | on | Build the sdk with GLOG dependency. Used for logging. |
| WITH_COMMAND_LINE_TOOLS | on/off | on | Build the command line tools. |
| WITH_COMMAND_LINE_TOOLS | on/off | on | Build the command line tools. |
| CI_BUILD | on/off | off | Only used for continuous integrations builds. Can overwrite other cmake options. |
Expand Down
2 changes: 1 addition & 1 deletion scripts/windows/setup_project.bat
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ if not exist %build_dire% md %build_dire%

::build the project with the selected options
pushd %build_dire%
cmake -G %generator% -DNVIDIA=OFF -DNXP=OFF -DWITH_NETWORK=ON -DWITH_SUBMODULES=ON -DWITH_PROTOBUF_DEPENDENCY=ON -DWITH_GLOG_DEPENDENCY=ON %source_dir% -DCMAKE_BUILD_TYPE=%config_type%
cmake -G %generator% -DNVIDIA=OFF -DNXP=OFF -DWITH_NETWORK=ON -DWITH_SUBMODULES=ON -DWITH_PROTOBUF_DEPENDENCY=ON %source_dir% -DCMAKE_BUILD_TYPE=%config_type%
if %do_not_build%==0 (
cmake --build . --config %config_type% -j %threads%
)
Expand Down
Loading