-
Notifications
You must be signed in to change notification settings - Fork 7
/
QtADS.prf
191 lines (166 loc) · 7.38 KB
/
QtADS.prf
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
################################################################
# QtADS Library
# Copyright (C) 2012-2018 Framatome, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
################################################################
include ( ./QtADSconfig.pri )
include ( ./QtADSfunctions.pri )
contains(QTADS_CONFIG, QtADSDll) {
DEFINES *= QTADS_DLL
}
# Try to find the ADS libraries automatically.
# On Windows it will search for TwinCAT installations
# using the registry. Unix OS's will have to use the
# open-source ADS library (https://github.com/Beckhoff/ADS)
# and specify ADSPATH manually.
!isEmpty(ADSPATH):!exists($${ADSPATH}) {
ADSPATH =
}
win32:contains(QTADS_CONFIG, QtADSTwinCAT3) {
DEFINES *= USE_TWINCAT
isEmpty(ADSPATH) {
ADSPATH = C:/TwinCAT3/
!exists($${ADSPATH}):ADSPATH =
isEmpty(ADSPATH) {
message( "Searching for TwinCAT3 32-bit" )
SYSTEM_CMD = reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\Beckhoff\\TwinCAT3 /v "TwinCATDir"
system($${SYSTEM_CMD}) {
SYSTEM_RET = $$system($${SYSTEM_CMD})
FORLOOP = 3 4 5 6 7
for(i, FORLOOP):ADSPATH += $$member(SYSTEM_RET, $${i})
}
}
isEmpty(ADSPATH) {
message( "Searching for TwinCAT3 64-bit" )
SYSTEM_CMD = reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Beckhoff\\TwinCAT3 /v "TwinCATDir"
system($${SYSTEM_CMD}) {
SYSTEM_RET = $$system($${SYSTEM_CMD})
FORLOOP = 3 4 5 6 7
for(i, FORLOOP):ADSPATH += $$member(SYSTEM_RET, $${i})
}
}
isEmpty(ADSPATH) {
error("This library requires an installation of TwinCAT3 which was not found. Install TwinCAT3 or specify ADSPATH manually.")
} else {
wince60Beckhoff_HMI_600-x86-msvc2005 {
message( "Building for TwinCAT on WinCE")
exists("$${ADSPATH}AdsApi/TcAdsDll/Ce/lib/x86/TcAdsDllCe.lib") {
LIBS *= "$${ADSPATH}AdsApi/TcAdsDll/Ce/lib/x86/TcAdsDllCe.lib"
} else {
error("Unable to locate ADSLib: $${ADSPATH}/AdsApi/TcAdsDllCe/lib/x86/TcAdsDllCe.lib")
}
} else {
contains(QMAKE_TARGET.arch, x86_64):{
message( "Building for 64 bit TwinCAT3")
exists("$${ADSPATH}AdsApi/TcAdsDll/x64/lib/TcAdsDll.lib") {
LIBS *= "$${ADSPATH}AdsApi/TcAdsDll/x64/lib/TcAdsDll.lib"
} else {
error("Unable to locate ADSLib: $${ADSPATH}AdsApi/TcAdsDll/x64/lib/TcAdsDll.lib")
}
}
contains(QMAKE_TARGET.arch, x86):{
message( "Building for 32 bit TwinCAT3")
exists("$${ADSPATH}AdsApi/TcAdsDll/Lib/TcAdsDll.lib") {
LIBS *= "$${ADSPATH}AdsApi/TcAdsDll/Lib/TcAdsDll.lib"
} else {
error("Unable to locate ADSLib: $${ADSPATH}AdsApi/TcAdsDll/Lib/TcAdsDll.lib")
}
}
}
}
}
}
win32:contains(QTADS_CONFIG, QtADSTwinCAT2) {
DEFINES *= USE_TWINCAT
isEmpty(ADSPATH) {
message( "Searching for TwinCAT2 32-bit" )
SYSTEM_CMD = reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\Beckhoff\\TwinCAT /v "InstallationPath"
system($${SYSTEM_CMD}) {
SYSTEM_RET = $$system($${SYSTEM_CMD})
FORLOOP = 7 8 9 10 11 12 13 14 15 16
for(i, FORLOOP):ADSPATH += $$member(SYSTEM_RET, $${i})
}
}
isEmpty(ADSPATH) {
message( "Searching for TwinCAT2 64-bit" )
SYSTEM_CMD = reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Beckhoff\\TwinCAT /v "InstallationPath"
system($${SYSTEM_CMD}) {
SYSTEM_RET = $$system($${SYSTEM_CMD})
FORLOOP = 3 4 5 6 7
for(i, FORLOOP):ADSPATH += $$member(SYSTEM_RET, $${i})
}
}
isEmpty(ADSPATH) {
error("This library requires an installation of TwinCAT2 which was not found. Install TwinCAT2 or specify ADSPATH manually.")
} else {
wince60Beckhoff_HMI_600-x86-msvc2005 {
message( "Building for TwinCAT on WinCE")
exists("$${ADSPATH}ADS Api/TcAdsDllCe/lib/x86/TcAdsDllCe.lib") {
LIBS *= "$${ADSPATH}ADS Api/TcAdsDllCe/lib/x86/TcAdsDllCe.lib"
} else {
error("Unable to locate ADSLib: $${ADSPATH}ADS Api/TcAdsDllCe/lib/x86/TcAdsDllCe.lib")
}
} else {
contains(QMAKE_TARGET.arch, x86_64):{
message( "Building for 64 bit TwinCAT2")
exists("$${ADSPATH}ADS Api/TcAdsDll/x64/lib/TcAdsDll.lib") {
LIBS *= "$${ADSPATH}ADS Api/TcAdsDll/x64/lib/TcAdsDll.lib"
} else {
error("Unable to locate ADSLib: $${ADSPATH}ADS Api/TcAdsDll/x64/lib/TcAdsDll.lib")
}
}
contains(QMAKE_TARGET.arch, x86):{
message( "Building for 32 bit TwinCAT2")
exists("$${ADSPATH}ADS Api/TcAdsDll/Lib/TcAdsDll.lib") {
LIBS *= "$${ADSPATH}ADS Api/TcAdsDll/Lib/TcAdsDll.lib"
} else {
error("Unable to locate ADSLib: $${ADSPATH}ADS Api/TcAdsDll/Lib/TcAdsDll.lib")
}
}
}
}
}
!contains(QTADS_CONFIG, QtADSDll):!contains(QTADS_CONFIG, QtADSTwinCAT2):!contains(QTADS_CONFIG, QtADSTwinCAT3) {
isEmpty(ADSPATH):error("This static library requires ADSLib and ADSPATH is not set.")
unix {
SYSTEM_RET = $$system(uname)
exists("$${ADSPATH}/AdsLib-$${SYSTEM_RET}.a") {
LIBS *= "$${ADSPATH}/AdsLib-$${SYSTEM_RET}.a"
} else {
error("Unable to locate ADSLib: $${ADSPATH}/AdsLib-$${SYSTEM_RET}.a")
}
} else {
exists("$${ADSPATH}/Release/AdsLib.lib"):release {
LIBS *= "$${ADSPATH}/Release/AdsLib.lib"
} else {
error("Unable to locate ADSLib: $${ADSPATH}/Release/AdsLib.lib")
}
exists("$${ADSPATH}/Debug/AdsLib.lib"):debug {
LIBS *= "$${ADSPATH}/Debug/AdsLib.lib"
}
}
}
contains(QTADS_CONFIG, QtADSFramework) {
INCLUDEPATH *= $${QTADS_INSTALL_LIBS}/QtADS.framework/Headers
}
else {
INCLUDEPATH *= $${QTADS_INSTALL_HEADERS}
}
qtadsAddLibrary($${QTADS_INSTALL_LIBS}, QtADS)