From df8182177baeb6eace7ce283035161d1df89be28 Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Wed, 27 May 2026 11:55:44 +0800 Subject: [PATCH 1/2] :construction_worker: Deduplicate blocks with YAML anchors Also fixed many actionlint warnings. --- .github/workflows/unit_tests.yml | 181 ++++++++++--------------------- 1 file changed, 60 insertions(+), 121 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index b176bb0..c04cec9 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -26,8 +26,8 @@ concurrency: jobs: build_and_test_24: - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 - strategy: + runs-on: &runner ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 + strategy: &strategy fail-fast: false matrix: compiler: [clang, gcc] @@ -112,20 +112,22 @@ jobs: stdlib: libc++ steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: &checkout actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Install build tools + - &install_build_tools + name: Install build tools run: | if [[ "${{matrix.compiler}}" == "clang" ]]; then - export DISTRO=$(lsb_release -cs) + distro=$(lsb_release -cs) wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc - sudo add-apt-repository -y deb https://apt.llvm.org/$DISTRO/ llvm-toolchain-$DISTRO-${{matrix.version}} main + sudo add-apt-repository -y deb "https://apt.llvm.org/$distro/" "llvm-toolchain-$distro-${{matrix.version}}" main sudo apt update && sudo apt install -y ninja-build clang-${{matrix.version}} libc++-${{matrix.version}}-dev libc++abi-${{matrix.version}}-dev else sudo apt update && sudo apt install -y ninja-build gcc-${{matrix.version}} g++-${{matrix.version}} fi - - name: Restore CPM cache + - &restore_cpm_cache + name: Restore CPM cache env: cache-name: cpm-cache-0 id: cpm-cache-restore @@ -142,7 +144,8 @@ jobs: CXX: ${{matrix.toolchain_root}}/bin/${{matrix.cxx}} run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{matrix.cxx_standard}} -DCMAKE_CXX_FLAGS_INIT=${{matrix.cxx_flags}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCPM_SOURCE_CACHE=~/cpm-cache - - name: Save CPM cache + - &save_cpm_cache + name: Save CPM cache env: cache-name: cpm-cache-0 if: steps.cpm-cache-restore.outputs.cache-hit != 'true' @@ -156,57 +159,48 @@ jobs: python3 -m venv ${{github.workspace}}/test_venv source ${{github.workspace}}/test_venv/bin/activate pip install -r ${{github.workspace}}/requirements.txt - echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH + echo "${{github.workspace}}/test_venv/bin" >> "$GITHUB_PATH" - name: Build Unit Tests run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -v -t build_unit_tests - name: Test working-directory: ${{github.workspace}}/build - run: ctest --output-on-failure -j $(nproc) -C ${{matrix.build_type}} + run: ctest --output-on-failure -j -C ${{matrix.build_type}} quality_checks_pass: - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 + runs-on: *runner steps: - name: Checkout target branch - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: *checkout with: ref: ${{github.base_ref}} - name: Extract target branch SHA - run: echo "branch=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + run: echo "branch=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" id: target_branch - name: Checkout PR branch - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: *checkout - name: Setup python venv run: | python3 -m venv ${{github.workspace}}/test_venv source ${{github.workspace}}/test_venv/bin/activate - echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH + echo "${{github.workspace}}/test_venv/bin" >> "$GITHUB_PATH" - name: Install build tools run: | - export DISTRO=$(lsb_release -cs) + distro="$(lsb_release -cs)" wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc - sudo add-apt-repository -y deb https://apt.llvm.org/$DISTRO/ llvm-toolchain-$DISTRO-${{env.DEFAULT_LLVM_VERSION}} main + sudo add-apt-repository -y deb "https://apt.llvm.org/$distro/" "llvm-toolchain-$distro-${{env.DEFAULT_LLVM_VERSION}}" main sudo apt update && sudo apt install -y ninja-build clang-tidy-${{env.DEFAULT_LLVM_VERSION}} clang-format-${{env.DEFAULT_LLVM_VERSION}} - name: Install cmake-format run: | pip install cmakelang pyyaml - - name: Restore CPM cache - env: - cache-name: cpm-cache-0 - id: cpm-cache-restore - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} - restore-keys: | - ${{runner.os}}-${{env.cache-name}}- + - *restore_cpm_cache - name: Configure CMake env: @@ -215,20 +209,13 @@ jobs: PR_TARGET_BRANCH: ${{ steps.target_branch.outputs.branch }} run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache - - name: Save CPM cache - env: - cache-name: cpm-cache-0 - if: steps.cpm-cache-restore.outputs.cache-hit != 'true' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} + - *save_cpm_cache - name: Run quality checks run: cmake --build ${{github.workspace}}/build -t ci-quality sanitize: - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 + runs-on: *runner strategy: fail-fast: false matrix: @@ -245,29 +232,20 @@ jobs: toolchain_root: "/usr" steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: *checkout - name: Install build tools run: | if [[ "${{matrix.compiler}}" == "clang" ]]; then - export DISTRO=$(lsb_release -cs) + distro=$(lsb_release -cs) wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc - sudo add-apt-repository -y deb https://apt.llvm.org/$DISTRO/ llvm-toolchain-$DISTRO-${{env.DEFAULT_LLVM_VERSION}} main + sudo add-apt-repository -y deb "https://apt.llvm.org/$distro/" "llvm-toolchain-$distro-${{env.DEFAULT_LLVM_VERSION}}" main sudo apt update && sudo apt install -y ninja-build clang-${{env.DEFAULT_LLVM_VERSION}} else sudo apt update && sudo apt install -y ninja-build ${{matrix.cc}} ${{matrix.cxx}} fi - - name: Restore CPM cache - env: - cache-name: cpm-cache-0 - id: cpm-cache-restore - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} - restore-keys: | - ${{runner.os}}-${{env.cache-name}}- + - *restore_cpm_cache - name: Configure CMake env: @@ -276,21 +254,14 @@ jobs: SANITIZERS: ${{matrix.sanitizer}} run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache - - name: Save CPM cache - env: - cache-name: cpm-cache-0 - if: steps.cpm-cache-restore.outputs.cache-hit != 'true' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} + - *save_cpm_cache - name: Install python test requirements run: | python3 -m venv ${{github.workspace}}/test_venv source ${{github.workspace}}/test_venv/bin/activate pip install -r ${{github.workspace}}/requirements.txt - echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH + echo "${{github.workspace}}/test_venv/bin" >> "$GITHUB_PATH" # https://github.com/actions/runner-images/issues/9524 - name: Fix kernel mmap rnd bits @@ -303,24 +274,15 @@ jobs: run: cmake --build ${{github.workspace}}/build -t unit_tests valgrind: - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 + runs-on: *runner steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: *checkout - name: Install build tools run: | sudo apt update && sudo apt install -y gcc-${{env.DEFAULT_GCC_VERSION}} g++-${{env.DEFAULT_GCC_VERSION}} ninja-build valgrind python3-venv python3-pip - - name: Restore CPM cache - env: - cache-name: cpm-cache-0 - id: cpm-cache-restore - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} - restore-keys: | - ${{runner.os}}-${{env.cache-name}}- + - *restore_cpm_cache - name: Configure CMake env: @@ -328,21 +290,14 @@ jobs: CXX: "/usr/bin/g++-${{env.DEFAULT_GCC_VERSION}}" run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache - - name: Save CPM cache - env: - cache-name: cpm-cache-0 - if: steps.cpm-cache-restore.outputs.cache-hit != 'true' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} + - *save_cpm_cache - name: Install python test requirements run: | python3 -m venv ${{github.workspace}}/test_venv source ${{github.workspace}}/test_venv/bin/activate pip install -r ${{github.workspace}}/requirements.txt - echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH + echo "${{github.workspace}}/test_venv/bin" >> "$GITHUB_PATH" - name: Build Unit Tests run: cmake --build ${{github.workspace}}/build -t build_unit_tests @@ -350,46 +305,46 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build run: | - ctest --output-on-failure -j $(nproc) -E EXPECT_FAIL -T memcheck + ctest --output-on-failure -j -E EXPECT_FAIL -T memcheck - LOGFILE=$(ls ./Testing/Temporary/LastDynamicAnalysis_*.log) - FAILSIZE=$(du -c ./Testing/Temporary/MemoryChecker.* | tail -1 | cut -f1) - echo "
" >> $GITHUB_STEP_SUMMARY + LOGFILE="$(ls ./Testing/Temporary/LastDynamicAnalysis_*.log)" + FAILSIZE="$(du -c ./Testing/Temporary/MemoryChecker.* | tail -1 | cut -f1)" + echo "
" >> "$GITHUB_STEP_SUMMARY" - echo "" >> $GITHUB_STEP_SUMMARY - if [ $FAILSIZE != "0" ]; then - echo "Failing tests:" | tee -a $GITHUB_STEP_SUMMARY + echo "" >> "$GITHUB_STEP_SUMMARY" + if [ "$FAILSIZE" != "0" ]; then + echo "Failing tests:" | tee -a "$GITHUB_STEP_SUMMARY" else - echo "No failing tests" >> $GITHUB_STEP_SUMMARY + echo "No failing tests" >> "$GITHUB_STEP_SUMMARY" fi - echo "" >> $GITHUB_STEP_SUMMARY + echo "" >> "$GITHUB_STEP_SUMMARY" for f in ./Testing/Temporary/MemoryChecker.* do - if [ -s $f ]; then - FILENAME=$(cd $(dirname $f) && pwd)/$(basename $f) - TEST_COMMAND=$(grep $FILENAME $LOGFILE) - echo "" | tee -a $GITHUB_STEP_SUMMARY + if [ -s "$f" ]; then + FILENAME="$(realpath -- "$(dirname -- "$f")")/$(basename -- "$f")" + TEST_COMMAND="$(grep "$FILENAME" "$LOGFILE")" + echo "" | tee -a "$GITHUB_STEP_SUMMARY" echo "========================================" - echo $TEST_COMMAND | tee -a $GITHUB_STEP_SUMMARY + echo "$TEST_COMMAND" | tee -a "$GITHUB_STEP_SUMMARY" echo "--------------------" - cat $f + cat "$f" fi done - echo "
" >> $GITHUB_STEP_SUMMARY - test $FAILSIZE = "0" + echo "
" >> "$GITHUB_STEP_SUMMARY" + test "$FAILSIZE" = "0" mutate: - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 + runs-on: *runner steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: *checkout - name: Install build tools run: | - export DISTRO=$(lsb_release -cs) + distro=$(lsb_release -cs) wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc - sudo add-apt-repository -y deb https://apt.llvm.org/$DISTRO/ llvm-toolchain-$DISTRO-${{env.MULL_LLVM_MAJOR_VERSION}} main + sudo add-apt-repository -y deb "https://apt.llvm.org/$distro/" "llvm-toolchain-$distro-${{env.MULL_LLVM_MAJOR_VERSION}}" main sudo apt update && sudo apt install -y ninja-build clang-${{env.MULL_LLVM_MAJOR_VERSION}} - name: Install mull @@ -400,16 +355,7 @@ jobs: wget -O "$MULL_DEB" https://github.com/mull-project/mull/releases/download/${{env.MULL_VERSION}}/${{env.mull-pkg}} sudo dpkg -i "$MULL_DEB" - - name: Restore CPM cache - env: - cache-name: cpm-cache-0 - id: cpm-cache-restore - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} - restore-keys: | - ${{runner.os}}-${{env.cache-name}}- + - *restore_cpm_cache - name: Configure CMake env: @@ -417,28 +363,21 @@ jobs: CXX: "/usr/lib/llvm-${{env.MULL_LLVM_MAJOR_VERSION}}/bin/clang++" run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache - - name: Save CPM cache - env: - cache-name: cpm-cache-0 - if: steps.cpm-cache-restore.outputs.cache-hit != 'true' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} + - *save_cpm_cache - name: Install python test requirements run: | python3 -m venv ${{github.workspace}}/test_venv source ${{github.workspace}}/test_venv/bin/activate pip install -r ${{github.workspace}}/requirements.txt - echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH + echo "${{github.workspace}}/test_venv/bin" >> "$GITHUB_PATH" - name: Build and run mull tests run: cmake --build build -t mull_tests merge_ok: - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 - needs: [build_and_test_24, mutate, quality_checks_pass, sanitize, valgrind] + runs-on: *runner + needs: [build_and_test_24_cmake, build_and_test_24_meson, mutate, quality_checks_pass, sanitize, valgrind] if: ${{ !cancelled() }} steps: - name: Enable merge From 0e77525e45982d7a2e1dd16657e971644113f229 Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Wed, 27 May 2026 12:00:46 +0800 Subject: [PATCH 2/2] :sparkles: Support Meson build system --- .github/workflows/unit_tests.yml | 26 +++++- .gitignore | 3 +- docs/meson.build | 58 +++++++++++++ include/meson.build | 0 meson.build | 111 +++++++++++++++++++++++++ meson_options.txt | 4 + subprojects/.gitignore | 3 + subprojects/baremetal-concurrency.wrap | 8 ++ subprojects/boost-mp11.wrap | 13 +++ subprojects/fmt.wrap | 13 +++ test/meson.build | 102 +++++++++++++++++++++++ 11 files changed, 339 insertions(+), 2 deletions(-) create mode 100644 docs/meson.build create mode 100644 include/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 subprojects/.gitignore create mode 100644 subprojects/baremetal-concurrency.wrap create mode 100644 subprojects/boost-mp11.wrap create mode 100644 subprojects/fmt.wrap create mode 100644 test/meson.build diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index c04cec9..59f366e 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -25,7 +25,7 @@ concurrency: cancel-in-progress: true jobs: - build_and_test_24: + build_and_test_24_cmake: runs-on: &runner ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 strategy: &strategy fail-fast: false @@ -168,6 +168,30 @@ jobs: working-directory: ${{github.workspace}}/build run: ctest --output-on-failure -j -C ${{matrix.build_type}} + build_and_test_24_meson: + runs-on: *runner + strategy: *strategy + steps: + - uses: *checkout + + - *install_build_tools + + - name: Install meson + run: pipx install meson + + - name: Configure meson + env: + CC: ${{matrix.toolchain_root}}/bin/${{matrix.cc}} + CXX: ${{matrix.toolchain_root}}/bin/${{matrix.cxx}} + CXXFLAGS: ${{matrix.cxx_flags}} + run: | + buildtype="${{matrix.build_type}}" + meson setup ${{github.workspace}}/build -Dcpp_std=c++${{matrix.cxx_standard}} --buildtype="${buildtype,,}" + + - name: Test + working-directory: ${{github.workspace}}/build + run: meson test + quality_checks_pass: runs-on: *runner steps: diff --git a/.gitignore b/.gitignore index cdb022a..cc59f29 100644 --- a/.gitignore +++ b/.gitignore @@ -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*/ diff --git a/docs/meson.build b/docs/meson.build new file mode 100644 index 0000000..9075547 --- /dev/null +++ b/docs/meson.build @@ -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, +) diff --git a/include/meson.build b/include/meson.build new file mode 100644 index 0000000..e69de29 diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..963c3af --- /dev/null +++ b/meson.build @@ -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) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..e36ca68 --- /dev/null +++ b/meson_options.txt @@ -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') diff --git a/subprojects/.gitignore b/subprojects/.gitignore new file mode 100644 index 0000000..4ec1d52 --- /dev/null +++ b/subprojects/.gitignore @@ -0,0 +1,3 @@ +/* +!/*.wrap +!/.gitignore diff --git a/subprojects/baremetal-concurrency.wrap b/subprojects/baremetal-concurrency.wrap new file mode 100644 index 0000000..7003073 --- /dev/null +++ b/subprojects/baremetal-concurrency.wrap @@ -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 diff --git a/subprojects/boost-mp11.wrap b/subprojects/boost-mp11.wrap new file mode 100644 index 0000000..f9036b7 --- /dev/null +++ b/subprojects/boost-mp11.wrap @@ -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 diff --git a/subprojects/fmt.wrap b/subprojects/fmt.wrap new file mode 100644 index 0000000..81bfadc --- /dev/null +++ b/subprojects/fmt.wrap @@ -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 diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 0000000..c50ef2b --- /dev/null +++ b/test/meson.build @@ -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