Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into hotfix/deploy-…
Browse files Browse the repository at this point in the history
…package
  • Loading branch information
ClayJay3 committed Sep 23, 2024
2 parents 0e8055f + 28022f7 commit 90c24d9
Show file tree
Hide file tree
Showing 15 changed files with 246 additions and 797 deletions.
10 changes: 2 additions & 8 deletions .devcontainer/Dockerfile_Jammy
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
yasm libatlas-base-dev gfortran libpq-dev libavutil-dev libpostproc-dev \
libxine2-dev libglew-dev libtiff5-dev zlib1g-dev cowsay locales \
libeigen3-dev python3-dev python3-pip python3-numpy libx11-dev \
libboost-all-dev valgrind doxygen graphviz htop nano fortune fortunes
libboost-all-dev valgrind doxygen graphviz htop nano fortune fortunes mingw-w64

# Install Required Python Packages
RUN python3 -m pip install numpy opencv-python pyopengl
Expand All @@ -59,12 +59,6 @@ RUN if [ "${CMAKE_VERSION}" != "none" ]; then \
# Set Working Directory
WORKDIR /opt

# Install Quill
ARG QUILL_VERSION="7.0.0-pre"
RUN wget -q https://github.com/MissouriMRDT/Autonomy_Packages/raw/main/quill/amd64/quill_${QUILL_VERSION}_amd64.deb && \
dpkg -i quill_${QUILL_VERSION}_amd64.deb && \
rm quill_${QUILL_VERSION}_amd64.deb

# Install Google Test
ARG GTEST_VERSION="1.15.2"
RUN wget -q https://github.com/MissouriMRDT/Autonomy_Packages/raw/main/gtest/amd64/gtest_${GTEST_VERSION}_amd64.deb && \
Expand Down Expand Up @@ -92,4 +86,4 @@ LABEL maintainer="Mars Rover Design Team <[email protected]>"
LABEL org.opencontainers.image.source=https://github.com/missourimrdt/rovecomm_cpp
LABEL org.opencontainers.image.licenses=GPL-3.0-onlyLABEL
LABEL org.opencontainers.image.version="v24.5.0"
LABEL org.opencontainers.image.description="Docker Image for Ubuntu ${UBUNTU_MAJOR}.${UBUNTU_MINOR} with CUDA ${CUDA_MAJOR}.${CUDA_MINOR}, Quill v${QUILL_VERSION}, and Google Test v${GTEST_VERSION}."
LABEL org.opencontainers.image.description="Docker Image for Ubuntu ${UBUNTU_MAJOR}.${UBUNTU_MINOR} with CUDA ${CUDA_MAJOR}.${CUDA_MINOR}, Google Test v${GTEST_VERSION}."
10 changes: 2 additions & 8 deletions .devcontainer/Dockerfile_JetPack
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
libjpeg8-dev libjpeg-turbo8-dev liblapack-dev liblapacke-dev libopenblas-dev libpng-dev \
libpostproc-dev libswscale-dev libtbb-dev libtbb2 libtesseract-dev libtiff-dev libv4l-dev \
libxine2-dev libxvidcore-dev libx264-dev libgtkglext1 libgtkglext1-dev pkg-config qv4l2 \
v4l-utils zlib1g-dev python3-dev python3-numpy libboost-all-dev valgrind doxygen graphviz nano
v4l-utils zlib1g-dev python3-dev python3-numpy libboost-all-dev valgrind doxygen graphviz nano mingw-w64

#This symbolic link is needed to use the streaming features on Jetson inside a container
RUN ln -sf /usr/lib/aarch64-linux-gnu/tegra/libv4l2.so.0 /usr/lib/aarch64-linux-gnu/libv4l2.so
Expand All @@ -55,12 +55,6 @@ RUN if [ "${CMAKE_VERSION}" != "none" ]; then \
# Set Working Directory
WORKDIR /opt

# Install Quill
ARG QUILL_VERSION="7.0.0-pre"
RUN wget -q https://github.com/MissouriMRDT/Autonomy_Packages/raw/main/quill/arm64/quill_${QUILL_VERSION}_arm64.deb && \
dpkg -i quill_${QUILL_VERSION}_arm64.deb && \
rm quill_${QUILL_VERSION}_arm64.deb

# Install Google Test
ARG GTEST_VERSION="1.15.2"
RUN wget -q https://github.com/MissouriMRDT/Autonomy_Packages/raw/main/gtest/arm64/gtest_${GTEST_VERSION}_arm64.deb && \
Expand All @@ -82,4 +76,4 @@ LABEL maintainer="Mars Rover Design Team <[email protected]>"
LABEL org.opencontainers.image.source=https://github.com/missourimrdt/rovecomm_cpp
LABEL org.opencontainers.image.licenses=GPL-3.0-only
LABEL org.opencontainers.image.version="v24.2.5"
LABEL org.opencontainers.image.description="Docker Image for ${L4T_BASE} ${L4T_MAJOR}.${L4T_MINOR}.${L4T_PATCH}, Quill v${QUILL_VERSION}, and Google Test v${GTEST_VERSION}."
LABEL org.opencontainers.image.description="Docker Image for ${L4T_BASE} ${L4T_MAJOR}.${L4T_MINOR}.${L4T_PATCH}, and Google Test v${GTEST_VERSION}."
4 changes: 1 addition & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// "image": "ghcr.io/missourimrdt/rovecomm-jetpack:latest",
// "build": {
// "dockerfile": "Dockerfile_Jammy"
// "dockerfile": "Dockerfile_JetPack"
// // "dockerfile": "Dockerfile_JetPack"
// },
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
Expand Down Expand Up @@ -62,8 +62,6 @@
"C_Cpp.default.compilerPath": "/usr/bin/g++",
"C_Cpp.default.cppStandard": "c++20",
"C_Cpp.default.includePath": [
"/usr/local/include/quill/",
"/usr/local/include/quill/**",
"/usr/local/include/gmock/",
"/usr/local/include/gmock/**",
"/usr/local/include/gtest/",
Expand Down
29 changes: 23 additions & 6 deletions .github/workflows/deploy_rovecomm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,14 @@ jobs:
- name: Install Project Dependencies
run: |
sudo apt update && sudo apt install -y libeigen3-dev zip
wget -q https://github.com/MissouriMRDT/Autonomy_Packages/raw/main/quill/amd64/quill_${QUILL_VERSION}_amd64.deb
sudo dpkg -i quill_${QUILL_VERSION}_amd64.deb
rm quill_${QUILL_VERSION}_amd64.deb
sudo apt update && sudo apt install -y libeigen3-dev zip mingw-w64
wget -q https://github.com/MissouriMRDT/Autonomy_Packages/raw/main/gtest/amd64/gtest_${GTEST_VERSION}_amd64.deb
sudo dpkg -i gtest_${GTEST_VERSION}_amd64.deb
rm gtest_${GTEST_VERSION}_amd64.deb
env:
QUILL_VERSION: "7.0.0-pre"
GTEST_VERSION: "1.15.2"

- name: Build and Create Executable
- name: Build and Create Unix Executable
run: |
cd /opt/RoveComm_CPP/
if [ -d "build" ]; then rm -Rf build; fi
Expand All @@ -77,13 +73,34 @@ jobs:
zip -r RoveComm_CPP_AMD64.zip include/* external/* lib/*
cp RoveComm_CPP_AMD64.zip /opt/RoveComm_CPP/build/
- name: Build and Create Windows Executable
run: |
cd /opt/RoveComm_CPP/
if [ -d "build" ]; then rm -Rf build; fi
mkdir build
cd build
cmake -DBUILD_WIN=ON ..
make
make package
- name: Rename Executable and Create ZIP
run: |
mv /opt/RoveComm_CPP/build/RoveComm_CPP**.sh /opt/RoveComm_CPP/build/RoveComm_CPP_AMD64.sh
tar xzf /opt/RoveComm_CPP/build/RoveComm_CPP**.tar.gz -C /opt/RoveComm_CPP/build/
mkdir -p /opt/RoveComm_CPP/build/RoveComm_CPP
mv /opt/RoveComm_CPP/build/RoveComm_CPP**/* /opt/RoveComm_CPP/build/RoveComm_CPP/
cd /opt/RoveComm_CPP/build/RoveComm_CPP/
zip -r RoveComm_CPP_WIN64.zip include/* external/* lib/*
cp RoveComm_CPP_WIN64.zip /opt/RoveComm_CPP/build/
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: RoveComm-Packages
path: |
/opt/RoveComm_CPP/build/RoveComm_CPP_AMD64_Installer.sh
/opt/RoveComm_CPP/build/RoveComm_CPP_AMD64.zip
/opt/RoveComm_CPP/build/RoveComm_CPP_WIN64.zip
create-release:
runs-on: ubuntu-latest
Expand Down
140 changes: 118 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ if(NOT CTest_CMake_INCLUDED)
include(CTest)
endif()

# Check if the project is standalone or within another project.
if(NOT DEFINED __ROVECOMM_LIBRARY_MODE__)
if(PROJECT_IS_TOP_LEVEL)
set(__ROVECOMM_LIBRARY_MODE__ 0)
Expand All @@ -32,30 +33,106 @@ if(NOT DEFINED __ROVECOMM_LIBRARY_MODE__)
endif()
endif()

message("RoveComm Build Mode: ${__ROVECOMM_LIBRARY_MODE__}")
# Check if we are on Windows or Linux or for windows mode if cross-compiling.
option(BUILD_WIN "Windows Cross-Compile Mode" OFF)
if(NOT DEFINED __ROVECOMM_WINDOWS_MODE__)
if(WIN32 OR BUILD_WIN)
set(__ROVECOMM_WINDOWS_MODE__ 1)
include(ExternalProject)
else()
set(__ROVECOMM_WINDOWS_MODE__ 0)
endif()
endif()

message("-- RoveComm Build Mode: ${__ROVECOMM_LIBRARY_MODE__}")
add_definitions(-D__ROVECOMM_LIBRARY_MODE__=${__ROVECOMM_LIBRARY_MODE__})
message("-- RoveComm Windows Mode: ${__ROVECOMM_WINDOWS_MODE__}")
add_definitions(-D__ROVECOMM_WINDOWS_MODE__=${__ROVECOMM_WINDOWS_MODE__})

## Detect if we are cross-compiling or should compile for windows.
if(__ROVECOMM_WINDOWS_MODE__)
message("-- RoveComm_CPP -- Cross-compiling for Windows on Linux")

## Set the cross-compilation toolchain
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc-posix)
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++-posix)
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)

## Set necessary paths for MinGW
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

## Check if we are using this as a library or just testing within the repo scope
if(PROJECT_IS_TOP_LEVEL)
message("-- RoveComm_CPP -- STAND ALONE MODE")

## Force CMAKE to build a completely static binary.
set(CMAKE_EXE_LINKER_FLAGS "-static")

## Find Eigen3.
find_package(Eigen3 3.3 REQUIRED NO_MODULE)

## ExternalProject configuration for pulling and building GTest
ExternalProject_Add(GTest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.15.2 # Specify the GTest version tag or commit
PREFIX ${CMAKE_BINARY_DIR}/gtest
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/gtest_install
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc-posix
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++-posix
-DCMAKE_SYSTEM_NAME=Windows
)

## Create an imported target for GTest
add_library(GTest::gtest IMPORTED INTERFACE)
add_library(GTest::gtest_main IMPORTED INTERFACE)

## Specify where to find GTest once they're built
ExternalProject_Get_Property(GTest install_dir)
set(GTEST_INCLUDE_DIR ${install_dir}_install/include)
set(GTEST_LIB_DIR ${install_dir}_install/lib)

## Must create empty install dirs.
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/gtest_install/include)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/gtest_install/lib)

## Set the imported target properties for GTest
set_target_properties(GTest::gtest PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${GTEST_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${GTEST_LIB_DIR}/libgtest.a
)
set_target_properties(GTest::gtest_main PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${GTEST_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${GTEST_LIB_DIR}/libgtest_main.a
)

## Enable to CTest and Google Test Frameworks
enable_testing()
else()
message("-- RoveComm_CPP -- LIBRARY MODE")
endif()
else()
message(STATUS "RoveComm_CPP -- Configuring for native platform: ${CMAKE_SYSTEM_NAME}")
## Check if we are using this as a library or just testing within the repo scope
if(PROJECT_IS_TOP_LEVEL)
message("-- RoveComm_CPP -- STAND ALONE MODE")

## Check if we are using this as a library or just testing within the repo scope
if(PROJECT_IS_TOP_LEVEL)
message("RoveComm_CPP -- STAND ALONE MODE")

## Find Quill
find_package(quill REQUIRED)

## Find Google Test
find_package(GTest CONFIG REQUIRED)
include(GoogleTest)
add_library(GTest::GTest INTERFACE IMPORTED)
target_link_libraries(GTest::GTest INTERFACE gtest_main)
## Find Google Test
find_package(GTest CONFIG REQUIRED)
include(GoogleTest)
add_library(GTest::GTest INTERFACE IMPORTED)
target_link_libraries(GTest::GTest INTERFACE gtest_main)

## Find Eigen3.
find_package(Eigen3 3.3 REQUIRED NO_MODULE)
## Find Eigen3.
find_package(Eigen3 3.3 REQUIRED NO_MODULE)

## Enable to CTest and Google Test Frameworks
enable_testing()
else()
message("RoveComm_CPP -- LIBRARY MODE")
## Enable to CTest and Google Test Frameworks
enable_testing()
else()
message("-- RoveComm_CPP -- LIBRARY MODE")
endif()
endif()

## Set ThreadPool Variables
Expand Down Expand Up @@ -133,7 +210,14 @@ if(PROJECT_IS_TOP_LEVEL)
endif()

## Attach libraries to Executable
target_link_libraries(${PROJECT_NAME}_App PRIVATE quill::quill RoveComm_CPP)
if (__ROVECOMM_WINDOWS_MODE__)
message("-- RoveComm_CPP -- USING WINDOWS SOCKETS")
# Set link libraries.
target_link_libraries(${PROJECT_NAME}_App PRIVATE RoveComm_CPP ws2_32)
else()
message("-- RoveComm_CPP -- USING UNIX SOCKETS")
target_link_libraries(${PROJECT_NAME}_App PRIVATE RoveComm_CPP)
endif()

## Find all test source files
file(GLOB UnitTests_SRC CONFIGURE_DEPENDS "tests/Unit/**/*.cc")
Expand All @@ -146,14 +230,26 @@ if(PROJECT_IS_TOP_LEVEL)
## Create Unit Tests if found
if (UnitTests_LEN GREATER 0)
add_executable(${PROJECT_NAME}_UnitTests "tests/Unit/main.cc" "tests/TestUtils.cc" ${UnitTests_SRC})
target_link_libraries(${PROJECT_NAME}_UnitTests GTest::gtest GTest::gtest_main RoveComm_CPP)
if (__ROVECOMM_WINDOWS_MODE__)
## Ensure GTest are built before project
add_dependencies(${PROJECT_NAME}_UnitTests GTest)
target_link_libraries(${PROJECT_NAME}_UnitTests RoveComm_CPP ws2_32 GTest::gtest GTest::gtest_main)
else()
target_link_libraries(${PROJECT_NAME}_UnitTests GTest::gtest GTest::gtest_main RoveComm_CPP)
endif()
add_test(Unit_Tests ${PROJECT_NAME}_UnitTests)
endif()

## Create Integration Tests if found
if (IntegrationTests_LEN GREATER 0)
add_executable(${PROJECT_NAME}_IntegrationTests "tests/Unit/main.cc" "tests/TestUtils.cc" ${IntegrationTests_SRC})
target_link_libraries(${PROJECT_NAME}_IntegrationTests GTest::gtest GTest::gtest_main RoveComm_CPP)
if (__ROVECOMM_WINDOWS_MODE__)
## Ensure GTest are built before project
add_dependencies(${PROJECT_NAME}_IntegrationTests GTest)
target_link_libraries(${PROJECT_NAME}_IntegrationTests RoveComm_CPP ws2_32 GTest::gtest GTest::gtest_main)
else()
target_link_libraries(${PROJECT_NAME}_IntegrationTests GTest::gtest GTest::gtest_main RoveComm_CPP)
endif()
add_test(Integration_Tests ${PROJECT_NAME}_IntegrationTests)
endif()
endif()
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ Examples: `int g_nExampleGlobalInteger` or `int m_nExampleMemberInteger`
#### External Types
- Boost:
- Asio > `asio` > Example: `asio::io_context io_context`
- Quill > `q` > Example: `quill::Config qConfig`

### Macro Names
Macros should be in all caps using underscores to seperate words. They should be detailed enough to not require an additional comment.
Expand Down
3 changes: 0 additions & 3 deletions src/RoveComm/RoveCommGlobals.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
#include "./RoveCommPacket.h"

// \cond
#include <arpa/inet.h>
#include <csignal>
#include <cstring>
#include <functional>
#include <iostream>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
#include <vector>

Expand Down
17 changes: 16 additions & 1 deletion src/RoveComm/RoveCommPacket.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,24 @@
/// \cond
#include <cstdint>
#include <cstring>
#include <netinet/in.h>
#include <vector>

#if defined(__ROVECOMM_WINDOWS_MODE__) && __ROVECOMM_WINDOWS_MODE__ == 1
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#elif _WIN32_WINNT < 0x0600
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#endif
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <arpa/inet.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <unistd.h>
#endif

/// \endcond

// These are used to convert 64-bit doubles to network bit order and back.
Expand Down
Loading

0 comments on commit 90c24d9

Please sign in to comment.