-
Notifications
You must be signed in to change notification settings - Fork 87
/
package.cmake
executable file
·542 lines (489 loc) · 21.2 KB
/
package.cmake
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
#!/usr/bin/cmake -P
# Program:
# Package WizNotePlus and it's dependencies into a portable AppImage or MacOS dmg.
cmake_minimum_required(VERSION 3.5)
#============================================================================
# Options and Settings 选项和设置
#============================================================================
message("\nThe following variables must be confirmed:\n")
get_filename_component(OUTSIDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
# Your Qt5 libraries path. 你的Qt5库位置
if(NOT QTDIR)
# check default Qt library
execute_process(COMMAND qmake -query QT_INSTALL_PREFIX
OUTPUT_VARIABLE qt_dir
RESULT_VARIABLE result
)
if( (NOT result EQUAL "0") OR (NOT qt_dir) )
message(FATAL_ERROR "\nQTDIR is not valid, Qt5 library cannot be found !\nPlease define QTDIR!")
endif()
set(QTDIR ${qt_dir})
else()
# check user defined Qt library
find_file(qmake_file "bin/qmake" ${QTDIR})
execute_process(COMMAND ${qmake_file} -query QT_INSTALL_PREFIX
OUTPUT_VARIABLE qt_dir
RESULT_VARIABLE result
)
if( (NOT result EQUAL "0") OR (NOT qt_dir) )
message(FATAL_ERROR "\nQTDIR is not valid, Qt5 library cannot be found !\nPlease define QTDIR!")
else()
set(QTDIR ${qt_dir})
endif()
endif()
string(STRIP ${QTDIR} QTDIR)
if(NOT CMAKE_PREFIX_PATH)
set(CMAKE_PREFIX_PATH ${QTDIR})
endif()
message(STATUS "Using CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
# MacOSX.SDK
if(APPLE)
if(NOT CMAKE_OSX_SYSROOT)
execute_process(COMMAND xcodebuild -version -sdk macosx Path
OUTPUT_VARIABLE CMAKE_OSX_SYSROOT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
find_path(osx_sysroot "SDKSettings.plist" ${CMAKE_OSX_SYSROOT})
if(NOT osx_sysroot)
message(FATAL_ERROR "CMAKE_OSX_SYSROOT is not valid, macOS SDK cannot be found !\nPlease define CMAKE_OSX_SYSROOT!")
endif(NOT osx_sysroot)
endif(NOT CMAKE_OSX_SYSROOT)
message (STATUS "Using CMAKE_OSX_SYSROOT: ${CMAKE_OSX_SYSROOT}")
endif(APPLE)
# WizNotePlus source directory. 项目源代码位置
if(NOT WIZNOTE_SOURCE_DIR)
set(WIZNOTE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
endif()
message(STATUS "Using WIZNOTE_SOURCE_DIR: ${WIZNOTE_SOURCE_DIR}")
# Build directory. 项目构建位置
if(NOT WIZNOTE_BUILD_DIR)
set(WIZNOTE_BUILD_DIR ${OUTSIDE_DIR}/build-WizNotePlus)
endif()
message(STATUS "Using WIZNOTE_BUILD_DIR: ${WIZNOTE_BUILD_DIR}")
# Install or Package directory. 项目打包程序工作目录
if(NOT WIZNOTE_PACKAGE_DIR)
set(WIZNOTE_PACKAGE_DIR ${OUTSIDE_DIR}/package-WizNotePlus)
endif()
message(STATUS "Using WIZNOTE_PACKAGE_DIR: ${WIZNOTE_PACKAGE_DIR}")
# install_prefix WizNote. 项目安装位置
if(NOT WIZNOTE_INSTALL_PREFIX)
set(WIZNOTE_INSTALL_PREFIX ${WIZNOTE_PACKAGE_DIR}/WizNote)
if(APPLE)
set(WIZNOTE_INSTALL_PREFIX ${WIZNOTE_PACKAGE_DIR}/WizNote.app)
endif(APPLE)
endif()
message(STATUS "Using WIZNOTE_INSTALL_PREFIX: ${WIZNOTE_INSTALL_PREFIX}")
# auto detect proccess number
if(NOT CMAKE_BUILD_PARALLEL_LEVEL)
include(ProcessorCount)
ProcessorCount(N)
if(NOT N EQUAL 0)
set(CMAKE_BUILD_PARALLEL_LEVEL ${N})
endif()
endif()
message(STATUS "Using CMAKE_BUILD_PARALLEL_LEVEL: ${CMAKE_BUILD_PARALLEL_LEVEL}")
# Package output directory. 打包结果输出位置
if(NOT WIZNOTE_PACKAGE_OUTPUT_PATH)
set(WIZNOTE_PACKAGE_OUTPUT_PATH ${OUTSIDE_DIR})
endif()
if(NOT GENERATE_INSTALL_DIR)
option(GENERATE_INSTALL_DIR "Decide whether install or not." ON)
endif()
message(STATUS "GENERATE_INSTALL_DIR: ${GENERATE_INSTALL_DIR}")
if(NOT GENERATE_PACKAGE)
option(GENERATE_PACKAGE "Decide whether generate AppImage or not." ON)
endif()
message(STATUS "GENERATE_PACKAGE: ${GENERATE_PACKAGE}")
if(NOT USE_FCITX)
option(USE_FCITX "Decide whether use fcitx-qt5 or not." ON)
endif()
message(STATUS "USE_FCITX: ${USE_FCITX}")
if(NOT VERBOSE_LEVEL)
set(VERBOSE_LEVEL 0)
endif()
if(NOT CMAKE_VERBOSE_MAKEFILE)
set(CMAKE_VERBOSE_MAKEFILE FALSE)
endif()
# Extract WizNotePlus Version
file(STRINGS ${WIZNOTE_SOURCE_DIR}/CMakeLists.txt project_command_str
ENCODING UTF-8
REGEX "project\\(WizNotePlus VERSION (.*)\\)"
)
string(REGEX MATCH "([0-9]+)\.([0-9]+)\.([0-9]+)" WIZNOTEPLUS_VERSION ${project_command_str})
# Get build version
execute_process(
COMMAND git describe --tags
WORKING_DIRECTORY ${WIZNOTE_SOURCE_DIR}
OUTPUT_VARIABLE WIZNOTEPLUS_BUILD_VERSION
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "Fail to get build version!")
endif()
string(STRIP ${WIZNOTEPLUS_BUILD_VERSION} WIZNOTEPLUS_BUILD_VERSION)
#============================================================================
# Construct directory tree 构建目录树
#============================================================================
if(UNIX)
if(APPLE)
# MacOS platform
file(MAKE_DIRECTORY
${WIZNOTE_BUILD_DIR}
${WIZNOTE_PACKAGE_DIR}
${WIZNOTE_PACKAGE_DIR}/WizNote.app
${WIZNOTE_PACKAGE_DIR}/WizNote.app/Contents
${WIZNOTE_PACKAGE_DIR}/WizNote.app/Contents/Frameworks
)
else(APPLE)
# Linux platform
file(MAKE_DIRECTORY
${WIZNOTE_BUILD_DIR}
${WIZNOTE_PACKAGE_DIR}
)
endif(APPLE)
elseif(WIN32)
#TODO: Windows platform
file(MAKE_DIRECTORY
${WIZNOTE_BUILD_DIR}
${WIZNOTE_PACKAGE_DIR}
)
else(UNIX)
message(FATAL_ERROR "\nCan't detect which platform your are useing!")
endif(UNIX)
#============================================================================
# Configure and generate WizNotePlus project 生成 WizNotePlus CMake 项目
#============================================================================
if(UNIX)
if(APPLE)
# MacOS platform use Unix Makefiles generator.
message("\nStart configure and generate WizNotePlus project:\n")
execute_process(COMMAND ${CMAKE_COMMAND}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_INSTALL_PREFIX=${WIZNOTE_INSTALL_PREFIX}
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
-DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE}
-H${WIZNOTE_SOURCE_DIR} -B${WIZNOTE_BUILD_DIR}
-G "Unix Makefiles"
-UPDATE_TRANSLATIONS=YES
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "Fail to generate WizNotePlus project!")
endif()
else(APPLE)
# Linux platform use Unix Makefiles generator
message("\nStart configure and generate WizNotePlus project:\n")
execute_process(COMMAND ${CMAKE_COMMAND}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_INSTALL_PREFIX=${WIZNOTE_INSTALL_PREFIX}
-DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE}
-H${WIZNOTE_SOURCE_DIR} -B${WIZNOTE_BUILD_DIR}
-G "Unix Makefiles"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "Fail to generate WizNotePlus project!")
endif()
endif(APPLE)
elseif(WIN32)
# Windows platform use NMake Makefiles JOM generator
message("\nStart configure and generate WizNotePlus project:\n")
execute_process(COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_INSTALL_PREFIX=${WIZNOTE_INSTALL_PREFIX}
-DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE}
-H${WIZNOTE_SOURCE_DIR} -B${WIZNOTE_BUILD_DIR}
-G "NMake Makefiles JOM"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "Fail to generate WizNotePlus project!")
endif()
else(UNIX)
message(FATAL_ERROR "\nCan't detect which platform your are useing!")
endif(UNIX)
#============================================================================
# Build WizNotePlus project 调用本地工具构建项目
#============================================================================
message("\nStart build WizNotePlus project:\n")
execute_process(COMMAND ${CMAKE_COMMAND} --build ${WIZNOTE_BUILD_DIR} --target all
--config Release
--
-j ${CMAKE_BUILD_PARALLEL_LEVEL}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "Fail to build WizNotePlus project!")
endif()
#============================================================================
# Install WizNotePlus project 将项目安装到打包位置
#============================================================================
if(GENERATE_INSTALL_DIR)
if(UNIX)
# use Unix Makefiles generator
message("\nStart install WizNotePlus project:\n")
execute_process(COMMAND make install
WORKING_DIRECTORY ${WIZNOTE_BUILD_DIR}
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "Fail to install WizNotePlus project!")
endif()
elseif(WIN32)
# Windows platform
message("\nStart install WizNotePlus project:\n")
file(GLOB all_bin ${WIZNOTE_BUILD_DIR}/bin/*)
file(COPY ${all_bin} DESTINATION ${WIZNOTE_PACKAGE_DIR}/WizNote/bin )
file(GLOB all_share ${WIZNOTE_BUILD_DIR}/share/*)
file(COPY ${all_share} DESTINATION ${WIZNOTE_PACKAGE_DIR}/WizNote/share )
else()
# unavailable platform
message(FATAL_ERROR "\nCan't detect which platform your are useing!")
endif()
endif()
#============================================================================
# Package resource files 打包相关文件
#============================================================================
if(GENERATE_INSTALL_DIR)
if(UNIX)
if(APPLE)
# MacOS platform
# copy files
file(COPY ${WIZNOTE_BUILD_DIR}/bin/WizNote.app
DESTINATION ${WIZNOTE_PACKAGE_DIR}
)
# get build version
execute_process(
COMMAND git rev-list HEAD
COMMAND wc -l
COMMAND awk "{print $1}"
WORKING_DIRECTORY ${WIZNOTE_SOURCE_DIR}
OUTPUT_VARIABLE wiznote_build_version
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "Fail to get build version!")
endif()
# replace version
execute_process(COMMAND plutil
-replace CFBundleVersion
-string ${wiznote_build_version}
${WIZNOTE_PACKAGE_DIR}/WizNote.app/Contents/Info.plist
WORKING_DIRECTORY ${WIZNOTE_SOURCE_DIR}
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "Fail to replace build version to Info.plist!")
endif()
else(APPLE)
# Linux platform
# qtwebengine_dictionaries
file(COPY ${WIZNOTE_SOURCE_DIR}/share/qtwebengine_dictionaries
DESTINATION ${WIZNOTE_PACKAGE_DIR}/WizNote/bin)
# copy WizNote logos
option(CREATE_LOGO OFF)
if(CREATE_LOGO)
file(MAKE_DIRECTORY
${WIZNOTE_PACKAGE_DIR}/logo
${WIZNOTE_PACKAGE_DIR}/logo/hicolor
)
foreach(ICON_SIZE 16 32 64 128 256 512)
set(icon_dir ${WIZNOTE_PACKAGE_DIR}/logo/hicolor/${ICON_SIZE}x${ICON_SIZE})
file(MAKE_DIRECTORY ${icon_dir})
file(COPY ${WIZNOTE_SOURCE_DIR}/build/common/logo/wiznote${ICON_SIZE}.png
DESTINATION ${icon_dir}
)
file(RENAME ${icon_dir}/wiznote${ICON_SIZE}.png ${icon_dir}/wiznote.png)
endforeach(ICON_SIZE)
endif()
# copy desktop file
file(COPY ${WIZNOTE_SOURCE_DIR}/build/common/wiznote2.desktop
DESTINATION ${WIZNOTE_PACKAGE_DIR})
file(RENAME ${WIZNOTE_PACKAGE_DIR}/wiznote2.desktop
${WIZNOTE_PACKAGE_DIR}/wiznote.desktop)
# copy fcitx-qt5 library
if(USE_FCITX)
set(fcitx_lib_paths
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/
/usr/lib64/qt5/plugins/platforminputcontexts/
/usr/lib/qt/plugins/platforminputcontexts/
)
find_file(fcitx_qt5_lib libfcitxplatforminputcontextplugin.so ${fcitx_lib_paths})
find_file(fcitx5_qt5_lib libfcitx5platforminputcontextplugin.so ${fcitx_lib_paths})
if(NOT fcitx_qt5_lib AND NOT fcitx5_qt5_lib)
if(FCITX_QT5_LIB)
set(fcitx_qt5_lib ${FCITX_QT5_LIB})
elseif(FCITX5_QT5_LIB)
set(fcitx5_qt5_lib ${FCITX5_QT5_LIB})
else()
message(FATAL_ERROR "Fail to find fcitx-qt5 and fcitx5-qt5!"
" Please specify the path of fcitx-qt5 or fcitx5-qt5 library"
" with -DFCITX_QT5_LIB=<path/to/libfcitxplatforminputcontextplugin.so>"
" or -DFCITX5_QT5_LIB=<path/to/libfcitx5platforminputcontextplugin.so>"
" respectively")
endif()
endif()
file(MAKE_DIRECTORY
${WIZNOTE_PACKAGE_DIR}/WizNote/plugins/platforminputcontexts
)
if(fcitx_qt5_lib)
file(COPY ${fcitx_qt5_lib}
DESTINATION ${WIZNOTE_PACKAGE_DIR}/WizNote/plugins/platforminputcontexts)
endif()
if(fcitx5_qt5_lib)
file(COPY ${fcitx5_qt5_lib}
DESTINATION ${WIZNOTE_PACKAGE_DIR}/WizNote/plugins/platforminputcontexts)
endif()
endif(USE_FCITX)
endif(APPLE)
elseif(WIN32)
# Windows platform
else(UNIX)
# unavailable platform
message(FATAL_ERROR "\nCan't detect which platform your are useing!")
endif(UNIX)
endif(GENERATE_INSTALL_DIR)
#============================================================================
# Deploy Qt5 libraries and package WizNotePlus 部署Qt5并生成包
#============================================================================
if(GENERATE_INSTALL_DIR AND GENERATE_PACKAGE)
if(UNIX)
if(APPLE)
# MacOS platform
find_file(create_dmg "create-dmg" "${WIZNOTE_SOURCE_DIR}/external/create-dmg")
if (NOT create_dmg)
message(STATUS "Downloading dmg package tool...")
execute_process(COMMAND git submodule update --init -- ${WIZNOTE_SOURCE_DIR}/external/create-dmg
WORKING_DIRECTORY ${WIZNOTE_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
set(create_dmg "${WIZNOTE_SOURCE_DIR}/external/create-dmg/create-dmg")
endif()
# change Info.plist version.
#file(READ ${WIZNOTE_INSTALL_PREFIX}/Contents/Info.plist info_plist ENCODING UTF-8)
#string(REGEX REPLACE "<string>2.7.0</string>" "<string>${WIZNOTEPLUS_VERSION}</string>" info_plist "${info_plist}")
#file(WRITE ${WIZNOTE_INSTALL_PREFIX}/Contents/Info.plist "${info_plist}")
# deploy 3rdpaty libraries
message("\nStart deploy WizNotePlus project:\n")
execute_process(COMMAND ${QTDIR}/bin/macdeployqt
${WIZNOTE_INSTALL_PREFIX} -verbose=${VERBOSE_LEVEL}
-executable=${WIZNOTE_INSTALL_PREFIX}/Contents/MacOS/WizNote
-libpath=${QTDIR}
WORKING_DIRECTORY ${WIZNOTE_BUILD_DIR}
RESULT_VARIABLE macdeployqt_result
)
if(NOT macdeployqt_result EQUAL "0")
message(FATAL_ERROR
"\nFail to package WizNotePlus project!"
"\n-- Command: ${QTDIR}/bin/macdeployqt"
"\n-- Exit Code: ${macdeployqt_result}"
)
endif()
# execute_process(COMMAND python ${WIZNOTE_SOURCE_DIR}/external/macdeployqtfix.py
# ${WIZNOTE_INSTALL_PREFIX}/Contents/MacOS/WizNote ${QTDIR}
# WORKING_DIRECTORY ${WIZNOTE_BUILD_DIR}
# RESULT_VARIABLE macdeployqtfix_result
# )
# if(NOT macdeployqtfix_result EQUAL "0")
# message(FATAL_ERROR
# "\nFail to package WizNotePlus project!"
# "\n-- Command: python ${WIZNOTE_SOURCE_DIR}/external/macdeployqtfix.py"
# "\n-- Exit Code: ${macdeployqtfix_result}"
# )
# endif()
#FIXME: Should not add rpath by hand!
execute_process(COMMAND install_name_tool
-add_rpath "@executable_path/../Frameworks"
${WIZNOTE_INSTALL_PREFIX}/Contents/MacOS/WizNote
WORKING_DIRECTORY ${WIZNOTE_BUILD_DIR}
RESULT_VARIABLE rpath_result
)
if(NOT rpath_result EQUAL "0")
message(FATAL_ERROR
"\nFail to package WizNotePlus project!"
"\n-- Command: install_name_tool"
"\n-- Exit Code: ${rpath_result}"
)
endif()
# sign code
#set(APPLCERT "Developer ID Application: Beijing Wozhi Technology Co. Ltd (KCS8N3QJ92)")
#execute_process(COMMAND codesign --verbose=2 --deep --sign "${APPLCERT}" ${WIZNOTE_INSTALL_PREFIX}
# WORKING_DIRECTORY ${WIZNOTE_BUILD_DIR}
# RESULT_VARIABLE result
#)
#if(NOT result EQUAL "0")
# message(FATAL_ERROR "Fail to sign code!")
#endif()
# change Package format
set(package_home "${WIZNOTE_SOURCE_DIR}/macos-package")
set(package_output_path ${WIZNOTE_PACKAGE_OUTPUT_PATH})
set(volumn_name "wiznote-disk")
set(volumn_path "/Volumes/${volumn_name}")
# create dmg
file(REMOVE
${package_output_path}/Wiznote-macOS.dmg
)
execute_process(COMMAND ${create_dmg}
--volname ${volumn_name}
--background ${WIZNOTE_SOURCE_DIR}/resources/wiznote-disk-cover.jpg
--window-pos 200 120
--window-size 522 350
--icon-size 100
--icon "WizNote.app" 100 190
--hide-extension "WizNote.app"
--app-drop-link 400 190
--format UDZO
${package_output_path}/WizNotePlus-mac-${WIZNOTEPLUS_BUILD_VERSION}.dmg
${WIZNOTE_PACKAGE_DIR}/
WORKING_DIRECTORY ${WIZNOTE_SOURCE_DIR}
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "Fail to execute command:"
"${WIZNOTE_SOURCE_DIR}/external/create-dmg")
endif()
else(APPLE)
# Linux platform
message("\nStart package WizNotePlus project:\n")
execute_process(COMMAND ${WIZNOTE_SOURCE_DIR}/external/linuxdeployqt
${WIZNOTE_PACKAGE_DIR}/WizNote/share/applications/wiznote.desktop
-verbose=${VERBOSE_LEVEL} -appimage -qmake=${qmake_file}
WORKING_DIRECTORY ${OUTSIDE_DIR}
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "Fail to package WizNotePlus project!")
endif()
# Rename AppImage with VERSION.
file(GLOB wiznote_appimage_files
LIST_DIRECTORIES false
${OUTSIDE_DIR}/WizNote*.AppImage)
list(GET wiznote_appimage_files 0 wiznote_appimage_file)
string(REGEX REPLACE "WizNote\\-(.*)\\.AppImage"
"WizNotePlus-linux-\\1-${WIZNOTEPLUS_BUILD_VERSION}.AppImage" new_appimage_filename
${wiznote_appimage_file})
file(RENAME ${wiznote_appimage_file} ${new_appimage_filename})
endif(APPLE)
elseif(WIN32)
# Windows platform
message("\nStart package WizNotePlus project:\n")
execute_process(COMMAND ${QTDIR}/bin/windeployqt ${WIZNOTE_PACKAGE_DIR}/WizNote/bin/WizNote.exe
WORKING_DIRECTORY ${WIZNOTE_PACKAGE_DIR}
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "Fail to package WizNotePlus project!")
endif()
else(UNIX)
message(FATAL_ERROR "\nCan't detect which platform your are useing!")
endif(UNIX)
endif(GENERATE_INSTALL_DIR AND GENERATE_PACKAGE)