Skip to content
Open
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
18 changes: 18 additions & 0 deletions deps/protobuf/protobuf.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
function(target_add_protobuf target_name)
include(FindProtobuf)

# Find the appropriate protobuf library for the current architecture
find_library(PROTOBUF_LIBRARY
NAMES protobuf
PATHS /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/aarch64-linux-gnu /usr/lib/arm-linux-gnueabihf
NO_DEFAULT_PATH
)

# Fallback to system default search
if(NOT PROTOBUF_LIBRARY)
find_library(PROTOBUF_LIBRARY NAMES protobuf)
endif()

if(NOT PROTOBUF_LIBRARY)
message(FATAL_ERROR "Could not find protobuf library")
endif()

set(Protobuf_LIBRARIES ${PROTOBUF_LIBRARY})
find_package(Protobuf REQUIRED)

target_include_directories(${target_name} PRIVATE ${PROTOBUF_INCLUDE_DIR})
Expand Down
56 changes: 9 additions & 47 deletions docker/Dockerfile.x86
Original file line number Diff line number Diff line change
Expand Up @@ -86,50 +86,12 @@ RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
ARG LIBTORCH_VERSION=2.1.0
ARG LIBTORCH_INSTALL_DIR=/libtorch-tmp
WORKDIR ${LIBTORCH_INSTALL_DIR}
RUN git clone -b main --recurse-submodule https://github.com/pytorch/pytorch.git
RUN mkdir pytorch-build
RUN cd pytorch-build
RUN USE_CUDA=0 \
USE_CUDNN=0 \
USE_NCCL=0 \
BUILD_TORCH=ON \
USE_MKLDNN=0 \
USE_ROCM=0 \
USE_KINETO=0 \
USE_NNPACK=1 \
BUILD_CAFFE2_OPS=0 \
BUILD_CAFFE2=0 \
cmake \
# don't need cuda, for now...
-DUSE_CUDA=0 \
# disable cudnn
-DUSE_CUDNN=0 \
# disable multigpu
-DUSE_NCCL=0 \
-DBUILD_TORCH=ON \
-DUSE_MKLDNN=0 \
-DUSE_ROCM=0 \
-DUSE_KINETO=0 \
-DUSE_NNPACK=1 \
-DBUILD_CAFFE2_OPS=0 \
-DBUILD_CAFFE2=0 \
-D_GLIBCXX_USE_CXX11_ABI=1 \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DPYTHON_EXECUTABLE:PATH=`which python3` \
-DCMAKE_PREFIX_PATH=../pytorch-install \
${LIBTORCH_INSTALL_DIR}/pytorch
RUN USE_CUDA=0 \
USE_CUDNN=0 \
USE_NCCL=0 \
BUILD_TORCH=ON \
USE_MKLDNN=0 \
USE_ROCM=0 \
USE_KINETO=0 \
USE_NNPACK=1 \
BUILD_CAFFE2_OPS=0 \
BUILD_CAFFE2=0 \
cmake --build . --target install
WORKDIR /tmp
RUN wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-${LIBTORCH_VERSION}%2Bcpu.zip \
&& unzip libtorch-cxx11-abi-shared-with-deps-${LIBTORCH_VERSION}+cpu.zip \
&& mv libtorch ${LIBTORCH_INSTALL_DIR} \
&& rm libtorch-cxx11-abi-shared-with-deps-${LIBTORCH_VERSION}+cpu.zip


ENV CMAKE_PREFIX_PATH="${LIBTORCH_INSTALL_DIR}/libtorch"

Expand All @@ -143,18 +105,18 @@ RUN wget "https://github.com/pytorch/vision/archive/refs/tags/v${TORCHVISION_VER
&& mkdir -p "${TORCHVISION_INSTALL_DIR}/vision-${TORCHVISION_VERSION}/build" \
&& cd "${TORCHVISION_INSTALL_DIR}/vision-${TORCHVISION_VERSION}/build" \
&& cmake -DWITH_CUDA=off -D_GLIBCXX_USE_CXX11_ABI=1 -DCMAKE_BUILD_TYPE=Release .. \
&& make -j2 \
&& make -j$(nproc) \
&& make install

# install MAVSDK from source
RUN git clone --depth 1 https://github.com/mavlink/MAVSDK.git --branch v2.9.1 --single-branch \
&& cd MAVSDK \
&& git submodule update --init --recursive \
&& cmake -DCMAKE_BUILD_TYPE=Release -Bbuild/default -H. \
&& cmake --build build/default -j2 --target install
&& cmake --build build/default -j$(nproc) --target install

RUN pip3 install gdown
ENV PATH="${PATH}:${HOME}/.local/bin"
ENV PATH="${PATH}:${HOME}/.local/binn"

# login as non-root user
USER $USERNAME
Expand Down