summaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/misc.py
AgeCommit message (Collapse)Author
2025-12-17Dependencies: Make use of the DependencyCandidate classDylan Baker
This makes the type checking more reasonable (including fixing an issue that newer mypy is pointing out to us), consolidating special cases, and improving code readability.
2025-12-17dependencies: Require 'native' be passed in kwargsDylan Baker
This simplifies a bunch of cases, and likely fixes some annoying bugs in cross compile situations where should have been passing this and weren't.
2025-12-17dependencies: stop passing "language" as a keyword argumentDylan Baker
It's allowed in the `DependencyKeywordArguments` TypeDict already, so we now have two sources of truth. Additionally, it's often populated by reading from that dict, so we're just doing useless work.
2025-12-17dependencies: Pass the `name` to `ExternalDependency` constructorDylan Baker
So we don't create a default name that is overwritten except in the case of appleframeworks. This allows for some cleanup, including deleting some initializers that were only setting the name.
2025-11-19compilers: Remove Environment parameter from Compiler.get_defineDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.has_headerDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.has_header_symbolDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.has_functionDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.find_libraryDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.thread_flagsDylan Baker
Same logic as the openmp flags
2025-11-19compilers: Remove Environment parameter from Compiler.openmp_flagsDylan Baker
I've done the compile and link flags in one commit since they're so closely related
2025-11-19compilers: Remove Environment parameter from Compiler.get_return_valueDylan Baker
2025-11-19Compilers: remove Environment parameter from Compiler.links()Dylan Baker
2025-10-31Fix: Add OpenMP 6.0 macro definition to implementation tablejaideepkathiresan
2025-10-20interpreter: port dependency version to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency static to typed_kwargsDylan Baker
Static must be optional, because although the default is static=false, we special case that static : false is different than static being not set in a number of cases.
2025-10-20interpreter: port dependency modules to typed_kwargsDylan Baker
2025-10-20interpreter: port dependency method to typed_kwargsDylan Baker
This allows us a bunch of nice things: 1. We can use the DependencyMethods enum everywhere 2. The deprecated methods can be checked in the Interpreter, so we can now emit deprecation warnings for stuff that was deperecated in 0.44! 3. We can share this more strongly typed method everywhere
2025-10-20interpreter: port dependency language to typed_kwargsDylan Baker
2025-10-20dependency: Use a TypedDict to describe the keyword arguments to DependencyDylan Baker
This allows us to check that all of the keyword arguments are of the correct type.
2025-07-02Revert "test 64-bit types for atomic"Eli Schwartz
This reverts commit 60d0410c0ae22fd8f37a798736973a53128b2966. The rationale for making this change was bogus and misunderstands the purpose of the dependency. > The check is currently broken as atomic_flag_clear is a macro, not a > function. Change it to test linkage instead. ... does not make any sense since the standard requires it to be a function. We already test linkage. > Also test if atomics work with 64-bit types. On certain platforms like > MIPS, external libatomic is needed. ... misses the fact that we already check for external libatomic ***first***, for precisely this reason. That was in the original design of this dependency. Checking for more interesting forms of atomic usage is quite pointless. You can't write code that "requires" -latomic, as the toolchain may arbitrarily implement *anything* internally or else as a helper library, and we can't force it to do the latter. Instead, we: - check if the ISO header exists, and -latomic is a valid library. If so, assume it's needed. Maybe it is, maybe it isn't, -latomic can always be pruned by `-Wl,--as-needed` so we refuse to clutch pearls over it - if -latomic doesn't exist, smoketest that the toolchain has "some kind of atomic support". That is, the ISO header exists and one randomly chosen function successfully links. This is not intended to be comprehensive, it is a fallback. Notice that unlike most dependencies with a "builtin" method, we do NOT prefer the builtin! This is, again, because the ***primary purpose*** of `dependency('atomic')` is to handle the fact that you should always use -latomic if it exists. Okay, so why revert the change? Maybe it doesn't matter? Well... that's a problem, since it was never actually tested. The code fails with: ``` $ gcc -latomic -o /tmp/foo /tmp/foo.c In file included from /tmp/foo.c:1: /tmp/foo.c: In function ‘main’: /tmp/foo.c:5:30: error: ‘b’ undeclared (first use in this function) 5 | return atomic_fetch_add(&b, 1); | ^ /tmp/foo.c:5:30: note: each undeclared identifier is reported only once for each function it appears in ``` As it was never tested, we shall not assume it fixes a real world problem. But it sure does break the fallback.
2025-07-02test 64-bit types for atomicRosen Penev
The check is currently broken as atomic_flag_clear is a macro, not a function. Change it to test linkage instead. Also test if atomics work with 64-bit types. On certain platforms like MIPS, external libatomic is needed. Signed-off-by: Rosen Penev <rosenp@gmail.com>
2025-03-10coredata: replace get_option with optstore.get_value_forDylan Baker
This is an old method, that is now just a wrapper around the OptionStore method, that doesn't add any value. It's also an option related method attached to the CoreData instead of the OptionStore, so useless and a layering violation.
2025-01-28dependencies: version_compare -> version_compare_manyDylan Baker
It's possible to get an array of versions here, so we need to handle that.
2025-01-28dependencies: correctly handle a language of NoneDylan Baker
For whatever reason Meson has always used None == <C Language>. This doesn't make a lot of sense to me, but it's how things currently work, and our dependency factories should handle that correctly.
2024-12-29dependencies: add custom atomic dependencyDudemanguy
Almost exactly the same as how the dl dependency works. On certain systems (like BSDs that use clang), stdatomic is provided by compiler-rt and doesn't need a separate library explictly linked. On a typical GNU/LINUX system, atomic is a separate library that must be explictly found and linked against. So just add a builtin and system method for these two use cases.
2024-10-04curses: Ignore /usr/bin/ncurses5.4-config on macOSNirbheek Chauhan
macOS mistakenly ships /usr/bin/ncurses5.4-config and a man page for it, but none of the headers or libraries are available in the location advertised by it. Ignore /usr/bin because it can only contain this broken configtool script. Homebrew is /usr/local or /opt/homebrew. Xcode's command-line tools SDK does include curses, but the configtool in there is wrong too, and anyway we can't just randomly pick it up since the user must explicitly select that as a target by using a native file. The MacOSX SDK itself does not include curses. We also can't ignore ncurses5.4-config entirely because it might be available in a different prefix.
2024-07-11Move OptionKey in the option source file.Jussi Pakkanen
2024-06-26dependencies/openmp: Simplify error caseDylan Baker
Instead of making the variable optional, just return if we hit the error case, since that's all that's going to happen anyway
2024-06-26compilers|dependencies: Move Clang-CL specific logic out of OpenMP depDylan Baker
And into the Clang-CL mixin.
2024-06-26dependencies/openmp: use mlog.warning instead of open codingDylan Baker
It was probably done this way originally since we didn't have the `fatal` keyword argument to avoid triggering the fatal-meson-warnings. While we're here, replace the use of a `if bool` with an `else` on the for loop.
2024-06-26dependencies/openmp: Set compile and link flags before testingDylan Baker
In case the OpenMP definition adds things like preprocessor directives or include paths, like when building on MacOS with OpenMP from Homebrew.
2024-06-26compilers: pass Environment to openmp_flagsDylan Baker
This will be needed by the Apple compiler
2024-05-19pylint: fix useless-returnEli Schwartz
A bare return at the end of a function doesn't do anything. And in the case of a try/except, it's really just an elaborate "pass" anyway.
2024-04-28Add support for depending on ObjFWJonathan Schleifer
This uses objfw-config to get to the flags, however, there's still several todos that can only be addressed once dependencies can have per-language flags.
2024-01-17fix openmp dependency for clang-clPeter Urban
- see https://github.com/mesonbuild/meson/issues/5298
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-09-23openmp: add 5.1/5.2, fixes openmp with llvm v17Christoph Reiter
llvm v17 defaults to 5.1 and without this meson fails to find openmp: 'ERROR: Dependency "openmp" not found, tried system' Add 5.2 as well while at it.
2023-09-12fix bug with openssl when cmake is missingCharles Brunet
Fixes #12098 DependencyFactory was returning a lambda, but it has no log_tried() function
2023-07-19fix implicit_reexport issues and enforce them going forwardEli Schwartz
This detects cases where module A imports a function from B, and C imports that same function from A instead of B. It's not part of the API contract of A, and causes innocent refactoring to break things.
2023-06-26dependencies: switch the delayed-import mechanism for custom dependenciesEli Schwartz
Simply store the module it is expected to be found in. That module then appends to the packages dict, which guarantees mypy can verify that it's got the right type -- there is no casting needed.
2023-04-11fix various spelling issuesJosh Soref
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-02-22dependencies: refactor python3 into its own fileEli Schwartz
2023-02-01treewide: add future annotations importEli Schwartz
2023-01-18dependencies: fix pcap-config which now errors on --versionEli Schwartz
The latest release of libpcap added argument validation to pcap-config, but still doesn't support --version. The next version of libpcap will support --version. Add support for config-tool dependencies which expect to break on --version, to fallback to an option that does not error out or print version info, for sanity checking.
2022-11-30pylint: enable the set_membership pluginDylan Baker
Which adds the `use-set-for-membership` check. It's generally faster in python to use a set with the `in` keyword, because it's a hash check instead of a linear walk, this is especially true with strings, where it's actually O(n^2), one loop over the container, and an inner loop of the strings (as string comparison works by checking that `a[n] == b[n]`, in a loop). Also, I'm tired of complaining about this in reviews, let the tools do it for me :)
2022-11-29Fix crash when toolchain is missingSmallWood-D
Add a MissingCompiler class returned by compiler detecting methods intead of None - accessing such an object raises a DependencyException Fixes #10586 Co-authored-by: duckflyer <duckflyer@gmail.com>
2022-09-12dependencies: simplify log_tried into a staticmethodEli Schwartz
It doesn't really need class instantiation to just know what type it is, and this way we can get the information early if a dependency fails to init.
2022-09-12dependencies: simplify logging methodsEli Schwartz
A bunch of SystemDependency subclasses overrode log_tried() even though they used the same function anyway. Delete them -- they still print the same thing either way.
2022-05-03add prefer_static built-in optionDudemanguy
By default, meson will try to look for shared libraries first before static ones. In the meson.build itself, one can use the static keyword to control if a static library will be tried first but there's no simple way for an end user performing a build to switch back and forth at will. Let's cover this usecase by adding an option that allows a user to specify if they want dependency lookups to try static or shared libraries first. The writer of the meson.build can manually specify the static keyword where appropriate which will override the value of this option.