From fc9df1253fa6d3a8f86c06d9e9a0d531ba0f5b13 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Mon, 10 Oct 2016 19:42:09 +0200 Subject: Fix building Swift on 32-bit Linux distributions Some distributions ship Qt configured so it requires your application to be build with the -fPIC flag. This adds a SCons check for this so the flag is automatically added if required. Test-Information: Successfully build Swift and ran unit tests on Ubuntu 16.04 (32 bit and 64 bit) and Debian 8.6 (32 bit and 64 bit). Change-Id: I8016bcb43fa36a3becf946ec179d74cdceb1d147 diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index 1ecdf4e..c8313c2 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -74,6 +74,14 @@ myenv.EnableQt4Modules(qt4modules, debug = False, version = qt_version) myenv.Append(CPPPATH = ["."]) +# Qt requires applications to be build with the -fPIC flag on some 32-bit Linux distributions. +if env["PLATFORM"] == "posix" : + testEnv = myenv.Clone() + conf = Configure(testEnv) + if conf.CheckDeclaration("QT_REDUCE_RELOCATIONS", "#include ") and conf.CheckDeclaration("__i386__"): + myenv.AppendUnique(CXXFLAGS = "-fPIC") + testEnv = conf.Finish() + if env["PLATFORM"] == "win32" : #myenv.Append(LINKFLAGS = ["/SUBSYSTEM:CONSOLE"]) myenv.Append(LINKFLAGS = ["/SUBSYSTEM:WINDOWS"]) -- cgit v0.10.2-6-g49f6