CMakeLists.txt 1.94 KB
Newer Older
Matteo's avatar
Matteo committed
1
2
3
4
5
6
7
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
PROJECT(video_analyser)

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
SET(CMAKE_CXX_STANDARD 20)

Matteo's avatar
Matteo committed
8
9
10
11
12
include(FetchContent)
FetchContent_Declare(
    googletest
    URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
Matteo's avatar
Matteo committed
13

Matteo's avatar
Matteo committed
14
15
16
# For Windows: Prevent overriding the parent project's compiler/linker settings
SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
Matteo's avatar
Matteo committed
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

LINK_DIRECTORIES(/usr/local/lib)

add_library(analyser_lib
    src/lib/colors.hpp
    src/lib/core.hpp
    src/lib/core.cpp
    src/lib/detection.hpp
    src/lib/detection.cpp
    src/lib/io.hpp
    src/lib/io.cpp
    src/lib/time.cpp
    src/lib/time.hpp
    src/lib/enums.hpp
    src/lib/enums.cpp
    src/lib/Irregularity.hpp
    src/lib/Irregularity.cpp
    src/lib/IrregularityFile.hpp
    src/lib/IrregularityFile.cpp
    src/lib/TimeLabel.hpp
    src/lib/TimeLabel.cpp
    src/lib/files.hpp
    src/lib/files.cpp
Matteo's avatar
Matteo committed
40
41
    src/utility.hpp
    src/utility.cpp
Matteo's avatar
Matteo committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
)

FIND_PACKAGE(OpenCV REQUIRED)
FIND_PACKAGE(nlohmann_json 3.2.0 REQUIRED)
FIND_PACKAGE(Boost COMPONENTS program_options REQUIRED)

INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})

ADD_EXECUTABLE(video_analyser ./src/main.cpp)

TARGET_LINK_LIBRARIES(analyser_lib
    ${OpenCV_LIBRARIES}
    nlohmann_json::nlohmann_json
    ${Boost_PROGRAM_OPTIONS_LIBRARY}
)

TARGET_LINK_LIBRARIES(video_analyser
    ${OpenCV_LIBRARIES}
    nlohmann_json::nlohmann_json
    ${Boost_PROGRAM_OPTIONS_LIBRARY}
    analyser_lib
)

Matteo's avatar
Matteo committed
66
enable_testing()
Matteo's avatar
Matteo committed
67

Matteo's avatar
Matteo committed
68
69
70
71
72
ADD_EXECUTABLE(
  test_suite
  tests/irregularity_test.cpp
  tests/enums_test.cpp
  tests/core_test.cpp
Matteo's avatar
Matteo committed
73
  tests/files_test.cpp
Matteo's avatar
Matteo committed
74
)
Matteo's avatar
Matteo committed
75

Matteo's avatar
Matteo committed
76
77
78
79
80
81
82
83
TARGET_LINK_LIBRARIES(
  test_suite
  GTest::gtest_main
  analyser_lib
  ${OpenCV_LIBRARIES}
  ${Boost_PROGRAM_OPTIONS_LIBRARY}
  nlohmann_json::nlohmann_json
)
Matteo's avatar
Matteo committed
84

Matteo's avatar
Matteo committed
85
86
include(GoogleTest)
gtest_discover_tests(test_suite)