Include project headers relative to top-level src directory

This commit is contained in:
Daniel Gustainis 2023-12-24 05:35:27 +00:00
parent 85ae275a18
commit b2c787330c
17 changed files with 69 additions and 74 deletions

View file

@ -5,24 +5,12 @@ cmake_minimum_required(VERSION 3.8)
project(blah2) project(blah2)
include(CMakePrintHelpers) include(CMakePrintHelpers)
include(CTest)
SET(CMAKE_CXX_STANDARD 20) SET(CMAKE_CXX_STANDARD 20)
SET(CMAKE_CXX_STANDARD_REQUIRED ON) SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF) SET(CMAKE_CXX_EXTENSIONS OFF)
SET (PROJECT_ROOT "${PROJECT_SOURCE_DIR}")
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_ROOT}/bin") SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_ROOT}/bin")
SET (PROJECT_TEST_DIR "${PROJECT_SOURCE_DIR}/test")
SET (PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/src")
SET (PROJECT_BINARY_DIR "${PROJECT_ROOT}/bin")
SET (PROJECT_BINARY_TEST_DIR "${PROJECT_ROOT}/bin/test")
SET (PROJECT_BINARY_TEST_UNIT_DIR "${PROJECT_ROOT}/bin/test/unit")
SET (PROJECT_LIB_DIR "${PROJECT_ROOT}/lib")
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(Threads REQUIRED)
find_package(asio CONFIG REQUIRED) find_package(asio CONFIG REQUIRED)
@ -32,7 +20,16 @@ find_package(httplib REQUIRED)
find_package(Armadillo REQUIRED) find_package(Armadillo REQUIRED)
find_package(Catch2 CONFIG REQUIRED) find_package(Catch2 CONFIG REQUIRED)
# find_package(fftw3 REQUIRED) # TODO: When release CI is finished, don't use these dirs, install target should go to prod
SET (PROJECT_ROOT "${PROJECT_SOURCE_DIR}")
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_ROOT}/bin")
SET (PROJECT_BINARY_TEST_DIR "${PROJECT_ROOT}/bin/test")
MESSAGE ("Binary path: ${PROJECT_BINARY_DIR}")
MESSAGE ("Binary test path: ${PROJECT_BINARY_TEST_DIR}")
# Include from top-level src dir
include_directories(src)
# TODO: Create FindSdrplay.cmake for this # TODO: Create FindSdrplay.cmake for this
add_library(sdrplay /usr/local/include/sdrplay_api.h) add_library(sdrplay /usr/local/include/sdrplay_api.h)
@ -70,33 +67,25 @@ target_link_libraries(blah2 PRIVATE
sdrplay sdrplay
) )
include_directories("${PROJECT_SOURCE_DIR}/capture/")
include_directories("${PROJECT_SOURCE_DIR}/capture/rspduo/")
include_directories("${PROJECT_SOURCE_DIR}/process/ambiguity/")
include_directories("${PROJECT_SOURCE_DIR}/process/clutter/")
include_directories("${PROJECT_SOURCE_DIR}/process/detection/")
include_directories("${PROJECT_SOURCE_DIR}/process/tracker/")
include_directories("${PROJECT_SOURCE_DIR}/process/spectrum/")
include_directories("${PROJECT_SOURCE_DIR}/process/meta/")
include_directories("${PROJECT_SOURCE_DIR}/data/")
include_directories("${PROJECT_SOURCE_DIR}/data/meta/")
# unit tests # unit tests
add_executable(testAmbiguity add_executable(testAmbiguity
${PROJECT_TEST_DIR}/unit/process/ambiguity/TestAmbiguity.cpp test/unit/process/ambiguity/TestAmbiguity.cpp
${PROJECT_SOURCE_DIR}/data/IqData.cpp src/data/IqData.cpp
${PROJECT_SOURCE_DIR}/data/Map.cpp src/data/Map.cpp
${PROJECT_SOURCE_DIR}/process/ambiguity/Ambiguity.cpp src/process/ambiguity/Ambiguity.cpp
${PROJECT_SOURCE_DIR}/process/meta/HammingNumber.cpp) src/process/meta/HammingNumber.cpp)
target_link_libraries(testAmbiguity PRIVATE Catch2::Catch2WithMain fftw3 fftw3_threads) target_link_libraries(testAmbiguity PRIVATE Catch2::Catch2WithMain fftw3 fftw3_threads)
set_target_properties(testAmbiguity PROPERTIES set_target_properties(testAmbiguity PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_TEST_UNIT_DIR}") RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_TEST_UNIT_DIR}")
add_executable(testTracker add_executable(testTracker
${PROJECT_TEST_DIR}/unit/process/tracker/TestTracker.cpp test/unit/process/tracker/TestTracker.cpp
${PROJECT_SOURCE_DIR}/data/Detection.cpp src/data/Detection.cpp
${PROJECT_SOURCE_DIR}/data/Track.cpp src/data/Track.cpp
${PROJECT_SOURCE_DIR}/process/tracker/Tracker.cpp) src/process/tracker/Tracker.cpp)
target_link_libraries(testTracker PRIVATE Catch2::Catch2WithMain) target_link_libraries(testTracker PRIVATE Catch2::Catch2WithMain)
set_target_properties(testTracker PROPERTIES set_target_properties(testTracker PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_TEST_UNIT_DIR}") RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_TEST_UNIT_DIR}")
add_test(NAME testAmbiguity COMMAND testAmbiguity)
add_test(NAME testTracker COMMAND testTracker)

View file

@ -2,23 +2,24 @@
/// @brief A real-time radar. /// @brief A real-time radar.
/// @author 30hours /// @author 30hours
#include "capture/Capture.h"
#include "data/IqData.h"
#include "data/Map.h"
#include "data/Detection.h"
#include "data/meta/Timing.h"
#include "data/Track.h"
#include "process/ambiguity/Ambiguity.h"
#include "process/clutter/WienerHopf.h"
#include "process/detection/CfarDetector1D.h"
#include "process/detection/Centroid.h"
#include "process/detection/Interpolate.h"
#include "process/spectrum/SpectrumAnalyser.h"
#include "process/tracker/Tracker.h"
#include <ryml/ryml.hpp> #include <ryml/ryml.hpp>
#include <ryml/ryml_std.hpp> // optional header, provided for std:: interop #include <ryml/ryml_std.hpp> // optional header, provided for std:: interop
#include <c4/format.hpp> // needed for the examples below #include <c4/format.hpp> // needed for the examples below
#include <asio.hpp> #include <asio.hpp>
#include <Capture.h>
#include <Ambiguity.h>
#include <WienerHopf.h>
#include <CfarDetector1D.h>
#include <Tracker.h>
#include <IqData.h>
#include <Map.h>
#include <Detection.h>
#include <Track.h>
#include <Centroid.h>
#include <Interpolate.h>
#include <Timing.h>
#include <SpectrumAnalyser.h>
#include <sys/types.h> #include <sys/types.h>
#include <getopt.h> #include <getopt.h>
#include <string> #include <string>

View file

@ -1,5 +1,5 @@
#include "Capture.h" #include "Capture.h"
#include "RspDuo.h" #include "rspduo/RspDuo.h"
#include <iostream> #include <iostream>
#include <thread> #include <thread>
#include <httplib.h> #include <httplib.h>

View file

@ -7,7 +7,7 @@
#define CAPTURE_H #define CAPTURE_H
#include <string> #include <string>
#include <IqData.h> #include "data/IqData.h"
class Capture class Capture
{ {

View file

@ -1,4 +1,5 @@
#include <RspDuo.h> #include "RspDuo.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>

View file

@ -20,9 +20,10 @@
#define RSPDUO_H #define RSPDUO_H
#include "sdrplay_api.h" #include "sdrplay_api.h"
#include "data/IqData.h"
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
#include <IqData.h>
#define BUFFER_SIZE_NR 1024 #define BUFFER_SIZE_NR 1024

View file

@ -15,7 +15,8 @@
#ifndef TRACK_H #ifndef TRACK_H
#define TRACK_H #define TRACK_H
#include <Detection.h> #include "data/Detection.h"
#include <stdint.h> #include <stdint.h>
#include <vector> #include <vector>
#include <string> #include <string>

View file

@ -8,9 +8,9 @@
#pragma once #pragma once
#include <IqData.h> #include "data/IqData.h"
#include <Map.h> #include "data/Map.h"
#include <HammingNumber.h> #include "process/meta/HammingNumber.h"
#include <stdint.h> #include <stdint.h>
#include <fftw3.h> #include <fftw3.h>
#include <memory> #include <memory>

View file

@ -9,7 +9,7 @@
#ifndef WIENERHOPF_H #ifndef WIENERHOPF_H
#define WIENERHOPF_H #define WIENERHOPF_H
#include <IqData.h> #include "data/IqData.h"
#include <stdint.h> #include <stdint.h>
#include <fftw3.h> #include <fftw3.h>
#include <armadillo> #include <armadillo>

View file

@ -7,7 +7,7 @@
#ifndef CENTROID_H #ifndef CENTROID_H
#define CENTROID_H #define CENTROID_H
#include <Detection.h> #include "data/Detection.h"
#include <stdint.h> #include <stdint.h>
class Centroid class Centroid

View file

@ -1,5 +1,6 @@
#include "CfarDetector1D.h" #include "CfarDetector1D.h"
#include "Map.h" #include "data/Map.h"
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <cmath> #include <cmath>

View file

@ -8,8 +8,8 @@
#ifndef CFARDETECTOR1D_H #ifndef CFARDETECTOR1D_H
#define CFARDETECTOR1D_H #define CFARDETECTOR1D_H
#include <Map.h> #include "data/Map.h"
#include <Detection.h> #include "data/Detection.h"
#include <stdint.h> #include <stdint.h>
#include <complex> #include <complex>

View file

@ -11,8 +11,8 @@
#ifndef INTERPOLATE_H #ifndef INTERPOLATE_H
#define INTERPOLATE_H #define INTERPOLATE_H
#include <Map.h> #include "data/Map.h"
#include <Detection.h> #include "data/Detection.h"
class Interpolate class Interpolate
{ {

View file

@ -9,7 +9,7 @@
#ifndef SPECTRUMANALYSER_H #ifndef SPECTRUMANALYSER_H
#define SPECTRUMANALYSER_H #define SPECTRUMANALYSER_H
#include <IqData.h> #include "data/IqData.h"
#include <stdint.h> #include <stdint.h>
#include <fftw3.h> #include <fftw3.h>

View file

@ -10,8 +10,8 @@
#ifndef TRACKER_H #ifndef TRACKER_H
#define TRACKER_H #define TRACKER_H
#include <Detection.h> #include "data/Detection.h"
#include <Track.h> #include "data/Track.h"
#include <stdint.h> #include <stdint.h>
class Tracker class Tracker

View file

@ -9,7 +9,7 @@
#include <catch2/matchers/catch_matchers_floating_point.hpp> #include <catch2/matchers/catch_matchers_floating_point.hpp>
#include <catch2/generators/catch_generators.hpp> #include <catch2/generators/catch_generators.hpp>
#include "Ambiguity.h" #include "process/ambiguity/Ambiguity.h"
#include <random> #include <random>
#include <iostream> #include <iostream>

View file

@ -4,9 +4,10 @@
#include <catch2/catch_test_macros.hpp> #include <catch2/catch_test_macros.hpp>
#include "Detection.h" #include "data/Detection.h"
#include "Tracker.h" #include "data/Track.h"
#include "Track.h" #include "process/tracker/Tracker.h"
#include <string> #include <string>
#include <vector> #include <vector>
#include <random> #include <random>