Add a configuration test to add /usr/local/lib in linkflags on FreeBSD

This commit is contained in:
Thomas Nagy 2016-05-01 17:03:55 +02:00
parent 568cd6881d
commit b70692dbb3
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
2 changed files with 20 additions and 11 deletions

View File

@ -15,26 +15,17 @@ def configure(conf):
conf.load('compiler_cxx qt5')
#conf.env.append_value('CXXFLAGS', ['-g']) # test
# Qt5 may be compiled with '-reduce-relocations' which requires dependent programs to have -fPIE or -fPIC?
frag = '#include <QApplication>\nint main(int argc, char **argv) {return 0;}\n'
uses = 'QT5CORE QT5WIDGETS QT5GUI'
try:
conf.check(features='qt5 cxx', use=uses, fragment=frag, msg='See if Qt files compile directly')
except conf.errors.ConfigurationError:
conf.check(features='qt5 cxx', use=uses, fragment=frag, uselib_store='qt5', cxxflags='-fPIE',
msg='Try again with -fPIE', okmsg='-fPIE seems to be required')
def build(bld):
# According to the Qt5 documentation:
# Qt classes in foo.h -> declare foo.h as a header to be processed by moc
# add the resulting moc_foo.cpp to the source files
# add the resulting moc_foo.cpp to the source files
# Qt classes in foo.cpp -> include foo.moc at the end of foo.cpp
#
bld(
features = 'qt5 cxx cxxprogram',
use = 'QT5CORE QT5GUI QT5SVG QT5WIDGETS',
source = 'main.cpp res.qrc but.ui foo.cpp',
moc = 'foo.h',
moc = 'foo.h',
target = 'window',
includes = '.',
lang = bld.path.ant_glob('linguist/*.ts'),

View File

@ -470,6 +470,24 @@ def configure(self):
self.add_qt5_rpath()
self.simplify_qt5_libs()
# Qt5 may be compiled with '-reduce-relocations' which requires dependent programs to have -fPIE or -fPIC?
frag = '#include <QApplication>\nint main(int argc, char **argv) {return 0;}\n'
uses = 'QT5CORE QT5WIDGETS QT5GUI'
try:
self.check(features='qt5 cxx', use=uses, fragment=frag, msg='See if Qt files compile directly')
except self.errors.ConfigurationError:
self.check(features='qt5 cxx', use=uses, fragment=frag, uselib_store='qt5', cxxflags='-fPIE',
msg='Try again with -fPIE', okmsg='-fPIE seems to be required')
# FreeBSD does not add /usr/local/lib and the pkg-config files do not provide it either :-/
from waflib import Utils
if Utils.unversioned_sys_platform() == 'freebsd':
frag = '#include <QApplication>\nint main(int argc, char **argv) { QApplication app(argc, argv); return NULL != (void*) (&app);}\n'
try:
self.check(features='qt5 cxx cxxprogram', use=uses, fragment=frag, msg='Can we link Qt programs on FreeBSD directly?')
except self.errors.ConfigurationError:
self.check(features='qt5 cxx cxxprogram', use=uses, uselib_store='qt5', libpath='/usr/local/lib', fragment=frag, msg='Is /usr/local/lib required?')
@conf
def find_qt5_binaries(self):
env = self.env