refactored 32/64bit detection in qmake files to avoid duplication

This commit is contained in:
Mathew Sutcliffe
2014-06-17 19:27:06 +01:00
parent 072667b3b4
commit 976de540e8
3 changed files with 59 additions and 76 deletions

View File

@@ -27,3 +27,45 @@ else {
VER_PAT = $${BLACK_VER_PAT} VER_PAT = $${BLACK_VER_PAT}
VERSION = $${BLACK_VERSION} VERSION = $${BLACK_VERSION}
} }
###########################
# Detect 32 or 64 bits
###########################
win32-msvc* {
win32:contains(QMAKE_TARGET.arch, x86_64) {
WORD_SIZE = 64
}
else {
WORD_SIZE = 32
}
}
win32-g++ {
WIN_FIND = $$(SYSTEMROOT)\system32\find
MINGW64 = $$system($$QMAKE_CXX -Q --help=target | $$WIN_FIND \"-m64\")
contains(MINGW64,[enabled]) {
WORD_SIZE = 64
}
else {
WORD_SIZE = 32
}
}
linux-g++ {
GCC64 = $$system($$QMAKE_CXX -Q --help=target | grep m64)
contains(MINGW64,[enabled]) {
WORD_SIZE = 64
}
else {
WORD_SIZE = 32
}
}
linux-g++-32 {
WORD_SIZE = 32
}
linux-g++-64 {
WORD_SIZE = 64
}
macx-clang {
# TODO
WORD_SIZE = 64
}

View File

@@ -24,56 +24,26 @@ isEmpty(EXTERNALDIR) {
INCLUDEPATH *= $$EXTERNALDIR/include INCLUDEPATH *= $$EXTERNALDIR/include
# and the library path depending on the used compiler # and the library path depending on the used compiler
win32-msvc2010 { win32-msvc2010 {
win32:contains(QMAKE_TARGET.arch, x86_64) { equals(WORD_SIZE,64): LIBS *= -L$$EXTERNALDIR/vs2010_64/lib
LIBS *= -L$$EXTERNALDIR/vs2010_64/lib equals(WORD_SIZE,32): LIBS *= -L$$EXTERNALDIR/vs2010_32/lib
} equals(WORD_SIZE,32): LIBS += -luser32
win32:contains(QMAKE_TARGET.arch, x86) {
LIBS *= -L$$EXTERNALDIR/vs2010_32/lib
LIBS += -luser32
}
} }
win32-msvc2013 { win32-msvc2013 {
win32:contains(QMAKE_TARGET.arch, x86_64) { equals(WORD_SIZE,64): LIBS *= -L$$EXTERNALDIR/vs2013_64/lib
LIBS *= -L$$EXTERNALDIR/vs2013_64/lib equals(WORD_SIZE,32): LIBS *= -L$$EXTERNALDIR/vs2013_32/lib
} equals(WORD_SIZE,32): LIBS += -luser32
win32:contains(QMAKE_TARGET.arch, x86) {
LIBS *= -L$$EXTERNALDIR/vs2013_32/lib
LIBS += -luser32
}
} }
win32-g++ { win32-g++ {
WIN_FIND = $$(SYSTEMROOT)\system32\find equals(WORD_SIZE,64): LIBS *= -L$$EXTERNALDIR/mingw64/lib
MINGW64 = $$system($$QMAKE_CXX -Q --help=target | $$WIN_FIND \"-m64\") equals(WORD_SIZE,32): LIBS *= -L$$EXTERNALDIR/mingw32/lib
contains(MINGW64,[enabled]) {
LIBS *= -L$$EXTERNALDIR/mingw64/lib
}
else {
LIBS *= -L$$EXTERNALDIR/mingw32/lib
}
LIBS += -luser32 LIBS += -luser32
} }
linux-g++* {
linux-g++ { equals(WORD_SIZE,64): LIBS *= -L$$EXTERNALDIR/linux64/lib
GCC64 = $$system($$QMAKE_CXX -Q --help=target | grep m64) equals(WORD_SIZE,32): LIBS *= -L$$EXTERNALDIR/linux32/lib
contains(GCC64,[enabled]) {
LIBS *= -L$$EXTERNALDIR/linux64/lib
}
else {
LIBS *= -L$$EXTERNALDIR/linux32/lib
}
} }
linux-g++-32 {
LIBS *= -L$$EXTERNALDIR/linux32/lib
}
linux-g++-64 {
LIBS *= -L$$EXTERNALDIR/linux64/lib
}
macx-clang { macx-clang {
LIBS *= -L$$EXTERNALDIR/macx-clang64/lib equals(WORD_SIZE,64): LIBS *= -L$$EXTERNALDIR/macx-clang64/lib
equals(WORD_SIZE,32): LIBS *= -L$$EXTERNALDIR/macx-clang32/lib
} }

View File

@@ -27,46 +27,17 @@ linux:DEFINES += LIN
macx:DEFINES += APL macx:DEFINES += APL
# X-Plane plugins must follow a prescribed filename and directory structure. # X-Plane plugins must follow a prescribed filename and directory structure.
# CPU architecture detection copied from externals.pri;
# TODO: refactor so detection is is done in only one place.
TARGET_EXT = .xpl TARGET_EXT = .xpl
win32:TARGET = win win32:TARGET = win
linux:TARGET = lin linux:TARGET = lin
macx:TARGET = mac macx:TARGET = mac
win32:contains(QMAKE_TARGET.arch, x86_64) {
DESTDIR = ../../xbus/64
}
win32:contains(QMAKE_TARGET.arch, x86) {
DESTDIR = ../../xbus
}
win32-g++ {
WIN_FIND = $$(SYSTEMROOT)\system32\find
MINGW64 = $$system($$QMAKE_CXX -Q --help=target | $$WIN_FIND \"-m64\")
contains(MINGW64,[enabled]) {
DESTDIR = ../../xbus/64
}
else {
DESTDIR = ../../xbus
}
}
linux-g++ {
GCC64 = $$system($$QMAKE_CXX -Q --help=target | grep m64)
contains(GCC64,[enabled]) {
DESTDIR = ../../xbus/64
}
else {
DESTDIR = ../../xbus
}
}
linux-g++-64 {
DESTDIR = ../../xbus/64
}
linux-g++-32 {
DESTDIR = ../../xbus
}
macx { macx {
# a single dylib file contains both 32bit and 64bit binaries # a single dylib file contains both 32bit and 64bit binaries
DESTDIR = ../../xbus DESTDIR = ../../xbus
} }
else {
equals(WORD_SIZE,64): DESTDIR = ../../xbus/64
equals(WORD_SIZE,32): DESTDIR = ../../xbus
}
include (../../libraries.pri) include (../../libraries.pri)