-
Notifications
You must be signed in to change notification settings - Fork 12
/
common.pri
62 lines (48 loc) · 1.5 KB
/
common.pri
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
PROJECT_ROOT_DIR = $${PWD}
# If the msgfmt command is not found, reset the USE_GETTEX variable.
MSGFMT_MSG=$$system("msgfmt -V")
!contains(MSGFMT_MSG, "msgfmt"): unset(USE_GETTEXT)
!defined(PREFIX, var) {
unix:PREFIX = /usr/local
win32:PREFIX = $$(programfiles)
}
unix {
APP_DATA_ROOT_DIR = share
APP_BIN_DIR = bin
APP_DEF_DIR = $${APP_DATA_ROOT_DIR}/applications
APP_ICONS_DIR = $${APP_DATA_ROOT_DIR}/icons
APP_LOCALE_DIR = $${APP_DATA_ROOT_DIR}/locale
}
win32 {
APP_BIN_DIR = bin
APP_ICONS_DIR = icons
APP_LOCALE_DIR = locale
}
#
# function findFiles(dir, basename)
# Returns a list of files with this basename.
# The function searches for dir and subdir recursively.
#
defineReplace(findFiles) {
dir = $$1
base_name = $$2
file_list = $$files($$dir/$$base_name)
path_list = $$files($$dir/*)
for(path, path_list) {
file_list += $$findFiles($$path, $$base_name)
}
return ($$file_list)
}
defineReplace(getVersion) {
version_file = src/version.h
!exists ($${PROJECT_ROOT_DIR}/$${version_file}): error(In function getVersion: File \"$${version_file}\" not found)
version_header = $$cat($${PROJECT_ROOT_DIR}/$${version_file}, lines)
for (str, version_header) {
sub_str=$$split(str, " ")
contains (sub_str, APP_VERSION) {
ver_str=$$find(sub_str, '".*"')
!isEmpty(ver_str): return ($$split(ver_str, '"'))
}
}
error(In function getVersion: APP_VERSION not found in $${version_file})
}