Skip to content

Commit

Permalink
Install hindsightcan with fetchcontent
Browse files Browse the repository at this point in the history
  • Loading branch information
abhaybd committed Aug 29, 2023
1 parent 03e0786 commit 9b38ba0
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/CAN/CAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <sys/types.h>

extern "C" {
#include "../HindsightCAN/CANCommon.h"
#include <HindsightCAN/CANCommon.h>
}

using robot::types::DataPoint;
Expand Down
6 changes: 3 additions & 3 deletions src/CAN/CANMotor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include <thread>

extern "C" {
#include "../HindsightCAN/CANCommon.h"
#include "../HindsightCAN/CANMotorUnit.h"
#include "../HindsightCAN/CANPacket.h"
#include <HindsightCAN/CANCommon.h>
#include <HindsightCAN/CANMotorUnit.h>
#include <HindsightCAN/CANPacket.h>
}

using namespace std::chrono_literals;
Expand Down
6 changes: 3 additions & 3 deletions src/CAN/CANMotor_AVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include <thread>

extern "C" {
#include "../HindsightCAN/CANCommon.h"
#include "../HindsightCAN/CANMotorUnit.h"
#include "../HindsightCAN/CANPacket.h"
#include <HindsightCAN/CANCommon.h>
#include <HindsightCAN/CANMotorUnit.h>
#include <HindsightCAN/CANPacket.h>
}

using namespace std::chrono_literals;
Expand Down
2 changes: 1 addition & 1 deletion src/CAN/CANUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <sstream>

extern "C" {
#include "../HindsightCAN/CANPacket.h"
#include <HindsightCAN/CANPacket.h>
}

namespace can {
Expand Down
2 changes: 1 addition & 1 deletion src/CAN/FakeCANBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <vector>

extern "C" {
#include "../HindsightCAN/CANScience.h"
#include <HindsightCAN/CANScience.h>
}

using namespace std::chrono_literals;
Expand Down
4 changes: 2 additions & 2 deletions src/CAN/TestIMU.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "../log.h"
#include "CAN.h"
extern "C" {
#include "../HindsightCAN/CANCommon.h"
#include "../HindsightCAN/CANSerialNumbers.h"
#include <HindsightCAN/CANCommon.h>
#include <HindsightCAN/CANSerialNumbers.h>
}

#include <chrono>
Expand Down
11 changes: 9 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

project(Rover LANGUAGES CXX C)

include(FetchContent)

# If a build type was not explicitly specified, default to "RelWithDebInfo" (Same optimization
# as the "Release" configuration but with debugging symbols).
#
Expand Down Expand Up @@ -109,7 +111,12 @@ find_package(nlohmann_json 3.2.0 REQUIRED)

# Find the CAN library; contains packet and protocol definitions and does not
# actually require physical CAN to be present.
find_package(HindsightCAN 1.4.0 REQUIRED)
FetchContent_Declare(
HindsightCAN
GIT_REPOSITORY https://github.com/huskyroboticsteam/HindsightCAN.git
GIT_TAG 09d0b2785ccd27536ca0381146b822205f2fad47 # TODO: update after pr is merged
)
FetchContent_MakeAvailable(HindsightCAN)

find_package(Threads REQUIRED)
find_package(OpenCV REQUIRED)
Expand Down Expand Up @@ -197,7 +204,7 @@ else()
CAN/CANStubs.cpp)
endif()
target_link_libraries(can_interface PUBLIC
HindsightCAN::HindsightCAN
HindsightCAN
Threads::Threads
utils
)
Expand Down
2 changes: 1 addition & 1 deletion update_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ sudo apt update
sudo apt install -y build-essential unzip gnupg2 lsb-release git \
cmake libeigen3-dev libopencv-dev libopencv-contrib-dev \
libwebsocketpp-dev libboost-system-dev gpsd gpsd-clients libgps-dev nlohmann-json3-dev \
catch2 urg-lidar rplidar ublox-linux hindsight-can=1.4.0 frozen libargparse-dev libavutil-dev \
catch2 urg-lidar rplidar ublox-linux frozen libargparse-dev libavutil-dev \
libx264-dev

0 comments on commit 9b38ba0

Please sign in to comment.