-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
149 lines (112 loc) · 5.15 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
# // ------------------------------------------------------------------------------
#
# This is CMake-Project for "ImgToDoc-CV" an utility application
# for converting image of document to its close analog (just like scan), ofcource with
# some issues due to big angles.
#
# License: see "LICENSE" file.
# Tools: QT || VC++, GCC || CLang || MSVC
# API: C/C++, OpenCV.
# Platforms: Any with C++
#
# // ------------------------------------------------------------------------------
# =================================================================================
# CMake Meta-Data
# =================================================================================
# CMake-Version
cmake_minimum_required ( VERSION 3.5 FATAL_ERROR ) # QT5 + CMake required 3.5 minimum.
# =================================================================================
# PROJECT
# =================================================================================
# Project Name
set ( PROJECT_NAME "img_to_doc_cv" )
# Project Version
set ( PROJECT_VERSION 0.0.1 )
# Configure Project
project ( ${PROJECT_NAME} VERSION ${PROJECT_VERSION} LANGUAGES C CXX )
# C++ Version
set ( CMAKE_CXX_STANDARD 11 ) # For campatability with legacy OS, like Windows 7 (before 2011)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Compiler-specific tunes (RC, CC, etc).
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
# =================================================================================
# CONFIGS
# =================================================================================
# Prefix to headers & sources dir.
set ( PROJECT_SRC_DIR_PREFIX "src/cxx" )
# Prefix for Third-Party Source-Code (not lib's includes).
set ( PROJECT_EXTERNAL_SRC_DIR_PREFIX "external" )
# SHARED (DYNAMIC) & STATIC Libs Dir.
set ( PROJECT_LIBS_DIR "libs/lib" )
# Includes Dir for Libs.
set ( PROJECT_LIBS_INCLUDES_DIR "libs/includes" )
# Prefix to qml dir.
set ( PROJECT_QML_DIR_PREFIX "src/qml/" )
# Add Definition, that QT API used.
add_definitions ( -DQFT_USE_QT=1 )
# =================================================================================
# QT Libraries/Modules
# =================================================================================
# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
# Check http://doc.qt.io/qt-5/deployment-android.html for more information.
# They need to be set before the find_package(Qt5 ...) call.
#if(ANDROID)
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
# if (ANDROID_ABI STREQUAL "armeabi-v7a")
# set(ANDROID_EXTRA_LIBS
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
# endif()
#endif()
#find_package(Qt5 COMPONENTS Core Quick LinguistTools Qml QuickControls2 REQUIRED)
# =================================================================================
# LIBRARIES
# =================================================================================
# OpenCV
set ( OpenCV_STATIC ON ) # Preffer STATIC Linking, but no guarantee
set ( OpenCV_SHARED OFF ) # Disable usage of SHARED, useless due to package CMake API
set ( OPENCV_WORLD OFF ) # In Theory, allows to use STATIC linking, but, in practice, still requires SHARED binaries
find_package ( OpenCV REQUIRED ) # Supported on Windows thanks to vcpkg =^_^=
# =================================================================================
# HEADERS
# =================================================================================
set ( ITDCV_HEADERS
# CONFIGS
#"${PROJECT_SRC_DIR_PREFIX}itdcv/config/numeric.hpp"
# CORE
"${PROJECT_SRC_DIR_PREFIX}/itdcv/win/main.hpp" )
# =================================================================================
# SOURCES
# =================================================================================
set ( ITDCV_SOURCES
# CORE
"${PROJECT_SRC_DIR_PREFIX}/itdcv/win/main.cpp" )
# =================================================================================
# RESOURCES
# =================================================================================
# Localizations
# =================================================================================
# BUILD
# =================================================================================
# Platform
if ( ANDROID ) # Android
# Add SHARED Library for Android
add_library ( itdcv SHARED ${ITDCV_SOURCES} ${ITDCV_HEADERS} )
else ( ANDROID ) # Desktop (Mac, Windows, Linux)
# Add Executable-Object
add_executable ( itdcv ${ITDCV_SOURCES} ${ITDCV_HEADERS} )
# Configure Executable Object
set_target_properties ( itdcv PROPERTIES
OUTPUT_NAME "ImageToDocument-CV"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}" )
endif ( ANDROID )
# Link with OpenCV
include_directories ( "${OpenCV_INCLUDE_DIRS}" )
#target_include_directories ( itdcv PUBLIC ${OpenCV_INCLUDE_DIRS} )
target_link_libraries ( itdcv ${OpenCV_LIBS} -static )
message ( STATUS "OpenCV Libs: ${OpenCV_LIBS}" )
target_compile_definitions( itdcv
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:Release>>:QT_QML_RELEASE> )