Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bruchar1 committed Jan 3, 2024
2 parents 494befd + e4bbc63 commit 8f92417
Show file tree
Hide file tree
Showing 44 changed files with 226 additions and 425 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
name: ${{ matrix.NAME }}
env:
MESON_CI_JOBNAME: ${{ matrix.NAME }}
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_AUTO_UPDATE: 1

steps:
- uses: actions/checkout@v3
Expand All @@ -101,7 +101,6 @@ jobs:
CPPFLAGS: "-I/usr/local/include"
LDFLAGS: "-L/usr/local/lib"
MESON_ARGS: --unity=${{ matrix.unity }}
HOMEBREW_NO_AUTO_UPDATE: 1
CI: 1
# These cannot evaluate anything, so we cannot set PATH or SDKROOT here
run: |
Expand All @@ -124,13 +123,13 @@ jobs:

Qt4macos:
runs-on: macos-latest
env:
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- env:
HOMEBREW_NO_AUTO_UPDATE: 1
- run: python -m pip install -e .
- run: brew install pkg-config ninja gcc
- run: brew tap cartr/qt4
Expand Down
2 changes: 1 addition & 1 deletion docs/markdown/Dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,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.
Expand Down
9 changes: 5 additions & 4 deletions docs/markdown/IDE-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +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
18 changes: 12 additions & 6 deletions docs/markdown/Qt6-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand All @@ -19,7 +25,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<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

Expand All @@ -32,7 +38,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<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]]

## compile_moc

Expand All @@ -49,7 +55,7 @@ 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
Expand Down Expand Up @@ -134,11 +140,11 @@ 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]]

## 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
Expand Down
3 changes: 2 additions & 1 deletion docs/markdown/Reference-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,11 @@ 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 |

*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),
Expand Down
12 changes: 7 additions & 5 deletions docs/markdown/_include_qt_base.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,7 +26,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-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.

## compile_moc
Expand All @@ -44,7 +44,7 @@ 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()`
Expand Down Expand Up @@ -81,7 +81,9 @@ This method takes the following keyword arguments:

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:
Expand Down Expand Up @@ -128,7 +130,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
Expand Down
5 changes: 0 additions & 5 deletions mesonbuild/backend/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,11 +1001,6 @@ def generate_basic_compiler_args(self, target: build.BuildTarget, compiler: 'Com
# command-line or default_options inside project().
commands += compiler.get_option_compile_args(copt_proxy)

# Add buildtype args: optimization level, debugging, etc.
buildtype = target.get_option(OptionKey('buildtype'))
assert isinstance(buildtype, str), 'for mypy'
commands += compiler.get_buildtype_args(buildtype)

optimization = target.get_option(OptionKey('optimization'))
assert isinstance(optimization, str), 'for mypy'
commands += compiler.get_optimization_args(optimization)
Expand Down
35 changes: 29 additions & 6 deletions mesonbuild/backend/ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1444,15 +1444,13 @@ def generate_cs_resource_tasks(self, target):
return args, deps

def generate_cs_target(self, target: build.BuildTarget):
buildtype = target.get_option(OptionKey('buildtype'))
fname = target.get_filename()
outname_rel = os.path.join(self.get_target_dir(target), fname)
src_list = target.get_sources()
compiler = target.compilers['cs']
rel_srcs = [os.path.normpath(s.rel_to_builddir(self.build_to_src)) for s in src_list]
deps = []
commands = compiler.compiler_args(target.extra_args['cs'])
commands += compiler.get_buildtype_args(buildtype)
commands += compiler.get_optimization_args(target.get_option(OptionKey('optimization')))
commands += compiler.get_debug_args(target.get_option(OptionKey('debug')))
if isinstance(target, build.Executable):
Expand Down Expand Up @@ -1495,7 +1493,6 @@ def generate_cs_target(self, target: build.BuildTarget):

def determine_single_java_compile_args(self, target, compiler):
args = []
args += compiler.get_buildtype_args(target.get_option(OptionKey('buildtype')))
args += self.build.get_global_args(compiler, target.for_machine)
args += self.build.get_project_args(compiler, target.subproject, target.for_machine)
args += target.get_java_args()
Expand Down Expand Up @@ -1726,7 +1723,6 @@ def generate_cython_transpile(self, target: build.BuildTarget) -> \

args: T.List[str] = []
args += cython.get_always_args()
args += cython.get_buildtype_args(target.get_option(OptionKey('buildtype')))
args += cython.get_debug_args(target.get_option(OptionKey('debug')))
args += cython.get_optimization_args(target.get_option(OptionKey('optimization')))
args += cython.get_option_compile_args(target.get_options())
Expand Down Expand Up @@ -2176,6 +2172,7 @@ def generate_swift_target(self, target):
srctreedir = os.path.normpath(os.path.join(self.environment.get_build_dir(), self.build_to_src, expdir))
sargs = swiftc.get_include_args(srctreedir, False)
compile_args += sargs
compile_args += target.get_extra_args('swift')
link_args = swiftc.get_output_args(os.path.join(self.environment.get_build_dir(), self.get_target_filename(target)))
link_args += self.build.get_project_link_args(swiftc, target.subproject, target.for_machine)
link_args += self.build.get_global_link_args(swiftc, target.for_machine)
Expand Down Expand Up @@ -2451,7 +2448,11 @@ def generate_compile_rule_for(self, langname, compiler):
# See also: https://github.com/ninja-build/ninja/pull/2275
options['extra'] = 'restat = 1'
rule = self.compiler_to_rule_name(compiler)
depargs = NinjaCommandArg.list(compiler.get_dependency_gen_args('$out', '$DEPFILE'), Quoting.none)
if langname == 'cuda':
# for cuda, we manually escape target name ($out) as $CUDA_ESCAPED_TARGET because nvcc doesn't support `-MQ` flag
depargs = NinjaCommandArg.list(compiler.get_dependency_gen_args('$CUDA_ESCAPED_TARGET', '$DEPFILE'), Quoting.none)
else:
depargs = NinjaCommandArg.list(compiler.get_dependency_gen_args('$out', '$DEPFILE'), Quoting.none)
command = compiler.get_exelist()
args = ['$ARGS'] + depargs + NinjaCommandArg.list(compiler.get_output_args('$out'), Quoting.none) + compiler.get_compile_only_args() + ['$in']
description = f'Compiling {compiler.get_display_language()} object $out'
Expand Down Expand Up @@ -3006,6 +3007,28 @@ def generate_single_compile(self, target: build.BuildTarget, src,
element.add_orderdep(i)
if dep_file:
element.add_item('DEPFILE', dep_file)
if compiler.get_language() == 'cuda':
# for cuda, we manually escape target name ($out) as $CUDA_ESCAPED_TARGET because nvcc doesn't support `-MQ` flag
def quote_make_target(targetName: str) -> str:
# this escape implementation is taken from llvm
result = ''
for (i, c) in enumerate(targetName):
if c in {' ', '\t'}:
# Escape the preceding backslashes
for j in range(i - 1, -1, -1):
if targetName[j] == '\\':
result += '\\'
else:
break
# Escape the space/tab
result += '\\'
elif c == '$':
result += '$'
elif c == '#':
result += '\\'
result += c
return result
element.add_item('CUDA_ESCAPED_TARGET', quote_make_target(rel_obj))
element.add_item('ARGS', commands)

self.add_dependency_scanner_entries_to_element(target, compiler, element, src)
Expand Down Expand Up @@ -3358,7 +3381,7 @@ def generate_link(self, target: build.BuildTarget, outname, obj_list, linker: T.
# Add things like /NOLOGO; usually can't be overridden
commands += linker.get_linker_always_args()
# Add buildtype linker args: optimization level, etc.
commands += linker.get_buildtype_linker_args(target.get_option(OptionKey('buildtype')))
commands += linker.get_optimization_link_args(target.get_option(OptionKey('optimization')))
# Add /DEBUG and the pdb filename when using MSVC
if target.get_option(OptionKey('debug')):
commands += self.get_link_debugfile_args(linker, target)
Expand Down
Loading

0 comments on commit 8f92417

Please sign in to comment.