forked from trikset/trikRuntime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.pri
107 lines (85 loc) · 2.95 KB
/
global.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
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
# Copyright 2014 CyberTech Co. Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Build settings common to all projects in TrikRuntime.
# Provides:
# CONFIGURATION_SUFFIX variable that shall be consistently used in TARGET and LIBS variables in all projects.
# copyToDestdir function to copy arbitrary files and directories to DESTDIR
# uses function to automatically add a library to INCLUDEPATH and LIBS.
CROSS_COMPILE = $$(CROSS_COMPILE)
!isEmpty(CROSS_COMPILE) {
ARCHITECTURE = arm
} else {
ARCHITECTURE = x86
}
CONFIG(debug, debug | release) {
CONFIGURATION = $$ARCHITECTURE-debug
CONFIGURATION_SUFFIX = -$$ARCHITECTURE-d
} else {
CONFIGURATION = $$ARCHITECTURE-release
equals(ARCHITECTURE, "arm") {
CONFIGURATION_SUFFIX =
} else {
CONFIGURATION_SUFFIX = -$$ARCHITECTURE
}
}
DESTDIR = $$PWD/bin/$$CONFIGURATION
PROJECT_BASENAME = $$basename(_PRO_FILE_)
PROJECT_NAME = $$section(PROJECT_BASENAME, ".", 0, 0)
TARGET = $$PROJECT_NAME$$CONFIGURATION_SUFFIX
equals(TEMPLATE, app) {
!macx {
QMAKE_LFLAGS += -Wl,-O1,-rpath,.
QMAKE_LFLAGS += -Wl,-rpath-link,$$DESTDIR
}
}
OBJECTS_DIR = .build/$$CONFIGURATION/.obj
MOC_DIR = .build/$$CONFIGURATION/.moc
RCC_DIR = .build/$$CONFIGURATION/.rcc
UI_DIR = .build/$$CONFIGURATION/.ui
INCLUDEPATH += $$_PRO_FILE_PWD_ \
$$_PRO_FILE_PWD_/include/$$PROJECT_NAME \
unix {
target.path = $$[INSTALL_ROOT]/
INSTALLS += target
}
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CXXFLAGS += -Wextra -Wcast-qual -Wwrite-strings -Wredundant-decls -Wunreachable-code -Wnon-virtual-dtor -Woverloaded-virtual
GLOBAL_PWD = $$PWD
# Useful function to copy additional files to destination,
# from http://stackoverflow.com/questions/3984104/qmake-how-to-copy-a-file-to-the-output
defineTest(copyToDestdir) {
FILES = $$1
for(FILE, FILES) {
# This ugly code is needed because xcopy requires to add source directory name to target directory name when copying directories
win32:AFTER_SLASH = $$section(FILE, "/", -1, -1)
win32:BASE_NAME = $$section(FILE, "/", -2, -2)
win32:equals(AFTER_SLASH, ""):DESTDIR_SUFFIX = /$$BASE_NAME
win32:FILE ~= s,/$,,g
win32:FILE ~= s,/,\,g
DDIR = $$DESTDIR$$DESTDIR_SUFFIX/
win32:DDIR ~= s,/,\,g
QMAKE_POST_LINK += $(COPY_DIR) $$quote($$FILE) $$quote($$DDIR) $$escape_expand(\\n\\t)
}
export(QMAKE_POST_LINK)
}
defineTest(uses) {
LIBS += -L$$DESTDIR
PROJECTS = $$1
for(PROJECT, PROJECTS) {
LIBS += -l$$PROJECT$$CONFIGURATION_SUFFIX
INCLUDEPATH += $$GLOBAL_PWD/$$PROJECT/include
}
export(LIBS)
export(INCLUDEPATH)
}