Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
207 changes: 85 additions & 122 deletions .github/workflows/unit_tests.yml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ignore all directories that start with . (except .github/)
# ignore all directories that start with . (except .github/ and .gitignore)
**/.*/
!.github/
!**/.gitignore

# ignore conventionally-named build directories
**/build*/
Expand Down
58 changes: 58 additions & 0 deletions docs/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
custom_target(
'index.html',
command: [
asciidoctor_exe,
'@INPUT@',
'-D',
'@OUTDIR@',
],
input: files('index.adoc'),
output: ['index.html'],
depend_files: files(
'algorithm.adoc',
'atomic.adoc',
'atomic_bitset.adoc',
'bit.adoc',
'bitset.adoc',
'byterator.adoc',
'cached.adoc',
'call_by_need.adoc',
'compiler.adoc',
'concepts.adoc',
'ct_conversions.adoc',
'ct_format.adoc',
'ct_string.adoc',
'cx_map.adoc',
'cx_multimap.adoc',
'cx_queue.adoc',
'cx_set.adoc',
'cx_vector.adoc',
'for_each_n_args.adoc',
'function_traits.adoc',
'functional.adoc',
'intro.adoc',
'intrusive_forward_list.adoc',
'intrusive_list.adoc',
'iterator.adoc',
'latched.adoc',
'memory.adoc',
'numeric.adoc',
'optional.adoc',
'panic.adoc',
'priority.adoc',
'ranges.adoc',
'rollover.adoc',
'span.adoc',
'static_assert.adoc',
'tuple.adoc',
'tuple_algorithms.adoc',
'tuple_destructure.adoc',
'type_traits.adoc',
'udls.adoc',
'utility.adoc',
),
install: true,
install_tag: 'doc',
install_dir: get_option('datadir') / 'doc' / meson.project_name(),
build_by_default: false,
)
Empty file added include/meson.build
Empty file.
111 changes: 111 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
project(
'stdx',
'cpp',
version: '0.1.0',
license: 'BSL-1.0',
default_options: ['cpp_std=c++23'],
meson_version: '>=0.63.0',
)

mp11_dep = dependency(
'boost',
'boost-mp11',
modules: ['mp11'],
version: '>=1.83.0',
)
fmt_dep = dependency('fmt', version: '>=11.0.0', required: get_option('fmt'))
concurrency_dep = dependency('baremetal-concurrency', required: get_option('conc'))

deps = [mp11_dep, fmt_dep, concurrency_dep]

inc = include_directories('include')
src = files(
'include/stdx/algorithm.hpp',
'include/stdx/array.hpp',
'include/stdx/bit.hpp',
'include/stdx/bitset.hpp',
'include/stdx/byterator.hpp',
'include/stdx/cached.hpp',
'include/stdx/call_by_need.hpp',
'include/stdx/compiler.hpp',
'include/stdx/concepts.hpp',
'include/stdx/ct_conversions.hpp',
'include/stdx/ct_string.hpp',
'include/stdx/cx_map.hpp',
'include/stdx/cx_multimap.hpp',
'include/stdx/cx_queue.hpp',
'include/stdx/cx_set.hpp',
'include/stdx/cx_vector.hpp',
'include/stdx/env.hpp',
'include/stdx/for_each_n_args.hpp',
'include/stdx/function_traits.hpp',
'include/stdx/functional.hpp',
'include/stdx/intrusive_forward_list.hpp',
'include/stdx/intrusive_list.hpp',
'include/stdx/iterator.hpp',
'include/stdx/latched.hpp',
'include/stdx/memory.hpp',
'include/stdx/numeric.hpp',
'include/stdx/optional.hpp',
'include/stdx/panic.hpp',
'include/stdx/pp_map.hpp',
'include/stdx/priority.hpp',
'include/stdx/ranges.hpp',
'include/stdx/rollover.hpp',
'include/stdx/span.hpp',
'include/stdx/tuple.hpp',
'include/stdx/tuple_algorithms.hpp',
'include/stdx/tuple_destructure.hpp',
'include/stdx/type_traits.hpp',
'include/stdx/udls.hpp',
'include/stdx/utility.hpp',
)
src_detail = files(
'include/stdx/detail/bitset_common.hpp',
'include/stdx/detail/freestanding.hpp',
'include/stdx/detail/list_common.hpp',
)

if fmt_dep.found()
src += files(
'include/stdx/ct_format.hpp',
'include/stdx/static_assert.hpp',
)
src_detail += files(
'include/stdx/detail/fmt.hpp',
)
endif

if concurrency_dep.found()
src += files(
'include/stdx/atomic.hpp',
'include/stdx/atomic_bitset.hpp',
)
endif

install_headers(src, subdir: meson.project_name())
install_headers(src_detail, subdir: meson.project_name() / 'detail')

stdx_dep = declare_dependency(
dependencies: deps,
include_directories: inc,
)

meson.override_dependency(meson.project_name(), stdx_dep)

pkgconfig = import('pkgconfig', required: false)
if pkgconfig.found()
pkgconfig.generate(
name: meson.project_name(),
description: 'A header-only C++ library that polyfills the standard library.',
url: 'https://intel.github.io/cpp-std-extensions/',
libraries: deps,
install_dir: get_option('datadir') / 'pkgconfig',
)
endif

asciidoctor_exe = find_program('asciidoctor', required: get_option('docs'))
subdir('docs', if_found: asciidoctor_exe)

catch2_dep = dependency('catch2-with-main', required: get_option('tests'))
subdir('test', if_found: catch2_dep)
4 changes: 4 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
option('docs', type: 'feature', description: 'Build documentation')
option('tests', type: 'feature', description: 'Build tests')
option('fmt', type: 'feature', value: 'enabled', description: 'Use fmtlib')
option('conc', type: 'feature', value: 'enabled', description: 'Use baremetal-concurrency')
3 changes: 3 additions & 0 deletions subprojects/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/*
!/*.wrap
!/.gitignore
8 changes: 8 additions & 0 deletions subprojects/baremetal-concurrency.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[wrap-git]
url = https://github.com/intel/cpp-baremetal-concurrency.git
# FIXME: this points to mcha-forks. use upstream commit or a stable tag
revision = 53f3493dace298888b60fd761e21f1ae5492ed21
depth = 1

[provide]
dependency_names = baremetal-concurrency
13 changes: 13 additions & 0 deletions subprojects/boost-mp11.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[wrap-file]
directory = mp11-boost-1.88.0
source_url = https://github.com/boostorg/mp11/archive/refs/tags/boost-1.88.0.zip
source_filename = boost-mp11-1.88.0.zip
source_hash = f8062dc44fe9a0cd8fd29ce1db112a2bc4deab93a78fbadec1fa92bf568a4659
patch_filename = boost-mp11_1.88.0-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/boost-mp11_1.88.0-1/get_patch
patch_hash = ed193c72b217e27d9ae1af5172fa9181f9c52e6ece427f87bf6518fdd142f9b2
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/boost-mp11_1.88.0-1/boost-mp11-1.88.0.zip
wrapdb_version = 1.88.0-1

[provide]
dependency_names = boost-mp11
13 changes: 13 additions & 0 deletions subprojects/fmt.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[wrap-file]
directory = fmt-12.1.0
source_url = https://github.com/fmtlib/fmt/archive/12.1.0.tar.gz
source_filename = fmt-12.1.0.tar.gz
source_hash = ea7de4299689e12b6dddd392f9896f08fb0777ac7168897a244a6d6085043fea
source_fallback_url = https://github.com/wrapdb/fmt/releases/download/12.1.0-5/fmt-12.1.0.tar.gz
patch_filename = fmt_12.1.0-5_patch.zip
patch_url = https://github.com/wrapdb/fmt/releases/download/12.1.0-5/fmt_12.1.0-5_patch.zip
patch_hash = 211a6c3f208ec152d3bac0bebbb09abc9b59f1d3a41165e77171e80d871dcd68
3rdparty_wrapdb_version = 12.1.0-5

[provide]
dependency_names = fmt
102 changes: 102 additions & 0 deletions test/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
rapidcheck_dep = dependency('rapidcheck', required: false, disabler: true)

atomic_override_cdata = configuration_data()
atomic_override_cdata.set_quoted(
'ATOMIC_CFG',
meson.current_source_dir() / 'detail' / 'atomic_cfg.hpp',
)

concurrency_dep_or_disabler = concurrency_dep.found() ? concurrency_dep : disabler()

tests = {
'algorithm': {},
'always_false': {},
'array': {},
'atomic': {
'dependencies': [concurrency_dep_or_disabler],
},
'atomic_override': {
'dependencies': [concurrency_dep_or_disabler],
'cpp_args': [
'-DATOMIC_CFG=' + atomic_override_cdata.get('ATOMIC_CFG'),
],
},
'atomic_bitset': {
'dependencies': [concurrency_dep_or_disabler],
},
'atomic_bitset_override': {
'dependencies': [concurrency_dep_or_disabler],
'cpp_args': [
'-DATOMIC_CFG=' + atomic_override_cdata.get('ATOMIC_CFG'),
],
},
'bind': {},
'bit': {},
'bitset': {},
'byterator': {},
'cached': {},
'call_by_need': {},
'callable': {},
'compiler': {},
'concepts': {},
'conditional': {},
'ct_conversions': {},
'ct_format': {},
'ct_format_freestanding': {
'source': ['ct_format.cpp'],
'cpp_args': ['-DSTDX_FREESTANDING'],
},
'ct_string': {},
'cx_map': {},
'cx_multimap': {},
'cx_queue': {},
'cx_set': {},
'cx_vector': {},
'default_panic': {},
'env': {},
'for_each_n_args': {},
'function_traits': {},
'functional': {},
'indexed_tuple': {},
'intrusive_forward_list': {},
'intrusive_list': {},
'intrusive_list_properties': {'dependencies': [rapidcheck_dep]},
'is_constant_evaluated': {},
'iterator': {},
'latched': {},
'memory': {},
'numeric': {},
'optional': {},
'overload': {},
'panic': {},
'pp_map': {},
'priority': {},
'ranges': {},
'remove_cvref': {},
'rollover': {},
'span': {},
'to_underlying': {},
'tuple': {},
'tuple_algorithms': {},
'type_bitset': {},
'type_map': {},
'type_traits': {},
'with_result_of': {},
'utility': {},
'udls': {},
}

foreach name, args : tests
test(
name,
executable(
f'@name@_test',
args.get('source', [f'@name@.cpp']),
dependencies: [stdx_dep, catch2_dep] + args.get('dependencies', []),
cpp_args: args.get('cpp_args', []),
build_by_default: false,
),
args: ['-r', 'tap'],
protocol: 'tap',
)
endforeach