-
Notifications
You must be signed in to change notification settings - Fork 53
/
CMakeLists.txt
144 lines (116 loc) · 3.31 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
cmake_minimum_required (VERSION 2.8)
set (CMAKE_SYSTEM_NAME Windows)
if (UNIX OR MINGW)
set (CMAKE_SYSROOT "$ENV{HOME}/bin/cross")
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set (toolchain_prefix i686-w64-mingw32)
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 (UNIX OR MINGW)
project (Compare)
if (UNIX OR MINGW)
set (defs
-DUNICODE -D_UNICODE -DMINGW_HAS_SECURE_API=1 -D_WIN32 -DWIN32
-D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN -DNOCOMM -DNDEBUG
)
set (CMAKE_CXX_FLAGS
"-std=c++11 -O3 -mwindows -mthreads -municode -Wall -Wno-unknown-pragmas"
)
set (CMAKE_MODULE_LINKER_FLAGS
"-s"
)
else (UNIX OR MINGW)
set (defs
-DUNICODE -D_UNICODE -D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES -D_WIN32 -DWIN32
-D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN -DNOCOMM
)
set (CMAKE_CXX_FLAGS
"/EHsc /MP /W4"
)
endif (UNIX OR MINGW)
set (project_rc_files
src/Compare.rc
)
set (project_sources
src/NppAPI/StaticDialog.cpp
src/AboutDlg/URLCtrl.cpp
src/AboutDlg/AboutDialog.cpp
src/SettingsDlg/ColorCombo.cpp
src/SettingsDlg/ColorPopup.cpp
src/SettingsDlg/SettingsDialog.cpp
src/NavDlg/NavDialog.cpp
src/ProgressDlg/ProgressDlg.cpp
src/Engine/Engine.cpp
src/Tools.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/XpmIcons/
src/Engine/
src/AboutDlg/
src/SettingsDlg/
src/NavDlg/
src/ProgressDlg/
src/SQLite/
src/LibGit2/
)
add_definitions (${defs})
add_library (ComparePlugin 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}
)
target_link_libraries (ComparePlugin ${comctl32} ${comdlg32} ${shlwapi} ${msimg32})
install (FILES ${CMAKE_BINARY_DIR}/libComparePlugin.dll
DESTINATION "$ENV{HOME}/.wine/drive_c/Program Files/Notepad++/plugins"
RENAME ComparePlugin.dll
)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
install (DIRECTORY libs/x64/
DESTINATION "$ENV{HOME}/.wine/drive_c/Program Files/Notepad++/plugins/ComparePlugin"
)
else()
install (DIRECTORY libs/x86/
DESTINATION "$ENV{HOME}/.wine/drive_c/Program Files/Notepad++/plugins/ComparePlugin"
)
endif()
else (UNIX OR MINGW)
target_link_libraries (ComparePlugin comctl32 comdlg32 shlwapi msimg32)
install (TARGETS ComparePlugin
DESTINATION "${PROJECT_SOURCE_DIR}/Notepad++/plugins"
)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
install (DIRECTORY libs/x64/
DESTINATION "${PROJECT_SOURCE_DIR}/Notepad++/plugins/ComparePlugin"
)
else()
install (DIRECTORY libs/x86/
DESTINATION "${PROJECT_SOURCE_DIR}/Notepad++/plugins/ComparePlugin"
)
endif()
endif (UNIX OR MINGW)