libcruft-util/cruft/util/meson.build

630 lines
14 KiB
Meson

cpp = meson.get_compiler('cpp')
###############################################################################
dependencies = []
dependencies += dependency('fmt', version: '>=10')
###############################################################################
ragel = generator(
find_program('ragel'),
output: '@BASENAME@.cpp',
arguments: [ '@INPUT@', '-o@OUTPUT@', '-G2' ]
)
sources = [
]
###############################################################################
backtrace_dep = cpp.find_library('execinfo', required: false)
dbghelp_dep = cpp.find_library('dbghelp', required: false)
if cpp.has_function('backtrace', dependencies: [backtrace_dep])
sources += ['backtrace_execinfo.cpp']
dependencies += backtrace_dep
elif cpp.has_function('RtlCaptureStackBackTrace', dependencies: [dbghelp_dep])
sources += ['backtrace_stackwalk.cpp']
dependencies += dbghelp_dep
else
sources += ['backtrace_null.cpp']
endif
###############################################################################
# Platform wrappers
if host_machine.system() == 'linux'
sources += 'exe_linux.cpp'
elif host_machine.system() == 'freebsd'
sources += 'exe_freebsd.cpp'
elif host_machine.system() == 'windows'
sources += 'exe_win32.cpp'
else
error('Unhandled platform')
endif
##-----------------------------------------------------------------------------
sources += [
'posix/dir.cpp',
'posix/dir.hpp',
'posix/except.cpp',
'posix/except.hpp',
'posix/fd.cpp',
'posix/fd.hpp',
'posix/flock.cpp',
'posix/flock.hpp',
'posix/ostream.cpp',
'posix/ostream.hpp',
'posix/util.cpp',
'posix/util.hpp',
]
if host_machine.system() == 'linux'
sources += [
'thread/event_futex.cpp',
'thread/flag_futex.cpp',
'rand/system_linux.cpp',
'rand/system_linux.hpp',
]
endif
if host_machine.system() != 'windows'
sources += [
'buffer/circular.cpp',
'buffer/circular.hpp',
'buffer/paged.cpp',
'buffer/paged.hpp',
'memory/system.cpp',
'memory/system.hpp',
'debug_posix.cpp',
'debug/crash_posix.cpp',
'debug/fpe_posix.cpp',
'debug/system_posix.cpp',
'fs/tmp_posix.cpp',
'io_posix.cpp',
'io_posix.hpp',
'library_posix.hpp',
'library_posix.cpp',
'paths_posix.cpp',
'posix/fwd.hpp',
'posix/interface.hpp',
'posix/interface.cpp',
'posix/map.cpp',
'posix/map.hpp',
'posix/socket.cpp',
'posix/socket.hpp',
'time_posix.cpp',
]
endif
if host_machine.system() == 'windows'
sources += [
'debug_win32.cpp',
'debug/crash_win32.cpp',
'debug/fpe_win32.cpp',
'debug/system_win32.cpp',
'exe_win32.cpp',
'fs/tmp_win32.cpp',
'io_win32.cpp',
'io_win32.hpp',
'library_win32.cpp',
'library_win32.hpp',
'paths_win32.cpp',
'rand/system_win32.cpp',
'rand/system_win32.hpp',
'time_win32.cpp',
'win32/windows.hpp',
'win32/except.cpp',
'win32/except.hpp',
'win32/file.cpp',
'win32/file.hpp',
'win32/handle.cpp',
'win32/handle.hpp',
'win32/registry.cpp',
'win32/registry.hpp',
]
endif
###############################################################################
sources += [
'thread/event.hpp',
'thread/flag.hpp',
'thread/primitive.hpp',
'thread/semaphore.hpp',
]
if host_machine.system() == 'linux'
sources += [
'thread/event_futex.cpp',
'thread/event_futex.hpp',
'thread/semaphore_linux.hpp',
'thread/semaphore_linux.cpp',
'thread/flag_futex.cpp',
'thread/flag_futex.hpp',
]
elif host_machine.system() == 'windows'
sources += [
'thread/event_std.cpp',
'thread/event_std.hpp',
'thread/event_win32.cpp',
'thread/semaphore_win32.hpp',
'thread/semaphore_win32.cpp',
'thread/flag_std.cpp',
'thread/flag_std.hpp',
]
else
error ('Unsupported thread platform')
endif
if host_machine.cpu_family() == 'x86_64'
sources += [
'cpuid/x86.cpp',
'cpuid/x86.hpp',
]
else
warning('Unknown architecture @host_machine.cpu_family()@. Defaulting to null implementation')
sources += [
'cpuid/none.cpp',
'cpuid/none.hpp',
]
endif
if host_machine.system() == 'windows'
sources += 'sysinfo_win32.cpp'
else
sources += 'sysinfo_posix.cpp'
endif
###############################################################################
# Common files
sources += [
'fwd.hpp',
'adapter.hpp',
'adapter.cpp',
'algo/search.hpp',
'algo/sort.cpp',
'algo/sort.hpp',
'alloc/fwd.hpp',
'alloc/affix.cpp',
'alloc/affix.hpp',
'alloc/aligned/direct.hpp',
'alloc/aligned/foreign.hpp',
'alloc/allocator.cpp',
'alloc/allocator.hpp',
'alloc/chunked.cpp',
'alloc/chunked.hpp',
'alloc/easy.hpp',
'alloc/fallback.cpp',
'alloc/fallback.hpp',
'alloc/linear.cpp',
'alloc/linear.hpp',
'alloc/malloc.cpp',
'alloc/malloc.hpp',
'alloc/null.cpp',
'alloc/null.hpp',
'alloc/stack.cpp',
'alloc/stack.hpp',
'alloc/std.hpp',
'alloc/traits.hpp',
'alloc/traits.hpp',
'annotation.hpp',
'array/darray.hpp',
'array/md.cpp',
'array/md.hpp',
'array/parray.cpp',
'array/parray.hpp',
'array/sarray.cpp',
'array/sarray.hpp',
'array/varray.hpp',
'ascii.hpp',
'backtrace.hpp',
'bezier.cpp',
'bezier1.cpp',
'bezier2.cpp',
'bezier3.cpp',
'bezier.hpp',
'bitwise.cpp',
'bitwise.hpp',
'bool.cpp',
'bool.hpp',
'buffer/simple.cpp',
'buffer/simple.hpp',
'buffer/traits.hpp',
'cast.hpp',
'cmdopt.cpp',
'cmdopt.hpp',
'cmdopt2/fwd.hpp',
'cmdopt2/args.cpp',
'cmdopt2/args.hpp',
'cmdopt2/parser.cpp',
'cmdopt2/parser.hpp',
'colour.cpp',
'colour.hpp',
'concepts.hpp',
'concepts/clock.hpp',
'concepts/string.hpp',
'container.hpp',
'coord.hpp',
'coord/fwd.hpp',
'coord/base.hpp',
'coord/comparator.hpp',
'coord/init.hpp',
'coord/iostream.hpp',
'coord/ops.hpp',
'coord/store.hpp',
'coord/traits.hpp',
'cpp.cpp',
'cpp.hpp',
'cpuid.cpp',
'cpuid.hpp',
'debug/assert.cpp',
'debug/assert.hpp',
'debug/common.cpp',
'debug/common.hpp',
'debug/compiler.cpp',
'debug/compiler.hpp',
'debug/crash.hpp',
'debug/debugger.cpp',
'debug/debugger.hpp',
'debug/fpe.hpp',
'debug/fpe.cpp',
'debug/memory.cpp',
'debug/memory.hpp',
'debug/panic.cpp',
'debug/panic.hpp',
'debug/system.cpp',
'debug/system.hpp',
'debug/trace.cpp',
'debug/trace.hpp',
'debug/validate.cpp',
'debug/validate.hpp',
'debug/warn.cpp',
'debug/warn.hpp',
'encode/number.hpp',
'encode/base.cpp',
'encode/base.hpp',
'endian.cpp',
'endian.hpp',
'except.cpp',
'except.hpp',
'exe.hpp',
'expected.hpp',
'extent.cpp',
'extent.hpp',
'fixed.cpp',
'fixed.hpp',
'fixed_string.hpp',
'float.cpp',
'float.hpp',
'format/quoted.hpp',
'fourcc.cpp',
'fourcc.hpp',
'fs/scoped.cpp',
'fs/scoped.hpp',
'fs/tmp.hpp',
'functor.hpp',
'geom/fwd.hpp',
'geom/aabb.cpp',
'geom/aabb.hpp',
'geom/cylinder.cpp',
'geom/cylinder.hpp',
'geom/ellipse.cpp',
'geom/ellipse.hpp',
'geom/frustum.cpp',
'geom/frustum.hpp',
'geom/iostream.cpp',
'geom/iostream.hpp',
'geom/line.hpp',
'geom/line.cpp',
'geom/ops.cpp',
'geom/ops.hpp',
'geom/plane.cpp',
'geom/plane.hpp',
'geom/ray.cpp',
'geom/ray.hpp',
'geom/rect.cpp',
'geom/rect.hpp',
'geom/region.cpp',
'geom/sample/fwd.hpp',
'geom/sample/edge.hpp',
'geom/sample/surface.hpp',
'geom/sample/volume.hpp',
'geom/sample/subregion.hpp',
'geom/segment.cpp',
'geom/segment.hpp',
'geom/sphere.cpp',
'geom/sphere.hpp',
'geom/traits.hpp',
'geom/tri.cpp',
'geom/tri.hpp',
'hash.hpp',
'hash/fwd.hpp',
'hash/adapter.hpp',
'hash/adler.cpp',
'hash/adler.hpp',
'hash/buzhash.hpp',
'hash/bsdsum.cpp',
'hash/bsdsum.hpp',
'hash/crc.cpp',
'hash/crc.hpp',
'hash/fasthash.cpp',
'hash/fasthash.hpp',
'hash/fletcher.cpp',
'hash/fletcher.hpp',
'hash/fnv1a.cpp',
'hash/fnv1a.hpp',
'hash/halfsipmix.cpp',
'hash/halfsipmix.hpp',
'hash/mix.cpp',
'hash/mix.hpp',
'hash/murmur/common.cpp',
'hash/murmur/common.hpp',
'hash/murmur.hpp',
'hash/murmur/murmur1.cpp',
'hash/murmur/murmur1.hpp',
'hash/murmur/murmur2.cpp',
'hash/murmur/murmur2.hpp',
'hash/murmur/murmur3.cpp',
'hash/murmur/murmur3.hpp',
'hash/siphash.cpp',
'hash/siphash.hpp',
'hash/std.cpp',
'hash/std.hpp',
'hash/table.cpp',
'hash/table.hpp',
'hash/tuple.cpp',
'hash/tuple.hpp',
'hash/wang.hpp',
'hash/xxhash.cpp',
'hash/xxhash.hpp',
'init.cpp',
'init.hpp',
'introspection/enum_manual.cpp',
'introspection/enum_manual.hpp',
'introspection/enum_simple.cpp',
'introspection/enum_simple.hpp',
'introspection/name.cpp',
'introspection/name.hpp',
'introspection/type.cpp',
'introspection/type.hpp',
'io.cpp',
'io.hpp',
'iterator/cast.hpp',
'iterator/constant.hpp',
'iterator/counting.hpp',
'iterator/dereference.hpp',
'iterator/discard.hpp',
'iterator/indices.hpp',
'iterator/infix.hpp',
'iterator/iota.hpp',
'iterator/numeric.hpp',
'iterator/placement_output.hpp',
'iterator/referencing.hpp',
'iterator/transform.hpp',
'iterator/tuple_picker.hpp',
'iterator/unequal.hpp',
'iterator/unordered_insert.hpp',
'iterator/zip.hpp',
'job/fwd.hpp',
'job/dispatch.hpp',
'job/queue.cpp',
'job/queue.hpp',
'kmeans.hpp',
'library.hpp',
'list/node.hpp',
'list/sort.hpp',
'log.hpp',
'log/fwd.hpp',
'log/level.cpp',
'log/level.hpp',
'log/log.cpp',
'log/log.hpp',
'log/packet.cpp',
'log/packet.hpp',
'log/scoped.cpp',
'log/scoped.hpp',
'log/sink/base.cpp',
'log/sink/base.hpp',
'log/sink/console.cpp',
'log/sink/console.hpp',
'log/sink/null.cpp',
'log/sink/null.hpp',
'log/sink/path.cpp',
'log/sink/path.hpp',
'map/multi_fixed.cpp',
'map/multi_fixed.hpp',
'map/fixed.cpp',
'map/fixed.hpp',
'maths.cpp',
'maths.hpp',
'maths/fast.hpp',
'matrix.cpp',
'matrix2.cpp',
'matrix3.cpp',
'matrix4.cpp',
'matrix.hpp',
'memory/deleter.cpp',
'memory/deleter.hpp',
'parallel/queue.cpp',
'parallel/queue.hpp',
'parallel/stack.cpp',
'parallel/stack.hpp',
'parse/fwd.hpp',
'parse/enum.cpp',
'parse/enum.hpp',
'parse/time.cpp',
'parse/time.hpp',
'parse/value.cpp',
'parse/value.hpp',
'parse/si.cpp',
'parse/si.hpp',
'paths.cpp',
'paths.hpp',
'platform.hpp',
'point.cpp',
'point.hpp',
'pointer.hpp',
'polynomial.cpp',
'polynomial.hpp',
'pool.cpp',
'pool.hpp',
'quaternion.cpp',
'quaternion.hpp',
'rand/distribution/normal.cpp',
'rand/distribution/normal.hpp',
'rand/distribution/uniform.cpp',
'rand/distribution/uniform.hpp',
'rand/generic.hpp',
'rand/lcg.cpp',
'rand/lcg.hpp',
'rand/mwc64x.cpp',
'rand/mwc64x.hpp',
'rand/pcg.cpp',
'rand/pcg.hpp',
'rand/rdrand.cpp',
'rand/rdrand.hpp',
'rand/splitmix64.hpp',
'rand/system.hpp',
'rand/xoshiro.cpp',
'rand/xoshiro.hpp',
'rand/xorshift.cpp',
'rand/xorshift.hpp',
'random.cpp',
'random.hpp',
'range.cpp',
'range.hpp',
'rational.cpp',
'rational.hpp',
'region.cpp',
'region.hpp',
'registrar.cpp',
'registrar.hpp',
'roots/bisection.hpp',
'scoped.hpp',
'serialise/converter.hpp',
'serialise/ops.hpp',
'serialise/std.hpp',
'set/dset.cpp',
'set/dset.hpp',
'signal.cpp',
'signal.hpp',
'singleton.hpp',
'stats.cpp',
'stats.hpp',
'std.hpp',
'stream.cpp',
'stream.hpp',
'string.cpp',
'string.hpp',
'stringcache.cpp',
'stringcache.hpp',
'stringid.cpp',
'stringid.hpp',
'strongdef.cpp',
'strongdef.hpp',
'sysinfo.hpp',
'tap.cpp',
'tap.hpp',
'term.cpp',
'term.hpp',
'thread/event.hpp',
'thread/flag.hpp',
'thread/monitor.cpp',
'thread/monitor.hpp',
'thread/ticketlock.cpp',
'thread/ticketlock.hpp',
'thread/spinlock.cpp',
'thread/spinlock.hpp',
'time.cpp',
'time.hpp',
'time/parse.hpp',
ragel.process('time/parse8601.cpp.rl'),
'tuple/index.hpp',
'tuple/type.hpp',
'tuple/value.hpp',
'typeidx.cpp',
'typeidx.hpp',
'types.hpp',
'types/sized.hpp',
'types/comparator.hpp',
'types/description.cpp',
'types/description.hpp',
'types/dispatch.hpp',
'types/string.cpp',
'types/string.hpp',
'types/tagged.hpp',
'types/traits.hpp',
ragel.process('uri.cpp.rl'),
'uri.cpp',
'uri.hpp',
'utf8.cpp',
'utf8.hpp',
'variadic.cpp',
'variadic.hpp',
'vector.cpp',
'vector.hpp',
'version.hpp',
ragel.process('version.cpp.rl'),
'view.cpp',
'view.hpp',
]
preprocessor_hpp = custom_target(
'preprocessor.hpp',
output: 'preprocessor.hpp',
input: meson.project_source_root() / 'preprocessor.py',
command: [python, '@INPUT@', '@OUTPUT@', '480']
)
sources += preprocessor_hpp
if get_option('simd')
sources += [
'coord/simd.cpp',
'coord/simd.hpp',
'coord/simd_sse.hpp',
'coord/simd_neon.hpp',
]
endif
###############################################################################
dependencies += [
cpp.find_library('rt', required: false),
cpp.find_library('dl', required: false),
cpp.find_library('m', required: false),
]
inc = include_directories('../../')
libcruft = static_library(
'cruft-util',
sources,
dependencies: dependencies,
include_directories: inc
)
libcruft_dep = declare_dependency(
link_with: libcruft,
include_directories: inc,
sources: [preprocessor_hpp],
dependencies: dependencies,
)