forked from Theresa-0328/MHY_Scanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
155 lines (126 loc) · 3.39 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
cmake_minimum_required(VERSION 3.26)
project(MHY_Scanner LANGUAGES CXX)
#set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_PREFIX_PATH "C:/Qt/6.2.3/msvc2019_64") # Qt Kit Dir
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(MAJOR_VERSION 1)
set(MINOR_VERSION 1)
set(MICRO_VERSION 5)
set(_VERSION_ "v${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}")
option(Unit_Tests "Unit Tests" ON)
option(USE_OPENSSL "OPENSSL" ON)
option(DEV "DEV" OFF)
if(MSVC)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /sdl")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /sdl")
endif()
# Specify MSVC UTF-8 encoding
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
#opencv
include_directories(./3rdparty/opencv/include)
link_directories(./3rdparty/opencv/staticlib)
#httplib
include_directories(./3rdparty/httplib)
#boost
include_directories(./3rdparty/boost)
#ffmpeg
include_directories(D:/Dev/ffmpeg/include)
link_directories(D:/Dev/ffmpeg/lib)
#curl
include_directories(./3rdparty/libcurl-vc17-X64-release-static-zlib-static-ipv6-sspi-schannel/include)
link_directories(./3rdparty/libcurl-vc17-X64-release-static-zlib-static-ipv6-sspi-schannel/lib)
add_definitions(-DCURL_STATICLIB)
#OpenSSL
if(USE_OPENSSL)
include_directories(D:/Dev/OpenSSL-Win64/include)
link_directories(D:/Dev/OpenSSL-Win64/lib)
add_definitions(-DUSE_OPENSSL)
endif()
find_package(Qt6 COMPONENTS Widgets REQUIRED)
add_definitions(-DSCAN_VER="${_VERSION_}")
if(NOT DEV)
add_definitions(-DTESTSPEED)
add_definitions(-DSHOW)
endif()
add_subdirectory(src)
if(NOT DEV)
#target_link_options(MHY_Scanner PRIVATE "/SUBSYSTEM:WINDOWS")
set_target_properties(MHY_Scanner PROPERTIES WIN32_EXECUTABLE TRUE)
endif()
#target_compile_definitions
if(Unit_Tests)
enable_testing()
add_subdirectory(tests)
endif()
set(PROJECT_LIBRARIES
MHY_Scanner_Core
TrrJson
# windows
Ws2_32
wldap32
winmm
Crypt32
Normaliz
# Qt6 Shared Library
Qt6::Core
Qt6::Widgets
# opencv
#ade$<$<CONFIG:Debug>:d>
IlmImf$<$<CONFIG:Debug>:d>
ittnotify$<$<CONFIG:Debug>:d>
libjpeg-turbo$<$<CONFIG:Debug>:d>
libopenjp2$<$<CONFIG:Debug>:d>
libpng$<$<CONFIG:Debug>:d>
libprotobuf$<$<CONFIG:Debug>:d>
libtiff$<$<CONFIG:Debug>:d>
libwebp$<$<CONFIG:Debug>:d>
opencv_img_hash480$<$<CONFIG:Debug>:d>
opencv_world480$<$<CONFIG:Debug>:d>
#quirc$<$<CONFIG:Debug>:d>
zlib$<$<CONFIG:Debug>:d>
# ffmpeg
avcodec
avdevice
avfilter
avformat
avutil
postproc
swresample
swscale
# curl
libcurl_a
)
if(USE_OPENSSL)
target_link_libraries(MHY_Scanner_Core PRIVATE
# OpenSSL
libssl_static
libcrypto_static)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE
${PROJECT_LIBRARIES}
)
if(Unit_Tests)
target_link_libraries(test_core PRIVATE ${PROJECT_LIBRARIES})
target_link_libraries(test_gui PRIVATE ${PROJECT_LIBRARIES})
target_link_libraries(test_video PRIVATE ${PROJECT_LIBRARIES})
target_link_libraries(test_video_hw PRIVATE ${PROJECT_LIBRARIES})
endif()
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION MHY_Scanner
)
install(
DIRECTORY
src/geetest
src/ScanModel
DESTINATION
MHY_Scanner
)