You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
3.0 KiB
Python
77 lines
3.0 KiB
Python
# -*- mode: python -*-
|
|
|
|
from waflib import Context
|
|
libshit_cross = getattr(Context.g_module, 'LIBSHIT_CROSS', False)
|
|
|
|
def options(ctx):
|
|
ctx.load('boost')
|
|
ctx.system_opt('boost', cross=libshit_cross)
|
|
ctx.with_opt('libbacktrace', ['system', 'none'], 'none', cross=libshit_cross)
|
|
|
|
def configure(ctx):
|
|
def system_libbacktrace(ctx):
|
|
ctx.check_cc(lib='backtrace')
|
|
ctx.with_chk('libbacktrace', {'system': system_libbacktrace, 'none': None},
|
|
cross=libshit_cross, define='LIBSHIT_WITH_LIBBACKTRACE')
|
|
|
|
def system_boost(ctx):
|
|
ctx.check_boost(lib=getattr(Context.g_module, 'BOOST_LIBS', []))
|
|
if ctx.env.BOOST_VERSION_NUMBER < 107700:
|
|
ctx.fatal('Boost 1.77 or later required')
|
|
def bundle_boost(ctx):
|
|
if not ctx.path.find_node('boost/boost/filesystem.hpp'):
|
|
ctx.fatal('No boost source at libshit/ext/boost/boost')
|
|
|
|
ctx.env.SYSTEM_INCLUDES_BOOST = ctx.path.find_node('boost').abspath()
|
|
# prevent the brain-dead autolink feature on windows, and maybe on
|
|
# other platforms that implement this abomination
|
|
ctx.env.append_value('DEFINES_BOOST', ['BOOST_ALL_NO_LIB'])
|
|
ctx.with_chk('boost', {'system': system_boost, 'bundle': bundle_boost},
|
|
cross=libshit_cross)
|
|
|
|
def build(ctx):
|
|
if ctx.env.WITH_BOOST != 'bundle': return
|
|
|
|
boost_libs = set(getattr(Context.g_module, 'BOOST_LIBS', []))
|
|
defines = [
|
|
'BOOST_SYSTEM_STATIC_LINK=1',
|
|
'BOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF',
|
|
]
|
|
if ctx.env.DEST_OS == 'vita':
|
|
defines += ['BOOST_HAS_UNISTD_H']
|
|
|
|
if 'system' in boost_libs:
|
|
boost_libs.remove('system')
|
|
|
|
ctx.stlib(idx = 51000,
|
|
source = 'boost/libs/system/src/error_code.cpp',
|
|
defines = defines,
|
|
target = 'boost_system',
|
|
uselib = 'BOOST EXT') # get proper includes
|
|
|
|
if 'filesystem' in boost_libs:
|
|
boost_libs.remove('filesystem')
|
|
|
|
fs_src = [
|
|
'boost/libs/filesystem/src/codecvt_error_category.cpp',
|
|
'boost/libs/filesystem/src/directory.cpp',
|
|
'boost/libs/filesystem/src/exception.cpp',
|
|
'boost/libs/filesystem/src/operations.cpp',
|
|
'boost/libs/filesystem/src/path.cpp',
|
|
'boost/libs/filesystem/src/path_traits.cpp',
|
|
'boost/libs/filesystem/src/portability.cpp',
|
|
'boost/libs/filesystem/src/unique_path.cpp',
|
|
'boost/libs/filesystem/src/utf8_codecvt_facet.cpp',
|
|
'boost/libs/filesystem/src/windows_file_codecvt.cpp',
|
|
]
|
|
ctx.stlib(idx = 51001,
|
|
source = fs_src,
|
|
defines = defines,
|
|
# hack: use our assert even here
|
|
includes = '../../src',
|
|
target = 'boost_filesystem',
|
|
uselib = 'BOOST EXT') # get proper includes
|
|
|
|
if boost_libs: # empty set is false
|
|
ctx.fatal("Unhandled boost libs: %s" % boost_libs)
|