src.pro 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5 and above")
  2. equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 12): error("requires Qt 5.12 and above")
  3. QT += core gui widgets webenginewidgets webchannel network svg printsupport
  4. CONFIG -= qtquickcompiler
  5. unix:!mac:exists(/usr/bin/ld.gold) {
  6. CONFIG += use_gold_linker
  7. }
  8. # Enable message log in release build
  9. DEFINES += QT_MESSAGELOGCONTEXT
  10. TARGET = vnote
  11. TEMPLATE = app
  12. win32:CONFIG(release, debug|release) {
  13. SRC_DESTDIR = $$OUT_PWD/release
  14. } else:win32:CONFIG(debug, debug|release) {
  15. SRC_DESTDIR = $$OUT_PWD/debug
  16. } else {
  17. SRC_DESTDIR = $$OUT_PWD
  18. }
  19. RC_ICONS = data/core/icons/vnote.ico
  20. ICON = data/core/icons/vnote.icns
  21. TRANSLATIONS += data/core/translations/vnote_zh_CN.ts
  22. SOURCES += \
  23. main.cpp
  24. INCLUDEPATH *= $$PWD
  25. LIBS_FOLDER = $$PWD/../libs
  26. include($$LIBS_FOLDER/vtextedit/src/editor/editor_export.pri)
  27. include($$LIBS_FOLDER/vtextedit/src/libs/syntax-highlighting/syntax-highlighting_export.pri)
  28. include($$PWD/utils/utils.pri)
  29. include($$PWD/core/core.pri)
  30. include($$PWD/widgets/widgets.pri)
  31. RESOURCES += \
  32. $$PWD/data/core/core.qrc
  33. RCC_BINARY_SOURCES += $$PWD/data/extra/extra.qrc
  34. win32 {
  35. rcc_binary.commands = $$shell_path($$[QT_HOST_BINS]/rcc.exe) -name ${QMAKE_FILE_IN_BASE} -binary ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
  36. rcc_binary.depend_command = $$shell_path($$[QT_HOST_BINS]/rcc.exe) -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN}
  37. } else {
  38. rcc_binary.commands = $$[QT_HOST_BINS]/rcc -name ${QMAKE_FILE_IN_BASE} -binary ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
  39. rcc_binary.depend_command = $$[QT_HOST_BINS]/rcc -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN}
  40. }
  41. rcc_binary.input = RCC_BINARY_SOURCES
  42. rcc_binary.output = $$SRC_DESTDIR/vnote_${QMAKE_FILE_IN_BASE}.rcc
  43. rcc_binary.CONFIG += no_link target_predeps
  44. QMAKE_EXTRA_COMPILERS += rcc_binary
  45. OTHER_FILES += $$RCC_BINARY_SOURCES
  46. macx {
  47. QMAKE_INFO_PLIST = data/core/Info.plist
  48. # Process VTextEdit framework
  49. vte_lib_name = VTextEdit
  50. vte_lib_dir = $${OUT_PWD}/../libs/vtextedit/src/editor
  51. vte_lib_full_name = $${vte_lib_name}.framework/Versions/1/$${vte_lib_name}
  52. app_bundle_dir = $${TARGET}.app/Contents/MacOS
  53. app_target = $${app_bundle_dir}/$${TARGET}
  54. QMAKE_POST_LINK += \
  55. install_name_tool -add_rpath $${vte_lib_dir} $${app_target} && \
  56. install_name_tool -change $${vte_lib_full_name} @rpath/$${vte_lib_full_name} $${app_target} &&
  57. # Process VSyntaxHighlighting framework
  58. sh_lib_name = VSyntaxHighlighting
  59. sh_lib_dir = $${OUT_PWD}/../libs/vtextedit/src/libs/syntax-highlighting
  60. sh_lib_full_name = $${sh_lib_name}.framework/Versions/1/$${sh_lib_name}
  61. QMAKE_POST_LINK += \
  62. install_name_tool -add_rpath $${sh_lib_dir} $${app_target} && \
  63. install_name_tool -change $${sh_lib_full_name} @rpath/$${sh_lib_full_name} $${app_target}
  64. # Move vnote_extra.rcc to the bundle.
  65. BUNDLE_EXTRA_RCC.files = $${SRC_DESTDIR}/vnote_extra.rcc
  66. BUNDLE_EXTRA_RCC.path = Contents/MacOS
  67. QMAKE_BUNDLE_DATA += BUNDLE_EXTRA_RCC
  68. }
  69. ## INSTALLS
  70. unix:!macx {
  71. isEmpty(PREFIX): PREFIX = /usr
  72. DATADIR = $${PREFIX}/share
  73. BINDIR = $${PREFIX}/bin
  74. LIBDIR = $${PREFIX}/lib
  75. INCLUDEDIR = $${PREFIX}/include
  76. # install desktop file
  77. desktop.path = $${DATADIR}/applications
  78. desktop.files += data/core/vnote.desktop
  79. # install icons
  80. icon16.path = $${DATADIR}/icons/hicolor/16x16/apps
  81. icon16.files = data/core/logo/16x16/vnote.png
  82. icon32.path = $${DATADIR}/icons/hicolor/32x32/apps
  83. icon32.files = data/core/logo/32x32/vnote.png
  84. icon48.path = $${DATADIR}/icons/hicolor/48x48/apps
  85. icon48.files = data/core/logo/48x48/vnote.png
  86. icon64.path = $${DATADIR}/icons/hicolor/64x64/apps
  87. icon64.files = data/core/logo/64x64/vnote.png
  88. icon128.path = $${DATADIR}/icons/hicolor/128x128/apps
  89. icon128.files = data/core/logo/128x128/vnote.png
  90. icon256.path = $${DATADIR}/icons/hicolor/256x256/apps
  91. icon256.files = data/core/logo/256x256/vnote.png
  92. iconsvg.path = $${DATADIR}/icons/hicolor/scalable/apps
  93. iconsvg.files = data/core/logo/vnote.svg
  94. target.path = $${BINDIR}
  95. extraresource.path = $${BINDIR}
  96. extraresource.extra = cp $${SRC_DESTDIR}/vnote_extra.rcc $(INSTALL_ROOT)$${BINDIR}/vnote_extra.rcc
  97. INSTALLS += target desktop icon16 icon32 icon48 icon64 icon128 icon256 iconsvg
  98. INSTALLS += extraresource
  99. message("VNote will be installed in prefix $${PREFIX}")
  100. }