2020-11-16 06:44:05 +11:00
|
|
|
# vim: ft=qmake
|
2020-07-17 03:50:06 +10:00
|
|
|
# Custom functions
|
|
|
|
|
|
|
|
defineReplace(glob_filenames) {
|
|
|
|
for(pattern, ARGS) {
|
|
|
|
results *= $$files(src/$${pattern}, true)
|
|
|
|
}
|
|
|
|
return($$results)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Base configuration
|
|
|
|
|
2019-07-16 06:14:08 +10:00
|
|
|
# widgets: Make native file dialogs available to QML (must use QApplication)
|
2020-03-14 04:09:06 +11:00
|
|
|
QT = quick quickcontrols2 widgets
|
2019-08-31 10:13:38 +10:00
|
|
|
DEFINES += QT_DEPRECATED_WARNINGS
|
|
|
|
CONFIG += warn_off c++11 release
|
|
|
|
TEMPLATE = app
|
2019-07-03 03:59:52 +10:00
|
|
|
|
2019-08-31 10:13:38 +10:00
|
|
|
BUILD_DIR = build
|
|
|
|
MOC_DIR = $$BUILD_DIR/moc
|
2019-07-03 03:59:52 +10:00
|
|
|
OBJECTS_DIR = $$BUILD_DIR/obj
|
2019-08-31 10:13:38 +10:00
|
|
|
RCC_DIR = $$BUILD_DIR/rcc
|
2019-07-03 03:59:52 +10:00
|
|
|
|
|
|
|
QRC_FILE = $$BUILD_DIR/resources.qrc
|
2019-08-31 10:13:38 +10:00
|
|
|
|
2019-09-11 07:15:24 +10:00
|
|
|
RESOURCES += $$QRC_FILE
|
2020-07-17 03:50:06 +10:00
|
|
|
HEADERS += $$glob_filenames(*.h) submodules/hsluv-c/src/hsluv.h
|
|
|
|
SOURCES += $$glob_filenames(*.cpp) submodules/hsluv-c/src/hsluv.c
|
2022-01-15 06:27:59 +11:00
|
|
|
TARGET = moment
|
2019-08-31 10:13:38 +10:00
|
|
|
|
2020-07-11 14:51:53 +10:00
|
|
|
unix:!macx {
|
|
|
|
LIBS += -lX11 -lXss
|
|
|
|
}
|
|
|
|
|
2019-08-31 10:13:38 +10:00
|
|
|
|
|
|
|
# Custom CONFIG options
|
|
|
|
|
|
|
|
dev {
|
2020-07-17 09:09:09 +10:00
|
|
|
# Enable debugging and don't use the Qt Resource System to compile faster
|
2019-09-11 07:15:24 +10:00
|
|
|
CONFIG -= warn_off release
|
|
|
|
CONFIG += debug qml_debug declarative_debug
|
|
|
|
RESOURCES -= $$QRC_FILE
|
|
|
|
|
|
|
|
warning(make install cannot be used with the dev CONFIG option.)
|
2019-08-31 10:13:38 +10:00
|
|
|
}
|
|
|
|
|
2020-07-17 09:09:09 +10:00
|
|
|
no-x11 {
|
|
|
|
# Compile without X11-specific features (auto-away)
|
|
|
|
DEFINES += NO_X11
|
|
|
|
LIBS -= -lX11 -lXss
|
|
|
|
}
|
|
|
|
|
2019-08-31 10:13:38 +10:00
|
|
|
|
2020-11-16 06:44:05 +11:00
|
|
|
# Files to copy for `make install` command
|
2019-08-31 10:13:38 +10:00
|
|
|
|
2020-03-16 02:04:44 +11:00
|
|
|
!dev:unix {
|
2020-05-31 08:57:02 +10:00
|
|
|
isEmpty(PREFIX) { PREFIX = /usr/local }
|
2019-08-31 10:13:38 +10:00
|
|
|
|
2020-03-16 02:04:44 +11:00
|
|
|
executables.path = $$PREFIX/bin
|
|
|
|
executables.files = $$TARGET
|
|
|
|
|
|
|
|
shortcuts.path = $$PREFIX/share/applications
|
2022-01-15 06:27:59 +11:00
|
|
|
shortcuts.files = packaging/moment.desktop
|
2020-03-16 02:04:44 +11:00
|
|
|
|
2020-10-03 17:00:22 +10:00
|
|
|
icons256.path = $$PREFIX/share/icons/hicolor/256x256/apps
|
2022-01-15 06:27:59 +11:00
|
|
|
icons256.files = packaging/moment.png
|
2020-03-16 02:04:44 +11:00
|
|
|
|
2022-01-15 06:27:59 +11:00
|
|
|
examples.path = $$PREFIX/share/examples/moment
|
2021-01-04 16:14:38 +11:00
|
|
|
examples.files = src/config/settings.py
|
|
|
|
|
2022-01-25 01:26:30 +11:00
|
|
|
metainfo.path = $$PREFIX/share/metainfo
|
|
|
|
metainfo.files = packaging/moment.metainfo.xml
|
|
|
|
|
|
|
|
INSTALLS += executables shortcuts icons256 examples metainfo
|
2020-03-16 02:04:44 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
!dev:win32 {
|
|
|
|
executables.path = "C:/Program Files"
|
|
|
|
executables.files = $$TARGET
|
|
|
|
|
|
|
|
INSTALLS += executables
|
|
|
|
}
|
2019-07-03 03:59:52 +10:00
|
|
|
|
|
|
|
|
2020-11-16 06:44:05 +11:00
|
|
|
# Add `make test` command
|
2019-07-03 03:59:52 +10:00
|
|
|
|
2020-11-16 07:33:05 +11:00
|
|
|
test.commands = find src/gui -type f -name '*.qml' -exec qmllint '{}' + &&
|
|
|
|
test.commands += flake8 src/backend &&
|
|
|
|
test.commands += mypy --pretty src/backend
|
2019-07-03 03:59:52 +10:00
|
|
|
|
2020-11-16 06:44:05 +11:00
|
|
|
QMAKE_EXTRA_TARGETS += test
|
2019-07-03 03:59:52 +10:00
|
|
|
|
|
|
|
|
2020-11-16 06:44:05 +11:00
|
|
|
# Add stuff to `make clean` command
|
2019-07-03 03:59:52 +10:00
|
|
|
|
|
|
|
# Allow cleaning folders instead of just files
|
|
|
|
win32:QMAKE_DEL_FILE = rmdir /q /s
|
2019-08-31 10:13:38 +10:00
|
|
|
!win32:QMAKE_DEL_FILE = rm -rf
|
2019-07-03 03:59:52 +10:00
|
|
|
|
|
|
|
for(file, $$list($$glob_filenames(*.py))) {
|
|
|
|
PYCACHE_DIRS *= $$dirname(file)/__pycache__
|
2019-08-31 10:41:51 +10:00
|
|
|
PYCACHE_DIRS *= $$dirname(file)/.mypy_cache
|
2019-07-03 03:59:52 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
QMAKE_CLEAN *= $$MOC_DIR $$OBJECTS_DIR $$RCC_DIR $$PYCACHE_DIRS $$QRC_FILE
|
2022-01-15 06:27:59 +11:00
|
|
|
QMAKE_CLEAN *= $$BUILD_DIR $$TARGET Makefile moment.pro.user .qmake.stash
|
2020-03-16 02:51:30 +11:00
|
|
|
QMAKE_CLEAN *= $$glob_filenames(*.pyc, *.qmlc, *.jsc, *.egg-info)
|
2020-09-18 08:08:02 +10:00
|
|
|
QMAKE_CLEAN *= packaging/flatpak/flatpak-env
|
|
|
|
QMAKE_CLEAN *= packaging/flatpak/flatpak-pip-generator
|
|
|
|
QMAKE_CLEAN *= packaging/flatpak/flatpak-env-requirements.txt
|
2020-03-26 07:27:40 +11:00
|
|
|
QMAKE_CLEAN *= packaging/flatpak/flatpak-pip.json .flatpak-builder
|
2020-11-16 06:44:05 +11:00
|
|
|
|
|
|
|
|
|
|
|
# Generate resource file
|
|
|
|
|
|
|
|
RESOURCE_FILES *= $$glob_filenames(qmldir, *.qml, *.qpl, *.js, *.py)
|
2021-03-01 04:59:36 +11:00
|
|
|
RESOURCE_FILES *= $$glob_filenames( *.jpg, *.jpeg, *.png, *.svg, *.wav)
|
2020-11-16 06:44:05 +11:00
|
|
|
|
|
|
|
file_content += '<!-- vim: set ft=xml : -->'
|
|
|
|
file_content += '<!DOCTYPE RCC>'
|
|
|
|
file_content += '<RCC version="1.0">'
|
|
|
|
file_content += '<qresource prefix="/">'
|
|
|
|
|
|
|
|
for(file, RESOURCE_FILES) {
|
|
|
|
file_content += ' <file alias="$$file">../$$file</file>'
|
|
|
|
}
|
|
|
|
|
|
|
|
file_content += '</qresource>'
|
|
|
|
file_content += '</RCC>'
|
|
|
|
|
|
|
|
write_file($$QRC_FILE, file_content)
|