-
-
Notifications
You must be signed in to change notification settings - Fork 140
/
CMakeLists.txt
197 lines (161 loc) · 4.45 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
cmake_minimum_required (VERSION 3.12)
set (CMAKE_SYSTEM_NAME Windows)
option (WIN64 "Win 64-bit build" ON)
option (MULTITHREAD "Multithread change detection" OFF)
option (OTHER_MOVED_ICONS "Use alternative moves lines icons" ON)
# On Cmake invokation if debug logging is desired set the value of DLOG to include the bit-flag of each desired
# function to log:
# bit 0 - log compare algorithm
# bit 1 - log views synchronization
# bit 2 - log Notepad++ and Scintilla notifications
# bit 3 - log navigation commands diff visiting
set (DLOG 0 CACHE STRING "Flags for debug log messages")
if (UNIX OR MINGW)
set (CMAKE_SYSROOT "/usr")
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
if (WIN64)
set (toolchain_prefix x86_64-w64-mingw32)
else ()
set (toolchain_prefix i686-w64-mingw32)
endif ()
set (CMAKE_C_COMPILER ${CMAKE_SYSROOT}/bin/${toolchain_prefix}-gcc)
set (CMAKE_CXX_COMPILER ${CMAKE_SYSROOT}/bin/${toolchain_prefix}-g++)
set (CMAKE_RC_COMPILER ${CMAKE_SYSROOT}/bin/${toolchain_prefix}-windres)
set (win32_inc_dir ${CMAKE_SYSROOT}/${toolchain_prefix}/include)
set (win32_lib_dir ${CMAKE_SYSROOT}/${toolchain_prefix}/lib)
endif ()
project (ComparePlus)
if (UNIX OR MINGW)
set (defs
-DUNICODE -D_UNICODE -DMINGW_HAS_SECURE_API=1 -D_WIN32 -DWIN32
-D_WIN32_WINNT=0x0600 -DWIN32_LEAN_AND_MEAN -DNOCOMM -DUNIX
)
if (NOT DEBUG)
set (defs ${defs} -DNDEBUG)
endif ()
if (WIN64)
set (defs ${defs} -DWIN64)
message ("Win64 build is ON")
endif ()
if (MULTITHREAD)
set (defs ${defs} -DMULTITHREAD)
message ("Multithread change detection is ON")
endif ()
if (DLOG)
set (defs ${defs} -DDLOG=${DLOG})
message ("Debug log flags value: ${DLOG}")
endif ()
if (OTHER_MOVED_ICONS)
set (defs ${defs} -DOTHER_MOVED_ICONS)
message ("Using alternative moved lines icons.")
endif ()
set (CMAKE_CXX_FLAGS
"-std=c++14 -O3 -static-libgcc -static-libstdc++ -Wall -Wno-unknown-pragmas"
)
set (CMAKE_MODULE_LINKER_FLAGS
"-s"
)
set (CMAKE_SHARED_MODULE_PREFIX "")
else ()
set (defs
-DUNICODE -D_UNICODE -D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES -D_WIN32 -DWIN32
-D_WIN32_WINNT=0x0600 -DWIN32_LEAN_AND_MEAN -DNOCOMM -DMULTITHREAD
)
set (CMAKE_CXX_FLAGS
"/EHsc /LD /MT /MP /W4"
)
endif ()
set (project_rc_files
src/Compare.rc
)
set (project_sources
src/NppAPI/DockingFeature/StaticDialog.cpp
src/AboutDlg/URLCtrl.cpp
src/AboutDlg/AboutDialog.cpp
src/SettingsDlg/ColorCombo.cpp
src/SettingsDlg/ColorPopup.cpp
src/SettingsDlg/SettingsDialog.cpp
src/IgnoreRegexDlg/IgnoreRegexDialog.cpp
src/NavDlg/NavDialog.cpp
src/ProgressDlg/ProgressDlg.cpp
src/Engine/Engine.cpp
src/Tools.cpp
src/UserSettings.cpp
src/Compare.cpp
src/LibGit2/LibGit2Helper.cpp
src/NppHelpers.cpp
src/LibHelpers.cpp
src/SQLite/SqliteHelper.cpp
)
include_directories (
${win32_inc_dir}
src/
src/NppAPI/
src/NppAPI/DockingFeature/
src/Icons/
src/Engine/
src/AboutDlg/
src/SettingsDlg/
src/IgnoreRegexDlg/
src/NavDlg/
src/ProgressDlg/
src/SQLite/
src/LibGit2/
)
add_definitions (${defs})
add_library (ComparePlus MODULE ${project_rc_files} ${project_sources})
if (UNIX OR MINGW)
find_library (comctl32
NAMES libcomctl32.a
PATHS ${win32_lib_dir}
)
find_library (comdlg32
NAMES libcomdlg32.a
PATHS ${win32_lib_dir}
)
find_library (shlwapi
NAMES libshlwapi.a
PATHS ${win32_lib_dir}
)
find_library (msimg32
NAMES libmsimg32.a
PATHS ${win32_lib_dir}
)
find_library (uxtheme
NAMES libuxtheme.a
PATHS ${win32_lib_dir}
)
target_link_libraries (ComparePlus ${comctl32} ${comdlg32} ${shlwapi} ${msimg32} ${uxtheme})
set (INSTALL_PATH
"$ENV{HOME}/wine/drive_c/Program Files/Notepad++/plugins/ComparePlus"
)
install (FILES ${CMAKE_BINARY_DIR}/ComparePlus.dll
DESTINATION "${INSTALL_PATH}"
)
else ()
target_link_libraries (ComparePlus comctl32 comdlg32 shlwapi msimg32 uxtheme)
set (INSTALL_PATH
"${PROJECT_SOURCE_DIR}/Notepad++/plugins/ComparePlus"
)
install (TARGETS ComparePlus
DESTINATION "${INSTALL_PATH}"
)
endif ()
message ("Install destination: ${INSTALL_PATH}")
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch")
install (DIRECTORY libs/arm64/
DESTINATION "${INSTALL_PATH}/libs"
)
else()
install (DIRECTORY libs/x64/
DESTINATION "${INSTALL_PATH}/libs"
)
endif()
else()
install (DIRECTORY libs/x86/
DESTINATION "${INSTALL_PATH}/libs"
)
endif()