-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
95 lines (85 loc) · 2.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
cmake_minimum_required(VERSION 3.12)
project(viewer VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
set(PROJECT_SOURCES
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
imageviewer.h
imageviewer.cpp
label.h
label.cpp
labeleditor.h
labeleditor.cpp
types.h
labelcategory.h
labelcategory.cpp
utils.h
utils.cpp
editor/circleeditor.h
editor/circleeditor.cpp
editor/ringeditor.h
editor/ringeditor.cpp
editor/rotatedrecteditor.h
editor/rotatedrecteditor.cpp
editor/recteditor.h
editor/recteditor.cpp
editor/polygoneditor.h
editor/polygoneditor.cpp
editor/regioneditor.h
editor/regioneditor.cpp
editor/rulereditor.h
editor/rulereditor.cpp
editor/protractoreditor.h
editor/protractoreditor.cpp
label/circlelabel.h
label/circlelabel.cpp
label/ringlabel.h
label/ringlabel.cpp
label/rotatedrectlabel.h
label/rotatedrectlabel.cpp
label/rectlabel.h
label/rectlabel.cpp
label/polygonlabel.h
label/polygonlabel.cpp
label/regionlabel.h
label/regionlabel.cpp
label/imagelabel.h
label/imagelabel.cpp
)
add_executable(viewer
${PROJECT_SOURCES}
res/resource.qrc
)
target_include_directories(viewer PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(viewer PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
target_compile_options(viewer PRIVATE
$<$<AND:$<CXX_COMPILER_ID:Clang>,$<STREQUAL:${CMAKE_SYSTEM_NAME},Linux>>:-fPIC -fvisibility=hidden -Wall -Wextra -Wpedantic -Wmisleading-indentation -Wunused -Wuninitialized -Wshadow -Wconversion -Werror>
$<$<AND:$<CXX_COMPILER_ID:Clang>,$<STREQUAL:${CMAKE_SYSTEM_NAME},Windows>>:/W4 /WX /external:W0>
)
#if(CMAKE_BUILD_TYPE)
# string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
# message("Build Type:${BUILD_TYPE}")
#
# if(${BUILD_TYPE} STREQUAL "debug")
# target_compile_options(viewer PRIVATE
# $<$<CXX_COMPILER_ID:MSVC>:>
# $<$<CXX_COMPILER_ID:GNU>:-fsanitize=address,undefined>
# $<$<CXX_COMPILER_ID:Clang>:-fsanitize=address,undefined>
# )
# endif()
#endif(CMAKE_BUILD_TYPE)
include(GNUInstallDirs)
install(TARGETS viewer
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)