Merge branch 'master' into master

pull/12135/head
Chasarr 3 months ago committed by GitHub
commit c73863fca2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      .gitattributes
  2. 9
      .github/workflows/codeql-analysis.yml
  3. 18
      .github/workflows/cygwin.yml
  4. 4
      .github/workflows/file_format.yml
  5. 3
      .github/workflows/images.yml
  6. 31
      .github/workflows/lint.yml
  7. 56
      .github/workflows/macos.yml
  8. 15
      .github/workflows/msys2.yml
  9. 4
      .github/workflows/nonnative.yml
  10. 27
      .github/workflows/os_comp.yml
  11. 2
      .github/workflows/stable_builddir.yml
  12. 8
      .github/workflows/unusedargs_missingreturn.yml
  13. 20
      .github/workflows/website.yml
  14. 2
      .mypy.ini
  15. 4
      .pylintrc
  16. 4
      azure-pipelines.yml
  17. 5
      ci/ciimage/arch/install.sh
  18. 3
      ci/ciimage/build.py
  19. 6
      ci/ciimage/common.sh
  20. 2
      ci/ciimage/cuda/install.sh
  21. 6
      ci/ciimage/fedora/install.sh
  22. 8
      ci/ciimage/gentoo/image.json
  23. 167
      ci/ciimage/gentoo/install.sh
  24. 9
      ci/ciimage/opensuse/install.sh
  25. 40
      ci/ciimage/ubuntu-rolling/install.sh
  26. 17
      ci/run.ps1
  27. 16
      ci/usercustomize.py
  28. 11
      cross/metrowerks-arm.txt
  29. 11
      cross/metrowerks-eppc.txt
  30. 22
      cross/ti-c6000.txt
  31. 4
      data/macros.meson
  32. 1253
      data/shell-completions/bash/meson
  33. 113
      data/shell-completions/zsh/_meson
  34. 20
      data/syntax-highlighting/vim/syntax/meson.vim
  35. 18
      data/test.schema.json
  36. 14
      docs/genrefman.py
  37. 15
      docs/genrelnotes.py
  38. 2
      docs/jsonvalidator.py
  39. 8
      docs/markdown/Build-options.md
  40. 2
      docs/markdown/Build-targets.md
  41. 46
      docs/markdown/Builtin-options.md
  42. 127
      docs/markdown/Commands.md
  43. 4
      docs/markdown/Configuration.md
  44. 2
      docs/markdown/Configuring-a-build-directory.md
  45. 228
      docs/markdown/Continuous-Integration.md
  46. 26
      docs/markdown/Contributing.md
  47. 27
      docs/markdown/Creating-releases.md
  48. 3
      docs/markdown/Cross-compilation.md
  49. 12
      docs/markdown/Cython.md
  50. 2
      docs/markdown/D.md
  51. 91
      docs/markdown/Dependencies.md
  52. 8
      docs/markdown/External-Project-module.md
  53. 16
      docs/markdown/FAQ.md
  54. 6
      docs/markdown/Fs-module.md
  55. 7
      docs/markdown/Gnome-module.md
  56. 14
      docs/markdown/GuiTutorial.md
  57. 9
      docs/markdown/Hotdoc-module.md
  58. 10
      docs/markdown/IDE-integration.md
  59. 4
      docs/markdown/Include-directories.md
  60. 14
      docs/markdown/Machine-files.md
  61. 24
      docs/markdown/Python-module.md
  62. 38
      docs/markdown/Qt6-module.md
  63. 21
      docs/markdown/Quick-guide.md
  64. 47
      docs/markdown/Reference-tables.md
  65. 2
      docs/markdown/Release-notes-for-0.51.0.md
  66. 2
      docs/markdown/Release-notes-for-0.63.0.md
  67. 2
      docs/markdown/Release-notes-for-1.0.0.md
  68. 2
      docs/markdown/Release-notes-for-1.2.0.md
  69. 338
      docs/markdown/Release-notes-for-1.3.0.md
  70. 111
      docs/markdown/Release-notes-for-1.4.0.md
  71. 214
      docs/markdown/Release-notes-for-1.5.0.md
  72. 175
      docs/markdown/Release-notes-for-1.6.0.md
  73. 4
      docs/markdown/Release-procedure.md
  74. 38
      docs/markdown/Rust-module.md
  75. 20
      docs/markdown/Rust.md
  76. 12
      docs/markdown/Style-guide.md
  77. 2
      docs/markdown/Subprojects.md
  78. 11
      docs/markdown/Syntax.md
  79. 9
      docs/markdown/Tutorial.md
  80. 33
      docs/markdown/Unit-tests.md
  81. 30
      docs/markdown/Users.md
  82. 14
      docs/markdown/Using-with-Visual-Studio.md
  83. 3
      docs/markdown/Wayland-module.md
  84. 2
      docs/markdown/Windows-module.md
  85. 86
      docs/markdown/Wrap-dependency-system-manual.md
  86. 27
      docs/markdown/_include_qt_base.md
  87. 27
      docs/markdown/howtox.md
  88. 14
      docs/markdown/snippets/cargo_features.md
  89. 5
      docs/markdown/snippets/compile_werror.md
  90. 8
      docs/markdown/snippets/deprecate_build_target_jar.md
  91. 7
      docs/markdown/snippets/external_project_devenv.md
  92. 4
      docs/markdown/snippets/find_program_default_options.md
  93. 8
      docs/markdown/snippets/fixed_sizeof_and_find_library_for_fortran.md
  94. 17
      docs/markdown/snippets/fs_relative_to.md
  95. 5
      docs/markdown/snippets/python_extension_module_limited_api.md
  96. 19
      docs/markdown/snippets/required_keyword_for_has_functions.md
  97. 10
      docs/markdown/snippets/string_format.md
  98. 4
      docs/markdown/snippets/vcs_tag.md
  99. 12
      docs/refman/generatorbase.py
  100. 3
      docs/refman/generatorjson.py
  101. Some files were not shown because too many files have changed in this diff Show More

2
.gitattributes vendored

@ -3,3 +3,5 @@
* text eol=lf
*.png binary
*.icns binary
data/shell-completions/bash/meson linguist-language=Shell
data/shell-completions/zsh/_meson linguist-language=Shell

@ -17,17 +17,16 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
# bypass cache: https://github.com/github/codeql-action/issues/1445
tools: latest
tools: linked
config-file: .github/codeql/codeql-config.yml
languages: python
# we have none
setup-python-dependencies: false
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3

@ -6,15 +6,21 @@ concurrency:
on:
push:
branches:
- master
# Stable branches such as 0.56 or 1.0
- '[0-9]+.[0-9]+'
paths:
- "mesonbuild/**"
- "test cases/**"
- "unittests/**"
- ".github/workflows/cygwin.yml"
- "run*tests.py"
pull_request:
paths:
- "mesonbuild/**"
- "test cases/**"
- "unittests/**"
- ".github/workflows/cygwin.yml"
- "run*tests.py"
@ -35,7 +41,7 @@ jobs:
MESON_CI_JOBNAME: cygwin-${{ matrix.NAME }}
steps:
- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
id: restore-cache
with:
# should use 'pip3 cache dir' to discover this path
@ -45,7 +51,7 @@ jobs:
- run: git config --global core.autocrlf input
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: cygwin/cygwin-install-action@master
with:
@ -63,6 +69,7 @@ jobs:
libgtk3-devel
libxml2-devel
libxslt-devel
make
ninja
python2-devel
python3-devel
@ -76,11 +83,10 @@ jobs:
- name: Run pip
run: |
export PATH=/usr/bin:/usr/local/bin:$(cygpath ${SYSTEMROOT})/system32
# jsonschema is max capped because the new version depends on rust dependencies which are... hard to get on cygwin
python3 -m pip --disable-pip-version-check install gcovr 'jsonschema<4.18' pefile pytest pytest-subtests pytest-xdist coverage
python3 -m pip --disable-pip-version-check install gcovr fastjsonschema pefile pytest pytest-subtests pytest-xdist coverage
shell: C:\cygwin\bin\bash.exe --noprofile --norc -o igncr -eo pipefail '{0}'
- uses: actions/cache/save@v3
- uses: actions/cache/save@v4
with:
# should use 'pip3 cache dir' to discover this path
path: C:\cygwin\home\runneradmin\.cache\pip
@ -96,7 +102,7 @@ jobs:
SKIP_STATIC_BOOST: 1
shell: C:\cygwin\bin\bash.exe --noprofile --norc -o igncr -eo pipefail '{0}'
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.NAME }}
path: meson-test-run.*

@ -13,8 +13,8 @@ jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: python3 ./run_format_tests.py

@ -7,7 +7,6 @@ concurrency:
on:
push:
branches:
- master
paths:
- 'ci/ciimage/**'
- '.github/workflows/images.yml'
@ -41,10 +40,12 @@ jobs:
- { name: Arch Linux, id: arch }
- { name: CUDA (on Arch), id: cuda }
- { name: Fedora, id: fedora }
- { name: Gentoo, id: gentoo }
- { name: OpenSUSE, id: opensuse }
- { name: Ubuntu Bionic, id: bionic }
- { name: Ubuntu Rolling, id: ubuntu-rolling }
steps:
# Need v3 because of bionic
- uses: actions/checkout@v3
# Login to dockerhub

@ -9,10 +9,16 @@ on:
paths:
- "**.py"
- ".github/workflows/lint.yml"
- ".pylintrc"
- ".flake8"
- ".mypy.ini"
pull_request:
paths:
- "**.py"
- ".github/workflows/lint.yml"
- ".pylintrc"
- ".flake8"
- ".mypy.ini"
permissions:
contents: read
@ -22,29 +28,34 @@ jobs:
pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: python -m pip install pylint
- run: pylint mesonbuild
- run: pylint --output-format colorized mesonbuild
flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: python -m pip install flake8
- run: flake8 mesonbuild/
- run: flake8 --color always mesonbuild/
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: python -m pip install mypy types-PyYAML
- run: python run_mypy.py
# Pin mypy to version 1.8, so we retain the ability to lint for Python 3.7
- run: python -m pip install "mypy==1.8" coverage strictyaml types-PyYAML types-tqdm types-chevron
- run: python run_mypy.py --allver
env:
PYTHONUNBUFFERED: 1
TERM: xterm-color
MYPY_FORCE_COLOR: 1

@ -6,19 +6,23 @@ concurrency:
on:
push:
branches:
- master
# Stable branches such as 0.56 or 1.0
- '[0-9]+.[0-9]+'
paths:
- "mesonbuild/**"
- "test cases/**"
- "unittests/**"
- ".github/workflows/macos.yml"
- "run_unittests.py"
- "run*tests.py"
pull_request:
paths:
- "mesonbuild/**"
- "test cases/**"
- "unittests/**"
- ".github/workflows/macos.yml"
- "run_unittests.py"
- "run*tests.py"
permissions:
contents: read
@ -27,24 +31,25 @@ jobs:
unittests-appleclang:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-xdist pytest-subtests jsonschema coverage
python -m pip install pytest pytest-xdist pytest-subtests fastjsonschema coverage
- run: brew install pkg-config ninja llvm qt@5
- env:
CPPFLAGS: "-I/usr/local/include"
LDFLAGS: "-L/usr/local/lib"
CPPFLAGS: "-I/opt/homebrew/include"
LDFLAGS: "-L/opt/homebrew/lib"
MESON_CI_JOBNAME: unittests-appleclang
MESON_UNIT_TEST_BACKEND: ninja
HOMEBREW_NO_AUTO_UPDATE: 1
# These cannot evaluate anything, so we cannot set PATH or SDKROOT here
run: |
export SDKROOT="$(xcodebuild -version -sdk macosx Path)"
export PATH="$HOME/tools:/usr/local/opt/qt@5/bin:$PATH:$(brew --prefix llvm)/bin"
export PKG_CONFIG_PATH="/usr/local/opt/qt@5/lib/pkgconfig:$PKG_CONFIG_PATH"
export PATH="$HOME/tools:/opt/homebrew/opt/qt@5/bin:/opt/homebrew/opt/llvm/bin:$PATH"
export PKG_CONFIG_PATH="/opt/homebrew/opt/qt@5/lib/pkgconfig:$PKG_CONFIG_PATH"
./tools/run_with_cov.py ./run_unittests.py
- name: Aggregate coverage reports
@ -73,9 +78,10 @@ jobs:
name: ${{ matrix.NAME }}
env:
MESON_CI_JOBNAME: ${{ matrix.NAME }}
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# Avoid picking up an older version of LLVM that does not work.
- run: brew update
# github actions overwrites brew's python. Force it to reassert itself, by running in a separate step.
@ -84,24 +90,28 @@ jobs:
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
sudo rm -rf /Library/Frameworks/Python.framework/
brew install --force python3 && brew unlink python3 && brew unlink python3 && brew link --overwrite python3
# Delete nonsensical PEP 668 breakage. It is the wrong solution to the problem and isn't designed to be
# productive -- only victim blaming -- however it bites particularly badly because this is a container/VM
# See commit 5c479d7a13a518c18ccb4dc3b6bdd7bfc2a9bdb5 for a more thorough analysis.
find /opt/homebrew/Cellar/python* -name EXTERNALLY-MANAGED -print0 | xargs -0 rm -vf
# use python3 from homebrew because it is a valid framework, unlike the actions one:
# https://github.com/actions/setup-python/issues/58
- run: brew install pkg-config ninja llvm qt@5 boost ldc hdf5 openmpi lapack scalapack sdl2 boost-python3 gtk-doc
- run: brew install pkg-config ninja llvm qt@5 boost ldc hdf5 openmpi lapack scalapack sdl2 boost-python3 gtk-doc zstd ncurses objfw libomp
- run: |
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade pip
python3 -m pip install cython coverage
- env:
CPPFLAGS: "-I/usr/local/include"
LDFLAGS: "-L/usr/local/lib"
CPPFLAGS: "-I/opt/homebrew/include"
LDFLAGS: "-L/opt/homebrew/lib"
MESON_ARGS: --unity=${{ matrix.unity }}
XML_CATALOG_FILES: "/opt/homebrew/etc/xml/catalog"
CI: 1
# These cannot evaluate anything, so we cannot set PATH or SDKROOT here
run: |
export SDKROOT="$(xcodebuild -version -sdk macosx Path)"
export PATH="$HOME/tools:/usr/local/opt/qt@5/bin:$PATH:$(brew --prefix llvm)/bin"
export PKG_CONFIG_PATH="/usr/local/opt/qt@5/lib/pkgconfig:$PKG_CONFIG_PATH"
export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"
export PATH="$HOME/tools:/opt/homebrew/opt/qt@5/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/ncurses/bin:$PATH"
export PKG_CONFIG_PATH="/opt/homebrew/opt/qt@5/lib/pkgconfig:/opt/homebrew/opt/lapack/lib/pkgconfig:/opt/homebrew/opt/ncurses/lib/pkgconfig:$PKG_CONFIG_PATH"
./tools/run_with_cov.py ./run_project_tests.py --backend=ninja
- name: Aggregate coverage reports
@ -116,10 +126,14 @@ jobs:
verbose: true
Qt4macos:
runs-on: macos-latest
# This job only works on Intel Macs, because OpenSSL 1.0 doesn't build on
# Apple ARM
runs-on: macos-13
env:
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: python -m pip install -e .
@ -131,13 +145,13 @@ jobs:
- run: ln -sfn /usr/local/Cellar/qt@4/4.8.7_6.reinstall /usr/local/Cellar/qt@4/4.8.7_6
- run: meson setup "test cases/frameworks/4 qt" build -Drequired=qt4
- run: meson compile -C build
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: Qt4_Mac_build
path: build/meson-logs/meson-log.txt
- run: meson test -C build -v
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: Qt4_Mac_test

@ -6,19 +6,23 @@ concurrency:
on:
push:
branches:
- master
# Stable branches such as 0.56 or 1.0
- '[0-9]+.[0-9]+'
paths:
- "mesonbuild/**"
- "test cases/**"
- "unittests/**"
- ".github/workflows/msys2.yml"
- "run_unittests.py"
- "run*tests.py"
pull_request:
paths:
- "mesonbuild/**"
- "test cases/**"
- "unittests/**"
- ".github/workflows/msys2.yml"
- "run_unittests.py"
- "run*tests.py"
permissions:
contents: read
@ -57,7 +61,7 @@ jobs:
shell: msys2 {0}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
@ -80,7 +84,8 @@ jobs:
mingw-w64-${{ matrix.MSYS2_ARCH }}-python-lxml
mingw-w64-${{ matrix.MSYS2_ARCH }}-python-setuptools
mingw-w64-${{ matrix.MSYS2_ARCH }}-python-pip
mingw-w64-${{ matrix.MSYS2_ARCH }}-python-jsonschema
mingw-w64-${{ matrix.MSYS2_ARCH }}-python-fastjsonschema
mingw-w64-${{ matrix.MSYS2_ARCH }}-objfw
mingw-w64-${{ matrix.MSYS2_ARCH }}-${{ matrix.TOOLCHAIN }}
- name: Install dependencies
@ -122,7 +127,7 @@ jobs:
MSYSTEM= python3 ./tools/run_with_cov.py run_tests.py --backend=ninja
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.NAME }}
path: meson-test-run.*

@ -8,7 +8,7 @@ on:
push:
branches:
- master
# Stable branches such as 0.56 or the eventual 1.0
# Stable branches such as 0.56 or 1.0
- '[0-9]+.[0-9]+'
paths:
- "mesonbuild/**"
@ -37,7 +37,7 @@ jobs:
apt-get -y purge clang gcc gdc
apt-get -y autoremove
python3 -m pip install coverage
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run tests
run: bash -c 'source /ci/env_vars.sh; cd $GITHUB_WORKSPACE; ./tools/run_with_cov.py ./run_tests.py $CI_ARGS --cross ubuntu-armhf.json --cross-only'

@ -8,7 +8,7 @@ on:
push:
branches:
- master
# Stable branches such as 0.56 or the eventual 1.0
# Stable branches such as 0.56 or 1.0
- '[0-9]+.[0-9]+'
paths:
- "mesonbuild/**"
@ -16,7 +16,7 @@ on:
- "unittests/**"
- ".github/workflows/images.yml"
- ".github/workflows/os_comp.yml"
- "run_unittests.py"
- "run*tests.py"
pull_request:
paths:
- "mesonbuild/**"
@ -24,7 +24,13 @@ on:
- "unittests/**"
- ".github/workflows/images.yml"
- ".github/workflows/os_comp.yml"
- "run_unittests.py"
- "run*tests.py"
# make GHA actions use node16 which still works with bionic
# See https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
# Unclear how long this will work though
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
permissions:
contents: read
@ -40,6 +46,7 @@ jobs:
- { name: Arch Linux, id: arch }
- { name: CUDA (on Arch), id: cuda }
- { name: Fedora, id: fedora }
- { name: Gentoo, id: gentoo }
- { name: OpenSUSE, id: opensuse }
- { name: Ubuntu Bionic, id: bionic }
container: mesonbuild/${{ matrix.cfg.id }}:latest
@ -47,12 +54,20 @@ jobs:
MESON_CI_JOBNAME: linux-${{ matrix.cfg.id }}-gcc
steps:
# Need v3 because of bionic
- uses: actions/checkout@v3
- name: Run tests
# All environment variables are stored inside the docker image in /ci/env_vars.sh
# They are defined in the `env` section in each image.json. CI_ARGS should be set
# via the `args` array ub the image.json
run: bash -c 'source /ci/env_vars.sh; cd $GITHUB_WORKSPACE; ./tools/run_with_cov.py ./run_tests.py $CI_ARGS'
shell: bash
run: |
# dmd is installed under /root on OpenSUSE
[[ ${{ matrix.cfg.id }} == opensuse ]] && export HOME=/root
source /ci/env_vars.sh
cd $GITHUB_WORKSPACE
./tools/run_with_cov.py ./run_tests.py $CI_ARGS
- name: Aggregate coverage reports
run: ./ci/combine_cov.sh
@ -73,7 +88,7 @@ jobs:
MESON_CI_JOBNAME_UPDATE: linux-arch-gcc-pypy
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run tests
run: |
source /ci/env_vars.sh
@ -127,7 +142,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Run tests
shell: bash

@ -14,7 +14,7 @@ jobs:
env:
TESTDIR: "manual tests/13 builddir upgrade"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: install ninja
run: sudo apt-get -y install build-essential ninja-build
- name: Fetch tags and unshallow

@ -44,8 +44,8 @@ jobs:
linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Compilers
@ -71,8 +71,8 @@ jobs:
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'

@ -10,9 +10,11 @@ on:
branches:
- master
paths:
- .github/workflows/website.yml
- docs/**
pull_request:
paths:
- .github/workflows/website.yml
- docs/**
workflow_dispatch:
release:
@ -30,11 +32,27 @@ jobs:
HAS_SSH_KEY: ${{ secrets.WEBSITE_PRIV_KEY != '' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
id: restore-cache
with:
# should use 'pip3 cache dir' to discover this path
path: ~/.cache/pip
key: website-pip-${{ github.run_number }}
restore-keys: website-pip-
- name: Install package
run: |
sudo apt-get -y install python3-pip ninja-build libjson-glib-dev
pip install hotdoc chevron strictyaml
- uses: actions/cache/save@v4
with:
# should use 'pip3 cache dir' to discover this path
path: ~/.cache/pip
key: website-pip-${{ github.run_number }}
- name: Setup SSH Keys and known_hosts
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock

@ -2,7 +2,7 @@
strict_optional = False
show_error_context = False
show_column_numbers = True
ignore_missing_imports = True
ignore_missing_imports = False
implicit_reexport = False
follow_imports = silent

@ -17,6 +17,7 @@ disable=
cell-var-from-loop,
consider-using-f-string,
consider-using-with,
contextmanager-generator-missing-cleanup,
cyclic-import,
deprecated-decorator,
duplicate-code,
@ -47,6 +48,7 @@ disable=
not-an-iterable,
not-callable,
pointless-string-statement,
possibly-used-before-assignment,
protected-access,
raise-missing-from,
redeclared-assigned-name,
@ -64,6 +66,7 @@ disable=
too-many-lines,
too-many-locals,
too-many-nested-blocks,
too-many-positional-arguments,
too-many-public-methods,
too-many-return-statements,
too-many-statements,
@ -75,6 +78,7 @@ disable=
unsubscriptable-object,
unused-argument,
unused-variable,
used-before-assignment,
useless-super-delegation,
wrong-import-order,
wrong-import-position,

@ -26,7 +26,7 @@ trigger:
- 'test cases'
- 'unittests'
- 'azure-pipelines.yml'
- 'ci/azure-steps.yml'
- 'ci/run.ps1'
- 'run_project_tests.py'
- 'run_tests.py'
- 'run_unittests.py'
@ -41,7 +41,7 @@ pr:
- 'test cases'
- 'unittests'
- 'azure-pipelines.yml'
- 'ci/azure-steps.yml'
- 'ci/run.ps1'
- 'run_project_tests.py'
- 'run_tests.py'
- 'run_unittests.py'

@ -11,7 +11,7 @@ pkgs=(
ninja make git sudo fakeroot autoconf automake patch
libelf gcc gcc-fortran gcc-objc vala rust bison flex cython go dlang-dmd
mono boost qt5-base gtkmm3 gtest gmock protobuf gobject-introspection
itstool gtk3 java-environment=8 gtk-doc llvm clang sdl2 graphviz
itstool glib2-devel gtk3 java-environment=8 gtk-doc llvm clang sdl2 graphviz
doxygen vulkan-validation-layers openssh mercurial gtk-sharp-2 qt5-tools
libwmf cmake netcdf-fortran openmpi nasm gnustep-base gettext
python-lxml hotdoc rust-bindgen qt6-base qt6-tools wayland wayland-protocols
@ -41,6 +41,9 @@ useradd -m $AUR_USER
echo "${AUR_USER}:" | chpasswd -e
echo "$AUR_USER ALL = NOPASSWD: ALL" >> /etc/sudoers
# fix installing packages from source, attempting to install debug info
sed -i '/OPTIONS/{s|debug|!debug|}' /etc/makepkg.conf
# Install yay
su $AUR_USER -c 'cd; git clone https://aur.archlinux.org/yay.git'
su $AUR_USER -c 'cd; cd yay; makepkg'

@ -143,13 +143,14 @@ class ImageTester(BuilderBase):
shutil.copytree(
self.meson_root,
self.temp_dir / 'meson',
symlinks=True,
ignore=shutil.ignore_patterns(
'.git',
'*_cache',
'__pycache__',
# 'work area',
self.temp_dir.name,
)
),
)
def do_test(self, tty: bool = False) -> None:

@ -15,7 +15,7 @@ base_python_pkgs=(
pytest-xdist
pytest-subtests
coverage
jsonschema
fastjsonschema
)
python_pkgs=(
@ -39,11 +39,11 @@ dub_fetch() {
}
install_minimal_python_packages() {
rm -f /usr/lib/python3.*/EXTERNALLY-MANAGED
rm -f /usr/lib*/python3.*/EXTERNALLY-MANAGED
python3 -m pip install "${base_python_pkgs[@]}" $*
}
install_python_packages() {
rm -f /usr/lib/python3.*/EXTERNALLY-MANAGED
rm -f /usr/lib*/python3.*/EXTERNALLY-MANAGED
python3 -m pip install "${base_python_pkgs[@]}" "${python_pkgs[@]}" $*
}

@ -18,4 +18,4 @@ install_minimal_python_packages
# Manually remove cache to avoid GitHub space restrictions
rm -rf /var/cache/pacman
echo "source /etc/profile.d/cuda.sh" >> /ci/env_vars.sh
echo "source /etc/profile" >> /ci/env_vars.sh

@ -6,13 +6,13 @@ source /ci/common.sh
pkgs=(
python python-pip python3-devel
ninja-build make git autoconf automake patch
ninja-build make git autoconf automake patch file
elfutils gcc gcc-c++ gcc-fortran gcc-objc gcc-objc++ vala rust bison flex ldc libasan libasan-static
mono-core boost-devel gtkmm30 gtest-devel gmock-devel protobuf-devel wxGTK3-devel gobject-introspection
mono-core boost-devel gtkmm30 gtest-devel gmock-devel protobuf-devel wxGTK-devel gobject-introspection
boost-python3-devel
itstool gtk3-devel java-latest-openjdk-devel gtk-doc llvm-devel clang-devel SDL2-devel graphviz-devel zlib zlib-devel zlib-static
#hdf5-openmpi-devel hdf5-devel netcdf-openmpi-devel netcdf-devel netcdf-fortran-openmpi-devel netcdf-fortran-devel scalapack-openmpi-devel
doxygen vulkan-devel vulkan-validation-layers-devel openssh mercurial gtk-sharp2-devel libpcap-devel gpgme-devel
doxygen vulkan-devel vulkan-validation-layers-devel openssh objfw mercurial gtk-sharp2-devel libpcap-devel gpgme-devel
qt5-qtbase-devel qt5-qttools-devel qt5-linguist qt5-qtbase-private-devel
libwmf-devel valgrind cmake openmpi-devel nasm gnustep-base-devel gettext-devel ncurses-devel
libxml2-devel libxslt-devel libyaml-devel glib2-devel json-glib-devel libgcrypt-devel wayland-devel wayland-protocols-devel

@ -0,0 +1,8 @@
{
"base_image": "gentoo/stage3:desktop",
"env": {
"CI": "1",
"MESON_CI_JOBNAME": "linux-gentoo-gcc",
"SKIP_STATIC_BOOST": "1"
}
}

@ -0,0 +1,167 @@
#!/bin/bash
set -e
source /ci/common.sh
# We divide the package list into 'pkgs_stable' and 'pkgs_latest'. The trade-off
# is that latest stuff may not have a binpkg available, but of course we get
# better test coverage with the bleeding edge then.
pkgs_stable=(
app-portage/portage-utils
dev-build/cmake
dev-vcs/git
# language support
dev-python/cython
dev-python/lxml
dev-python/pip
virtual/fortran
dev-lang/nasm
dev-lang/vala
dev-lang/python:2.7
dev-java/openjdk-bin
# requires rustfmt, bin rebuild (TODO: file bug)
#dev-util/bindgen
dev-libs/elfutils
dev-util/gdbus-codegen
dev-libs/gobject-introspection
dev-util/itstool
dev-libs/protobuf
# custom deps
net-libs/libpcap
dev-util/gtk-doc
media-libs/libwmf
sys-cluster/openmpi
sci-libs/netcdf
media-libs/libsdl2
dev-cpp/gtest
sci-libs/hdf5
dev-qt/linguist-tools
sys-devel/llvm
dev-qt/qttools
# misc
app-admin/sudo
app-text/doxygen
sys-apps/fakeroot
sys-devel/bison
sys-devel/gettext
# TODO: vulkan-validation-layers
# TODO: cuda
#dev-cpp/gtkmm:3.0
#dev-java/openjdk-bin:8
#dev-lang/go
#dev-lang/mono
#dev-lang/python
#dev-lang/rust-bin
#dev-libs/wayland
#dev-libs/wayland-protocols
#dev-python/pypy3
#dev-qt/qtbase:6
#dev-qt/qtcore:5
#dev-qt/qttools:6
#dev-vcs/mercurial
#gnustep-base/gnustep-base
#media-gfx/graphviz
#sci-libs/netcdf-fortran
#sys-devel/clang
#x11-libs/gtk+:3
)
pkgs_latest=(
# ~arch boost needed for py3.12 for now (needs 1.84)
dev-build/b2
dev-libs/boost
dev-build/autoconf
dev-build/automake
# ~arch only
sci-libs/scalapack
)
pkgs=( "${pkgs_stable[@]}" "${pkgs_latest[@]}" )
emerge-webrsync --quiet
# This means we can't really take advantage of the binhost but a lot of the
# advantages of using Gentoo in CI come from the bleeding edge side.
# With full ~arch, we don't get binpkgs for much at all. Instead, let's just
# do ~arch for the test deps we have.
#echo 'ACCEPT_KEYWORDS="~amd64"' >> /etc/portage/make.conf
printf "%s\n" ${pkgs[@]} >> /var/lib/portage/world
printf "%s\n" ${pkgs_latest[@]} >> /etc/portage/package.accept_keywords/meson
cat /etc/portage/package.accept_keywords/meson
cat <<-EOF > /etc/portage/package.accept_keywords/misc
dev-lang/python-exec
dev-lang/python
EOF
mkdir /etc/portage/binrepos.conf || true
mkdir /etc/portage/profile || true
cat <<-EOF > /etc/portage/package.use/ci
dev-cpp/gtkmm X
dev-libs/boost python
sys-libs/zlib static-libs
EOF
cat <<-EOF >> /etc/portage/make.conf
EMERGE_DEFAULT_OPTS="--complete-graph --quiet=y --quiet-build=y --jobs=$(nproc) --load-average=$(nproc)"
EMERGE_DEFAULT_OPTS="\${EMERGE_DEFAULT_OPTS} --autounmask-write --autounmask-continue --autounmask-keep-keywords=y --autounmask-use=y"
EMERGE_DEFAULT_OPTS="\${EMERGE_DEFAULT_OPTS} --binpkg-respect-use=y"
# prevent painfully verbose Github Actions logs.
FETCHCOMMAND='wget --no-show-progress -t 3 -T 60 --passive-ftp -O "\\\${DISTDIR}/\\\${FILE}" "\\\${URI}"'
# Fortran is no longer enabled by default in 23.0, but we do need and use it.
USE="\${USE} fortran"
FEATURES="\${FEATURES} parallel-fetch parallel-install -merge-sync"
FEATURES="\${FEATURES} getbinpkg binpkg-request-signature"
# These don't work in Docker, so reduce noise in logs
FEATURES="\${FEATURES} -ipc-sandbox -network-sandbox -pid-sandbox"
EOF
# TODO: Enable all Pythons / add multiple jobs with diff. Python impls?
#echo '*/* PYTHON_TARGETS: python3_10 python3_11 python3_12' >> /etc/portage/package.use/python
echo '*/* PYTHON_TARGETS: python3_12' >> /etc/portage/package.use/python
cat <<-EOF >> /etc/portage/profile/use.mask
-python_targets_python3_12
-python_single_target_python3_12
EOF
cat <<-EOF >> /etc/portage/profile/use.stable.mask
-python_targets_python3_12
-python_single_target_python3_12
EOF
echo 'dev-lang/python ensurepip' >> /etc/portage/package.use/python
# Silly mono circular dep
#USE=minimal emerge --oneshot dev-lang/mono
# If we don't want to do this, we could use the 'portage' container instead
# so the stage3/repo match.
emerge --update --deep --changed-use @world
qlop -d 'yesterday'
env-update && . /etc/profile
rm /usr/lib/python/EXTERNALLY-MANAGED
python3 -m ensurepip
install_python_packages
python3 -m pip install "${base_python_pkgs[@]}"
echo "source /etc/profile" >> /ci/env_vars.sh
# Cleanup to avoid including large contents in the docker image.
# We don't need cache files that are side artifacts of installing packages.
# We also don't need the gentoo tree -- the official docker image doesn't
# either, and expects you to use emerge-webrsync once you need it.
rm -rf /var/cache/binpkgs
rm -rf /var/cache/distfiles
rm -rf /var/db/repos/gentoo

@ -5,11 +5,11 @@ set -e
source /ci/common.sh
pkgs=(
python3-pip python3 python3-devel
python3-pip python3 python3-devel python3-setuptools
ninja make git autoconf automake patch libjpeg-devel
elfutils gcc gcc-c++ gcc-fortran gcc-objc gcc-obj-c++ vala rust bison flex curl lcov
mono-core gtkmm3-devel gtest gmock protobuf-devel wxGTK3-3_2-devel gobject-introspection-devel
itstool gtk3-devel java-20-openjdk-devel gtk-doc llvm-devel clang-devel libSDL2-devel graphviz-devel zlib-devel zlib-devel-static
itstool gtk3-devel java-17-openjdk-devel gtk-doc llvm-devel clang-devel libSDL2-devel graphviz-devel zlib-devel zlib-devel-static
#hdf5-devel netcdf-devel libscalapack2-openmpi3-devel libscalapack2-gnu-openmpi3-hpc-devel openmpi3-devel
doxygen vulkan-devel vulkan-validationlayers openssh mercurial gtk-sharp3-complete gtk-sharp2-complete libpcap-devel libgpgme-devel
libqt5-qtbase-devel libqt5-qttools-devel libqt5-linguist libqt5-qtbase-private-headers-devel
@ -35,11 +35,14 @@ echo 'export PKG_CONFIG_PATH="/usr/lib64/mpi/gcc/openmpi3/lib64/pkgconfig:$PKG_C
curl -fsS https://dlang.org/install.sh | bash -s dmd | tee dmd_out.txt
cat dmd_out.txt | grep source | sed 's/^[^`]*`//g' | sed 's/`.*//g' >> /ci/env_vars.sh
chmod +x /ci/env_vars.sh
# Lower ulimit before running dub, otherwise there's a very high chance it will OOM.
# See: https://github.com/dlang/phobos/pull/9048 and https://github.com/dlang/phobos/pull/8990
echo 'ulimit -n -S 10000' >> /ci/env_vars.sh
source /ci/env_vars.sh
dub_fetch urld
dub build urld --compiler=dmd
dub build --deep urld --arch=x86_64 --compiler=dmd --build=debug
dub_fetch dubtestproject
dub build dubtestproject:test1 --compiler=dmd
dub build dubtestproject:test2 --compiler=dmd

@ -27,9 +27,10 @@ pkgs=(
bindgen
itstool
openjdk-11-jre
jq
)
sed -i '/^#\sdeb-src /s/^#//' "/etc/apt/sources.list"
sed -i '/^Types: deb/s/deb/deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources
apt-get -y update
apt-get -y upgrade
apt-get -y install eatmydata
@ -43,9 +44,13 @@ eatmydata apt-get -y install --no-install-recommends wine-stable # Wine is spec
install_python_packages hotdoc
# Lower ulimit before running dub, otherwise there's a very high chance it will OOM.
# See: https://github.com/dlang/phobos/pull/9048 and https://github.com/dlang/phobos/pull/8990
echo 'ulimit -n -S 10000' >> /ci/env_vars.sh
ulimit -n -S 10000
# dub stuff
dub_fetch urld
dub build urld --compiler=gdc
dub build --deep urld --arch=x86_64 --compiler=gdc --build=debug
dub_fetch dubtestproject
dub build dubtestproject:test1 --compiler=ldc2
dub build dubtestproject:test2 --compiler=ldc2
@ -56,6 +61,37 @@ apt-get -y remove rustc || true
wget -O - https://sh.rustup.rs | sh -s -- -y --profile minimal --component clippy
source "$HOME/.cargo/env"
rustup target add x86_64-pc-windows-gnu
rustup target add arm-unknown-linux-gnueabihf
# Zig
# Use the GitHub API to get the latest release information
LATEST_RELEASE=$(wget -qO- "https://api.github.com/repos/ziglang/zig/releases/latest")
ZIGVER=$(echo "$LATEST_RELEASE" | jq -r '.tag_name')
ZIG_BASE="zig-linux-x86_64-$ZIGVER"
wget "https://ziglang.org/download/$ZIGVER/$ZIG_BASE.tar.xz"
tar xf "$ZIG_BASE.tar.xz"
rm -rf "$ZIG_BASE.tar.xz"
cd "$ZIG_BASE"
# As mentioned in the Zig readme, the binary and files under lib can be copied
# https://github.com/ziglang/zig?tab=readme-ov-file#installation
mv zig /usr/bin
mv lib /usr/lib/zig
# Copy the LICENSE
mkdir -p /usr/share/doc/zig
cp LICENSE /usr/share/doc/zig
# Remove what's left of the directory
cd ..
rm -rf "$ZIG_BASE"
# Hack for https://github.com/linux-test-project/lcov/issues/245
# https://github.com/linux-test-project/lcov/commit/bf135caf5f626e02191c42bd2773e08a0bb9b7e5
# XXX: Drop this once Ubuntu has lcov-2.1*
git clone https://github.com/linux-test-project/lcov
cd lcov
make install
# cleanup
apt-get -y clean

@ -8,21 +8,22 @@ if ($LastExitCode -ne 0) {
$env:Path = ($env:Path.Split(';') | Where-Object { $_ -notmatch 'mingw|Strawberry|Chocolatey|PostgreSQL' }) -join ';'
if ($env:arch -eq 'x64') {
rustup default 1.77
# Rust puts its shared stdlib in a secret place, but it is needed to run tests.
$env:Path += ";$HOME/.rustup/toolchains/stable-x86_64-pc-windows-msvc/bin"
$env:Path += ";$HOME/.rustup/toolchains/1.77-x86_64-pc-windows-msvc/bin"
} elseif ($env:arch -eq 'x86') {
# Switch to the x86 Rust toolchain
rustup default stable-i686-pc-windows-msvc
# Also install clippy
rustup component add clippy
rustup default 1.77-i686-pc-windows-msvc
# Rust puts its shared stdlib in a secret place, but it is needed to run tests.
$env:Path += ";$HOME/.rustup/toolchains/stable-i686-pc-windows-msvc/bin"
$env:Path += ";$HOME/.rustup/toolchains/1.77-i686-pc-windows-msvc/bin"
# Need 32-bit Python for tests that need the Python dependency
$env:Path = "C:\hostedtoolcache\windows\Python\3.7.9\x86;C:\hostedtoolcache\windows\Python\3.7.9\x86\Scripts;$env:Path"
}
# Also install clippy
rustup component add clippy
# Set the CI env var for the meson test framework
$env:CI = '1'
@ -49,7 +50,7 @@ function DownloadFile([String] $Source, [String] $Destination) {
if (($env:backend -eq 'ninja') -and ($env:arch -ne 'arm64')) { $dmd = $true } else { $dmd = $false }
DownloadFile -Source https://github.com/mesonbuild/cidata/releases/download/ci3/ci_data.zip -Destination $env:AGENT_WORKFOLDER\ci_data.zip
DownloadFile -Source https://github.com/mesonbuild/cidata/releases/download/ci5/ci_data.zip -Destination $env:AGENT_WORKFOLDER\ci_data.zip
echo "Extracting ci_data.zip"
Expand-Archive $env:AGENT_WORKFOLDER\ci_data.zip -DestinationPath $env:AGENT_WORKFOLDER\ci_data
& "$env:AGENT_WORKFOLDER\ci_data\install.ps1" -Arch $env:arch -Compiler $env:compiler -Boost $true -DMD $dmd
@ -92,7 +93,7 @@ python --version
# Needed for running unit tests in parallel.
echo ""
python -m pip --disable-pip-version-check install --upgrade pefile pytest-xdist pytest-subtests jsonschema coverage
python -m pip --disable-pip-version-check install --upgrade pefile pytest-xdist pytest-subtests fastjsonschema coverage
# Needed for running the Cython tests
python -m pip --disable-pip-version-check install cython

@ -1,19 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2021 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script is used by coverage (see tools/run_with_cov.py) to enable coverage
# reports in python subprocesses
import coverage
coverage.process_startup()

@ -2,12 +2,6 @@
# toolchain is added to the environment(PATH) variable, so that
# Meson can find the binaries while building.
# You should also do one of the following to ensure Meson can
# locate the .lcf linker script:
# - Add the cross directory to PATH as well
# - Edit c_link_args and cpp_link_args with the full
# path to the .lcf file on your machine
[binaries]
c = 'mwccarm'
c_ld = 'mwldarm'
@ -18,11 +12,12 @@ as = 'mwasmarm'
[built-in options]
c_args = ['-lang', 'c99', '-D_NITRO', '-nosyspath']
c_link_args = 'metrowerks.lcf'
c_link_args = '@DIRNAME@' / 'metrowerks.lcf'
cpp_args = ['-lang', 'c++', '-D_NITRO', '-nosyspath']
cpp_link_args = 'metrowerks.lcf'
cpp_link_args = '@DIRNAME@' / 'metrowerks.lcf'
[host_machine]
system = 'bare metal'
cpu = 'arm'
cpu_family = 'arm'
endian = 'little'

@ -2,12 +2,6 @@
# of choice is added to the environment(PATH) variable, so that
# Meson can find the binaries while building.
# You should also do one of the following to ensure Meson can
# locate the .lcf linker script:
# - Add the cross directory to PATH as well
# - Edit c_link_args and cpp_link_args with the full
# path to the lcf file on your machine
[binaries]
c = 'mwcceppc'
c_ld = 'mwldeppc'
@ -18,11 +12,12 @@ as = 'mwasmeppc'
[built-in options]
c_args = ['-lang', 'c99', '-nosyspath']
c_link_args = 'metrowerks.lcf'
c_link_args = '@DIRNAME@' / 'metrowerks.lcf'
cpp_args = ['-lang', 'c++', '-nosyspath']
cpp_link_args = 'metrowerks.lcf'
cpp_link_args = '@DIRNAME@' / 'metrowerks.lcf'
[host_machine]
system = 'bare metal'
cpu = 'ppc'
cpu_family = 'ppc'
endian = 'little'

@ -0,0 +1,22 @@
# Cross file tested on Texas Instruments C6000 compiler (bare metal DSP devices)
# This file assumes that path to the Texas Instruments C6000 toolchain is added
# to the environment(PATH) variable.
[host_machine]
system = 'c6000'
cpu_family = 'c6000'
cpu = 'c64x'
endian = 'little'
[binaries]
c = 'cl6x'
cpp = 'cl6x'
ar = 'ar6x'
strip = 'strip6x'
nm = 'nm6x'
as = 'asm6x'
[properties]
needs_exe_wrapper = true
has_function_printf = true
bits = 32

@ -1,6 +1,7 @@
%__meson %{_bindir}/meson
%__meson_wrap_mode nodownload
%__meson_auto_features enabled
%__meson_verbose 1
%meson \
%set_build_flags \
@ -28,13 +29,14 @@
%{shrink:%{__meson} compile \
-C %{_vpath_builddir} \
-j %{_smp_build_ncpus} \
--verbose \
%{?__meson_verbose:--verbose} \
%{nil}}
%meson_install \
%{shrink:DESTDIR=%{buildroot} %{__meson} install \
-C %{_vpath_builddir} \
--no-rebuild \
%{!?__meson_verbose:--quiet} \
%{nil}}
%meson_test \

File diff suppressed because it is too large Load Diff

@ -29,10 +29,10 @@
local curcontext="$curcontext" state line
local -i ret
local __meson_backends="(ninja xcode ${(j. .)${:-vs{,2010,2015,2017}}})"
local __meson_backends="(ninja "${(j. .)${:-vs{,2010,2015,2017,2019,2022}}}" xcode none)"
local __meson_build_types="(plain debug debugoptimized minsize release)"
local __meson_wrap_modes="(WrapMode.{default,nofallback,nodownload,forcefallback})"
local __meson_dist_formats=("xztar" "gztar" "zip")
local __meson_wrap_modes="(default nofallback nodownload forcefallback nopromote)"
local __meson_dist_formats=("xztar" "bztar" "gztar" "zip")
local __meson_cd='-C[change into this directory before running]:target dir:_directories'
local -a __meson_common=(
'--prefix=[installation prefix]: :_directories'
@ -81,6 +81,11 @@ local -a meson_commands=(
'wrap:manage source dependencies'
'subprojects:manage subprojects'
'compile:Build the project'
'rewrite:Modify the project definition'
'devenv:Run commands in developer environment'
'env2mfile:Convert current environment to a cross or native file'
'format:Format meson source file'
'help:Print help of a subcommand'
)
(( $+functions[__meson_is_build_dir] )) || __meson_is_build_dir() {
@ -181,6 +186,7 @@ local -a meson_commands=(
'--no-rebuild[do not rebuild before running tests]'
'--gdb[run tests under gdb]'
'--gdb-path=[program to run for gdb (can be wrapper or compatible program)]:program:_path_commands'
'(--interactive -i)'{'--interactive','-i'}'[run tests with interactive input/output]'
'--list[list available tests]'
'(--wrapper --wrap)'{'--wrapper=','--wrap='}'[wrapper to run tests with]:wrapper program:_path_commands'
"$__meson_cd"
@ -195,6 +201,7 @@ local -a meson_commands=(
'(--quiet -q)'{'--quiet','-q'}'[produce less output to the terminal]'
'(--timeout-multiplier -t)'{'--timeout-multiplier','-t'}'[a multiplier for test timeouts]:Python floating-point number: '
'--setup[which test setup to use]:test setup: '
'--max-lines[Maximum number of lines to show from a long test log]:Python integer number: '
'--test-args[arguments to pass to the tests]: : '
'*:Meson tests:__meson_test_names'
)
@ -210,7 +217,7 @@ local -a meson_commands=(
"$__meson_cd"
'--no-rebuild[Do not rebuild before installing]'
'--only-changed[Do not overwrite files that are older than the copied file]'
'--quiet[Do not print every file that was installed]'
'(--quiet -q)'{'--quiet','-q'}'[Do not print every file that was installed]'
)
_arguments \
'(: -)'{'--help','-h'}'[show a help message and quit]' \
@ -368,7 +375,7 @@ _arguments \
)
if (( CURRENT == 2 )); then
_describe -t commands "Meson subproject subcommands" commands
_describe -t commands "Meson subprojects subcommands" commands
else
local curcontext="$curcontext"
cmd="${${commands[(r)$words[2]:*]%%:*}}"
@ -379,7 +386,7 @@ _arguments \
_meson-subprojects-$cmd
fi
else
_message "unknown meson subproject command: $words[2]"
_message "unknown meson subprojects command: $words[2]"
fi
fi
@ -390,7 +397,7 @@ _arguments \
local -a specs=(
"$__meson_cd"
'--clean[Clean the build directory]'
'(-j --jobs)'{'-j','--jobs'}'=[the number fo work jobs to run (if supported)]:_guard "[0-9]#" "number of jobs"'
'(-j --jobs)'{'-j','--jobs'}'=[the number of work jobs to run (if supported)]:_guard "[0-9]#" "number of jobs"'
'(-l --load-average)'{'-l','--load-average'}'=[the system load average to try to maintain (if supported)]:_guard "[0-9]#" "load average"'
'(-v --verbose)'{'-v','--verbose'}'[Show more output]'
'--ninja-args=[Arguments to pass to ninja (only when using ninja)]'
@ -401,6 +408,98 @@ _arguments \
"${(@)specs}"
}
# TODO: implement rewrite sub-commands properly
(( $+functions[_meson-rewrite-target] )) || _meson-rewrite-target() {
_arguments \
'(: -)'{'--help','-h'}'[show a help message and quit]' \
}
(( $+functions[_meson-rewrite-kwargs] )) || _meson-rewrite-kwargs() {
_arguments \
'(: -)'{'--help','-h'}'[show a help message and quit]' \
}
(( $+functions[_meson-rewrite-default-options] )) || _meson-rewrite-default-options() {
_arguments \
'(: -)'{'--help','-h'}'[show a help message and quit]' \
}
(( $+functions[_meson-rewrite-command] )) || _meson-rewrite-command() {
_arguments \
'(: -)'{'--help','-h'}'[show a help message and quit]' \
}
(( $+functions[_meson-rewrite] )) || _meson-rewrite() {
local -a commands=(
'target:Modify a target'
'kwargs:Modify keyword arguments'
'default-options:Modify the project default options'
'command:Execute a JSON array of commands'
)
if (( CURRENT == 2 )); then
_describe -t commands "Meson rewrite subcommands" commands
else
local curcontext="$curcontext"
cmd="${${commands[(r)$words[2]:*]%%:*}}"
if [[ $cmd == status ]]; then
_message "no options"
else
_meson-rewrite-$cmd
fi
fi
}
(( $+functions[_meson-devenv] )) || _meson-devenv() {
local curcontext="$curcontext"
local -a specs=(
"$__meson_cd"
'--clean=[Clean the build directory]'
'(-w workdir)'{'-w','--workdir'}'=[Directory to cd into before running (default: builddir, Since 1.0.0)]:target dir:_directories'
'--dump=[Only print required environment (Since 0.62.0) Takes an optional file path (Since 1.1.0)]:dump path:_files'
'--dump-format=[Format used with --dump (Since 1.1.0)]:format:(sh export vscode)'
)
_arguments \
'(: -)'{'--help','-h'}'[show a help message and quit]' \
"${(@)specs}"
}
(( $+functions[_meson-env2mfile] )) || _meson-env2mfile() {
local curcontext="$curcontext"
local -a specs=(
'--debarch=[The dpkg architecture to generate.]'
'--gccsuffix=[A particular gcc version suffix if necessary.]'
'-o=[The output file.]:file:_files'
'--cross=[Generate a cross compilation file.]'
'--native=[Generate a native compilation file.]'
'--system=[Define system for cross compilation.]'
'--subsystem=[Define subsystem for cross compilation.]'
'--kernel=[Define kernel for cross compilation.]'
'--cpu=[Define cpu for cross compilation.]'
'--cpu-family=[Define cpu family for cross compilation.]'
'--endian=[Define endianness for cross compilation.]:endianness:(big little)'
)
_arguments \
'(: -)'{'--help','-h'}'[show a help message and quit]' \
"${(@)specs}"
}
(( $+functions[_meson-format] )) || _meson-format() {
local curcontext="$curcontext"
local -a specs=(
'(-q --check-only)'{'-q','--check-only'}'=[exit with 1 if files would be modified by meson format]'
'(-i --inplace)'{'-i','--inplace'}'=[format files in-place]'
'(-r --recursive)'{'-r','--recursive'}'=[recurse subdirs (requires --check-only or --inplace option)]'
'(-c --configuration)'{'-c','--configuration'}'=[read configuration from meson.format]'
'(-e --editor-config)'{'-e','--editor-config'}'=[try to read configuration from .editorconfig]'
'(-o --output)'{'-o','--output'}'=[output file (implies having exactly one input)]'
)
_arguments \
'(: -)'{'--help','-h'}'[show a help message and quit]' \
"${(@)specs}"
}
if [[ $service != meson ]]; then
_call_function ret _$service
return ret

@ -3,7 +3,7 @@
" License: VIM License
" Maintainer: Nirbheek Chauhan <nirbheek.chauhan@gmail.com>
" Liam Beguin <liambeguin@gmail.com>
" Last Change: 2021 Aug 16
" Last Change: 2023 Aug 27
" Credits: Zvezdan Petkovic <zpetkovic@acm.org>
" Neil Schemenauer <nas@meson.ca>
" Dmitry Vasiliev
@ -64,6 +64,11 @@ syn keyword mesonBoolean false true
" Built-in functions
syn keyword mesonBuiltin
\ build_machine
\ host_machine
\ meson
\ option
\ target_machine
\ add_global_arguments
\ add_global_link_arguments
\ add_languages
@ -75,11 +80,11 @@ syn keyword mesonBuiltin
\ assert
\ benchmark
\ both_libraries
\ build_machine
\ build_target
\ configuration_data
\ configure_file
\ custom_target
\ debug
\ declare_dependency
\ dependency
\ disabler
@ -87,30 +92,26 @@ syn keyword mesonBuiltin
\ error
\ executable
\ files
\ find_library
\ find_program
\ generator
\ get_option
\ get_variable
\ gettext
\ host_machine
\ import
\ include_directories
\ install_data
\ install_emptydir
\ install_headers
\ install_man
\ install_subdir
\ install_symlink
\ install_emptydir
\ is_disabler
\ is_variable
\ jar
\ join_paths
\ library
\ meson
\ message
\ option
\ project
\ range
\ run_command
\ run_target
\ set_variable
@ -122,13 +123,10 @@ syn keyword mesonBuiltin
\ subdir_done
\ subproject
\ summary
\ target_machine
\ test
\ unset_variable
\ vcs_tag
\ warning
\ range
\ debug
if exists("meson_space_error_highlight")
" trailing whitespace

@ -27,12 +27,14 @@
"shared_lib",
"python_lib",
"python_limited_lib",
"python_bytecode",
"pdb",
"implib",
"py_implib",
"py_limited_implib",
"implibempty",
"expr"
"expr",
"link"
]
},
"platform": {
@ -85,13 +87,13 @@
"type": "string"
}
},
"skip_on_jobname": {
"expect_skip_on_jobname": {
"type": "array",
"items": {
"type": "string"
}
},
"skip_on_os": {
"expect_skip_on_os": {
"type": "array",
"items": {
"type": "string"
@ -165,13 +167,19 @@
"type": "string"
}
},
"skip_on_jobname": {
"expect_skip_on_jobname": {
"type": "array",
"items": {
"type": "string"
}
},
"skip_on_os": {
"expect_skip_on_os": {
"type": "array",
"items": {
"type": "string"
}
},
"cleanup": {
"type": "array",
"items": {
"type": "string"

@ -1,19 +1,7 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
# Copyright 2021 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Hack to make relative imports to mlog possible
from pathlib import Path
import sys

@ -1,18 +1,7 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
# Copyright 2019 The Meson development team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
'''
Generates release notes for new releases of Meson build system
'''

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# SPDX-License-Identifer: Apache-2.0
# SPDX-License-Identifier: Apache-2.0
# Copyright 2021 The Meson development team
import argparse

@ -6,7 +6,7 @@ short-description: Build options to configure project properties
Most non-trivial builds require user-settable options. As an example a
program may have two different data backends that are selectable at
build time. Meson provides for this by having a option definition
build time. Meson provides for this by having an option definition
file. Its name is `meson.options` and it is placed at the root of
your source tree. For versions of meson before 1.1, this file was called
`meson_options.txt`.
@ -60,7 +60,7 @@ This type is available since Meson version 0.45.0.
### Arrays
Arrays represent an array of strings. By default the array can contain
arbitrary strings. To limit the possible values that can used set the
arbitrary strings. To limit the possible values that can be used set the
`choices` parameter. Meson will then only allow the value array to
contain strings that are in the given list. The array may be
empty. The `value` parameter specifies the default value of the option
@ -75,7 +75,7 @@ This type is available since version 0.44.0
### Features
A `feature` option has three states: `enabled`, `disabled` or `auto`.
It is intended to be passed as value for the `required` keyword
It is intended to be passed as a value for the `required` keyword
argument of most functions. Currently supported in
[[add_languages]],
[[compiler.find_library]],
@ -155,7 +155,7 @@ option('o5', type: 'boolean', deprecated: {'enabled': 'true', 'disabled': 'false
```
Since *0.63.0* the `deprecated` keyword argument can take the name of a new option
that replace this option. In that case, setting a value on the deprecated option
that replaces this option. In that case, setting a value on the deprecated option
will set the value on both the old and new names, assuming they accept the same
values.

@ -36,7 +36,7 @@ ignored if the library is configured as static at the compile time.
```meson
project('shared lib', 'c')
library('mylib', 'source.c', version : '1.2.3', soversion : '0')
library('mylib', 'source.c', version : '1.2.3', soversion : '1')
```
It is common to build a library and then an executable that links

@ -79,6 +79,7 @@ machine](#specifying-options-per-machine) section for details.
| genvslite {vs2022} | vs2022 | Setup multi-builtype ninja build directories and Visual Studio solution | no | no |
| buildtype {plain, debug,<br>debugoptimized, release, minsize, custom} | debug | Build type to use | no | no |
| debug | true | Enable debug symbols and other information | no | no |
| default_both_libraries {shared, static, auto} | shared | Default library type for both_libraries | no | no |
| default_library {shared, static, both} | shared | Default library type | no | yes |
| errorlogs | true | Whether to print the logs from failing tests. | no | no |
| install_umask {preserve, 0000-0777} | 022 | Default umask to apply on permissions of installed files | no | no |
@ -91,7 +92,7 @@ machine](#specifying-options-per-machine) section for details.
| strip | false | Strip targets on install | no | no |
| unity {on, off, subprojects} | off | Unity build | no | no |
| unity_size {>=2} | 4 | Unity file block size | no | no |
| warning_level {0, 1, 2, 3, everything} | 1 | Set the warning level. From 0 = none to everything = highest | no | yes |
| warning_level {0, 1, 2, 3, everything} | 1 | Set the warning level. From 0 = compiler default to everything = highest | no | yes |
| werror | false | Treat warnings as errors | no | yes |
| wrap_mode {default, nofallback,<br>nodownload, forcefallback, nopromote} | default | Wrap mode to use | no | no |
| force_fallback_for | [] | Force fallback for those dependencies | no | no |
@ -177,6 +178,19 @@ fails.
`vsenv` is `true` by default when using the `vs` backend.
#### Details for `default_both_libraries`
Since `1.6.0`, you can select the default type of library selected when using
a `both_libraries` object. This can be either 'shared' (default value, compatible
with previous meson versions), 'static', or 'auto'. With auto, the value from
`default_library` option is used, unless it is 'both', in which case 'shared'
is used instead.
When `default_both_libraries` is 'auto', passing a [[@both_libs]] dependency
in [[both_libraries]] will link the static dependency with the static lib,
and the shared dependency with the shared lib.
## Base options
These are set in the same way as universal options, either by
@ -257,7 +271,7 @@ or compiler being used:
| ------ | ------------- | --------------- | ----------- |
| c_args | | free-form comma-separated list | C compile arguments to use |
| c_link_args | | free-form comma-separated list | C link arguments to use |
| c_std | none | none, c89, c99, c11, c17, c18, c2x, gnu89, gnu99, gnu11, gnu17, gnu18, gnu2x | C language standard to use |
| c_std | none | none, c89, c99, c11, c17, c18, c2x, c23, gnu89, gnu99, gnu11, gnu17, gnu18, gnu2x, gnu23 | C language standard to use |
| c_winlibs | see below | free-form comma-separated list | Standard Windows libs to link against |
| c_thread_count | 4 | integer value ≥ 0 | Number of threads to use with emcc when using threads |
| cpp_args | | free-form comma-separated list | C++ compile arguments to use |
@ -280,11 +294,11 @@ All these `<lang>_*` options are specified per machine. See below in
the [specifying options per machine](#specifying-options-per-machine)
section on how to do this in cross builds.
When using MSVC, `cpp_eh=none` will result in no exception flags being
passed, while the `cpp_eh=[value]` will result in `/EH[value]`. Since
*0.51.0* `cpp_eh=default` will result in `/EHsc` on MSVC. When using
gcc-style compilers, nothing is passed (allowing exceptions to work),
while `cpp_eh=none` passes `-fno-exceptions`.
When using MSVC, `cpp_eh=[value]` will result in `/EH[value]` being passed.
The magic value `none` translates to `s-c-` to disable exceptions. *Since
0.51.0* `default` translates to `sc`. When using gcc-style compilers, nothing
is passed (allowing exceptions to work), while `cpp_eh=none` passes
`-fno-exceptions`.
Since *0.54.0* The `<lang>_thread_count` option can be used to control
the value passed to `-s PTHREAD_POOL_SIZE` when using emcc. No other
@ -296,6 +310,21 @@ is inherited from the main project. This is useful, for example, when the main
project requires C++11, but a subproject requires C++14. The `cpp_std` value
from the subproject's `default_options` is now respected.
Since *1.3.0* `c_std` and `cpp_std` options now accept a list of values.
Projects that prefer GNU C, but can fallback to ISO C, can now set, for
example, `default_options: 'c_std=gnu11,c11'`, and it will use `gnu11` when
available, but fallback to c11 otherwise. It is an error only if none of the
values are supported by the current compiler.
Likewise, a project that can take benefit of `c++17` but can still build with
`c++11` can set `default_options: 'cpp_std=c++17,c++11'`.
This allows us to deprecate `gnuXX` values from the MSVC compiler. That means
that `default_options: 'c_std=gnu11'` will now print a warning with MSVC
but fallback to `c11`. No warning is printed if at least one
of the values is valid, i.e. `default_options: 'c_std=gnu11,c11'`.
In the future that deprecation warning will become an hard error because
`c_std=gnu11` should mean GNU is required, for projects that cannot be
built with MSVC for example.
## Specifying options per machine
Since *0.51.0*, some options are specified per machine rather than
@ -393,7 +422,8 @@ interpreter directly, even if it is a venv. Setting to `venv` will instead use
the paths for the virtualenv the python found installation comes from (or fail
if it is not a virtualenv). Setting to `auto` will check if the found
installation is a virtualenv, and use `venv` or `system` as appropriate (but
never `prefix`). This option is mutually exclusive with the `platlibdir`/`purelibdir`.
never `prefix`). Note that Conda environments are treated as `system`.
This option is mutually exclusive with the `platlibdir`/`purelibdir`.
For backwards compatibility purposes, the default `install_env` is `prefix`.

@ -58,14 +58,17 @@ Builds a default or a specified target of a configured Meson project.
*(since 0.55.0)*
`TARGET` has the following syntax `[PATH/]NAME[:TYPE]`, where:
`TARGET` has the following syntax `[PATH/]NAME.SUFFIX[:TYPE]`, where:
- `NAME`: name of the target from `meson.build` (e.g. `foo` from `executable('foo', ...)`).
- `SUFFIX`: name of the suffix of the target from `meson.build` (e.g. `exe` from `executable('foo', suffix: 'exe', ...)`).
- `PATH`: path to the target relative to the root `meson.build` file. Note: relative path for a target specified in the root `meson.build` is `./`.
- `TYPE`: type of the target. Can be one of the following: 'executable', 'static_library', 'shared_library', 'shared_module', 'custom', 'alias', 'run', 'jar'.
`PATH` and/or `TYPE` can be omitted if the resulting `TARGET` can be
`PATH`, `SUFFIX`, and `TYPE` can all be omitted if the resulting `TARGET` can be
used to uniquely identify the target in `meson.build`.
Note that `SUFFIX` did not exist prior to 1.3.0.
#### Backend specific arguments
*(since 0.55.0)*
@ -111,7 +114,7 @@ meson compile foo:shared_library foo:static_library bar
Produce a coverage html report (if available):
```
meson compile coverage-html
ninja coverage-html
```
### dist
@ -222,6 +225,34 @@ DESTDIR=/path/to/staging/area meson install -C builddir
Since *0.60.0* `DESTDIR` and `--destdir` can be a path relative to build
directory. An absolute path will be set into environment when executing scripts.
### reprotest
*(since 1.6.0)*
{{ reprotest_usage.inc }}
Simple reproducible build tester that compiles the project twice and
checks whether the end results are identical.
This command must be run in the source root of the project you want to
test.
{{ reprotest_arguments.inc }}
#### Examples
meson reprotest
Builds the current project with its default settings.
meson reprotest --intermediaries -- --buildtype=debugoptimized
Builds the target and also checks that all intermediate files like
object files are also identical. All command line arguments after the
`--` are passed directly to the underlying `meson` invocation. Only
use option arguments, i.e. those that start with a dash, Meson sets
directory arguments automatically.
### rewrite
*(since 0.50.0)*
@ -244,6 +275,17 @@ Configures a build directory for the Meson project.
was no COMMAND supplied). However, supplying the command is necessary to avoid
clashes with future added commands, so "setup" should be used explicitly.
*Since 1.1.0* `--reconfigure` is allowed even if the build directory does not
already exist, that argument is ignored in that case.
*Since 1.3.0* If the build directory already exists, options are updated with
their new value given on the command line (`-Dopt=value`). Unless `--reconfigure`
is also specified, this won't reconfigure immediately. This has the same behaviour
as `meson configure <builddir> -Dopt=value`.
*Since 1.3.0* It is possible to clear the cache and reconfigure in a single command
with `meson setup --clearcache --reconfigure <builddir>`.
{{ setup_arguments.inc }}
See [Meson introduction
@ -382,3 +424,82 @@ format should be used. There are currently 3 formats supported:
seems to be properly supported by vscode.
{{ devenv_arguments.inc }}
### format
*(since 1.5.0)*
{{ format_usage.inc }}
Format specified `meson.build` documents. For compatibility with `muon`, `fmt`
is an alias to `format`.
{{ format_arguments.inc }}
The configuration file is a `.ini` file. If a `meson.format` file exists
beside the provided build file to analyze, and no configuration file is
provided on the command line, the `meson.format` file is automatically used.
If no build file is provided on the command line, the `meson.build` file in
current directory is analyzed.
The following options are recognized:
- max_line_length (int): When an array, a dict, a function or a method
would be longer that this, it is formatted one argument per line
(Default is 80).
- indent_by (str): Indentation to use (Default is four spaces `' '`).
- space_array (bool): Whether to add spaces between `[]` and array
arguments (default is false).
- kwargs_force_multiline (bool): If true, arguments are formatted one per
line as soon as there is a keyword argument (default is false).
- wide_colon (bool): If true, a space is placed before colon in dict
and in keyword arguments (default is false).
- no_single_comma_function (bool): If true, a comma is never appended
to function arguments if there is only one argument, even if
using multiline arguments (default is false).
- end_of_line ('cr', 'lf', 'crlf', 'native'): Line ending to use
(applied when using `--output` or `--inline` argument) (default
is 'native).
- indent_before_comments (str): Indentation to use before inline comments
(default is two spaces `' '`).
- simplify_string_literals (bool): When true, multiline strings are
converted to single line strings if they don't contain newlines.
Formatted strings are converted to normal strings if they don't
contain substitutions (default is true).
- insert_final_newline (bool): If true, force the `meson.build` file
to end with a newline character (default is true).
- tab_width (int): Width of tab stops, used to compute line length
when `indent_by` uses tab characters (default is 4).
- sort_files (bool): When true, arguments of `files()` function are
sorted alphabetically (default is false).
- group_arg_value (bool): When true, string argument with `--` prefix
followed by string argument without `--` prefix are grouped on the
same line, in multiline arguments (default is false).
- use_editor_config (bool): When true, also uses config from .editorconfig .
The first six options are the same than for the `muon fmt` command.
It is also possible to use a `.editorconfig` file, by providing
the `--editor-config` option on the command line, or with the
`use_editor_config` option in the config file.
When `--recursive` option is specified, `meson.build` files from
`subdir` are also analyzed (must be used in conjunction with `--inplace`
or `--check-only` option).
#### Differences with `muon fmt`
The `meson format` command should be compatible with the `muon fmt` command.
However, it has more features, and some differences:
- By default, `meson format` put two spaces before inline comments,
while `muon fmt` only puts one.
- `muon fmt` can potentially mix crlf and lf end-of-lines, as it is not aware
of them. `meson format` will always be consistent in the output it produces.
- `muon fmt` only recognize the `indent_by` option from .editorconfig files.
`meson format` also recognizes `max_line_length`, `end_of_line`,
`insert_final_newline` and `tab_width` options.
- `meson format` has many additional format rules (see option list above).

@ -87,7 +87,7 @@ endif
## Configuring without an input file
If the input file is not defined then Meson will generate a header
file all the entries in the configuration data object. The
file with all the entries in the configuration data object. The
replacements are the same as when generating `#mesondefine` entries:
```meson
@ -116,7 +116,7 @@ Will produce:
## Dealing with file encodings
The default Meson file encoding to configure files is utf-8. If you
need to configure a file that is not utf-8 encoded the encoding
need to configure a file that is not utf-8 encoded the `encoding`
keyword will allow you to specify which file encoding to use. It is
however strongly advised to convert your non utf-8 file to utf-8
whenever possible. Supported file encodings are those of python3, see

@ -61,7 +61,7 @@ a sample output for a simple project.
------ ------------- --------------- -----------
c_args [] Extra arguments passed to the C compiler
c_link_args [] Extra arguments passed to the C linker
c_std c99 [none, c89, c99, c11, c17, c18, c2x, gnu89, gnu99, gnu11, gnu17, gnu18, gnu2x] C language standard to use
c_std c99 [none, c89, c99, c11, c17, c18, c2x, c23, gnu89, gnu99, gnu11, gnu17, gnu18, gnu2x, gnu23] C language standard to use
cpp_args [] Extra arguments passed to the C++ compiler
cpp_debugstl false [true, false] STL debug mode
cpp_link_args [] Extra arguments passed to the C++ linker

@ -40,7 +40,7 @@ script:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) meson setup builddir && meson test -C builddir; fi
```
## CircleCi for Linux (with Docker)
## CircleCI for Linux host (with custom Docker images)
[CircleCi](https://circleci.com/) can work for spinning all of the
Linux images you wish. Here's a sample `yml` file for use with that.
@ -68,25 +68,43 @@ jobs:
executor: meson_ubuntu_builder
steps:
- checkout
- run: meson setup builddir --backend ninja
- run: meson compile -C builddir
- run: meson test -C builddir
- run:
name: Configure Project
command: meson setup builddir --backend ninja
- run:
name: Compile Project
command: meson compile -C builddir
- run:
name: Run Tests
command: meson test -C builddir
meson_debian_build:
executor: meson_debian_builder
steps:
- checkout
- run: meson setup builddir --backend ninja
- run: meson compile -C builddir
- run: meson test -C builddir
- run:
name: Configure Project
command: meson setup builddir --backend ninja
- run:
name: Compile Project
command: meson compile -C builddir
- run:
name: Run Tests
command: meson test -C builddir
meson_fedora_build:
executor: meson_fedora_builder
steps:
- checkout
- run: meson setup builddir --backend ninja
- run: meson compile -C builddir
- run: meson test -C builddir
- run:
name: Configure Project
command: meson setup builddir --backend ninja
- run:
name: Compile Project
command: meson compile -C builddir
- run:
name: Run Tests
command: meson test -C builddir
workflows:
version: 2
@ -95,6 +113,71 @@ workflows:
- meson_ubuntu_build
- meson_debian_build
- meson_fedora_build
```
## CircleCI for Linux host (without custom Docker images)
This CircleCI configuration defines two jobs, `build-linux` and `build-macos`,
within a workflow named `build`. The `build-linux` job utilizes a Docker image
with Python 3.12.3, while `build-macos` runs on macOS with Xcode 15.3.0. Each
job involves checking out the code, installing Meson and Ninja, configuring the
project, compiling it, and running tests using Meson.
```yaml
version: 2.1
jobs:
build-linux:
docker:
- image: cimg/python:3.12.3
steps:
- checkout
- run:
name: Install Meson and Ninja
command: |
python -m pip install --user meson ninja
- run:
name: Configure Project
command: |
meson setup builddir
- run:
name: Compile Project
command: |
meson compile -C builddir
- run:
name: Run Tests
command: |
meson test -C builddir
build-macos:
macos:
xcode: 15.3.0
steps:
- checkout
- run:
name: Install Meson and Ninja
command: |
python -m pip install meson ninja
- run:
name: Configure Project
command: |
meson setup builddir
- run:
name: Compile Project
command: |
meson compile -C builddir
- run:
name: Run Tests
command: |
meson test -C builddir
workflows:
version: 2.1
build:
jobs:
- build-linux
- build-macos
```
## AppVeyor for Windows
@ -106,45 +189,25 @@ AppVeyor also has
[MacOS](https://www.appveyor.com/docs/macos-images-software/) and
[Linux](https://www.appveyor.com/docs/linux-images-software/) CI
images. This is a sample `appveyor.yml` file for Windows with Visual
Studio 2015 and 2017.
Studio 2017, 2019, and 2022.
```yaml
image: Visual Studio 2017
environment:
matrix:
- arch: x86
compiler: msvc2015
- arch: x64
compiler: msvc2015
- arch: x86
compiler: msvc2017
- arch: x64
compiler: msvc2017
platform:
- x64
version: 1.0.{build}
image:
- Visual Studio 2022
- Visual Studio 2019
- Visual Studio 2017
install:
# Set paths to dependencies (based on architecture)
- cmd: if %arch%==x86 (set PYTHON_ROOT=C:\python37) else (set PYTHON_ROOT=C:\python37-x64)
# Print out dependency paths
- cmd: echo Using Python at %PYTHON_ROOT%
# Add necessary paths to PATH variable
- cmd: set PATH=%cd%;%PYTHON_ROOT%;%PYTHON_ROOT%\Scripts;%PATH%
# Install meson and ninja
- cmd: pip install ninja meson
# Set up the build environment
- cmd: if %compiler%==msvc2015 ( call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %arch% )
- cmd: if %compiler%==msvc2017 ( call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" %arch% )
- cmd: python -m pip install meson ninja
build_script:
- cmd: echo Building on %arch% with %compiler%
- cmd: meson --backend=ninja builddir
- cmd: meson compile -C builddir
- cmd: >-
meson setup builddir
meson compile -C builddir
test_script:
- cmd: meson test -C builddir
- cmd: meson test -C builddir
```
### Qt
@ -199,16 +262,17 @@ script:
## GitHub Actions
GitHub Actions are distinct from Azure Pipelines in their workflow
syntax. It can be easier to setup specific CI tasks in Actions than
Pipelines, depending on the particular task. This is an example file:
.github/workflows/ci_meson.yml supposing the project is C-based, using
GCC on Linux, Mac and Windows. The optional `on:` parameters only run
this CI when the C code is changed--corresponding ci_python.yml might
run only on "**.py" file changes.
GitHub Actions provides a versatile platform for continuous integration
(CI). This example workflow file, `ci_meson.yml`, is tailored for C-based
projects utilizing GCC on Linux, macOS, and Windows. Triggered by changes
to C code files, it automates building and testing processes using different
versions of Meson (1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0) across various operating
systems. Each job in the workflow handles checkout, dependency installation,
project configuration, test execution, and optional test log uploads upon
failure.
```yaml
name: ci_meson
name: CI Meson
on:
push:
@ -221,59 +285,33 @@ on:
- "**.h"
jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- run: pip install meson ninja
- run: meson setup builddir/
env:
CC: gcc
- run: meson test -C builddir/ -v
- uses: actions/upload-artifact@v1
if: failure()
with:
name: Linux_Meson_Testlog
path: builddir/meson-logs/testlog.txt
macos:
runs-on: macos-latest
build:
name: Build and Test on ${{ matrix.os }} with Meson v${{ matrix.meson_version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
meson_version: ["1.2.0", "1.3.0", "1.4.0"]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: brew install gcc
- run: pip install meson ninja
- run: meson setup builddir/
- name: Install dependencies
run: python -m pip install meson==${{ matrix.meson_version }} ninja
- name: Configure Project
run: meson setup builddir/
env:
CC: gcc
- run: meson test -C builddir/ -v
- uses: actions/upload-artifact@v1
- name: Run Tests
run: meson test -C builddir/ -v
- name: Upload Test Log
uses: actions/upload-artifact@v4
if: failure()
with:
name: MacOS_Meson_Testlog
name: ${{ matrix.os }}_Meson_Testlog
path: builddir/meson-logs/testlog.txt
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- run: pip install meson ninja
- run: meson setup builddir/
env:
CC: gcc
- run: meson test -C builddir/ -v
- uses: actions/upload-artifact@v1
if: failure()
with:
name: Windows_Meson_Testlog
path: builddir/meson-logs/testlog.txt
```

@ -150,8 +150,8 @@ Subsets of project tests can be selected with
time when only a certain part of Meson is being tested.
For example, a useful and easy contribution to Meson is making
sure the full set of compilers is supported. One could for example test
various Fortran compilers by setting `FC=ifort` or `FC=flang` or similar
with `./run_project_test.py --only fortran`.
various Fortran compilers by setting `FC=ifort`, `FC=flang` or
`FC=flang-new` or similar with `./run_project_test.py --only fortran`.
Some families of tests require a particular backend to run.
For example, all the CUDA project tests run and pass on Windows via
`./run_project_tests.py --only cuda --backend ninja`
@ -334,9 +334,11 @@ Each value must contain the `val` key for the value of the option.
`null` can be used for adding matrix entries without the current
option.
The `skip_on_env`, `skip_on_jobname` and `skip_on_os` keys (as described below)
may be used in the value to skip that matrix entry, based on the current
environment.
The `skip_on_env` key (as described below) may be used in the value to skip that
matrix entry, based on the current environment.
The `expect_skip_on_jobname` and `expect_skip_on_os` keys (as described below)
may be used to expect that the test will be skipped, based on the current environment.
Similarly, the `compilers` key can be used to define a mapping of
compilers to languages that are required for this value.
@ -412,23 +414,23 @@ The `skip_on_env` key can be used to specify a list of environment variables. If
at least one environment variable in the `skip_on_env` list is present, the test
is skipped.
#### skip_on_jobname
#### expect_skip_on_jobname
The `skip_on_jobname` key contains a list of strings. If the `MESON_CI_JOBNAME`
The `expect_skip_on_jobname` key contains a list of strings. If the `MESON_CI_JOBNAME`
environment variable is set, and any of them are a sub-string of it, the test is
expected to be skipped (that is, it is expected that the test will output
`MESON_SKIP_TEST`, because the CI environment is not one in which it can run,
for whatever reason).
The test is failed if it skips or runs unexpectedly.
The test is failed if it either skips unexpectedly or runs unexpectedly.
#### skip_on_os
#### expect_skip_on_os
The `skip_on_os` key can be used to specify a list of OS names (or their
negations, prefixed with a `!`). If at least one item in the `skip_on_os` list
The `expect_skip_on_os` key can be used to specify a list of OS names (or their
negations, prefixed with a `!`). If at least one item in the `expect_skip_on_os` list
is matched, the test is expected to be skipped.
The test is failed if it skips or runs unexpectedly.
The test is failed if it either skips unexpectedly or runs unexpectedly.
### Skipping integration tests

@ -86,3 +86,30 @@ meson setup builddir
meson dist -C builddir
```
This produces `builddir/meson-dist/mysubproject-1.0.tar.xz` tarball.
## Cement a version obtained from VCS
*Since 1.4.0* the `meson dist` command enables rewriting the build
configuration of the distribution tarball. This is needed when the
configuration depends on metadata from revision control such as in the
following example.
`meson.build`:
```meson
project('tig', 'c',
version : run_command('version.sh', 'get-vcs').stdout.strip())
meson.add_dist_script('version.sh', 'set-dist', meson.project_version())
```
`version.sh`:
```sh
#!/bin/sh
if [ "$1" = "get-vcs" ]; then
git -C "$MESON_SOURCE_ROOT" describe --always --dirty
elif [ "$1" = "set-dist" ]; then
$MESONREWRITE --sourcedir="$MESON_PROJECT_DIST_ROOT" kwargs set project / version "$2"
else
exit 1
fi
```

@ -14,6 +14,7 @@ targeting 64-bit Windows could be:
c = 'x86_64-w64-mingw32-gcc'
cpp = 'x86_64-w64-mingw32-g++'
ar = 'x86_64-w64-mingw32-ar'
windres = 'x86_64-w64-mingw32-windres'
strip = 'x86_64-w64-mingw32-strip'
exe_wrapper = 'wine64'
@ -256,7 +257,7 @@ to be the host machine.
Once you have the cross file, starting a build is simple
```console
$ meson srcdir builddir --cross-file cross_file.txt
$ meson setup builddir --cross-file cross_file.txt
```
Once configuration is done, compilation is started by invoking `meson compile`

@ -32,6 +32,18 @@ py.extension_module(
)
```
You can pass arguments accepted by the `cython` CLI script with the
`cython_args` argument:
```meson
py.extension_module(
'foo-bounds'
'foo.pyx',
dependencies : dep_py,
cython_args : ['-Xboundscheck=False'],
)
```
## C++ intermediate support
*(New in 0.60.0)*

@ -139,6 +139,6 @@ DUB is a fully integrated build system for D, but it is also a way to
provide dependencies. Adding dependencies from the [D package
registry](https://code.dlang.org/) is pretty straight forward. You can
find how to do this in
[Dependencies](Dependencies.md#some-notes-on-dub). You can also
[Dependencies](Dependencies.md#dub). You can also
automatically generate a `dub.json` file as explained in
[Dlang](Dlang-module.md#generate_dub_file).

@ -80,8 +80,8 @@ var = foo_dep.get_variable(cmake : 'CMAKE_VAR', pkgconfig : 'pkg-config-var', co
```
It accepts the keywords 'cmake', 'pkgconfig', 'pkgconfig_define',
'configtool', 'internal', and 'default_value'. 'pkgconfig_define'
works just like the 'define_variable' argument to
'configtool', 'internal', 'system', and 'default_value'.
'pkgconfig_define' works just like the 'define_variable' argument to
`get_pkgconfig_variable`. When this method is invoked the keyword
corresponding to the underlying type of the dependency will be used to
look for a variable. If that variable cannot be found or if the caller
@ -266,11 +266,12 @@ DC="dmd" meson setup builddir
## Config tool
[CUPS](#cups), [LLVM](#llvm), [pcap](#pcap), [WxWidgets](#wxwidgets),
[libwmf](#libwmf), [GCrypt](#libgcrypt), [GPGME](#gpgme), and GnuStep either do not provide pkg-config
modules or additionally can be detected via a config tool
(cups-config, llvm-config, libgcrypt-config, etc). Meson has native support for these
tools, and they can be found like other dependencies:
[CUPS](#cups), [LLVM](#llvm), [ObjFW](#objfw), [pcap](#pcap),
[WxWidgets](#wxwidgets), [libwmf](#libwmf), [GCrypt](#libgcrypt),
[GPGME](#gpgme), and GnuStep either do not provide pkg-config modules or
additionally can be detected via a config tool (cups-config, llvm-config,
libgcrypt-config, etc). Meson has native support for these tools, and they can
be found like other dependencies:
```meson
pcap_dep = dependency('pcap', version : '>=1.0')
@ -278,6 +279,7 @@ cups_dep = dependency('cups', version : '>=1.4')
llvm_dep = dependency('llvm', version : '>=4.0')
libgcrypt_dep = dependency('libgcrypt', version: '>= 1.8')
gpgme_dep = dependency('gpgme', version: '>= 1.0')
objfw_dep = dependency('objfw', version: '>= 1.0')
```
*Since 0.55.0* Meson won't search $PATH any more for a config tool
@ -476,9 +478,8 @@ language-specific, you must specify the requested language using the
* `dependency('hdf5', language: 'cpp')` for the C++ HDF5 headers and libraries
* `dependency('hdf5', language: 'fortran')` for the Fortran HDF5 headers and libraries
Meson uses pkg-config to find HDF5. The standard low-level HDF5
function and the `HL` high-level HDF5 functions are linked for each
language.
The standard low-level HDF5 function and the `HL` high-level HDF5
functions are linked for each language.
`method` may be `auto`, `config-tool` or `pkg-config`.
@ -638,6 +639,36 @@ language-specific, you must specify the requested language using the
Meson uses pkg-config to find NetCDF.
## ObjFW
*(added 1.5.0)*
Meson has native support for ObjFW, including support for ObjFW packages.
In order to use ObjFW, simply create the dependency:
```meson
objfw_dep = dependency('objfw')
```
In order to also use ObjFW packages, simply specify them as modules:
```meson
objfw_dep = dependency('objfw', modules: ['SomePackage'])
```
If you need a dependency with and without packages, e.g. because your tests
want to use ObjFWTest, but you don't want to link your application against the
tests, simply get two dependencies and use them as appropriate:
```meson
objfw_dep = dependency('objfw', modules: ['SomePackage'])
objfwtest_dep = dependency('objfw', modules: ['ObjFWTest'])
```
Then use `objfw_dep` for your library and only `objfwtest_dep` (not both) for
your tests.
## OpenMP
*(added 0.46.0)*
@ -653,6 +684,14 @@ The `language` keyword may used.
`method` may be `auto`, `pkg-config`, `system` or `cmake`.
## NumPy
*(added 1.4.0)*
`method` may be `auto`, `pkg-config`, or `config-tool`.
`dependency('numpy')` supports regular use of the NumPy C API.
Use of `numpy.f2py` for binding Fortran code isn't yet supported.
## pcap
*(added 0.42.0)*
@ -679,7 +718,7 @@ but dependency tries `pkg-config` first.
`method` may be `auto`, `extraframework`, `pkg-config` or `sysconfig`
## Qt4 & Qt5
## Qt
Meson has native Qt support. Its usage is best demonstrated with an
example.
@ -727,7 +766,7 @@ your own risk.
## SDL2
SDL2 can be located using `pkg-confg`, the `sdl2-config` config tool,
SDL2 can be located using `pkg-config`, the `sdl2-config` config tool,
as an OSX framework, or `cmake`.
`method` may be `auto`, `config-tool`, `extraframework`,
@ -810,6 +849,34 @@ version.
*New in 0.54.0* the `system` method.
## DIA SDK
*(added 1.6.0)*
Microsoft's Debug Interface Access SDK (DIA SDK) is available only on Windows,
when using msvc, clang-cl or clang compiler from Microsoft Visual Studio.
The DIA SDK runtime is not statically linked to target. The default usage
method requires the runtime DLL (msdiaXXX.dll) to be manually registered in the
OS with `regsrv32.exe` command, so it can be loaded using `CoCreateInstance`
Windows function.
Alternatively, you can use meson to copy the DIA runtime DLL to your build
directory, and load it dynamically using `NoRegCoCreate` function provided by
the DIA SDK. To facilitate this, you can read DLL path from dependency's
variable 'dll' and use fs module to copy it. Example:
```meson
dia = dependency('diasdk', required: true)
fs = import('fs')
fs.copyfile(dia.get_variable('dll'))
conf = configuration_data()
conf.set('msdia_dll_name', fs.name(dia_dll_name))
```
Only the major version is available (eg. version is `14` for msdia140.dll).
<hr>
<a name="footnote1">1</a>: They may appear to be case-insensitive, if the
underlying file system happens to be case-insensitive.

@ -5,6 +5,8 @@
*This is an experimental module, API could change.*
*Added 0.56.0*
This module allows building code that uses build systems other than
Meson. This module is intended to be used to build Autotools
subprojects as fallback if the dependency couldn't be found on the
@ -47,7 +49,8 @@ Known limitations:
from `-uninstalled.pc` files. This is arguably a bug that could be fixed in
future version of pkg-config/pkgconf.
*Added 0.56.0*
*Since 1.7.0* [Meson devenv][Commands.md#devenv] setup `PATH` and
`LD_LIBRARY_PATH` to be able to run programs.
## Functions
@ -78,7 +81,8 @@ Keyword arguments:
added in case some tags are not found in `configure_options`:
`'--prefix=@PREFIX@'`, `'--libdir=@PREFIX@/@LIBDIR@'`, and
`'--includedir=@PREFIX@/@INCLUDEDIR@'`. It was previously considered a fatal
error to not specify them.
error to not specify them. *Since 1.7.0* `@BINDIR@` and `'--bindir=@PREFIX@/@BINDIR@'`
default argument have been added.
- `cross_configure_options`: Extra options appended to `configure_options` only
when cross compiling. special tag `@HOST@` will be replaced by
`'{}-{}-{}'.format(host_machine.cpu_family(), build_machine.system(), host_machine.system()`.

@ -405,6 +405,9 @@ advantages:
not care what the extension is](https://docs.microsoft.com/en-us/cpp/build/reference/link-input-files?view=vs-2019),
so specifying `libfoo.a` instead of `foo.lib` does not change the workflow,
and is an improvement since it's less ambiguous.
1. Projects built with the MinGW compiler are fully compatible with
MSVC as long as they use the same CRT (e.g. UCRT with MSYS2).
These projects also name their static libraries `libfoo.a`.
If, for some reason, you really need your project to output static
libraries of the form `foo.lib` when building with MSVC, you can set
@ -692,3 +695,16 @@ directory. It glob ignores ```"*"```, since all generated files should not be
checked into git.
Users of older versions of Meson may need to set up ignore files themselves.
## How to add preprocessor defines to a target?
Just add `-DFOO` to `c_args` or `cpp_args`. This works for all known compilers.
```meson
mylib = library('mylib', 'mysource.c', c_args: ['-DFOO'])
```
Even though [MSVC documentation](https://learn.microsoft.com/en-us/cpp/build/reference/d-preprocessor-definitions)
uses `/D` for preprocessor defines, its [command-line syntax](https://learn.microsoft.com/en-us/cpp/build/reference/compiler-command-line-syntax)
accepts `-` instead of `/`.
It's not necessary to treat preprocessor defines specially in Meson ([GH-6269](https://github.com/mesonbuild/meson/issues/6269#issuecomment-560003922)).

@ -228,13 +228,13 @@ fs.stem('foo/bar/baz.dll.a') # baz.dll
*Since 1.3.0*
Return a relative filepath. In event a relative path could not be found, the
Return a relative filepath. In the event a relative path could not be found, the
absolute path of `to` is returned. Relative path arguments will be assumed to be
relative to `meson.current_source_dir()`.
Has the following positional arguments:
- to `str | file | custom_tgt | custom_idx | tgt`: end path
- from `str | file | custom_tgt | custom_idx | tgt`: start path
- to `str | file | custom_tgt | custom_idx | build_tgt`: end path
- from `str | file | custom_tgt | custom_idx | build_tgt`: start path
returns:
- a string

@ -204,6 +204,13 @@ for a build target, you must add the generated header to the build
target's list of sources to codify the dependency. This is true for
all generated sources, not just `mkenums_simple`.
The generated source file includes all headers passed to the sources keyword
argument, using paths relative to current build or source directory. That means
that targets that compile the generated source file must have the current
directory in its `include_directories`. *Since 1.3.0* `sources` outside of
current directory do not require adding those directories into
`include_directories` anymore.
* `body_prefix`: additional prefix at the top of the body file,
e.g. for extra includes
* `decorator`: optional decorator for the function declarations,

@ -170,6 +170,20 @@ executable('sdlprog', 'sdlprog.c',
dependencies: sdl2_dep)
```
**NOTE:** If you're on Windows you need to include the sdl2main dependency as well; To do so you can modify the above build script like so:
```meson
project('sdldemo', 'c',
default_options: 'default_library=static')
sdl2_dep = dependency('sdl2')
sdl2_main_dep = dependency('sdl2main')
executable('sdlprog', 'sdlprog.c',
win_subsystem: 'windows',
dependencies: [sdl2_dep, sdl2_main_dep])
```
In addition to the dependency this has a few other changes. First we
specify that we want to build helper libraries statically. For simple
projects like these it makes things simpler. We also need to tell

@ -33,12 +33,19 @@ Generates documentation using [hotdoc] and installs it into `$prefix/share/doc/h
* `sitemap` ([[@str]] or [[@file]]) (**required**): The hotdoc sitemap file
* `index` ([[@str]] or [[@file]]) (**required**): Location of the index file
* `dependencies`([[@build_tgt]]): Targets on which the documentation generation depends on.
* `dependencies`([[@build_tgt]]): Build targets to use when generating documentation.
* `depends`([[@custom_tgt]]): Custom targets on which this documentation target depends.
* `subprojects`: A list of `HotdocTarget` that are used as subprojects for hotdoc to generate
the documentation.
* ... Any argument of `hotdoc` can be used replacing dashes (`-`) with underscores (`_`).
For a full list of available parameters, just have a look at `hotdoc help`.
*Changed in 0.64.1:* `depends:` added.
Previously, all types of targets were accepted by `dependencies:`.
This is now deprecated.
Use `dependencies:` only with build targets, to pass their configuration to hotdoc.
Use `depends:` to set up dependency relationships on custom targets.
**Returns:**
`HotdocTarget`: A [[custom_target]] with the

@ -418,10 +418,12 @@ schema is defined by the class structure given in
# Existing integrations
- [CLion](https://www.jetbrains.com/clion/)
- [Eclipse CDT](https://www.eclipse.org/cdt/)
- [Gnome Builder](https://wiki.gnome.org/Apps/Builder)
- [KDevelop](https://www.kdevelop.org)
- [Eclipse CDT](https://www.eclipse.org/cdt/)
- [Meson Syntax Highlighter](https://plugins.jetbrains.com/plugin/13269-meson-syntax-highlighter) plugin for JetBrains IDEs.
- [vscode-meson](https://github.com/mesonbuild/vscode-meson) extension for VS Code/Codium
- [Qt Creator](https://doc.qt.io/qtcreator/creator-project-meson.html)
- [Meson Syntax Highlighter](https://plugins.jetbrains.com/plugin/13269-meson-syntax-highlighter) 3rd party plugin for JetBrains IDEs.
- [Meson-UI](https://github.com/dreamer-coding-555/meson-ui) (build GUI for Meson)
- [mmeson](https://github.com/stephanlachnit/mmeson) (ccmake clone for Meson)
- [Qt Creator](https://doc.qt.io/qtcreator/creator-project-meson.html)
- [vscode-meson](https://github.com/mesonbuild/vscode-meson) extension for VS Code/Codium

@ -27,4 +27,6 @@ proper compiler flags to make it all work.
Another thing to note is that `include_directories` adds both the
source directory and corresponding build directory to include path, so
you don't have to care.
you don't have to care. If it turns out you don't want it after all, this can
be disabled with the `implicit_include_directories` argument to the [build
function](Reference-manual_functions.md) you use.

@ -128,6 +128,18 @@ b = a + 'World'
a = 'Hello'
```
*Since 1.3.0* Some tokens are replaced in the machine file before parsing it:
- `@GLOBAL_SOURCE_ROOT@`: the absolute path to the project's source tree
- `@DIRNAME@`: the absolute path to the machine file's parent directory.
It can be used, for example, to have paths relative to the source directory, or
relative to toolchain's installation directory.
```ini
[binaries]
c = '@DIRNAME@/toolchain/gcc'
exe_wrapper = '@GLOBAL_SOURCE_ROOT@' / 'build-aux' / 'my-exe-wrapper.sh'
```
### Binaries
The binaries section contains a list of binaries. These can be used
@ -261,7 +273,7 @@ list of strings.
[cmake]
CMAKE_C_COMPILER = '/usr/bin/gcc'
CMAKE_CXX_COMPILER = 'C:\\user\\bin\\g++'
CMAKE_CXX_COMPILER = 'C:\\usr\\bin\\g++'
CMAKE_SOME_VARIABLE = ['some', 'value with spaces']
```

@ -12,6 +12,15 @@ authors:
This module provides support for finding and building extensions against
python installations, be they python 2 or 3.
If you want to build and package Python extension modules using tools
compatible with [PEP-517](https://peps.python.org/pep-0517/), check out
[meson-python](https://mesonbuild.com/meson-python/index.html).
If you are building Python extension modules against a Python interpreter
located in a venv or Conda environment, you probably want to set
`python.install_env=auto`;
see [Python module options](Builtin-options.md#python-module) for details.
*Added 0.46.0*
## Functions
@ -113,6 +122,8 @@ Additionally, the following diverge from [[shared_module]]'s default behavior:
of Python that support this (the python headers define `PyMODINIT_FUNC` has
default visibility).
Note that Cython support uses `extension_module`, see [the reference for Cython](Cython.md).
*since 0.63.0* `extension_module` automatically adds a dependency to the library
if one is not explicitly provided. To support older versions, the user may need to
add `dependencies : py_installation.dependency()`, see [[dependency]].
@ -147,11 +158,8 @@ void py_installation.install_sources(list_of_files, ...)
Install actual python sources (`.py`).
All positional and keyword arguments are the same as for
[[install_data]], with the addition of the following:
*Since 0.60.0* `python.platlibdir` and `python.purelibdir` options can be used
to control the default installation path. See [Python module options](Builtin-options.md#python-module).
Source files to install are given as positional argument, in the same way as for
[[install_data]]. Supported keyword arguments are:
- `pure`: On some platforms, architecture independent files are
expected to be placed in a separate directory. However, if the
@ -166,6 +174,12 @@ to control the default installation path. See [Python module options](Builtin-op
- `install_tag` *(since 0.60.0)*: A string used by `meson install --tags` command
to install only a subset of the files. By default it has the tag `python-runtime`.
- `preserve_path`: if `true`, disable stripping child-directories from data
files when installing. Default is `false`. *(since 0.64.0)*
*Since 0.60.0* `python.platlibdir` and `python.purelibdir` options can be used
to control the default installation path. See [Python module options](Builtin-options.md#python-module).
#### `get_install_dir()`
``` meson

@ -2,9 +2,15 @@
*New in Meson 0.57.0*
The Qt6 module provides tools to automatically deal with the various
The Qt6 module provides methods to automatically deal with the various
tools and steps required for Qt.
<div class="alert alert-warning">
<strong>Warning:</strong> before version 0.63.0 Meson would fail to find
Qt 6.1 or later due to the Qt tools having moved to the libexec subdirectory,
and tool names being suffixed with only the Qt major version number e.g. qmake6.
</div>
## compile_resources
*New in 0.59.0*
@ -14,12 +20,12 @@ Compiles Qt's resources collection files (.qrc) into c++ files for compilation.
It takes no positional arguments, and the following keyword arguments:
- `name` (string | empty): if provided a single .cpp file will be generated,
and the output of all qrc files will be combined in this file, otherwise
each qrc file be written to it's own cpp file.
each qrc file be written to its own cpp file.
- `sources` (File | string | custom_target | custom_target index | generator_output)[]:
A list of sources to be transpiled. Required, must have at least one source<br/>
*New in 0.60.0*: support for custom_target, custom_target_index, and generator_output.
- `extra_args` string[]: Extra arguments to pass directly to `qt-rcc`
- `method` string: The method to use to detect qt, see [[dependency]]
- `method` string: The method to use to detect Qt, see [[dependency]]
## compile_ui
@ -32,7 +38,12 @@ It takes no positional arguments, and the following keyword arguments:
A list of sources to be transpiled. Required, must have at least one source<br/>
*New in 0.60.0*: support for custom_target, custom_target_index, and generator_output.
- `extra_args` string[]: Extra arguments to pass directly to `qt-uic`
- `method` string: The method to use to detect qt, see [[dependency]]
- `method` string: The method to use to detect Qt, see [[dependency]]
- `preserve_paths` bool: *New in 1.4.0*. If `true`, specifies that the output
files need to maintain their directory structure inside the target temporary
directory. For instance, when a file called `subdir/one.input` is processed
it generates a file `{target private directory}/subdir/one.out` when `true`,
and `{target private directory}/one.out` when `false` (default).
## compile_moc
@ -49,10 +60,15 @@ It takes no positional arguments, and the following keyword arguments:
A list of headers to be transpiled into .cpp files<br/>
*New in 0.60.0*: support for custom_target, custom_target_index, and generator_output.
- `extra_args` string[]: Extra arguments to pass directly to `qt-moc`
- `method` string: The method to use to detect qt, see [[dependency]]
- `method` string: The method to use to detect Qt, see [[dependency]]
- `dependencies`: dependency objects whose include directories are used by moc.
- `include_directories` (string | IncludeDirectory)[]: A list of `include_directory()`
objects used when transpiling the .moc files
- `preserve_paths` bool: *New in 1.4.0*. If `true`, specifies that the output
files need to maintain their directory structure inside the target temporary
directory. For instance, when a file called `subdir/one.input` is processed
it generates a file `{target private directory}/subdir/one.out` when `true`,
and `{target private directory}/one.out` when `false` (default).
## preprocess
@ -90,6 +106,11 @@ This method takes the following keyword arguments:
- `dependencies` Dependency[]: dependency objects needed by moc.
- *Deprecated in 0.59.0.*: `sources`: a list of extra sources, which are added
to the output unchanged.
- `preserve_paths` bool: *Since 1.4.0*. If `true`, specifies that the output
files need to maintain their directory structure inside the target temporary
directory. For instance, when a file called `subdir/one.input` is processed
it generates a file `{target private directory}/subdir/one.out` when `true`,
and `{target private directory}/one.out` when `false` (default).
It returns an array of targets and sources to pass to a compilation target.
@ -134,11 +155,14 @@ This method takes the following keyword arguments:
- `required` bool | FeatureOption: by default, `required` is set to `false`. If `required` is set to
`true` or an enabled [`feature`](Build-options.md#features) and some tools are
missing Meson will abort.
- `method` string: The method to use to detect qt, see [[dependency]]
- `method` string: The method to use to detect Qt, see [[dependency]]
- `tools`: string[]: *Since 1.6.0*. List of tools to check. Testable tools
are `moc`, `uic`, `rcc` and `lrelease`. By default `tools` is set to `['moc',
'uic', 'rcc', 'lrelease']`
## Dependencies
See [Qt dependencies](Dependencies.md#qt4-qt5)
See [Qt dependencies](Dependencies.md#qt)
The 'modules' argument is used to include Qt modules in the project.
See the Qt documentation for the [list of

@ -55,7 +55,7 @@ $ pip3 install --user meson
```
Install as root:
```console
$ pip3 install meson
# pip3 install meson
```
*If you are unsure whether to install as root or a local user, install
@ -79,19 +79,20 @@ $ meson setup builddir
$ bash: /usr/bin/meson: No such file or directory
```
Description: The default installation prefix for the python pip module
installation is not included in your shell environment PATH. The
default prefix for python pip installation modules is located under
``/usr/local``.
**Description**: The default installation prefix for the python pip module
installation might not be included in your shell environment `PATH`.
The default install location varies depending on your OS, distro and
Python version.
**Resolution:
This issue can be resolved by altering the default shell environment
PATH to include ``/usr/local/bin``. **
**Resolution**: This issue can be resolved by altering the default shell
environment `PATH` to include the path where Pip installed the
binaries. This can be, e.g. ``/usr/local/bin`` or
`/home/<username>/.local/bin`.
*Note: There are other ways of fixing this issue such as using
**Note**: There are other ways of fixing this issue such as using
symlinks or copying the binaries to a default path and these methods
are not recommended or supported as they may break package management
interoperability.*
interoperability.
Compiling a Meson project

@ -15,7 +15,7 @@ These are return values of the `get_id` (Compiler family) and
| clang-cl | The Clang compiler (MSVC compatible driver) | msvc |
| dmd | D lang reference compiler | |
| emscripten| Emscripten WASM compiler | |
| flang | Flang Fortran compiler | |
| flang | Classic Flang Fortran compiler | |
| g95 | The G95 Fortran compiler | |
| gcc | The GNU Compiler Collection | gcc |
| intel | Intel compiler (Linux and Mac) | gcc |
@ -24,18 +24,21 @@ These are return values of the `get_id` (Compiler family) and
| intel-llvm-cl | Intel oneAPI LLVM-based compiler (Windows) | msvc |
| lcc | Elbrus C/C++/Fortran Compiler | |
| llvm | LLVM-based compiler (Swift, D) | |
| llvm-flang| Flang Fortran compiler (LLVM-based) | |
| mono | Xamarin C# compiler | |
| mwccarm | Metrowerks C/C++ compiler for Embedded ARM | |
| mwcceppc | Metrowerks C/C++ compiler for Embedded PowerPC | |
| msvc | Microsoft Visual Studio | msvc |
| nagfor | The NAG Fortran compiler | |
| nvidia_hpc| NVidia HPC SDK compilers | |
| nvcc | NVidia CUDA compiler | |
| open64 | The Open64 Fortran Compiler | |
| pathscale | The Pathscale Fortran compiler | |
| pgi | Portland PGI C/C++/Fortran compilers | |
| rustc | Rust compiler | |
| sun | Sun Fortran compiler | |
| c2000 | Texas Instruments C/C++ Compiler (C2000) | |
| c6000 | Texas Instruments C/C++ Compiler (C6000) | |
| ti | Texas Instruments C/C++ Compiler | |
| valac | Vala compiler | |
| xc16 | Microchip XC16 C compiler | |
@ -59,6 +62,7 @@ These are return values of the `get_linker_id` method in a compiler object.
| ld.mold | The fast MOLD linker |
| ld.solaris | Solaris and illumos |
| ld.wasm | emscripten's wasm-ld linker |
| ld.zigcc | The Zig linker (C/C++ frontend; GNU-like) |
| ld64 | Apple ld64 |
| ld64.lld | The LLVM linker, with the ld64 interface |
| link | MSVC linker |
@ -69,6 +73,7 @@ These are return values of the `get_linker_id` method in a compiler object.
| xc16-ar | The Microchip linker, used with XC16 only |
| ar2000 | The Texas Instruments linker, used with C2000 only |
| ti-ar | The Texas Instruments linker |
| ar6000 | The Texas Instruments linker, used with C6000 only |
| armlink | The ARM linker (arm and armclang compilers) |
| pgi | Portland/Nvidia PGI |
| nvlink | Nvidia Linker used with cuda |
@ -84,6 +89,7 @@ For languages that don't have separate dynamic linkers such as C# and Java, the
| Value | Comment |
| ----- | ------- |
| MESONINTROSPECT | Command to run to run the introspection command, may be of the form `python /path/to/meson introspect`, user is responsible for splitting the path if necessary. |
| MESONREWRITE | Command to run to run the rewriting command, only set when running `dist` scripts |
| MESON_BUILD_ROOT | Absolute path to the build dir |
| MESON_DIST_ROOT | Points to the root of the staging directory, only set when running `dist` scripts |
| MESON_SOURCE_ROOT | Absolute path to the source dir |
@ -103,6 +109,7 @@ set in the cross file.
| arm | 32 bit ARM processor |
| avr | Atmel AVR processor |
| c2000 | 32 bit C2000 processor |
| c6000 | 32 bit C6000 processor |
| csky | 32 bit CSky processor |
| dspic | 16 bit Microchip dsPIC |
| e2k | MCST Elbrus processor |
@ -127,11 +134,13 @@ set in the cross file.
| sh4 | SuperH SH-4 |
| sparc | 32 bit SPARC |
| sparc64 | SPARC v9 processor |
| sw_64 | 64 bit sunway processor |
| wasm32 | 32 bit Webassembly |
| wasm64 | 64 bit Webassembly |
| x86 | 32 bit x86 processor |
| x86_64 | 64 bit x86 processor |
Any cpu family not listed in the above list is not guaranteed to
remain stable in future releases.
@ -147,7 +156,7 @@ These are provided by the `.system()` method call.
| Value | Comment |
| ----- | ------- |
| android | By convention only, subject to change |
| cygwin | The Cygwin environment for Windows |
| cygwin | Cygwin or MSYS2 environment on Windows |
| darwin | Either OSX or iOS |
| dragonfly | DragonFly BSD |
| emscripten | Emscripten's JavaScript environment |
@ -157,7 +166,7 @@ These are provided by the `.system()` method call.
| linux | |
| netbsd | |
| openbsd | |
| windows | Any version of Windows |
| windows | Native Windows (not Cygwin or MSYS2) |
| sunos | illumos and Solaris |
Any string not listed above is not guaranteed to remain stable in
@ -173,6 +182,7 @@ Native names as returned by the `.kernel()` method.
| freebsd | |
| openbsd | |
| netbsd | |
| gnu | GNU Hurd |
| nt | |
| xnu | Kernel of various Apple OSes |
| illumos | Kernel derived from OpenSolaris by community efforts |
@ -208,6 +218,7 @@ to your build target.
| C | c_args | c_link_args |
| C++ | cpp_args | cpp_link_args |
| C# | cs_args | cs_link_args |
| CUDA | cuda_args | cuda_link_args |
| D | d_args | d_link_args |
| Fortran | fortran_args | fortran_link_args |
| Java | java_args | java_link_args |
@ -239,6 +250,7 @@ arguments](#language-arguments-parameter-names) instead.
| ----- | ------- |
| CFLAGS | Flags for the C compiler |
| CXXFLAGS | Flags for the C++ compiler |
| CUFLAGS | Flags for the CUDA compiler |
| OBJCFLAGS | Flags for the Objective C compiler |
| FFLAGS | Flags for the Fortran compiler |
| DFLAGS | Flags for the D compiler |
@ -264,7 +276,7 @@ which are supported by GCC, Clang, and other compilers.
| Name |
|--------------------------|
|-----------------------------|
| alias |
| aligned |
| alloc_size |
@ -292,6 +304,7 @@ which are supported by GCC, Clang, and other compilers.
| nonnull |
| noreturn |
| nothrow |
| null_terminated_string_arg⁷ |
| optimize |
| packed |
| pure |
@ -326,6 +339,8 @@ which are supported by GCC, Clang, and other compilers.
⁶ *New in 1.1.0*
⁷ *New in 1.5.0*
### MSVC __declspec
These values are supported using the MSVC style `__declspec` annotation,
@ -369,10 +384,32 @@ machine](#Environment-variables-per-machine) section for details.
| Rust | RUSTC | RUSTC_LD | Before 0.54 RUST_LD* |
| Vala | VALAC | | Use CC_LD. Vala transpiles to C |
| C# | CSC | CSC | The linker is the compiler |
| Cython | CYTHON | | |
| nasm | NASM | | Uses the C linker |
| archiver | | AR | |
*The old environment variables are still supported, but are deprecated
and will be removed in a future version of Meson.*
and will be removed in a future version of Meson.
*changed in 1.3.0* Paths with spaces were split unconditionally to extract
components such as the [path to Ccache](Feature-autodetection.md#ccache),
intrinsic compiler flags like `-m32` or `--target`, etc. This broke passing
a hardcoded compiler path to CMake subprojects. To work around this, paths
must be wrapped with double quotes:
```bash
export CC='"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe"'
```
You can also set the values through [machine files](Machine-files.md#binaries).
*New in 1.3.0* Paths that point to an existing executable no longer need
wrapping:
```bash
export CC='C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe'
```
## Environment variables per machine

@ -143,7 +143,7 @@ then invoke Meson as `meson setup builddir/ -Dcmake_prefix_path=/tmp/dep`
You can tag a test as needing to fail like this:
```meson
test('shoulfail', exe, should_fail: true)
test('shouldfail', exe, should_fail: true)
```
If the test passes the problem is reported in the error logs but due

@ -47,7 +47,7 @@ ptr_size = meson.get_compiler('d').sizeof('void*')
## Deprecate an option and replace it with a new one
The `deprecated` keyword argument can now take the name of a new option
that replace this option. In that case, setting a value on the deprecated option
that replaces this option. In that case, setting a value on the deprecated option
will set the value on both the old and new names, assuming they accept the same
values.

@ -59,7 +59,7 @@ Any include paths in these dependencies will be passed to the underlying call to
## String arguments to the rust.bindgen include_directories argument
Most other cases of include_directories accept strings as well as
`IncludeDirectory` objects, so lets do that here too for consistency.
`IncludeDirectory` objects, so let's do that here too for consistency.
## The Rust module is stable

@ -49,7 +49,7 @@ directory, instead of using Visual Studio's native engine.
## More data in introspection files
- Used compilers are listed in `intro-compilers.json`
- Informations about `host`, `build` and `target` machines
- Information about `host`, `build` and `target` machines
are lister in `intro-machines.json`
- `intro-dependencies.json` now includes internal dependencies,
and relations between dependencies.

@ -0,0 +1,338 @@
---
title: Release 1.3.0
short-description: Release notes for 1.3.0
...
# New features
Meson 1.3.0 was released on 19 November 2023
## Clarify implicitly-included headers in C-like compiler checks
Compiler check methods `compiler.compute_int()`, `compiler.alignment()`
and `compiler.sizeof()` now have their implicitly-included headers
corrected and documented.
`<stdio.h>` was included unintentionally when cross-compiling, which
is less than ideal because there is no guarantee that a standard library
is available for the target platform. Only `<stddef.h>` is included instead.
For projects that depend on the old behavior, the compiler check methods
have an optional argument `prefix`, which can be used to specify additional
`#include` directives.
## Treat warnings as error in compiler checks
Compiler check methods `compiler.compiles()`, `compiler.links()` and `compiler.run()`
now have a new `werror: true` keyword argument to treat compiler warnings as error.
This can be used to check if code compiles without warnings.
## Compilers now have a `has_define` method
This method returns true if the given preprocessor symbol is
defined, else false is returned. This is useful is cases where
an empty define has to be distinguished from a non-set one, which
is not possible using `get_define`.
Additionally it makes intent clearer for code that only needs
to check if a specific define is set at all and does not care
about its value.
## [[configure_file]] now has a `macro_name` parameter.
This new parameter, `macro_name` allows C macro-style include guards to be added
to [[configure_file]]'s output when a template file is not given. This change
simplifies the creation of configure files that define macros with dynamic names
and want the C-style include guards.
## `c_std` and `cpp_std` options now accepts a list of values
Projects that prefer GNU C, but can fallback to ISO C, can now set, for
example, `default_options: 'c_std=gnu11,c11'`, and it will use `gnu11` when
available, but fallback to `c11` otherwise. It is an error only if none of the
values are supported by the current compiler.
Likewise, a project that can take benefit of `c++17` but can still build with
`c++11` can set `default_options: 'cpp_std=c++17,c++11'`.
This allows us to deprecate `gnuXX` values from the MSVC compiler. That means
that `default_options: 'c_std=gnu11'` will now print a warning with MSVC
but fallback to `c11`. No warning is printed if at least one
of the values is valid, i.e. `default_options: 'c_std=gnu11,c11'`.
In the future that deprecation warning will become an hard error because
`c_std=gnu11` should mean GNU is required, for projects that cannot be
built with MSVC for example.
## More meaningful description of many generative tasks
When a module uses a `CustomTarget` to process files, it now has the possibility
to customize the message displayed by ninja.
Many modules were updated to take advantage of this new feature.
## Deprecate 'jar' as a build_target type
The point of `build_target()` is that what is produced can be conditionally
changed. However, `jar()` has a significant number of non-overlapping arguments
from other build_targets, including the kinds of sources it can include. Because
of this crafting a `build_target` that can be used as a Jar and as something
else is incredibly hard to do. As such, it has been deprecated, and using
`jar()` directly is recommended.
## generator.process() gains 'env' keyword argument
Like the kwarg of the same name in `custom_target()`, `env` allows
you to set the environment in which the generator will process inputs.
## Target names for executables now take into account suffixes.
In previous versions of meson, a `meson.build` file like this:
```
executable('foo', 'main.c')
executable('foo', 'main.c', name_suffix: 'bar')
```
would result in a configure error because meson internally used
the same id for both executables. This build file is now allowed
since meson takes into account the `bar` suffix when generating the
second executable. This allows for executables with the same basename
but different suffixes to be built in the same subdirectory.
## Executable gains vs_module_defs keyword
This allows using a .def file to control which functions an [[executable]] will
expose to a [[shared_module]].
## find_program() now supports the 'default_options' argument
In a similar fashion as dependency(), find_program() now also allows you to set default
options for the subproject that gets built in case of a fallback.
## `fs.relative_to()`
The `fs` module now has a `relative_to` method. The method will return the
relative path from argument one to argument two, if one exists. Otherwise, the
absolute path to argument one is returned.
```meson
assert(fs.relative_to('c:\\prefix\\lib', 'c:\\prefix\\bin') == '..\\lib')
assert(fs.relative_to('c:\\proj1\\foo', 'd:\\proj1\\bar') == 'c:\\proj1\\foo')
assert(fs.relative_to('prefix\\lib\\foo', 'prefix') == 'lib\\foo')
assert(fs.relative_to('/prefix/lib', '/prefix/bin') == '../lib')
assert(fs.relative_to('prefix/lib/foo', 'prefix') == 'lib/foo')
```
In addition to strings, it can handle files, custom targets, custom target
indices, and build targets.
## Added follow_symlinks arg to install_data, install_header, and install_subdir
The [[install_data]], [[install_headers]], [[install_subdir]] functions now
have an optional argument `follow_symlinks` that, if set to `true`, makes it so
symbolic links in the source are followed, rather than copied into the
destination tree, to match the old behavior. The default, which is currently
to follow links, is subject to change in the future.
## Added 'fill' kwarg to int.to_string()
int.to_string() now accepts a `fill` argument. This allows you to pad the
string representation of the integer with leading zeroes:
```meson
n = 4
message(n.to_string())
message(n.to_string(fill: 3))
n = -4
message(n.to_string(fill: 3))
```
OUTPUT:
```meson
4
004
-04
```
## Added 'json' output_format to configure_file()
When no input file is specified, [[configure_file]] can now
generate a `json` file from given [[@cfg_data]].
Field descriptions are not preserved in the json file.
## `@GLOBAL_SOURCE_ROOT@` and `@DIRNAME@` in machine files
Some tokens are now replaced in the machine file before parsing it:
- `@GLOBAL_SOURCE_ROOT@`: the absolute path to the project's source tree
- `@DIRNAME@`: the absolute path to the machine file's parent directory.
It can be used, for example, to have paths relative to the source directory, or
relative to toolchain's installation directory.
```ini
[binaries]
c = '@DIRNAME@/toolchain/gcc'
exe_wrapper = '@GLOBAL_SOURCE_ROOT@' / 'build-aux' / 'my-exe-wrapper.sh'
```
## clang-tidy-fix target
If `clang-tidy` is installed and the project's source root contains a
`.clang-tidy` (or `_clang-tidy`) file, Meson will automatically define
a `clang-tidy-fix` target that runs `run-clang-tidy` tool with `-fix`
option to apply the changes found by clang-tidy to the source code.
If you have defined your own `clang-tidy-fix` target, Meson will not
generate its own target.
## Meson compile command now accepts suffixes for TARGET
The syntax for specifying a target for meson compile is now
`[PATH_TO_TARGET/]TARGET_NAME.TARGET_SUFFIX[:TARGET_TYPE]` where
`TARGET_SUFFIX` is the suffix argument given in the build target
within meson.build. It is optional and `TARGET_NAME` remains
sufficient if it uniquely resolves to one single target.
## New environment variable `MESON_PACKAGE_CACHE_DIR`
If the `MESON_PACKAGE_CACHE_DIR` environment variable is set, it is used instead of the
project's `subprojects/packagecache`. This allows sharing the cache across multiple
projects. In addition it can contain an already extracted source tree as long as it
has the same directory name as the `directory` field in the wrap file. In that
case, the directory will be copied into `subprojects/` before applying patches.
## Update options with `meson setup <builddir> -Dopt=value`
If the build directory already exists, options are updated with their new value
given on the command line (`-Dopt=value`). Unless `--reconfigure` is also specified,
this won't reconfigure immediately. This has the same behaviour as
`meson configure <builddir> -Dopt=value`.
Previous Meson versions were simply a no-op.
## Clear persistent cache with `meson setup --clearcache`
Just like `meson configure --clearcache`, it is now possible to clear the cache
and reconfigure in a single command with `meson setup --clearcache --reconfigure <builddir>`.
## pkg-config dependencies can now get a variable with multiple replacements
When using [[dep.get_variable]] and defining a `pkgconfig_define`, it is
sometimes useful to remap multiple dependency variables. For example, if the
upstream project changed the variable name that is interpolated and it is
desirable to support both versions.
It is now possible to pass multiple pairs of variable/value.
The same applies to the compatibility [[dep.get_pkgconfig_variable]] method.
## Machine files: `pkgconfig` field deprecated and replaced by `pkg-config`
Meson used to allow both `pkgconfig` and `pkg-config` entries in machine files,
the former was used for `dependency()` lookup and the latter was used as return
value for `find_program('pkg-config')`.
This inconsistency is now fixed by deprecating `pkgconfig` in favor of
`pkg-config` which matches the name of the binary. For backward compatibility
it is still allowed to define both with the same value, in that case no
deprecation warning is printed.
## Support targeting Python's limited C API
The Python module's `extension_module` function has gained the ability
to build extensions which target Python's limited C API via a new keyword
argument: `limited_api`.
## All compiler `has_*` methods support the `required` keyword
Now instead of
```meson
assert(cc.has_function('some_function'))
assert(cc.has_type('some_type'))
assert(cc.has_member('struct some_type', 'x'))
assert(cc.has_members('struct some_type', ['x', 'y']))
```
we can use
```meson
cc.has_function('some_function', required: true)
cc.has_type('some_type', required: true)
cc.has_member('struct some_type', 'x', required: true)
cc.has_members('struct some_type', ['x', 'y'], required: true)
```
## Deprecated `rust_crate_type` and replaced by `rust_abi`
The new `rust_abi` keyword argument is accepted by [[shared_library]],
[[static_library]], [[library]] and [[shared_module]] functions. It can be either
`'rust'` (the default) or `'c'` strings.
`rust_crate_type` is now deprecated because Meson already knows if it's a shared
or static library, user only need to specify the ABI (Rust or C).
`proc_macro` crates are now handled by the [`rust.proc_macro()`](Rust-module.md#proc_macro)
method.
## Tests now abort on errors by default under sanitizers
Sanitizers like AddressSanitizer and UndefinedBehaviorSanitizer do not abort
by default on detected violations. Meson now exports `ASAN_OPTIONS` and `UBSAN_OPTIONS`
when unset in the environment to provide sensible abort-by-default behavior.
## `<lang>_(shared|static)_args` for both_library, library, and build_target
We now allow passing arguments like `c_static_args` and `c_shared_args`. This
allows a [[both_libraries]] to have arguments specific to either the shared or
static library, as well as common arguments to both.
There is a drawback to this, since Meson now cannot re-use object files between
the static and shared targets. This could lead to much higher compilation time
when using a [[both_libraries]] if there are many sources.
## `-j` shorthand for `--num-processes`
`-j` now means the same thing as `--num-processes`. It was inconsistently
supported only in some subcommands. Now you may use it everywhere
## Unified message(), str.format() and f-string formatting
They now all support the same set of values: strings, integers, bools, options,
dictionaries and lists thereof.
- Feature options (i.e. enabled, disabled, auto) were not previously supported
by any of those functions.
- Lists and dictionaries were not previously supported by f-string.
- str.format() allowed any type and often resulted in printing the internal
representation which is now deprecated.
## Subprojects excluded from scan-build reports
The `scan-build` target, created when using the `ninja` backend with `scan-build`
present, now excludes bugs found in subprojects from its final report.
## vs_module_defs keyword now supports indexes of custom_target
This means you can do something like:
```meson
defs = custom_target('generate_module_defs', ...)
shared_library('lib1', vs_module_defs : defs[0])
shared_library('lib2', vs_module_defs : defs[2])
```
## Automatic fallback to `cmake` and `cargo` subproject
CMake subprojects have been supported for a while using the `cmake.subproject()`
module method. However until now it was not possible to use a CMake subproject
as fallback in a `dependency()` call.
A wrap file can now specify the method used to build it by setting the `method`
key in the wrap file's first section. The method defaults to `meson`.
Supported methods:
- `meson` requires `meson.build` file.
- `cmake` requires `CMakeLists.txt` file. [See details](Wrap-dependency-system-manual.md#cmake-wraps).
- `cargo` requires `Cargo.toml` file. [See details](Wrap-dependency-system-manual.md#cargo-wraps).

@ -0,0 +1,111 @@
---
title: Release 1.4.0
short-description: Release notes for 1.4.0
...
# New features
Meson 1.4.0 was released on 12 March 2024
## Added support for `[[@build_tgt]]`, `[[@custom_tgt]]`, and `[[@custom_idx]]` to certain FS module functions
Support for `[[@build_tgt]]`, `[[@custom_tgt]]`, and `[[@custom_idx]]` was
added to the following FS module APIs:
- `fs.name`
- `fs.parent`
- `fs.replace_suffix`
- `fs.stem`
## Meson now reads the project version of cmake subprojects
CMake subprojects configured by meson will now have their project
version set to the project version in their CMakeLists.txt. This
allows version constraints to be properly checked when falling back to
a cmake subproject.
## `ndebug` setting now controls C++ stdlib assertions
The `ndebug` setting, if disabled, now passes preprocessor defines to enable
debugging assertions within the C++ standard library.
For GCC, `-D_GLIBCXX_ASSERTIONS=1` is set.
For Clang, `-D_GLIBCXX_ASSERTIONS=1` is set to cover libstdc++ usage,
and `-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE` or
`-D_LIBCPP_ENABLE_ASSERTIONS=1` is used depending on the Clang version.
## `stldebug` gains Clang support
For Clang, we now pass `-D_GLIBCXX_DEBUG=1` if `debugstl` is enabled, and
we also pass `-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG`.
## New `unset()` method on `environment` objects
[[@env]] now has an [[env.unset]] method to ensure an existing environment
is *not* defined.
## File object now has `full_path()` method
Returns a full path pointing to the file. This is useful for printing the path
with e.g [[message]] function for debugging purpose.
**NOTE:** In most cases using the object itself will do the same job
as this and will also allow Meson to setup dependencies correctly.
## New numpy custom dependency
Support for `dependency('numpy')` was added, via supporting the `numpy-config` tool and
pkg-config support, both of which are available since NumPy 2.0.0.
Config-tool support is useful because it will work out of the box when
``numpy`` is installed, while the pkg-config file is located inside python's
site-packages, which makes it impossible to use in an out of the box manner
without setting `PKG_CONFIG_PATH`.
## `depends` kwarg now supported by compiler.preprocess()
It is now possible to specify the dependent targets with `depends:`
for compiler.preprocess(). These targets should be built before the
preprocessing starts.
## Added `preserve_paths` keyword argument to qt module functions.
In `qt4`, `qt5`, and `qt6` modules, `compile_ui`, `compile_moc`, and
`preprocess` functions now have a `preserve_paths` keyword argument.
If `'true`, it specifies that the output files need to maintain their directory
structure inside the target temporary directory. For instance, when a file
called `subdir/one.input` is processed it generates a file
`{target private directory}/subdir/one.out` when `true`,
and `{target private directory}/one.out` when `false` (default).
## Bindgen will now use Meson's heuristic for what is a C++ header
Bindgen natively assumes that a file with the extension `.hpp` is a C++ header,
but that everything else is a C header. Meson has a whole list of extensions it
considers to be C++, and now will automatically look for those extensions and
set bindgen to treat those as C++
## Overriding bindgen language setting
Even though Meson will now tell bindgen to do the right thing in most cases,
there may still be cases where Meson does not have the intended behavior,
specifically with headers with a `.h` suffix, but are C++ headers.
## Bindgen now uses the same C/C++ std as the project as a whole
Which is very important for C++ bindings.
## Tests now abort on errors by default under more sanitizers
Sanitizers like MemorySanitizer do not abort
by default on detected violations. Meson now exports `MSAN_OPTIONS` (in addition to
`ASAN_OPTIONS` and `UBSAN_OPTIONS` from a previous release) when unset in the
environment to provide sensible abort-by-default behavior.
## Use `custom_target` as test executable
The [[test]] function now accepts [[@custom_tgt]] and [[@custom_idx]] for the
command to execute.

@ -0,0 +1,214 @@
---
title: Release 1.5.0
short-description: Release notes for 1.5.0
...
# New features
Meson 1.5.0 was released on 10 July 2024
## Support for `bztar` in `meson dist`
The `bztar` format is now supported in `meson dist`. This format is also known
as `bzip2`.
## Cargo dependencies names now include the API version
Cargo dependencies names are now in the format `<package_name>-<version>-rs`:
- `package_name` is defined in `[package] name = ...` section of the `Cargo.toml`.
- `version` is the API version deduced from `[package] version = ...` as follow:
* `x.y.z` -> 'x'
* `0.x.y` -> '0.x'
* `0.0.x` -> '0'
It allows to make different dependencies for incompatible versions of the same
crate.
- `-rs` suffix is added to distinguish from regular system dependencies, for
example `gstreamer-1.0` is a system pkg-config dependency and `gstreamer-0.22-rs`
is a Cargo dependency.
That means the `.wrap` file should have `dependency_names = foo-1-rs` in their
`[provide]` section when `Cargo.toml` has package name `foo` and version `1.2`.
This is a breaking change (Cargo subprojects are still experimental), previous
versions were using `<package_name>-rs` format.
## Added support `Cargo.lock` file
When a (sub)project has a `Cargo.lock` file at its root, it is loaded to provide
an automatic fallback for dependencies it defines, fetching code from
https://crates.io or git. This is identical as providing `subprojects/*.wrap`,
see [cargo wraps](Wrap-dependency-system-manual.md#cargo-wraps) dependency naming convention.
## Meson now propagates its build type to CMake
When the CMake build type variable, `CMAKE_BUILD_TYPE`, is not set via the
`add_cmake_defines` method of the [`cmake options` object](CMake-module.md#cmake-options-object),
it is inferred from the [Meson build type](Builtin-options.md#details-for-buildtype).
Build types of the two build systems do not match perfectly. The mapping from
Meson build type to CMake build type is as follows:
- `debug` -> `Debug`
- `debugoptimized` -> `RelWithDebInfo`
- `release` -> `Release`
- `minsize` -> `MinSizeRel`
No CMake build type is set for the `plain` Meson build type. The inferred CMake
build type overrides any `CMAKE_BUILD_TYPE` environment variable.
## compiler.run() method is now available for all languages
It used to be only implemented for C-like and D languages, but it is now available
for all languages.
## dependencies created by compiler.find_library implement the `name()` method
Previously, for a [[@dep]] that might be returned by either [[dependency]] or
[[compiler.find_library]], the method might or might not exist with no way
of telling.
## New version_argument kwarg for find_program
When finding an external program with `find_program`, the `version_argument`
can be used to override the default `--version` argument when trying to parse
the version of the program.
For example, if the following is used:
```meson
foo = find_program('foo', version_argument: '-version')
```
meson will internally run `foo -version` when trying to find the version of `foo`.
## Meson configure handles changes to options in more cases
Meson configure now correctly handles updates to the options file without a full
reconfigure. This allows making a change to the `meson.options` or
`meson_options.txt` file without a reconfigure.
For example, this now works:
```sh
meson setup builddir
git pull
meson configure builddir -Doption-added-by-pull=value
```
## New meson format command
This command is similar to `muon fmt` and allows to format a `meson.build`
document.
## Added support for GCC's `null_terminated_string_arg` function attribute
You can now check if a compiler support the `null_terminated_string_arg`
function attribute via the `has_function_attribute()` method on the
[[@compiler]] object.
```meson
cc = meson.get_compiler('c')
if cc.has_function_attribute('null_terminated_string_arg')
# We have it...
endif
```
## A new dependency for ObjFW is now supported
For example, you can create a simple application written using ObjFW like this:
```meson
project('SimpleApp', 'objc')
objfw_dep = dependency('objfw', version: '>= 1.0')
executable('SimpleApp', 'SimpleApp.m',
dependencies: [objfw_dep])
```
Modules are also supported. A test case using ObjFWTest can be created like
this:
```meson
project('Tests', 'objc')
objfwtest_dep = dependency('objfw', version: '>= 1.1', modules: ['ObjFWTest'])
executable('Tests', ['FooTest.m', 'BarTest.m'],
dependencies: [objfwtest_dep])
```
## Support of indexed `@PLAINNAME@` and `@BASENAME@`
In `custom_target()` and `configure_file()` with multiple inputs,
it is now possible to specify index for `@PLAINNAME@` and `@BASENAME@`
macros in `output`:
```
custom_target('target_name',
output: '@PLAINNAME0@.dl',
input: [dep1, dep2],
command: cmd)
```
## Required kwarg on more `compiler` methods
The following `compiler` methods now support the `required` keyword argument:
- `compiler.compiles()`
- `compiler.links()`
- `compiler.runs()`
```meson
cc.compiles(valid, name: 'valid', required : true)
cc.links(valid, name: 'valid', required : true)
cc.run(valid, name: 'valid', required : true)
assert(not cc.compiles(valid, name: 'valid', required : opt))
assert(not cc.links(valid, name: 'valid', required : opt))
res = cc.run(valid, name: 'valid', required : opt)
assert(res.compiled())
assert(res.returncode() == 0)
assert(res.stdout() == '')
assert(res.stderr() == '')
```
## The Meson test program supports a new "--interactive" argument
`meson test --interactive` invokes tests with stdout, stdin and stderr
connected directly to the calling terminal. This can be useful when running
integration tests that run in containers or virtual machines which can spawn a
debug shell if a test fails.
## meson test now sets the `MESON_TEST_ITERATION` environment variable
`meson test` will now set the `MESON_TEST_ITERATION` environment variable to the
current iteration of the test. This will always be `1` unless `--repeat` is used
to run the same test multiple times.
## The Meson test program supports a new "--max-lines" argument
By default `meson test` only shows the last 100 lines of test output from tests
that produce large amounts of output. This default can now be changed with the
new `--max-lines` option. For example, `--max-lines=1000` will increase the
maximum number of log output lines from 100 to 1000.
## Basic support for TI Arm Clang (tiarmclang)
Support for TI's newer [Clang-based ARM toolchain](https://www.ti.com/tool/ARM-CGT).
## Support for Texas Instruments C6000 C/C++ compiler
Meson now supports the TI C6000 C/C++ compiler use for the C6000 cpu family.
The example cross file is available in `cross/ti-c6000.txt`.
## Wayland stable protocols can be versioned
The wayland module now accepts a version number for stable protocols.
```meson
wl_mod = import('unstable-wayland')
wl_mod.find_protocol(
'linux-dmabuf',
state: 'stable'
version: 1
)
```

@ -0,0 +1,175 @@
---
title: Release 1.6.0
short-description: Release notes for 1.6.0
...
# New features
Meson 1.6.0 was released on 20 October 2024
## Support for OpenXL compiler in AIX.
The OpenXL compiler is now supported from Meson 1.6.0 onwards.
So currently, in AIX Operating system we support GCC and openXL compilers for Meson build system.
Both the compilers will archive shared libraries and generate a shared object
for a shared module while using Meson in AIX.
## `alias_target` of `both_libraries`
Previously, when passing a [[@both_libs]] object to [[alias_target]], the alias
would only point to the shared library. It now points to both the static and the
shared library.
## Default to printing deprecations when no minimum version is specified.
For a long time, the [[project]] function has supported specifying the minimum
`meson_version:` needed by a project. When this is used, deprecated features
from before that version produce warnings, as do features which aren't
available in all supported versions.
When no minimum version was specified, meson didn't warn you even about
deprecated functionality that might go away in an upcoming semver major release
of meson.
Now, meson will treat an unspecified minimum version following semver:
- For new features introduced in the current meson semver major cycle
(currently: all features added since 1.0) a warning is printed. Features that
have been available since the initial 1.0 release are assumed to be widely
available.
- For features that have been deprecated by any version of meson, a warning is
printed. Since no minimum version was specified, it is assumed that the
project wishes to follow the latest and greatest functionality.
These warnings will overlap for functionality that was both deprecated and
replaced with an alternative in the current release cycle. The combination
means that projects without a minimum version specified are assumed to want
broad compatibility with the current release cycle (1.x).
Projects that specify a minimum `meson_version:` will continue to only receive
actionable warnings based on their current minimum version.
## Cargo subprojects is experimental
Cargo subprojects was intended to be experimental with no stability guarantees.
That notice was unfortunately missing from documentation. Meson will now start
warning about usage of experimental features and future releases might do breaking
changes.
This is aligned with our general policy regarding [mixing build systems](Mixing-build-systems.md).
## Dependencies from CMake subprojects now use only PUBLIC link flags
Any [[@dep]] obtained from a CMake subproject (or `.wrap` with `method = cmake`)
now only includes link flags marked in CMake as `PUBLIC` or `INTERFACE`.
Flags marked as `PRIVATE` are now only applied when building the subproject
library and not when using it as a dependency. This better matches how CMake
handles link flags and fixes link errors when using some CMake projects as
subprojects.
## New built-in option for default both_libraries
`both_libraries` targets used to be considered as a shared library by default.
There is now the `default_both_libraries` option to change this default.
When `default_both_libraries` is 'auto', [[both_libraries]] with dependencies
that are [[@both_libs]] themselves will link with the same kind of library.
For example, if `libA` is a [[@both_libs]] and `libB` is a [[@both_libs]]
linked with `libA` (or with an internal dependency on `libA`),
the static lib of `libB` will link with the static lib of `libA`, and the
shared lib of `libA` will link with the shared lib of `libB`.
## New `as_static` and `as_shared` methods on internal dependencies
[[@dep]] object returned by [[declare_dependency]] now has `.as_static()` and
`.as_shared()` methods, to convert to a dependency that prefers the `static`
or the `shared` version of the linked [[@both_libs]] target.
When the same dependency is used without those methods, the
`default_both_libraries` option determines which version is used.
## Support for DIA SDK
Added support for Windows Debug Interface Access SDK (DIA SDK) dependency. It allows reading with MSVC debugging information (.PDB format). This dependency can only be used on Windows, with msvc, clang or clang-cl compiler.
## Support for LLVM-based flang compiler
Added basic handling for the [flang](https://flang.llvm.org/docs/) compiler
that's now part of LLVM. It is the successor of another compiler named
[flang](https://github.com/flang-compiler/flang) by largely the same
group of developers, who now refer to the latter as "classic flang".
Meson already supports classic flang, and the LLVM-based flang now
uses the compiler-id `'llvm-flang'`.
## nvc and nvc++ now support setting std
The following standards are available for nvc: c89, c90, c99, c11,
c17, c18, gnu90, gnu89, gnu99, gnu11, gnu17, gnu18. For nvc++:
c++98, c++03, c++11, c++14, c++17, c++20, c++23, gnu++98, gnu++03,
gnu++11, gnu++14, gnu++17, gnu++20
## Tools can be selected when calling `has_tools()` on the Qt modules
When checking for the presence of Qt tools, you can now explictly ask Meson
which tools you need. This is particularly useful when you do not need
`lrelease` because you are not shipping any translations. For example:
```meson
qt6_mod = import('qt6')
qt6_mod.has_tools(required: true, tools: ['moc', 'uic', 'rcc'])
```
valid tools are `moc`, `uic`, `rcc` and `lrelease`.
## Simple tool to test build reproducibility
Meson now ships with a command for testing whether your project can be
[built reproducibly](https://reproducible-builds.org/). It can be used
by running a command like the following in the source root of your
project:
meson reprotest --intermediaries -- --buildtype=debugoptimized
All command line options after the `--` are passed to the build
invocations directly.
This tool is not meant to be exhaustive, but instead easy and
convenient to run. It will detect some but definitely not all
reproducibility issues.
## Support for variable in system dependencies
System Dependency method `get_variable()` now supports `system` variable.
## test() and benchmark() functions accept new types
`test` and `benchmark` now accept ExternalPrograms (as returned by
`find_program`) in the `args` list. This can be useful where the test
executable is a wrapper which invokes another program given as an
argument.
```meson
test('some_test', find_program('sudo'), args : [ find_program('sh'), 'script.sh' ])
```
## Zig 0.11 can be used as a C/C++ compiler frontend
Zig offers
[a C/C++ frontend](https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html) as a drop-in replacement for Clang. It worked fine with Meson up to Zig 0.10. Since 0.11, Zig's
dynamic linker reports itself as `zig ld`, which wasn't known to Meson. Meson now correctly handles
Zig's linker.
You can use Zig's frontend via a [machine file](Machine-files.md):
```ini
[binaries]
c = ['zig', 'cc']
cpp = ['zig', 'c++']
ar = ['zig', 'ar']
ranlib = ['zig', 'ranlib']
lib = ['zig', 'lib']
dlltool = ['zig', 'dlltool']
```

@ -16,8 +16,8 @@ choose.
# Major releases
Major releases are currently in the form 0.X.0, where X is an
increasing number. We aim to do a major release roughly once a month,
though the schedule is not set in stone.
increasing number. We aim to do a major release roughly once every 3 to 4
months, though the schedule is not set in stone.
Before a major release is made a stable branch will be made, and
0.X.0-rc1 release candidate will be made. A new milestone for 0.X.0

@ -3,7 +3,7 @@ short-description: Rust language integration module
authors:
- name: Dylan Baker
email: dylan@pnwbakers.com
years: [2020, 2021, 2022]
years: [2020, 2021, 2022, 2024]
...
# Rust module
@ -57,11 +57,16 @@ It takes the following keyword arguments
- `input`: a list of Files, Strings, or CustomTargets. The first element is
the header bindgen will parse, additional elements are dependencies.
- `output`: the name of the output rust file
- `output_inline_wrapper`: the name of the optional output c file containing
wrappers for static inline function. This requires `bindgen-0.65` or
newer (*since 1.3.0*).
- `include_directories`: A list of `include_directories` or `string` objects,
these are passed to clang as `-I` arguments *(string since 1.0.0)*
- `c_args`: a list of string arguments to pass to clang untouched
- `args`: a list of string arguments to pass to `bindgen` untouched.
- `dependencies`: a list of `Dependency` objects to pass to the underlying clang call (*since 1.0.0*)
- `language`: A literal string value of `c` or `cpp`. When set this will force bindgen to treat a source as the given language. Defaults to checking based on the input file extension. *(since 1.4.0)*
- `bindgen_version`: a list of string version values. When set the found bindgen binary must conform to these constraints. *(since 1.4.0)*
```meson
rust = import('unstable-rust')
@ -103,5 +108,34 @@ were never turned on by Meson.
```ini
[properties]
bindgen_clang_arguments = ['--target', 'x86_64-linux-gnu']
bindgen_clang_arguments = ['-target', 'x86_64-linux-gnu']
```
### proc_macro()
```meson
rustmod.proc_macro(name, sources, ...)
```
*Since 1.3.0*
This function creates a Rust `proc-macro` crate, similar to:
```meson
[[shared_library]](name, sources,
rust_crate_type: 'proc-macro',
native: true)
```
`proc-macro` targets can be passed to `link_with` keyword argument of other Rust
targets.
Only a subset of [[shared_library]] keyword arguments are allowed:
- rust_args
- rust_dependency_map
- sources
- dependencies
- extra_files
- link_args
- link_depends
- link_with
- override_options

@ -5,6 +5,26 @@ short-description: Working with Rust in Meson
# Using Rust with Meson
## Avoid using `extern crate`
Meson can't track dependency information for crates linked by rustc as
a result of `extern crate` statements in Rust source code. If your
crate dependencies are properly expressed in Meson, there should be no
need for `extern crate` statements in your Rust code, as long as you use the
Rust 2018 edition or later. This means adding `rust_std=2018` (or later) to the
`project(default_options)` argument.
An example of the problems with `extern crate` is that if you delete a
crate from a Meson build file, other crates that depend on that crate
using `extern crate` might continue linking with the leftover rlib of
the deleted crate rather than failing to build, until the build
directory is cleaned.
This limitation could be resolved in future with rustc improvements,
for example if the [`-Z
binary-dep-depinfo`](https://github.com/rust-lang/rust/issues/63012)
feature is stabilized.
## Mixing Rust and non-Rust sources
Meson currently does not support creating a single target with Rust and non Rust

@ -9,7 +9,11 @@ Meson build files.
## Tabs or spaces?
Always spaces.
Always spaces. Two spaces is the most common.
## Trailing commas?
Yes, where possible. They help make nicer diffs in version control systems.
## Naming Variable
@ -70,7 +74,7 @@ normal files. This rule also applies recursively for subdirectories.
The following example shows correct source list definition:
```meson
sources = files([
sources = files(
'aaa/a1.c',
'aaa/a2.c',
'bbb/subdir1/b1.c',
@ -82,6 +86,6 @@ sources = files([
'f1.c',
'f2.c',
'f10.c',
'f20.c'
])
'f20.c',
)
```

@ -300,7 +300,7 @@ types. Multiple types can be set as comma separated list e.g. `--types
git,file`.
*Since 0.56.0* If the subcommand fails on any subproject an error code
is returned at the end instead of retuning success.
is returned at the end instead of returning success.
### Download subprojects

@ -109,7 +109,7 @@ Strings in Meson are declared with single quotes. To enter a literal
single quote do it like this:
```meson
single quote = 'contains a \' character'
single_quote = 'contains a \' character'
```
The full list of escape sequences is:
@ -454,6 +454,15 @@ Keys must be unique:
my_dict = {'foo': 42, 'foo': 43}
```
Accessing elements of a dictionary works similarly to array indexing:
```meson
my_dict = {'foo': 42, 'bar': 'baz'}
forty_two = my_dict['foo']
# This will fail
my_dict['does_not_exist']
```
Dictionaries are immutable and do not have a guaranteed order.
Dictionaries are available since 0.47.0.

@ -18,6 +18,8 @@ following command:
sudo apt install libgtk-4-dev
```
In addition, it is recommended to have the glib library with version 2.74 or higher.
It is possible to build the GUI application on other platforms, such
as Windows and macOS, but you need to install the needed dependencies.
@ -147,7 +149,12 @@ int main(int argc, char **argv)
GtkApplication *app;
int status;
app = gtk_application_new("org.example.Example", G_APPLICATION_DEFAULT_FLAGS);
#if GLIB_CHECK_VERSION(2, 74, 0)
app = gtk_application_new(NULL, G_APPLICATION_DEFAULT_FLAGS);
#else
app = gtk_application_new(NULL, G_APPLICATION_FLAGS_NONE);
#endif
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
status = g_application_run(G_APPLICATION(app), argc, argv);
g_object_unref(app); // Free from memory when program terminates

@ -38,6 +38,12 @@ set to a random value between 1..255. This can help find memory leaks on
configurations using glibc, including with non-GCC compilers. This feature
can be disabled as discussed in [[test]].
### ASAN_OPTIONS, UBSAN_OPTIONS, and MSAN_OPTIONS
By default, the environment variables `ASAN_OPTIONS`, `UBSAN_OPTIONS`, and
`MSAN_OPTIONS` are set to enable aborting on detected violations and to give a
backtrace. This feature can be disabled as discussed in [[test]].
## Coverage
If you enable coverage measurements by giving Meson the command line
@ -49,7 +55,7 @@ targets. These targets are `coverage-xml` and `coverage-text` which
are both provided by [Gcovr](http://gcovr.com) (version 3.3 or higher)
`coverage-sonarqube` which is provided by [Gcovr](http://gcovr.com) (version 4.2 or higher)
and `coverage-html`, which requires
[Lcov](https://ltp.sourceforge.io/coverage/lcov.php) and
[lcov](https://github.com/linux-test-project/lcov) and
[GenHTML](https://linux.die.net/man/1/genhtml) or
[Gcovr](http://gcovr.com). As a convenience, a high-level `coverage`
target is also generated which will produce all 3 coverage report
@ -83,6 +89,10 @@ variable `MESON_TESTTHREADS` like this.
$ MESON_TESTTHREADS=5 meson test
```
Setting `MESON_TESTTHREADS` to 0 enables the default behavior (core
count), whereas setting an invalid value results in setting the job
count to 1.
## Priorities
*(added in version 0.52.0)*
@ -202,6 +212,9 @@ Sometimes you need to run the tests multiple times, which is done like this:
$ meson test --repeat=10
```
Meson will set the `MESON_TEST_ITERATION` environment variable to the
current iteration of the test *(added 1.5.0)*.
Invoking tests via a helper executable such as Valgrind can be done with the
`--wrap` argument
@ -250,11 +263,29 @@ $ meson test --gdb --gdb-path /path/to/gdb testname
$ meson test --print-errorlogs
```
Running tests interactively can be done with the `--interactive` option.
`meson test --interactive` invokes tests with stdout, stdin and stderr
connected directly to the calling terminal. This can be useful if your test is
an integration test running in a container or virtual machine where a debug
shell is spawned if it fails *(added 1.5.0)*:
```console
$ meson test --interactive testname
```
Meson will report the output produced by the failing tests along with
other useful information as the environmental variables. This is
useful, for example, when you run the tests on Travis-CI, Jenkins and
the like.
By default, the output from tests will be limited to the last 100 lines. The
maximum number of lines to show can be configured with the `--max-lines` option
*(added 1.5.0)*:
```console
$ meson test --max-lines=1000 testname
```
**Timeout**
In the test case options, the `timeout` option is specified in a number of seconds.

@ -19,6 +19,7 @@ topic](https://github.com/topics/meson).
- [Akira](https://github.com/akiraux/Akira), a native Linux app for UI and UX design built in Vala and Gtk
- [AQEMU](https://github.com/tobimensch/aqemu), a Qt GUI for QEMU virtual machines, since version 0.9.3
- [Arduino sample project](https://github.com/jpakkane/mesonarduino)
- [Asteria](https://github.com/lhmouse/asteria), another scripting language
- [Audacious](https://github.com/audacious-media-player), a lightweight and versatile audio player
- [bolt](https://gitlab.freedesktop.org/bolt/bolt), userspace daemon to enable security levels for Thunderbolt™ 3 on Linux
- [bsdutils](https://github.com/dcantrell/bsdutils), alternative to GNU coreutils using software from FreeBSD
@ -37,6 +38,8 @@ topic](https://github.com/topics/meson).
- [DOSBox Staging](https://github.com/dosbox-staging/dosbox-staging), DOS/x86 emulator
- [DPDK](http://dpdk.org/browse/dpdk), Data Plane Development Kit, a set of libraries and drivers for fast packet processing
- [DXVK](https://github.com/doitsujin/dxvk), a Vulkan-based Direct3D 11 implementation for Linux using Wine
- [EFL](https://www.enlightenment.org/about-efl), multiplatform set of libraries, used by the Enlightenment windows manager and other projects
- [Enlightenment](https://www.enlightenment.org/), windows manager, compositor and minimal desktop for Linux
- [elementary OS](https://github.com/elementary/), Linux desktop oriented distribution
- [Emeus](https://github.com/ebassi/emeus), constraint based layout manager for GTK+
- [Entangle](https://entangle-photo.org/), tethered camera control and capture desktop application
@ -48,8 +51,8 @@ topic](https://github.com/topics/meson).
- [Frida](https://github.com/frida/frida-core), a dynamic binary instrumentation toolkit
- [fwupd](https://github.com/hughsie/fwupd), a simple daemon to allow session software to update firmware
- [GameMode](https://github.com/FeralInteractive/gamemode), a daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS
- [Geary](https://wiki.gnome.org/Apps/Geary), an email application built around conversations, for the GNOME 3 desktop.
- [GIMP](https://gitlab.gnome.org/GNOME/gimp), an image manipulation program (experimental replacing autoconf)
- [Geary](https://wiki.gnome.org/Apps/Geary), an email application built around conversations, for the GNOME 3 desktop
- [GIMP](https://gitlab.gnome.org/GNOME/gimp), an image manipulation program (master branch)
- [GLib](https://gitlab.gnome.org/GNOME/glib), cross-platform C library used by GTK+ and GStreamer
- [Glorytun](https://github.com/angt/glorytun), a multipath UDP tunnel
- [GNOME Boxes](https://gitlab.gnome.org/GNOME/gnome-boxes), a GNOME hypervisor
@ -59,6 +62,7 @@ topic](https://github.com/topics/meson).
- [GNOME Software](https://gitlab.gnome.org/GNOME/gnome-software), an app store for GNOME
- [GNOME Twitch](https://github.com/vinszent/gnome-twitch), an app for viewing Twitch streams on GNOME desktop
- [GNOME Usage](https://gitlab.gnome.org/GNOME/gnome-usage), a GNOME application for visualizing system resources
- [GNOME Web](https://gitlab.gnome.org/GNOME/epiphany), a browser for a simple, clean, beautiful view of the web
- [GNU FriBidi](https://github.com/fribidi/fribidi), the open source implementation of the Unicode Bidirectional Algorithm
- [Graphene](https://ebassi.github.io/graphene/), a thin type library for graphics
- [Grilo](https://git.gnome.org/browse/grilo) and [Grilo plugins](https://git.gnome.org/browse/grilo-plugins), the Grilo multimedia framework
@ -86,16 +90,17 @@ topic](https://github.com/topics/meson).
- [Le](https://github.com/kirushyk/le), machine learning framework
- [libcamera](https://git.linuxtv.org/libcamera.git/), a library to handle complex cameras on Linux, ChromeOS and Android
- [Libdrm](https://gitlab.freedesktop.org/mesa/drm), a library for abstracting DRM kernel interfaces
- [libdwarf](https://www.prevanders.net/dwarf.html), a multiplatform DWARF parser library
- [libeconf](https://github.com/openSUSE/libeconf), Enhanced config file parsing library, which merges config files placed in several locations into one
- [Libepoxy](https://github.com/anholt/libepoxy/), a library for handling OpenGL function pointer management
- [libfuse](https://github.com/libfuse/libfuse), the reference implementation of the Linux FUSE (Filesystem in Userspace) interface
- [Libgit2-glib](https://git.gnome.org/browse/libgit2-glib), a GLib wrapper for libgit2
- [libglvnd](https://gitlab.freedesktop.org/glvnd/libglvnd), Vendor neutral OpenGL dispatch library for Unix-like OSes
- [Libhttpseverywhere](https://git.gnome.org/browse/libhttpseverywhere), a library to enable httpseverywhere on any desktop app
- [libmodulemd](https://github.com/fedora-modularity/libmodulemd), a GObject Introspected library for managing [Fedora Project](https://getfedora.org/) module metadata.
- [libmodulemd](https://github.com/fedora-modularity/libmodulemd), a GObject Introspected library for managing [Fedora Project](https://getfedora.org/) module metadata
- [Libosmscout](https://github.com/Framstag/libosmscout), a C++ library for offline map rendering, routing and location
lookup based on OpenStreetMap data
- [libratbag](https://github.com/libratbag/libratbag), provides a DBus daemon to configure input devices, mainly gaming mice.
- [libratbag](https://github.com/libratbag/libratbag), provides a DBus daemon to configure input devices, mainly gaming mice
- [libspng](https://github.com/randy408/libspng), a C library for reading and writing Portable Network Graphics (PNG)
format files
- [libSRTP](https://github.com/cisco/libsrtp) (from Cisco Systems), a library for SRTP (Secure Realtime Transport Protocol)
@ -104,8 +109,10 @@ format files
- [libvips](https://github.com/libvips/libvips), a fast image processing library with low memory needs
- [Libvirt](https://libvirt.org), a toolkit to manage virtualization platforms
- [Libzim](https://github.com/openzim/libzim), the reference implementation for the ZIM file format
- [Linux PAM](https://github.com/linux-pam/linux-pam), The Pluggable Authentication Modules project for Linux
- [LXC](https://github.com/lxc/lxc), Linux container runtime
- [Marker](https://github.com/fabiocolacio/Marker), a GTK-3 markdown editor
- [mcfgthread](https://github.com/lhmouse/mcfgthread), cornerstone library for C++11 threading on mingw-w64
- [Mesa](https://mesa3d.org/), an open source graphics driver project
- [Miniz](https://github.com/richgel999/miniz), a zlib replacement library
- [MiracleCast](https://github.com/albfan/miraclecast), connect external monitors to your system via WiFi-Display specification aka Miracast
@ -113,13 +120,16 @@ format files
- [mrsh](https://github.com/emersion/mrsh), a minimal POSIX shell
- [Nautilus](https://gitlab.gnome.org/GNOME/nautilus), the GNOME file manager
- [Nemo](https://github.com/linuxmint/nemo), the file manager for the Cinnamon desktop environment
- [netatalk](https://netatalk.io/), a free and open source AFP file server for Mac and Apple II
- [NetPanzer](https://github.com/netpanzer/netpanzer), a 2D online multiplayer tactical warfare game designed for fast action combat
- [NumPy](https://numpy.org/), a Python package for scientific computing
- [nvme-cli](https://github.com/linux-nvme/nvme-cli), NVMe management command line interface
- [OcherBook](https://github.com/ccoffing/OcherBook), an open source book reader for Kobo devices
- [oomd](https://github.com/facebookincubator/oomd), a userspace Out-Of-Memory (OOM) killer for Linux systems
- [OpenH264](https://github.com/cisco/openh264), open source H.264 codec
- [OpenHMD](https://github.com/OpenHMD/OpenHMD), a free and open source API and drivers for immersive technology, such as head mounted displays with built in head tracking
- [OpenRC](https://github.com/OpenRC/openrc), an init system for Unix-like operating systems
- [OpenTitan](https://github.com/lowRISC/opentitan), an open source silicon Root of Trust (RoT) project.
- [OpenTitan](https://github.com/lowRISC/opentitan), an open source silicon Root of Trust (RoT) project
- [Orc](https://gitlab.freedesktop.org/gstreamer/orc), the Optimized Inner Loop Runtime Compiler
- [OTS](https://github.com/khaledhosny/ots), the OpenType Sanitizer, parses and serializes OpenType files (OTF, TTF) and WOFF and WOFF2 font files, validating and sanitizing them as it goes. Used by Chromium and Firefox
- [Outlier](https://github.com/kerolasa/outlier), a small Hello World style Meson example project
@ -130,7 +140,7 @@ format files
- [Peek](https://github.com/phw/peek), simple animated GIF screen recorder with an easy to use interface
- [PicoLibc](https://github.com/keith-packard/picolibc), a standard C library for small embedded systems with limited RAM
- [PipeWire](https://github.com/PipeWire/pipewire), a framework for video and audio for containerized applications
- [Paper Rock Scissors](https://github.com/michaelbrockus/paper_rock_scissors), a game with weapons themed at home paper rock scissors style.
- [Paper Rock Scissors](https://github.com/michaelbrockus/paper_rock_scissors), a game with weapons themed at home paper rock scissors style
- [Pistache](https://github.com/pistacheio/pistache), a high performance REST toolkit written in C++
- [Pithos](https://github.com/pithos/pithos), a Pandora Radio client
- [Pitivi](https://github.com/pitivi/pitivi/), a nonlinear video editor
@ -141,7 +151,7 @@ format files
- [qboot](https://github.com/bonzini/qboot), a minimal x86 firmware for booting Linux kernels
- [QEMU](https://qemu.org), a processor emulator and virtualizer
- [radare2](https://github.com/radare/radare2), unix-like reverse engineering framework and commandline tools (not the default)
- [refivar](https://github.com/nvinson/refivar), A reimplementation of efivar in Rust.
- [refivar](https://github.com/nvinson/refivar), A reimplementation of efivar in Rust
- [Rizin](https://rizin.re), Free and Open Source Reverse Engineering Framework
- [rmw](https://remove-to-waste.info), safe-remove utility for the command line
- [RxDock](https://gitlab.com/rxdock/rxdock), a protein-ligand docking software designed for high throughput virtual screening (fork of rDock)
@ -158,16 +168,18 @@ format files
- [szl](https://github.com/dimkr/szl), a lightweight, embeddable scripting language
- [Taisei Project](https://taisei-project.org/), an open-source Touhou Project clone and fangame
- [Terminology](https://github.com/billiob/terminology), a terminal emulator based on the Enlightenment Foundation Libraries
- [ThorVG](https://www.thorvg.org/), vector-based scenes and animations library
- [Tilix](https://github.com/gnunn1/tilix), a tiling terminal emulator for Linux using GTK+ 3
- [Tizonia](https://github.com/tizonia/tizonia-openmax-il), a command-line cloud music player for Linux with support for Spotify, Google Play Music, YouTube, SoundCloud, TuneIn, Plex servers and Chromecast devices
- [Fossil Logic](https://github.com/fossillogic), Fossil Logic is a cutting-edge software development company specializing in C/C++, Python, programming, Android development using Kotlin, and SQL solutions
- [UFJF-MLTK](https://github.com/mateus558/UFJF-Machine-Learning-Toolkit), A C++ cross-platform framework for machine learning algorithms development and testing
- [Vala Language Server](https://github.com/benwaffle/vala-language-server), code intelligence engine for the Vala and Genie programming languages
- [Valum](https://github.com/valum-framework/valum), a micro web framework written in Vala
- [Venom](https://github.com/naxuroqa/Venom), a modern Tox client for the GNU/Linux desktop
- [vkQuake](https://github.com/Novum/vkQuake), a port of id Software's Quake using Vulkan instead of OpenGL for rendering
- [VMAF](https://github.com/Netflix/vmaf) (by Netflix), a perceptual video quality assessment based on multi-method fusion
- [Wayland](https://github.com/wayland-project/wayland) and [Weston](https://github.com/wayland-project/weston), a next generation display server
- [wlroots](https://github.com/swaywm/wlroots), a modular Wayland compositor library
- [Wayland](https://gitlab.freedesktop.org/wayland/wayland) and [Weston](https://gitlab.freedesktop.org/wayland/weston), a next generation display server
- [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots), a modular Wayland compositor library
- [xi-gtk](https://github.com/eyelash/xi-gtk), a GTK+ front-end for the Xi editor
- [Xorg](https://gitlab.freedesktop.org/xorg/xserver), the X.org display server (not the default yet)
- [X Test Suite](https://gitlab.freedesktop.org/xorg/test/xts), The X.org test suite

@ -5,9 +5,17 @@ short-description: How to use Meson in Visual Studio
# Using with Visual Studio
In order to generate Visual Studio projects, Meson needs to know the
settings of your installed version of Visual Studio. The only way to
get this information is to run Meson under the Visual Studio Command
Prompt.
settings of your installed version of Visual Studio.
The traditional way to get this information is to run Meson (or any build
system) under the Visual Studio Command Prompt.
If no Visual Studio Command Prompt was detected, and no mingw compilers are
detected either, meson will attempt to find "a" Visual Studio installation for
you automatically, by asking Microsoft's "vswhere" program. If you want to
ignore mingw compilers, pass the `--vsenv` option on the meson command line.
If you need to guarantee a specific Visual Studio version, set it up manually.
You can always find the Visual Studio Command Prompt by searching from
the Start Menu. However, the name is different for each Visual Studio

@ -53,7 +53,8 @@ generated = wl_mod.scan_xml(
include_core_only : true,
)
```
This function accepts one or more arguments of either string or file type.
This function accepts one or more arguments of either string or file type, so
it can be used in conjunction with `find_protocol` or not.
It takes the following keyword arguments:
- `public` Optional arg that specifies the scope of the generated code.

@ -12,7 +12,7 @@ Windows.
windows.compile_resources(...(string | File | CustomTarget | CustomTargetIndex),
args: []string,
depend_files: [](string | File),
depends: [](BuildTarget | CustomTarget)
depends: [](BuildTarget | CustomTarget | CustomTargetIndex)
include_directories: [](IncludeDirectories | string)): []CustomTarget
```

@ -66,7 +66,7 @@ An example wrap-git will look like this:
```ini
[wrap-git]
url = https://github.com/libfoobar/libfoobar.git
revision = head
revision = HEAD
depth = 1
```
@ -87,6 +87,11 @@ previously reserved to `wrap-file`:
`subprojects/packagefiles`.
- `diff_files` - *Since 0.63.0* Comma-separated list of local diff files (see
[Diff files](#diff-files) below).
- `method` - *Since 1.3.0* The build system used by this subproject. Defaults to `meson`.
Supported methods:
- `meson` requires `meson.build` file.
- `cmake` requires `CMakeLists.txt` file. [See details](#cmake-wraps).
- `cargo` requires `Cargo.toml` file. [See details](#cargo-wraps).
### Specific to wrap-file
- `source_url` - download url to retrieve the wrap-file source archive
@ -109,11 +114,17 @@ project's `subprojects/packagecache` directory, it will be used instead
of downloading the file, even if `--wrap-mode` option is set to
`nodownload`. The file's hash will be checked.
Since *1.3.0* if the `MESON_PACKAGE_CACHE_DIR` environment variable is set, it is used instead of
the project's `subprojects/packagecache`. This allows sharing the cache across multiple
projects. In addition it can contain an already extracted source tree as long as it
has the same directory name as the `directory` field in the wrap file. In that
case, the directory will be copied into `subprojects/` before applying patches.
### Specific to VCS-based wraps
- `url` - name of the wrap-git repository to clone. Required.
- `revision` - name of the revision to checkout. Must be either: a
valid value (such as a git tag) for the VCS's `checkout` command, or
(for git) `head` to track upstream's default branch. Required.
(for git) `HEAD` to track upstream's default branch. Required.
### Specific to wrap-git
- `depth` - shallowly clone the repository to X number of commits. This saves bandwidth and disk
@ -284,6 +295,77 @@ With such wrap file, `find_program('myprog')` will automatically
fallback to use the subproject, assuming it uses
`meson.override_find_program('myprog')`.
### CMake wraps
**Note**: This is experimental and has no backwards or forwards compatibility guarantees.
See [Meson's rules on mixing build systems](Mixing-build-systems.md).
Since the CMake module does not know the public name of the provided
dependencies, a CMake `.wrap` file cannot use the `dependency_names = foo`
syntax. Instead, the `dep_name = <target_name>_dep` syntax should be used, where
`<target_name>` is the name of a CMake library with all non alphanumeric
characters replaced by underscores `_`.
For example, a CMake project that contains `add_library(foo-bar ...)` in its
`CMakeList.txt` and that applications would usually find using the dependency
name `foo-bar-1.0` (e.g. via pkg-config) would have a wrap file like this:
```ini
[wrap-file]
...
method = cmake
[provide]
foo-bar-1.0 = foo_bar_dep
```
### Cargo wraps
**Note**: This is experimental and has no backwards or forwards compatibility guarantees.
See [Meson's rules on mixing build systems](Mixing-build-systems.md).
Cargo subprojects automatically override the `<package_name>-<version>-rs` dependency
name:
- `package_name` is defined in `[package] name = ...` section of the `Cargo.toml`.
- `version` is the API version deduced from `[package] version = ...` as follow:
* `x.y.z` -> 'x'
* `0.x.y` -> '0.x'
* `0.0.x` -> '0'
It allows to make different dependencies for incompatible versions of the same
crate.
- `-rs` suffix is added to distinguish from regular system dependencies, for
example `gstreamer-1.0` is a system pkg-config dependency and `gstreamer-0.22-rs`
is a Cargo dependency.
That means the `.wrap` file should have `dependency_names = foo-1-rs` in their
`[provide]` section when `Cargo.toml` has package name `foo` and version `1.2`.
Note that the version component was added in Meson 1.4, previous versions were
using `<package_name>-rs` format.
Cargo subprojects require a toml parser. Python >= 3.11 have one built-in, older
Python versions require either the external `tomli` module or `toml2json` program.
For example, a Cargo project with the package name `foo-bar` would have a wrap
file like that:
```ini
[wrap-file]
...
method = cargo
[provide]
dependency_names = foo-bar-0.1-rs
```
In addition, if the file `meson/meson.build` exists, Meson will call `subdir('meson')`
where the project can add manual logic that would usually be part of `build.rs`.
Some naming conventions need to be respected:
- The `extra_args` variable is pre-defined and can be used to add any Rust arguments.
This is typically used as `extra_args += ['--cfg', 'foo']`.
- The `extra_deps` variable is pre-defined and can be used to add extra dependencies.
This is typically used as `extra_deps += dependency('foo')`.
Since *1.5.0* Cargo wraps can also be provided with `Cargo.lock` file at the root
of (sub)project source tree. Meson will automatically load that file and convert
it into a series of wraps definitions.
## Using wrapped projects
Wraps provide a convenient way of obtaining a project into your

@ -12,7 +12,7 @@ It takes no positional arguments, and the following keyword arguments:
A list of sources to be transpiled. Required, must have at least one source
*New in 0.60.0*: support for custom_target, custom_target_index, and generator_output.
- `extra_args` string[]: Extra arguments to pass directly to `qt-rcc`
- `method` string: The method to use to detect qt, see `dependency()` for more
- `method` string: The method to use to detect Qt, see `dependency()` for more
information.
## compile_ui
@ -26,8 +26,13 @@ It takes no positional arguments, and the following keyword arguments:
A list of sources to be transpiled. Required, must have at least one source
*New in 0.60.0*: support for custom_target, custom_target_index, and generator_output.
- `extra_args` string[]: Extra arguments to pass directly to `qt-uic`
- `method` string: The method to use to detect qt, see `dependency()` for more
- `method` string: The method to use to detect Qt, see `dependency()` for more
information.
- `preserve_paths` bool: *Since 1.4.0*. If `true`, specifies that the output
files need to maintain their directory structure inside the target temporary
directory. For instance, when a file called `subdir/one.input` is processed
it generates a file `{target private directory}/subdir/one.out` when `true`,
and `{target private directory}/one.out` when `false` (default).
## compile_moc
@ -44,11 +49,16 @@ It takes no positional arguments, and the following keyword arguments:
A list of headers to be transpiled into .cpp files
*New in 0.60.0*: support for custom_target, custom_target_index, and generator_output.
- `extra_args` string[]: Extra arguments to pass directly to `qt-moc`
- `method` string: The method to use to detect qt, see `dependency()` for more
- `method` string: The method to use to detect Qt, see `dependency()` for more
information.
- `dependencies`: dependency objects whose include directories are used by moc.
- `include_directories` (string | IncludeDirectory)[]: A list of `include_directory()`
objects used when transpiling the .moc files
- `preserve_paths` bool: *New in 1.4.0*. If `true`, specifies that the output
files need to maintain their directory structure inside the target temporary
directory. For instance, when a file called `subdir/one.input` is processed
it generates a file `{target private directory}/subdir/one.out` when `true`,
and `{target private directory}/one.out` when `false` (default).
## preprocess
@ -78,10 +88,17 @@ This method takes the following keyword arguments:
- `rcc_extra_arguments` string[]: any additional arguments to `rcc`. Since v0.49.0.
- `dependencies` Dependency[]: dependency objects needed by moc. Available since v0.48.0.
- `sources`: a list of extra sources, which are added to the output unchanged. Deprecated in 0.59.0.
- `preserve_paths` bool: *New in 1.4.0*. If `true`, specifies that the output
files need to maintain their directory structure inside the target temporary
directory. For instance, when a file called `subdir/one.input` is processed
it generates a file `{target private directory}/subdir/one.out` when `true`,
and `{target private directory}/one.out` when `false` (default).
It returns an array of targets and sources to pass to a compilation target.
## compile_translations (since v0.44.0)
## compile_translations
*since 0.44.0*
This method generates the necessary targets to build translation files with
lrelease, it takes no positional arguments, and the following keyword arguments:
@ -128,7 +145,7 @@ This method takes the following keyword arguments:
## Dependencies
See [Qt dependencies](Dependencies.md#qt4-qt5)
See [Qt dependencies](Dependencies.md#qt)
The 'modules' argument is used to include Qt modules in the project.
See the Qt documentation for the [list of

@ -166,7 +166,7 @@ execute permissions, the generated file will have them too.
First initialize the build directory with this command.
```console
$ meson <other flags> -Db_coverage=true
$ meson setup <other flags> -Db_coverage=true
```
Then issue the following commands.
@ -174,7 +174,7 @@ Then issue the following commands.
```console
$ meson compile
$ meson test
$ meson compile coverage-html (or coverage-xml)
$ ninja coverage-html (or coverage-xml)
```
The coverage report can be found in the meson-logs subdirectory.
@ -202,7 +202,7 @@ sanitizer](https://clang.llvm.org/docs/AddressSanitizer.html). Meson
has native support for these with the `b_sanitize` option.
```console
$ meson <other options> -Db_sanitize=address
$ meson setup <other options> -Db_sanitize=address
```
After this you just compile your code and run the test suite. Address
@ -323,3 +323,24 @@ executable(
deps : [my_dep]
)
```
## Exclude a file from unity builds
If your project supports unity builds, you should fix any bugs that crop up when
source files are concatenated together.
Sometimes this isn't possible, though, for example if the source files are
generated.
In this case, you can put them in a separate static library build target and
override the unity setting.
```meson
generated_files = ...
unityproof_lib = static_library('unityproof', generated_files,
override_options : ['unity=off'])
main_exe = executable('main', main_sources, link_with : unityproof_lib)
```
To link the static library into another library target, you may need to use
`link_whole` instead of `link_with`.

@ -0,0 +1,14 @@
## Cargo features are resolved globally
When configuring a Cargo dependency, Meson will now resolve its complete
dependency tree and feature set before generating the subproject AST.
This solves many cases of Cargo subprojects being configured with missing
features that the main project had to enable by hand using e.g.
`default_options: ['foo-rs:feature-default=true']`.
Note that there could still be issues in the case there are multiple Cargo
entry points. That happens if the main Meson project makes multiple `dependency()`
calls for different Cargo crates that have common dependencies.
Breaks: This change removes per feature Meson options that were previously
possible to set as shown above or from command line `-Dfoo-rs:feature-foo=true`.

@ -1,5 +0,0 @@
## Treat warnings as error in compiler checks
Compiler check methods `compiler.compiles()`, `compiler.links()` and `compiler.run()`
now have a new `werror: true` keyword argument to treat compiler warnings as error.
This can be used to check if code compiles without warnings.

@ -1,8 +0,0 @@
## Deprecate 'jar' as a build_target type
The point of `build_target()` is that what is produced can be conditionally
changed. However, `jar()` has a significant number of non-overlapping arguments
from other build_targets, including the kinds of sources it can include. Because
of this crafting a `build_target` that can be used as a Jar and as something
else is incredibly hard to do. As such, it has been deprecated, and using
`jar()` directly is recommended.

@ -0,0 +1,7 @@
## Devenv support in external project module
The [external project module](External-Project-module.md) now setups `PATH` and
`LD_LIBRARY_PATH` to be able to run programs.
`@BINDIR@` is now substitued in arguments and `'--bindir=@PREFIX@/@BINDIR@'`
default argument have been added.

@ -1,4 +0,0 @@
## find_program() now supports the 'default_options' argument
In a similar fashion as dependency(), find_program() now also allows you to set default
options for the subproject that gets built in case of a fallback.

@ -0,0 +1,8 @@
## Fixed `sizeof` and `find_library` methods for Fortran compilers
The implementation of the `.sizeof()` method has been fixed for Fortran
compilers (it was previously broken since it would try to compile a C code
snippet). Note that this functionality requires Fortran 2008 support.
Incidentally this also fixes the `.find_library()` method for Fortran compilers
when the `prefer_static` built-in option is set to true.

@ -1,17 +0,0 @@
## `fs.relative_to()`
The `fs` module now has a `relative_to` method. The method will return the
relative path from argument one to argument two, if one exists. Otherwise, the
absolute path to argument one is returned.
```meson
assert(fs.relative_to('c:\\prefix\\lib', 'c:\\prefix\\bin') == '..\\lib')
assert(fs.relative_to('c:\\proj1\\foo', 'd:\\proj1\\bar') == 'c:\\proj1\\foo')
assert(fs.relative_to('prefix\\lib\\foo', 'prefix') == 'lib\\foo')
assert(fs.relative_to('/prefix/lib', '/prefix/bin') == '../lib')
assert(fs.relative_to('prefix/lib/foo', 'prefix') == 'lib/foo')
```
In addition to strings, it can handle files, custom targets, custom target
indices, and build targets.

@ -1,5 +0,0 @@
## Support targeting Python's limited C API
The Python module's `extension_module` function has gained the ability
to build extensions which target Python's limited C API via a new keyword
argument: `limited_api`.

@ -1,19 +0,0 @@
## All compiler `has_*` methods support the `required` keyword
Now instead of
```meson
assert(cc.has_function('some_function'))
assert(cc.has_type('some_type'))
assert(cc.has_member('struct some_type', 'x'))
assert(cc.has_members('struct some_type', ['x', 'y']))
```
we can use
```meson
cc.has_function('some_function', required: true)
cc.has_type('some_type', required: true)
cc.has_member('struct some_type', 'x', required: true)
cc.has_members('struct some_type', ['x', 'y'], required: true)
```

@ -1,10 +0,0 @@
## Unified message(), str.format() and f-string formatting
They now all support the same set of values: strings, integers, bools, options,
dictionaries and lists thereof.
- Feature options (i.e. enabled, disabled, auto) were not previously supported
by any of those functions.
- Lists and dictionaries were not previously supported by f-string.
- str.format() allowed any type and often resulted in printing the internal
representation which is now deprecated.

@ -0,0 +1,4 @@
## Install vcs_tag() output
[[vcs_tag]] now has `install`, `install_dir`, `install_tag` and `install_mode`
keyword arguments to install the generated file.

@ -1,16 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2021 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from abc import ABCMeta, abstractmethod
import typing as T

@ -1,5 +1,6 @@
# SPDX-License-Identifer: Apache-2.0
# SPDX-License-Identifier: Apache-2.0
# Copyright 2021 The Meson development team
from __future__ import annotations
from pathlib import Path
import json

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save