diff --git a/CMakeLists.txt b/CMakeLists.txt index e5d7e75..c05cd5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,28 +1,16 @@ cmake_minimum_required(VERSION 3.8) - if(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) - endif(COMMAND cmake_policy) +if(COMMAND cmake_policy) + cmake_policy(SET CMP0003 NEW) +endif(COMMAND cmake_policy) project(blah2) include(CMakePrintHelpers) +include(CTest) SET(CMAKE_CXX_STANDARD 20) SET(CMAKE_CXX_STANDARD_REQUIRED ON) SET(CMAKE_CXX_EXTENSIONS OFF) - -SET (PROJECT_ROOT "${PROJECT_SOURCE_DIR}") 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(asio CONFIG REQUIRED) @@ -32,7 +20,16 @@ find_package(httplib REQUIRED) find_package(Armadillo 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 add_library(sdrplay /usr/local/include/sdrplay_api.h) @@ -68,35 +65,27 @@ target_link_libraries(blah2 PRIVATE fftw3 fftw3_threads 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 add_executable(testAmbiguity - ${PROJECT_TEST_DIR}/unit/process/ambiguity/TestAmbiguity.cpp - ${PROJECT_SOURCE_DIR}/data/IqData.cpp - ${PROJECT_SOURCE_DIR}/data/Map.cpp - ${PROJECT_SOURCE_DIR}/process/ambiguity/Ambiguity.cpp - ${PROJECT_SOURCE_DIR}/process/meta/HammingNumber.cpp) + test/unit/process/ambiguity/TestAmbiguity.cpp + src/data/IqData.cpp + src/data/Map.cpp + src/process/ambiguity/Ambiguity.cpp + src/process/meta/HammingNumber.cpp) target_link_libraries(testAmbiguity PRIVATE Catch2::Catch2WithMain fftw3 fftw3_threads) set_target_properties(testAmbiguity PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_TEST_UNIT_DIR}") add_executable(testTracker - ${PROJECT_TEST_DIR}/unit/process/tracker/TestTracker.cpp - ${PROJECT_SOURCE_DIR}/data/Detection.cpp - ${PROJECT_SOURCE_DIR}/data/Track.cpp - ${PROJECT_SOURCE_DIR}/process/tracker/Tracker.cpp) + test/unit/process/tracker/TestTracker.cpp + src/data/Detection.cpp + src/data/Track.cpp + src/process/tracker/Tracker.cpp) target_link_libraries(testTracker PRIVATE Catch2::Catch2WithMain) set_target_properties(testTracker PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_TEST_UNIT_DIR}") \ No newline at end of file + RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_TEST_UNIT_DIR}") + +add_test(NAME testAmbiguity COMMAND testAmbiguity) +add_test(NAME testTracker COMMAND testTracker) diff --git a/src/blah2.cpp b/src/blah2.cpp index da49d53..c8361fd 100644 --- a/src/blah2.cpp +++ b/src/blah2.cpp @@ -2,23 +2,24 @@ /// @brief A real-time radar. /// @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 #include // optional header, provided for std:: interop #include // needed for the examples below #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include diff --git a/src/capture/Capture.cpp b/src/capture/Capture.cpp index a6521f9..4f764e1 100644 --- a/src/capture/Capture.cpp +++ b/src/capture/Capture.cpp @@ -1,5 +1,5 @@ #include "Capture.h" -#include "RspDuo.h" +#include "rspduo/RspDuo.h" #include #include #include diff --git a/src/capture/Capture.h b/src/capture/Capture.h index 27486fc..f4520e7 100644 --- a/src/capture/Capture.h +++ b/src/capture/Capture.h @@ -7,7 +7,7 @@ #define CAPTURE_H #include -#include +#include "data/IqData.h" class Capture { diff --git a/src/capture/rspduo/RspDuo.cpp b/src/capture/rspduo/RspDuo.cpp index d7fc1cd..8da0d81 100644 --- a/src/capture/rspduo/RspDuo.cpp +++ b/src/capture/rspduo/RspDuo.cpp @@ -1,4 +1,5 @@ -#include +#include "RspDuo.h" + #include #include #include diff --git a/src/capture/rspduo/RspDuo.h b/src/capture/rspduo/RspDuo.h index bec3669..e3080d8 100644 --- a/src/capture/rspduo/RspDuo.h +++ b/src/capture/rspduo/RspDuo.h @@ -20,9 +20,10 @@ #define RSPDUO_H #include "sdrplay_api.h" +#include "data/IqData.h" + #include #include -#include #define BUFFER_SIZE_NR 1024 diff --git a/src/data/Track.h b/src/data/Track.h index 016bf4f..e17d23a 100644 --- a/src/data/Track.h +++ b/src/data/Track.h @@ -15,7 +15,8 @@ #ifndef TRACK_H #define TRACK_H -#include +#include "data/Detection.h" + #include #include #include diff --git a/src/process/ambiguity/Ambiguity.h b/src/process/ambiguity/Ambiguity.h index 5d93094..86ddcad 100644 --- a/src/process/ambiguity/Ambiguity.h +++ b/src/process/ambiguity/Ambiguity.h @@ -8,9 +8,9 @@ #pragma once -#include -#include -#include +#include "data/IqData.h" +#include "data/Map.h" +#include "process/meta/HammingNumber.h" #include #include #include diff --git a/src/process/clutter/WienerHopf.h b/src/process/clutter/WienerHopf.h index bf28a40..5f9ddc3 100644 --- a/src/process/clutter/WienerHopf.h +++ b/src/process/clutter/WienerHopf.h @@ -9,7 +9,7 @@ #ifndef WIENERHOPF_H #define WIENERHOPF_H -#include +#include "data/IqData.h" #include #include #include diff --git a/src/process/detection/Centroid.h b/src/process/detection/Centroid.h index 342f654..fa9b7c7 100644 --- a/src/process/detection/Centroid.h +++ b/src/process/detection/Centroid.h @@ -7,7 +7,7 @@ #ifndef CENTROID_H #define CENTROID_H -#include +#include "data/Detection.h" #include class Centroid diff --git a/src/process/detection/CfarDetector1D.cpp b/src/process/detection/CfarDetector1D.cpp index 7a00bb5..7758e8e 100644 --- a/src/process/detection/CfarDetector1D.cpp +++ b/src/process/detection/CfarDetector1D.cpp @@ -1,5 +1,6 @@ #include "CfarDetector1D.h" -#include "Map.h" +#include "data/Map.h" + #include #include #include diff --git a/src/process/detection/CfarDetector1D.h b/src/process/detection/CfarDetector1D.h index 0064e97..9d39693 100644 --- a/src/process/detection/CfarDetector1D.h +++ b/src/process/detection/CfarDetector1D.h @@ -8,8 +8,8 @@ #ifndef CFARDETECTOR1D_H #define CFARDETECTOR1D_H -#include -#include +#include "data/Map.h" +#include "data/Detection.h" #include #include diff --git a/src/process/detection/Interpolate.h b/src/process/detection/Interpolate.h index 11afce9..c1758a2 100644 --- a/src/process/detection/Interpolate.h +++ b/src/process/detection/Interpolate.h @@ -11,8 +11,8 @@ #ifndef INTERPOLATE_H #define INTERPOLATE_H -#include -#include +#include "data/Map.h" +#include "data/Detection.h" class Interpolate { diff --git a/src/process/spectrum/SpectrumAnalyser.h b/src/process/spectrum/SpectrumAnalyser.h index 7057500..da0bf30 100644 --- a/src/process/spectrum/SpectrumAnalyser.h +++ b/src/process/spectrum/SpectrumAnalyser.h @@ -9,7 +9,7 @@ #ifndef SPECTRUMANALYSER_H #define SPECTRUMANALYSER_H -#include +#include "data/IqData.h" #include #include diff --git a/src/process/tracker/Tracker.h b/src/process/tracker/Tracker.h index aa0ebd6..4ac5d31 100644 --- a/src/process/tracker/Tracker.h +++ b/src/process/tracker/Tracker.h @@ -10,8 +10,8 @@ #ifndef TRACKER_H #define TRACKER_H -#include -#include +#include "data/Detection.h" +#include "data/Track.h" #include class Tracker diff --git a/test/unit/process/ambiguity/TestAmbiguity.cpp b/test/unit/process/ambiguity/TestAmbiguity.cpp index cc1879a..59c7f74 100644 --- a/test/unit/process/ambiguity/TestAmbiguity.cpp +++ b/test/unit/process/ambiguity/TestAmbiguity.cpp @@ -9,7 +9,7 @@ #include #include -#include "Ambiguity.h" +#include "process/ambiguity/Ambiguity.h" #include #include diff --git a/test/unit/process/tracker/TestTracker.cpp b/test/unit/process/tracker/TestTracker.cpp index 19279b6..8e59118 100644 --- a/test/unit/process/tracker/TestTracker.cpp +++ b/test/unit/process/tracker/TestTracker.cpp @@ -4,9 +4,10 @@ #include -#include "Detection.h" -#include "Tracker.h" -#include "Track.h" +#include "data/Detection.h" +#include "data/Track.h" +#include "process/tracker/Tracker.h" + #include #include #include