问题
I have a Qt Version that supports following ABI's (Qt Creator → Preferences → Build & Run / Qt Versions):
- arm-macos-generic-mach_o-32bit
- arm-macos-generic-mach_o-64bit
- x86-macos-generic-mach_o-32bit
- x86-macos-generic-mach_o-64bit
So, combining in a Qt Kit this Qt Version with different compilers I can build libs for all mentioned architectures.
At the same time the mkspecs/qconfig.pri
contains:
host_build {
QT_ARCH = x86_64
QT_TARGET_ARCH = arm
} else {
QT_ARCH = arm
}
So, in a .pro
file I can not detect a target architecture (it is always arm
). I can check CONFIG
for iphonesimulator
value and so detect arm/not arm architecture but there is still 32bit/64bit issue.
Is there a way to distinguish armv7/arm64/... builds in qmake (.pro file)?
回答1:
The only method I found is:
Qt Creator → Preferences → Build & Run / Kits → Environment → Change...
Than set specific IOS_ARCH
env var for each kit.
In .pro
file:
IOS_ARCH = $$(IOS_ARCH)
!isEmpty(IOS_ARCH): TARGET_ARCH = $$IOS_ARCH
# then use $$TARGET_ARCH as usual
来源:https://stackoverflow.com/questions/39338987/how-to-detect-target-ios-architecture-in-qmake