forked from Hopsan/hopsan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommon.prf
More file actions
105 lines (90 loc) · 3.02 KB
/
Common.prf
File metadata and controls
105 lines (90 loc) · 3.02 KB
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
#Determine debug extension, and debug output on/off
CONFIG(debug, debug|release) {
DEBUG_EXT = _d
DEFINES *= DEBUGCOMPILING
} else {
DEBUG_EXT =
DEFINES *= QT_NO_DEBUG_OUTPUT
DEFINES *= RELEASECOMPILING
}
#Add a defined value with the debug extension (that can be used in the code)
DEFINES *= DEBUG_EXT=$${DEBUG_EXT}
#Determine the dynamic link library file extension, typically .dll for Windows, .so for UNIX and .dylib for OSX
win32:DLL_EXT = .dll
unix:DLL_EXT = .so
macx:DLL_EXT = .dylib
#Add a defined value with the dll extension (that can be used in the code)
DEFINES *= DLL_EXT=$${DLL_EXT}
#Define the lib prefix for the different platforms, (not you can NOT change the prefix here)
unix:LIB_PREFIX = lib
win32:LIB_PREFIX =
macx:LIB_PREFIX = lib
DEFINES *= DLL_PREFIX=$${LIB_PREFIX}
# Set optimization flags
# Og = optimization that does not interfere with debugging
# O3 = highest optimization level for speed
CONFIG(debug, debug|release) {
#QMAKE_CXXFLAGS += -Og
}
CONFIG(release, debug|release) {
QMAKE_CXXFLAGS += -O3
}
#Determine if default component lib should be build in
#DEFINES *= HOPSAN_INTERNALDEFAULTCOMPONENTS
#Help function to select one of multiple choice paths to include
defineReplace(selectPath){
PATH = $$1
DEFAULT_PATHS = $$2
NAME = $$3
!exists($${PATH}) {
!isEmpty(PATH) {
!build_pass:message("The custom $${NAME} path $${PATH} does not exist!")
}
#Clear the path in case it containes rubish
PATH =
for(path,DEFAULT_PATHS){
isEmpty(PATH):exists($${path}){
PATH = $${path}
!build_pass:message("Setting $${NAME} path to one of the defaults $${PATH}")
}
}
} else {
!build_pass:message("Using custom $${NAME} path $${PATH}")
}
!exists($${PATH}){
!build_pass:message("The $${NAME} path $${PATH} does not exist")
}
return($${PATH})
}
#This function generates the command line code necessary to copy a certain file or files from src directory to dst directory
defineReplace(generateCopyDllCommand){
fileNames = $$1
srcDir = $$2
dstDir = $$3
files =
qmake_post_link =
#message(fileNames $$fileNames)
#message(srcDir $$srcDir)
#message(dstDir $$dstDir)
for(file, fileNames){
files += $${srcDir}/$${file}
}
#message(files $$files)
#On win32 we need to replace all slash with backslash (escaped backslashes)
win32 {
for(file, files){
qmake_post_link += $$quote(xcopy /Y \"$$replace(file,/,\\)\" \"$$replace(dstDir,/,\\)\"$$escape_expand(\\n\\t))
}
}
#On unix we dont need to replace slashes
unix {
for(file, files){
!macx:qmake_post_link += $$quote(cp -df $${file} $${dstDir}$$escape_expand(\\n\\t))
macx:qmake_post_link += $$quote(cp -fp $${file} $${dstDir}$$escape_expand(\\n\\t))
}
}
#message(qmake_post_link $${qmake_post_link})
return($$qmake_post_link)
}
#Make compile output clean
CONFIG += silent warn_on