Skip to content
Open
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
171 changes: 171 additions & 0 deletions .github/workflows/meson.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
on:
workflow_call:

jobs:
meson:
runs-on: ${{ matrix.platform }}
name: meson on ${{ matrix.platform }} (${{ matrix.mode.name }})
strategy:
fail-fast: false
matrix:
mode:
- name: default
args: -Dtests=enabled -Dbenchmarks=disabled
extra_envs: {}

# Alternative compiler setups
- name: gcc
args: -Dtests=enabled -Dbenchmarks=disabled
extra_envs:
CC: gcc
CXX: g++
- name: clang
args: -Dtests=enabled -Dbenchmarks=disabled
extra_envs:
CC: clang
CXX: clang++

- name: sanitize
args: >-
-Dtests=enabled -Dbenchmarks=disabled "-Db_sanitize=address,undefined"
extra_envs: {}

# This is for MSVC, which only supports AddressSanitizer.
# https://learn.microsoft.com/en-us/cpp/sanitizers/
- name: sanitize+asanonly
args: -Dtests=enabled -Dbenchmarks=disabled -Db_sanitize=address
extra_envs:
ASAN_OPTIONS: report_globals=0:halt_on_error=1:abort_on_error=1:print_summary=1

- name: clang+sanitize
args: >-
-Dtests=enabled -Dbenchmarks=disabled -Db_lundef=false "-Db_sanitize=address,undefined"
extra_envs:
CC: clang
CXX: clang++

# default clang on GitHub hosted runners is from MSYS2.
# Use Visual Studio supplied clang-cl instead.
- name: clang-cl
args: >-
-Dtests=enabled -Dbenchmarks=disabled
extra_envs:
CC: clang-cl
CXX: clang-cl
- name: clang-cl+sanitize
args: >-
-Dtests=enabled -Dbenchmarks=disabled "-Db_sanitize=address,undefined"
extra_envs:
CC: clang-cl
CXX: clang-cl
platform:
- ubuntu-24.04
- windows-2025
- macos-15

exclude:
# clang-cl only makes sense on windows.
- platform: ubuntu-24.04
mode:
name: clang-cl
- platform: macos-15
mode:
name: clang-cl
- platform: ubuntu-24.04
mode:
name: clang-cl+sanitize
- platform: macos-15
mode:
name: clang-cl+sanitize

# FIXME: clang-cl is currently broken:
# https://github.com/llvm/llvm-project/issues/143245
- platform: windows-2025
mode:
name: clang-cl
- platform: windows-2025
mode:
name: clang-cl+sanitize

# Use clang-cl instead of MSYS2 clang.
#
# we already tested clang+sanitize on linux,
# if this doesn't work, it should be an issue for MSYS2 team to consider.
- platform: windows-2025
mode:
name: clang
- platform: windows-2025
mode:
name: clang+sanitize

# MSVC-only sanitizers
- platform: ubuntu-24.04
mode:
name: sanitize+asanonly
- platform: macos-15
mode:
name: sanitize+asanonly
- platform: windows-2025
mode:
name: sanitize

# clang is the default on macos
# also gcc is an alias to clang
- platform: macos-15
mode:
name: clang
- platform: macos-15
mode:
name: gcc

# gcc is the default on linux
- platform: ubuntu-24.04
mode:
name: gcc

# MinGW is not officially tested
- platform: windows-2025
mode:
name: gcc

# only run sanitizer tests on linux
#
# gcc/clang's codegen shouldn't massively change across platforms,
# and linux supports most of the sanitizers.
- platform: macos-15
mode:
name: clang+sanitize
- platform: macos-15
mode:
name: sanitize

steps:
- name: Setup meson
run: |
pipx install meson ninja
- name: Checkout
uses: actions/checkout@v4
- name: Activate MSVC and Configure
if: ${{ matrix.platform == 'windows-2025' }}
env: ${{ matrix.mode.extra_envs }}
run: |
meson setup build --buildtype=release ${{ matrix.mode.args }} --vsenv
- name: Configuring
if: ${{ matrix.platform != 'windows-2025' }}
env: ${{ matrix.mode.extra_envs }}
run: |
meson setup build --buildtype=release ${{ matrix.mode.args }}
- name: Building
run: |
meson compile -C build
meson compile -C build msft_proxy_tests examples

- name: Running tests
env: ${{ matrix.mode.extra_envs }}
run: |
meson test -C build --timeout-multiplier 5 --print-errorlogs
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: ${{ matrix.platform }}-${{ matrix.mode.name }}-logs
path: build/meson-logs
4 changes: 4 additions & 0 deletions .github/workflows/pipeline-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
name: Generate report
needs: [run-bvt-gcc, run-bvt-clang, run-bvt-msvc, run-bvt-appleclang, run-bvt-nvhpc, run-bvt-oneapi]

run-meson:
uses: ./.github/workflows/meson.yml
name: Run builds with meson

mkdocs:
uses: ./.github/workflows/mkdocs.yml
name: Build mkdocs
4 changes: 2 additions & 2 deletions .github/workflows/pipeline-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
version=$(grep -oP 'msft_proxy\d+\s+VERSION\s+\K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt)
git tag "$version"
git push origin "$version"
tar -czf "proxy-$version.tgz" $(git ls-files 'include/**.h' 'include/**.ixx')
echo "PRO_VER=$version" >> $GITHUB_OUTPUT
git ls-files 'include/**.h' 'include/**.ixx' | xargs tar -czf "proxy-$version.tgz"
echo "PRO_VER=$version" >> "$GITHUB_OUTPUT"
shell: bash

- name: create release draft
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Ignore build directories
build/
Testing/

# Python bytecode cache
__pycache__/

# Meson subprojects
/subprojects/*
!/subprojects/*.wrap
80 changes: 80 additions & 0 deletions benchmarks/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
benchmarks_exe = executable(
'msft_proxy_benchmarks',
files(
'proxy_creation_benchmark.cpp',
'proxy_operation_benchmark.cpp',
'proxy_operation_benchmark_context.cpp',
),
implicit_include_directories: false,
dependencies: [msft_proxy4_dep, benchmark_dep],
build_by_default: false,
)

autogen_benchmarks = custom_target(
command: [
autogen_benchmarks_exe,
custom_target(
command: [benchmarks_exe, '--benchmark_list_tests'],
capture: true,
output: 'tests.txt',
),
meson.current_source_dir() / 'meson.build',
],
output: 'autogen.stamp',
build_by_default: true,
)

#pragma autogen push
benchmarks = {
'ObjectCreation': [
'BM_SmallObjectCreationWithProxy_Shared',
'BM_SmallObjectCreationWithProxy_SharedPooled',
'BM_SmallObjectCreationWithUniquePtr',
'BM_SmallObjectCreationWithSharedPtr',
'BM_SmallObjectCreationWithSharedPtr_Pooled',
'BM_SmallObjectCreationWithAny',
'BM_LargeObjectCreationWithProxy',
'BM_LargeObjectCreationWithProxy_Pooled',
'BM_LargeObjectCreationWithProxy_Shared',
'BM_LargeObjectCreationWithProxy_SharedPooled',
'BM_LargeObjectCreationWithUniquePtr',
'BM_LargeObjectCreationWithSharedPtr',
'BM_LargeObjectCreationWithSharedPtr_Pooled',
'BM_LargeObjectCreationWithAny',
],
'ObjectInvocation': [
'BM_SmallObjectInvocationViaProxy_Shared',
'BM_SmallObjectInvocationViaProxyView',
'BM_SmallObjectInvocationViaVirtualFunction',
'BM_SmallObjectInvocationViaVirtualFunction_Shared',
'BM_SmallObjectInvocationViaVirtualFunction_RawPtr',
'BM_LargeObjectInvocationViaProxy',
'BM_LargeObjectInvocationViaProxy_Shared',
'BM_LargeObjectInvocationViaProxyView',
'BM_LargeObjectInvocationViaVirtualFunction',
'BM_LargeObjectInvocationViaVirtualFunction_Shared',
'BM_LargeObjectInvocationViaVirtualFunction_RawPtr',
],
'ObjectRelocation': [
'BM_SmallObjectRelocationViaProxy_NothrowRelocatable',
'BM_SmallObjectRelocationViaUniquePtr',
'BM_SmallObjectRelocationViaAny',
'BM_LargeObjectRelocationViaProxy',
'BM_LargeObjectRelocationViaProxy_NothrowRelocatable',
'BM_LargeObjectRelocationViaUniquePtr',
'BM_LargeObjectRelocationViaAny',
],
}
#pragma autogen pop

foreach suite : benchmarks.keys()
foreach name : benchmarks[suite]
benchmark(
name,
benchmarks_exe,
args: [f'--benchmark_filter=^@name@$'],
suite: suite,
depends: autogen_benchmarks,
)
endforeach
endforeach
4 changes: 4 additions & 0 deletions docs/example.cpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// This file was auto-generated from:
// @MD_PATH@

@CODE@
Loading