libshit

Just some random shit
git clone https://git.neptards.moe/neptards/libshit.git
Log | Files | Refs | Submodules | README | LICENSE

wscript (3028B)


      1 # -*- mode: python -*-
      2 
      3 from waflib import Context
      4 libshit_cross = getattr(Context.g_module, 'LIBSHIT_CROSS', False)
      5 
      6 def options(ctx):
      7     ctx.load('boost')
      8     ctx.system_opt('boost', cross=libshit_cross)
      9     ctx.with_opt('libbacktrace', ['system', 'none'], 'none', cross=libshit_cross)
     10 
     11 def configure(ctx):
     12     def system_libbacktrace(ctx):
     13         ctx.check_cc(lib='backtrace')
     14     ctx.with_chk('libbacktrace', {'system': system_libbacktrace, 'none': None},
     15                  cross=libshit_cross, define='LIBSHIT_WITH_LIBBACKTRACE')
     16 
     17     def system_boost(ctx):
     18         ctx.check_boost(lib=getattr(Context.g_module, 'BOOST_LIBS', []))
     19         if ctx.env.BOOST_VERSION_NUMBER < 107700:
     20             ctx.fatal('Boost 1.77 or later required')
     21     def bundle_boost(ctx):
     22         if not ctx.path.find_node('boost/boost/filesystem.hpp'):
     23             ctx.fatal('No boost source at libshit/ext/boost/boost')
     24 
     25         ctx.env.SYSTEM_INCLUDES_BOOST = ctx.path.find_node('boost').abspath()
     26         # prevent the brain-dead autolink feature on windows, and maybe on
     27         # other platforms that implement this abomination
     28         ctx.env.append_value('DEFINES_BOOST', ['BOOST_ALL_NO_LIB'])
     29     ctx.with_chk('boost', {'system': system_boost, 'bundle': bundle_boost},
     30                  cross=libshit_cross)
     31 
     32 def build(ctx):
     33     if ctx.env.WITH_BOOST != 'bundle': return
     34 
     35     boost_libs = set(getattr(Context.g_module, 'BOOST_LIBS', []))
     36     defines = [
     37         'BOOST_SYSTEM_STATIC_LINK=1',
     38         'BOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF',
     39     ]
     40     if ctx.env.DEST_OS == 'vita':
     41         defines += ['BOOST_HAS_UNISTD_H']
     42 
     43     if 'system' in boost_libs:
     44         boost_libs.remove('system')
     45 
     46         ctx.stlib(idx     = 51000,
     47                   source  = 'boost/libs/system/src/error_code.cpp',
     48                   defines = defines,
     49                   target  = 'boost_system',
     50                   uselib  = 'BOOST EXT') # get proper includes
     51 
     52     if 'filesystem' in boost_libs:
     53         boost_libs.remove('filesystem')
     54 
     55         fs_src = [
     56             'boost/libs/filesystem/src/codecvt_error_category.cpp',
     57             'boost/libs/filesystem/src/directory.cpp',
     58             'boost/libs/filesystem/src/exception.cpp',
     59             'boost/libs/filesystem/src/operations.cpp',
     60             'boost/libs/filesystem/src/path.cpp',
     61             'boost/libs/filesystem/src/path_traits.cpp',
     62             'boost/libs/filesystem/src/portability.cpp',
     63             'boost/libs/filesystem/src/unique_path.cpp',
     64             'boost/libs/filesystem/src/utf8_codecvt_facet.cpp',
     65             'boost/libs/filesystem/src/windows_file_codecvt.cpp',
     66         ]
     67         ctx.stlib(idx     = 51001,
     68                   source  = fs_src,
     69                   defines = defines,
     70                   # hack: use our assert even here
     71                   includes = '../../src',
     72                   target  = 'boost_filesystem',
     73                   uselib  = 'BOOST EXT') # get proper includes
     74 
     75     if boost_libs: # empty set is false
     76         ctx.fatal("Unhandled boost libs: %s" % boost_libs)