summaryrefslogtreecommitdiff
path: root/mesonbuild/modules/windows.py
AgeCommit message (Collapse)Author
2025-11-30Revert "Detect dependency changes in Windows rc compiler"Jussi Pakkanen
This reverts commit 632115ecff3bd7f9cb519098e04e0467b0cfd3a1.
2025-11-18modules/windows: Also search for llvm-rc and llvm-windresLuca Bacci
Fixes #15011
2025-10-14Detect dependency changes in Windows rc compilerCharles Brunet
The `rc.exe` resource compiler neither provides *depfile* support nor allows showing includes, as is possible with C or C++ compilers. Therefore, changes to files included by the `.rc` file did not trigger recompilation of the resource file. A workaround was added to *meson* by calling the preprocessor on the `.rc` file to detect the included headers and adding the result as a dependency to the resource compilation.
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-08-18Add more descriptive description to CustomTargetCharles Brunet
Allow modules using CustomTarget to modify the command description used by ninja backend. This result in more precise logs when building a project.
2023-07-10windows: Fix detection of the llvm-rc resource compilerMartin Storsjö
By default, clang-cl based environments use rc.exe as resource compiler. However, when cross compiling with clang-cl, one might want to use llvm-rc instead. Try to detect llvm-rc based on the output from "$CMD /?". This requires a very recent llvm-rc; previosly, the output of "/?" with llvm-rc was very generic and didn't explicitly indicate that it actually was llvm-rc. This was changed in https://github.com/llvm/llvm-project/commit/bab6902eba55026a829d232629f99ac276936ef0 which will be included in the upcoming LLVM 17.0.0 release. Contrary to the other regexes, don't include the preceding parts of the line in the log printout, as it includes an unhelpful "OVERVIEW:" prefix.
2023-06-15windows: Fix windres detection for Microsoft shipped ClangL. E. Segovia
Clang, clang-cl, and MSVC all rely on RC.EXE to build resource files. Fixes #11845
2023-04-11fix various spelling issuesJosh Soref
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-02-01treewide: add future annotations importEli Schwartz
2022-08-31Fix 2 typos in a single string which can be shown in error messages.Jehan
2022-08-17modules: use module level information about new and deprecationDylan Baker
Instead of using FeatureNew/FeatureDeprecated in the module. The goal here is to be able to handle information about modules in a single place, instead of having to handle it separately. Each module simply defines some metadata, and then the interpreter handles the rest.
2022-06-17fix confusing incorrect default name for a KwargInfoEli Schwartz
We can use this lots of places, and it's always the same kwarg. There doesn't seem to be a point in naming it badly, then evolving it to the standard name in the one place it is currently used. This made it not shareable.
2022-03-29Pass environment down to base Target classXavier Claessens
2022-01-28build: replace kwargs in CustomTarget initializerDylan Baker
Because we don't want to pass the Interpreter kwargs into the build layer. This turned out to be a mega commit, as there's really on elegant way to make this change in an incremental way. On the nice side, mypy made this change super easy, as nearly all of the calls to `CustomTarget` are fully type checked! It also turns out that we're not handling install_tags in custom_target correctly, since we're not converting the boolean values into Optional values!
2021-12-17Fix mypy errorsDaniel Mensinger
2021-11-20add location nodes to some Feature callsEli Schwartz
2021-10-09modules/windows: allow CustomTargets with more than one output for ↵Dylan Baker
compile_resources
2021-10-09modules/windows: allow CustomTargetIndex for compile_resourcesDylan Baker
In the positional arguments
2021-10-09modules/windows: use typed_kwargsDylan Baker
2021-10-08modules/windows: use typed_pos_argsDylan Baker
2021-10-08modules/windows: add some easy type annotationsDylan Baker
This isn't complete, it's just the easy stuff
2021-10-07Windows module: Make path flattening for windres work in more casesLuca Bacci
If either 'name' or 'name_formatted' are absolute paths, then they are of the form: C:\path/to/file.ext (example) By only substituting slashes with the underscore, we get: C:_path_to_file.ext This is still not quite right, infact os.path.basename() returns: _path_to_file.ext Also replace colons with underscores to overcome issues when absolute paths are involved.
2021-07-07windows: Support wrc resource compilerConnor Abbott
It has a similar interface to windres, but it produces ELF instead of COFF binaries. It uses its own preprocessor which doesn't support creating depfiles, but we can convince it to use the system preprocessor instead and pass those arguments using the --preprocessor option. Together with some hacks to override the shared library/executable suffix and some wine patches [1] this is enough to compile dxvk when ripping out the hand-rolled rc support. [1] https://www.winehq.org/pipermail/wine-devel/2021-July/190100.html https://www.winehq.org/pipermail/wine-devel/2021-July/190098.html https://www.winehq.org/pipermail/wine-devel/2021-July/190099.html https://www.winehq.org/pipermail/wine-devel/2021-July/190101.html
2021-06-18holders: remove unholderDaniel Mensinger
2021-05-28modules: Add methods dict everywhereXavier Claessens
This fix calling random internal methods from meson.build as long as they were not prefixed by underscore.
2021-05-12gnome: Fix gtkdoc generationXavier Claessens
install_scripts used to replace @BUILD_ROOT@ and @SOURCE_ROOT@ but it was not documented and got removed in Meson 0.58.0. gnome.gtkdoc() was relying on that behaviour, but it has always been broken in the case the source or build directory contains spaces. Fix this by changing get_include_args() to substitue paths directly which will then get escaped correctly. Add a unit test that builds GObject documentation which is where this issue has been spotted. Fixes: #8744
2021-03-19split program related classes and functions out of dependenciesDylan Baker
Dependencies is already a large and complicated package without adding programs to the list. This also allows us to untangle a bit of spaghetti that we have.
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz
performed by running "pyupgrade --py36-plus" and committing the results
2020-10-15windows: Avoid target name clash happening in GTK+Xavier Claessens
2020-09-28windows: reduce chance of going over path limit in backend/vsPeter Harris
When building with vs2019 (not ninja), a path length error will be thrown if the path to a resource file is even remotely deep within the tree. This is largely because the target name includes the string "Windows resource for file 'full path'", which is then expanded twice (once for the .vcxproj itself, and once for IntDir) and added to the full path. When combined with the tiny path limits on Windows, it is easy to exceed path limits. This error is largely avoided by the ninja back-end. Unlike the vs back-end, the ninja back-end does not use target.get_id() as part of the project file path, nor does it use target.get_id() as part of get_target_private_dir(). Example error: error MSB4184: The expression "[MSBuild]::NormalizePath( C:\src\mesonbuild\Misc\FreeRDP-master\client\X11\xfreerdp\xfreerdp, f3f7317@@Windows resource for file 'Misc_FreeRDP-master_client_X11_xfreerdp_xfreerdp_xfreerdp.rc'@cus\, f3f7317@@Windows resource for file 'Misc_FreeRDP-master_client_X11_xfreerdp_xfreerdp_xfreerdp.rc'@cus. vcxproj.CopyComplete)" cannot be evaluated. Path: C:\src\mesonbuild\Misc\FreeRDP-master\client\X11\xfreerdp\xfreerdp\f3f7317 @@Windows resource for file 'Misc_FreeRDP-master_client_X11_xfreerdp_xfreerdp_xfreerdp.rc'@cus\f3f7317 @@Windows resource for file 'Misc_FreeRDP-master_client_X11_xfreerdp_xfreerdp_xfreerdp.rc'@cus. vcxproj.CopyComplete exceeds the OS max path limit. The fully qualified file name must be less than 260 characters.
2020-09-17Revert "windows: reduce chance of going over path limit in backend/vs"Nirbheek Chauhan
This reverts commit 807f88739ebfa002c9a0b9acd3e24c9610fb02a2.
2020-09-17windows: reduce chance of going over path limit in backend/vsPeter Harris
When building with vs2019 (not ninja), a path length error will be thrown if the path to a resource file is even remotely deep within the tree. This is largely because the target name includes the string "Windows resource for file 'full path'", which is then expanded twice (once for the .vcxproj itself, and once for IntDir) and added to the full path. When combined with the tiny path limits on Windows, it is easy to exceed path limits. This error is largely avoided by the ninja back-end. Unlike the vs back-end, the ninja back-end does not use target.get_id() as part of the project file path, nor does it use target.get_id() as part of get_target_private_dir(). Example error: error MSB4184: The expression "[MSBuild]::NormalizePath( C:\src\mesonbuild\Misc\FreeRDP-master\client\X11\xfreerdp\xfreerdp, f3f7317@@Windows resource for file 'Misc_FreeRDP-master_client_X11_xfreerdp_xfreerdp_xfreerdp.rc'@cus\, f3f7317@@Windows resource for file 'Misc_FreeRDP-master_client_X11_xfreerdp_xfreerdp_xfreerdp.rc'@cus. vcxproj.CopyComplete)" cannot be evaluated. Path: C:\src\mesonbuild\Misc\FreeRDP-master\client\X11\xfreerdp\xfreerdp\f3f7317 @@Windows resource for file 'Misc_FreeRDP-master_client_X11_xfreerdp_xfreerdp_xfreerdp.rc'@cus\f3f7317 @@Windows resource for file 'Misc_FreeRDP-master_client_X11_xfreerdp_xfreerdp_xfreerdp.rc'@cus. vcxproj.CopyComplete exceeds the OS max path limit. The fully qualified file name must be less than 260 characters.
2020-07-05Don't make unactionable warnings fatalNirbheek Chauhan
Some warnings are out of the user's control, such as the RCC QT bug, or the GNU windres bug, or our informational warning about auto-disabling of options when -Db_bitcode is enabled. Such warnings should not be fatal when --fatal-meson-warnings is passed because there's no action that the user can take to fix it. The only purpose it serves is to prevent people who use those features from using --fatal-meson-warnings.
2020-03-23Fix legacy env var support with crossJohn Ericson
Fix #3969
2020-03-05Make use of unholderDylan Baker
We have a lot of cases of code like: ```python if hasattr(var, 'held_object'): var = var.held_object` ``` replace that with the unholder function.
2019-07-05Fix windres module argument flatteningePirat
2019-06-09Purge `is_cross` and friends without changing user interfacesJohn Ericson
In most cases instead pass `for_machine`, the name of the relevant machines (what compilers target, what targets run on, etc). This allows us to use the cross code path in the native case, deduplicating the code. As one can see, environment got bigger as more information is kept structured there, while ninjabackend got a smaller. Overall a few amount of lines were added, but the hope is what's added is a lot simpler than what's removed.
2019-05-20Remove compilers from ModuleState objectJon Turney
It doesn't make much sense to have this and not also have cross-compilers (so any use of this is already pretty suspect as probably wrong when cross-compiling). This information is accessible anyhow via environment.coredata.
2019-05-13modules/windows: ICL uses rc, not windresDylan Baker
2019-04-29Fix builtin variable namesDaniel Mensinger
2019-01-02Remove cross_info; cross file is parsed up front and discardedJohn Ericson
2018-11-14modules/python3: allow specifying in the native fileDylan Baker
2018-11-14modules/windows: Allow getting windres from native fileDylan Baker
2018-11-14replace ExternalProgram.from_cross_info with from_bin_listDylan Baker
This more generic method will also be used to check a config file for binary information.
2018-11-04Use 'rc' resource compiler with clang-cl toolchainJon Turney
The LLVM toolchain doesn't come with a Windows resource compiler at the moment. Use 'rc' from the Windows SDK.
2018-10-02Probe Windows resource compiler typeJon Turney
Determine the type of the Windows resource compiler by looking at its output, not its name. Also log the name and version of the resource compiler we are using.
2018-10-01Factor out windows resource compiler determinationJon Turney
Factor out determination of the windows resource compiler as _find_resource_compiler(). Cache the result, so the work is only done once.
2018-09-10Improve windows resource compiler executable selectionJon Turney
Always honour any windres setting in cross-file (we can't be compiling with msvc, but this should apply when cross-compiling using gcc or clang) Always honour WINDRES environment variable Otherwise look for the resource compiler which is part of the same toolset as the C or C++ compiler. Add some commentary on why the conventions for compiled resource file extensions differ between RC and windres Also don't try to report non-existent path when we couldn't find the resource compiler.
2018-08-27Remove some spurious calls to the format() functionJon Turney
Remove some spurious calls to the format() function, left by mistake after c2f37853
2018-08-16Use unique output for windows.compile_resources()Jon Turney
Use a unique output filename for windows.compile_resources() even when input basename is not unique.