moment.pro 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # vim: ft=qmake
  2. # Custom functions
  3. defineReplace(glob_filenames) {
  4. for(pattern, ARGS) {
  5. results *= $$files(src/$${pattern}, true)
  6. }
  7. return($$results)
  8. }
  9. # Base configuration
  10. # widgets: Make native file dialogs available to QML (must use QApplication)
  11. QT = quick quickcontrols2 widgets
  12. DEFINES += QT_DEPRECATED_WARNINGS
  13. CONFIG += warn_off c++11 release
  14. TEMPLATE = app
  15. BUILD_DIR = build
  16. MOC_DIR = $$BUILD_DIR/moc
  17. OBJECTS_DIR = $$BUILD_DIR/obj
  18. RCC_DIR = $$BUILD_DIR/rcc
  19. QRC_FILE = $$BUILD_DIR/resources.qrc
  20. RESOURCES += $$QRC_FILE
  21. HEADERS += $$glob_filenames(*.h) submodules/hsluv-c/src/hsluv.h
  22. SOURCES += $$glob_filenames(*.cpp) submodules/hsluv-c/src/hsluv.c
  23. TARGET = moment
  24. unix:!macx {
  25. LIBS += -lX11 -lXss
  26. }
  27. # Custom CONFIG options
  28. dev {
  29. # Enable debugging and don't use the Qt Resource System to compile faster
  30. CONFIG -= warn_off release
  31. CONFIG += debug qml_debug declarative_debug
  32. RESOURCES -= $$QRC_FILE
  33. warning(make install cannot be used with the dev CONFIG option.)
  34. }
  35. no-x11 {
  36. # Compile without X11-specific features (auto-away)
  37. DEFINES += NO_X11
  38. LIBS -= -lX11 -lXss
  39. }
  40. # Files to copy for `make install` command
  41. !dev:unix {
  42. isEmpty(PREFIX) { PREFIX = /usr/local }
  43. executables.path = $$PREFIX/bin
  44. executables.files = $$TARGET
  45. shortcuts.path = $$PREFIX/share/applications
  46. shortcuts.files = packaging/moment.desktop
  47. icons256.path = $$PREFIX/share/icons/hicolor/256x256/apps
  48. icons256.files = packaging/moment.png
  49. examples.path = $$PREFIX/share/examples/moment
  50. examples.files = src/config/settings.py
  51. metainfo.path = $$PREFIX/share/metainfo
  52. metainfo.files = packaging/moment.metainfo.xml
  53. INSTALLS += executables shortcuts icons256 examples metainfo
  54. }
  55. !dev:win32 {
  56. executables.path = "C:/Program Files"
  57. executables.files = $$TARGET
  58. INSTALLS += executables
  59. }
  60. # Add `make test` command
  61. test.commands = find src/gui -type f -name '*.qml' -exec qmllint '{}' + &&
  62. test.commands += flake8 src/backend &&
  63. test.commands += mypy --pretty src/backend
  64. QMAKE_EXTRA_TARGETS += test
  65. # Add stuff to `make clean` command
  66. # Allow cleaning folders instead of just files
  67. win32:QMAKE_DEL_FILE = rmdir /q /s
  68. !win32:QMAKE_DEL_FILE = rm -rf
  69. for(file, $$list($$glob_filenames(*.py))) {
  70. PYCACHE_DIRS *= $$dirname(file)/__pycache__
  71. PYCACHE_DIRS *= $$dirname(file)/.mypy_cache
  72. }
  73. QMAKE_CLEAN *= $$MOC_DIR $$OBJECTS_DIR $$RCC_DIR $$PYCACHE_DIRS $$QRC_FILE
  74. QMAKE_CLEAN *= $$BUILD_DIR $$TARGET Makefile moment.pro.user .qmake.stash
  75. QMAKE_CLEAN *= $$glob_filenames(*.pyc, *.qmlc, *.jsc, *.egg-info)
  76. QMAKE_CLEAN *= packaging/flatpak/flatpak-env
  77. QMAKE_CLEAN *= packaging/flatpak/flatpak-pip-generator
  78. QMAKE_CLEAN *= packaging/flatpak/flatpak-env-requirements.txt
  79. QMAKE_CLEAN *= packaging/flatpak/flatpak-pip.json .flatpak-builder
  80. # Generate resource file
  81. RESOURCE_FILES *= $$glob_filenames(qmldir, *.qml, *.qpl, *.js, *.py)
  82. RESOURCE_FILES *= $$glob_filenames( *.jpg, *.jpeg, *.png, *.svg, *.wav)
  83. file_content += '<!-- vim: set ft=xml : -->'
  84. file_content += '<!DOCTYPE RCC>'
  85. file_content += '<RCC version="1.0">'
  86. file_content += '<qresource prefix="/">'
  87. for(file, RESOURCE_FILES) {
  88. file_content += ' <file alias="$$file">../$$file</file>'
  89. }
  90. file_content += '</qresource>'
  91. file_content += '</RCC>'
  92. write_file($$QRC_FILE, file_content)