-
Notifications
You must be signed in to change notification settings - Fork 211
build: support meson build system #375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mochaaP
wants to merge
21
commits into
microsoft:main
Choose a base branch
from
mcha-forks:mochaa
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
d97e2a5
tests: migrate deprecated std::is_trivial_v
mochaaP e127815
tools: add python typings
mochaaP d9d2f09
Fix compatibility with fmt 12
mochaaP ec42e34
build: support meson build system
mochaaP d54b74f
ci: fix shellcheck warnings
mochaaP c21e9b7
ci: add meson tests
mochaaP f4d87fa
style: run clang-format
mochaaP 13b9949
ci: workaround clang sanitizer linking bug
mochaaP af02f3b
build/meson: fix modules builds on mingw winpthreads
mochaaP 788fa3b
build/meson: do not link -nodefaultlibs on sanitized builds
mochaaP 94cae03
build/meson: increase max object section count on msvc
mochaaP ce70232
ci: only test release builds, do not run benchmarks
mochaaP d4d3e3b
ci: pin runner versions
mochaaP f8d0b56
ci: exclude unsupported / broken platforms
mochaaP 56af5a2
build: add a notice about clang-cl broken msvc compatibility
mochaaP 842d903
build: meson gtest autodiscovery
mochaaP cab6915
build: meson doctest autoglob
mochaaP 823cbfc
ci: manage meson builds from proxy-ci
mochaaP 97f1dc2
fixup! ci: only test release builds, do not run benchmarks
mochaaP 9bf24e2
fixup! build: meson doctest autoglob
mochaaP a21f0af
build: meson benchmarks autogen
mochaaP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| // This file was auto-generated from: | ||
| // @MD_PATH@ | ||
|
|
||
| @CODE@ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.