-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
110 lines (84 loc) · 3.72 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
cmake_minimum_required(VERSION 3.9)
# -------------------------------------------------------------------------- #
# Versioning #
# -------------------------------------------------------------------------- #
file(STRINGS "version.txt" NITRO_VERSION LIMIT_COUNT 1)
set(NITRO_NAME "NITRO")
project(nitro VERSION ${NITRO_VERSION} LANGUAGES CXX)
# -------------------------------------------------------------------------- #
# Options #
# -------------------------------------------------------------------------- #
set(CMAKE_INCLUDE_CURRENT_DIR ON)
cmake_policy(SET CMP0079 NEW)
set(CMAKE_AUTOMOC ON)
include(GNUInstallDirs)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
# -------------------------------------------------------------------------- #
# Required components #
# -------------------------------------------------------------------------- #
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS OpenGL OpenGLWidgets)
find_package(OpenCV REQUIRED)
find_package(OpenMP)
# -------------------------------------------------------------------------- #
# 3rd Party dependencies #
# -------------------------------------------------------------------------- #
add_subdirectory(external)
list(APPEND NITRO_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/include)
# -------------------------------------------------------------------------- #
# Requires libraries #
# -------------------------------------------------------------------------- #
set(NITRO_LIBS "")
list(APPEND NITRO_LIBS opencv_core)
list(APPEND NITRO_LIBS opencv_imgproc)
list(APPEND NITRO_LIBS opencv_imgcodecs)
list(APPEND NITRO_LIBS Qt6::Core)
list(APPEND NITRO_LIBS Qt6::Gui)
list(APPEND NITRO_LIBS Qt6::Widgets)
if (OpenMP_FOUND)
list(APPEND NITRO_LIBS OpenMP::OpenMP_CXX)
else ()
message("OpenMP was not found. Compiling without OpenMP support.")
endif ()
# -------------------------------------------------------------------------- #
# Create main project target #
# -------------------------------------------------------------------------- #
include_directories(
${CMAKE_BINARY_DIR}
${OpenCV_INCLUDE_DIRS})
file(GLOB_RECURSE CPPS src/*.cpp)
file(GLOB_RECURSE HPPS src/*.hpp include/*.hpp)
qt_add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE
${CPPS} ${HPPS}
resources/resources.qrc
)
target_include_directories(${PROJECT_NAME}
PRIVATE
${NITRO_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME}
PUBLIC
${EXTERNAL_LIBS}
PRIVATE
${NITRO_LIBS}
)
# -------------------------------------------------------------------------- #
# Modules #
# -------------------------------------------------------------------------- #
# Include the custom module functions
include(cmake/modules.cmake)
add_module(ImCore)
add_module(ImProc)
add_module(Compression)
#add_module(Thesis)
# Adds and links the modules
include(cmake/config.cmake)
# -------------------------------------------------------------------------- #
# Install #
# -------------------------------------------------------------------------- #
install(TARGETS ${PROJECT_NAME}
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)