Added devcontainer and removed dependence on vendored third-party libraries

This commit is contained in:
Daniel Gustainis 2023-12-24 01:07:03 +00:00
parent 8ebad95509
commit a51bef308a
8 changed files with 161 additions and 63 deletions

39
.devcontainer/Dockerfile Normal file
View file

@ -0,0 +1,39 @@
# ubuntu-22.04 by default
ARG VARIANT="jammy"
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT}
ENV DEBIAN_FRONTEND=noninteractive
# Feel like this shouldn't be needed but it drops me in / during build
WORKDIR /workspace
RUN apt-get update \
#
# Install dev tools and package dependencies
&& apt-get install -y clang-tidy clang-format doxygen graphviz gfortran \
libfftw3-dev liblapack-dev libopenblas-dev libudev-dev libusb-1.0.0-dev \
#
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies from vcpkg
RUN vcpkg integrate install \
&& vcpkg install catch2 \
&& vcpkg install rapidjson \
&& vcpkg install asio \
&& vcpkg install cpp-httplib \
&& vcpkg install armadillo \
&& vcpkg install ryml
COPY lib/sdrplay-3.0.7/SDRplay_RSP_API-Linux-3.07.1.run /workspace/
# Install shitty sdrplay API
RUN chmod +x /workspace/SDRplay_RSP_API-Linux-3.07.1.run \
&& /workspace/SDRplay_RSP_API-Linux-3.07.1.run --tar -xf \
&& cp x86_64/libsdrplay_api.so.3.07 /usr/local/lib/libsdrplay_api.so \
&& ln -s /usr/local/lib/libsdrplay_api.so /usr/local/lib/libsdrplay_api.so.3.07 \
&& cp inc/* /usr/local/include \
&& chmod 644 /usr/local/lib/libsdrplay_api.so /usr/local/lib/libsdrplay_api.so.3.07 \
&& ldconfig

View file

@ -0,0 +1,48 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
"name": "blah2 dev",
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": [
"docker-compose.yml"
],
// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "blah2-dev",
// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/workspace",
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Uncomment the next line if you want start specific services in your Docker Compose config.
// "runServices": [],
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
// "shutdownAction": "none",
// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",
// Configure tool-specific properties.
// "customizations": {},
"customizations": {
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-vscode.cpptools-extension-pack",
],
}
},
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "vscode"
}

View file

@ -0,0 +1,13 @@
version: "3.2"
services:
blah2-dev:
user: vscode
build:
context: ..
dockerfile: .devcontainer/Dockerfile
volumes:
- type: bind
source: ..
target: /workspace
working_dir: /workspace
command: sleep infinity

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
build/*
build*/*
bin/*
!build/README.md
!bin/README.md

View file

@ -1,10 +1,14 @@
project(blah2)
cmake_minimum_required(VERSION 3.8)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
project(blah2)
include(CMakePrintHelpers)
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD 20)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
SET (PROJECT_ROOT "${PROJECT_SOURCE_DIR}")
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_ROOT}/bin")
@ -18,59 +22,53 @@ MESSAGE ("Source path: ${PROJECT_SOURCE_DIR}")
MESSAGE ("Binary path: ${PROJECT_BINARY_DIR}")
MESSAGE ("Binary test path: ${PROJECT_BINARY_TEST_DIR}")
MESSAGE ("Lib path: ${PROJECT_LIB_DIR}")
MESSAGE ("CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
find_package(Threads REQUIRED)
find_package(asio CONFIG REQUIRED)
find_package(RapidJSON REQUIRED)
find_package(ryml CONFIG REQUIRED)
find_package(httplib REQUIRED)
find_package(Armadillo REQUIRED)
find_package(Catch2 CONFIG REQUIRED)
# find_package(fftw3 REQUIRED)
# TODO: Create FindSdrplay.cmake for this
add_library(sdrplay /usr/local/include/sdrplay_api.h)
set_target_properties(sdrplay PROPERTIES LINKER_LANGUAGE C)
target_link_libraries(sdrplay PUBLIC /usr/local/lib/libsdrplay_api.so.3.07)
add_executable(blah2
${PROJECT_SOURCE_DIR}/blah2.cpp
${PROJECT_SOURCE_DIR}/capture/Capture.cpp
${PROJECT_SOURCE_DIR}/capture/rspduo/RspDuo.cpp
${PROJECT_SOURCE_DIR}/process/ambiguity/Ambiguity.cpp
${PROJECT_SOURCE_DIR}/process/clutter/WienerHopf.cpp
${PROJECT_SOURCE_DIR}/process/detection/CfarDetector1D.cpp
${PROJECT_SOURCE_DIR}/process/detection/Centroid.cpp
${PROJECT_SOURCE_DIR}/process/detection/Interpolate.cpp
${PROJECT_SOURCE_DIR}/process/tracker/Tracker.cpp
${PROJECT_SOURCE_DIR}/process/spectrum/SpectrumAnalyser.cpp
${PROJECT_SOURCE_DIR}/process/meta/HammingNumber.cpp
${PROJECT_SOURCE_DIR}/data/IqData.cpp
${PROJECT_SOURCE_DIR}/data/Map.cpp
${PROJECT_SOURCE_DIR}/data/Detection.cpp
${PROJECT_SOURCE_DIR}/data/Track.cpp
${PROJECT_SOURCE_DIR}/data/meta/Timing.cpp
src/blah2.cpp
src/capture/Capture.cpp
src/capture/rspduo/RspDuo.cpp
src/process/ambiguity/Ambiguity.cpp
src/process/clutter/WienerHopf.cpp
src/process/detection/CfarDetector1D.cpp
src/process/detection/Centroid.cpp
src/process/detection/Interpolate.cpp
src/process/tracker/Tracker.cpp
src/process/spectrum/SpectrumAnalyser.cpp
src/process/meta/HammingNumber.cpp
src/data/IqData.cpp
src/data/Map.cpp
src/data/Detection.cpp
src/data/Track.cpp
src/data/meta/Timing.cpp
)
add_library(ryml ${PROJECT_LIB_DIR}/rapidyaml-0.5.0/ryml-0.5.0.hpp)
add_library(rapidjson ${PROJECT_LIB_DIR}/rapidjson-1.1.0/)
add_library(sdrplay /usr/local/include/sdrplay_api.h)
add_library(asio ${PROJECT_LIB_DIR}/asio-1.26.0/asio.hpp)
add_library(httplib ${PROJECT_LIB_DIR}/cpp-httplib-0.12.2/httplib.h)
add_library(catch2 ${PROJECT_LIB_DIR}/catch2/catch_amalgamated.cpp)
target_include_directories(catch2 PUBLIC ${PROJECT_LIB_DIR}/catch2)
include_directories("${PROJECT_LIB_DIR}/rapidjson-1.1.0/")
set_target_properties(rapidjson PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(blah2 rapidjson)
include_directories("${PROJECT_LIB_DIR}/asio-1.26.0/")
set_target_properties(asio PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(blah2 asio)
include_directories("${PROJECT_LIB_DIR}/cpp-httplib-0.12.2/")
set_target_properties(httplib PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(blah2 httplib)
include_directories("${PROJECT_LIB_DIR}/rapidyaml-0.5.0/")
set_target_properties(ryml PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(blah2 ryml)
set_target_properties(sdrplay PROPERTIES LINKER_LANGUAGE C)
target_link_libraries(sdrplay /usr/local/lib/libsdrplay_api.so.3.07)
target_link_libraries(blah2 sdrplay)
target_link_libraries(blah2 fftw3)
target_link_libraries(blah2 fftw3_threads)
target_link_libraries(blah2 lapack)
target_link_libraries(blah2 blas)
target_link_libraries(blah2 armadillo)
target_link_libraries(blah2 PRIVATE
Threads::Threads
rapidjson
asio::asio
ryml::ryml
httplib::httplib
armadillo
fftw3
fftw3_threads
sdrplay
)
include_directories("${PROJECT_SOURCE_DIR}/capture/")
include_directories("${PROJECT_SOURCE_DIR}/capture/rspduo/")
@ -90,7 +88,7 @@ add_executable(testAmbiguity
${PROJECT_SOURCE_DIR}/data/Map.cpp
${PROJECT_SOURCE_DIR}/process/ambiguity/Ambiguity.cpp
${PROJECT_SOURCE_DIR}/process/meta/HammingNumber.cpp)
target_link_libraries(testAmbiguity catch2 fftw3 fftw3_threads)
target_link_libraries(testAmbiguity PRIVATE Catch2::Catch2WithMain fftw3 fftw3_threads)
set_target_properties(testAmbiguity PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_TEST_UNIT_DIR}")
@ -99,6 +97,6 @@ add_executable(testTracker
${PROJECT_SOURCE_DIR}/data/Detection.cpp
${PROJECT_SOURCE_DIR}/data/Track.cpp
${PROJECT_SOURCE_DIR}/process/tracker/Tracker.cpp)
target_link_libraries(testTracker catch2)
target_link_libraries(testTracker PRIVATE Catch2::Catch2WithMain)
set_target_properties(testTracker PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_TEST_UNIT_DIR}")
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_TEST_UNIT_DIR}")

View file

@ -2,9 +2,9 @@
/// @brief A real-time radar.
/// @author 30hours
#define RYML_SINGLE_HDR_DEFINE_NOW
#include <ryml-0.5.0.hpp>
#include <ryml/ryml.hpp>
#include <ryml/ryml_std.hpp> // optional header, provided for std:: interop
#include <c4/format.hpp> // needed for the examples below
#include <asio.hpp>
#include <Capture.h>
#include <Ambiguity.h>

View file

@ -5,8 +5,9 @@
/// @todo Add golden data IqData file for testing.
/// @todo Declaration match to coding style?
#define CATCH_CONFIG_MAIN
#include "catch_amalgamated.hpp"
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_floating_point.hpp>
#include <catch2/generators/catch_generators.hpp>
#include "Ambiguity.h"
#include <random>

View file

@ -2,8 +2,7 @@
/// @brief Unit test for Tracker.cpp
/// @author 30hours
#define CATCH_CONFIG_MAIN
#include "catch_amalgamated.hpp"
#include <catch2/catch_test_macros.hpp>
#include "Detection.h"
#include "Tracker.h"