aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/cmake.py
AgeCommit message (Collapse)AuthorFilesLines
2022-11-29pylint: enable the bad_builtin checkerDylan Baker1-1/+1
This finds uses of deny-listed functions, which defaults to map and filter. These functions should be replaced by comprehensions in idiomatic python because: 1. comprehensions are more heavily optimized and are often faster 2. They avoid the need for lambdas in some cases, which make them faster 3. you can do the equivalent in one statement rather than two, which is faster 4. They're easier to read 5. if you need a concrete instance (ie, a list) then you don't have to convert the iterator to a list afterwards
2022-10-04pylint: enable use-a-generatorDylan Baker1-1/+1
This catches some optimization problems, mostly in the use of `all()` and `any()`. Basically writing `any([x == 5 for x in f])` vs `any(x == 5 for x in f)` reduces the performance because the entire concrete list must first be created, then iterated over, while in the second f is iterated and checked element by element.
2022-09-12dependencies: simplify log_tried into a staticmethodEli Schwartz1-2/+3
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-08-26Remove redundant backslash and fix white space issueAlf Henrik Sauge1-4/+5
2022-08-26Fix purely white space issues reported by flake8Alf Henrik Sauge1-2/+2
2022-06-10treewide: various cleanups to move imports for mypy into typechecking blocksEli Schwartz1-1/+3
Along the way, add __future__ annotations where lacking.
2022-04-13dependencies: tighten type checking and fix cmake API violation for get_variableEli Schwartz1-5/+11
dep.get_variable() only supports string values for pkg-config and config-tool, because those interfaces use text communication, and internal variables (from declare_dependency) operate the same way. CMake had an oddity, where get_variable doesn't document that it allows list values but apparently it miiiiiight work? Actually getting that kind of result would be dangerously inconsistent though. Also, CMake does not support lists so it's a lie. Strings that are *treated* as lists with `;` splitting don't count... We could do two things here: - raise an error - treat it as a string and return a string It's not clear what the use case of get_variable() on a maybe-list is, and should probably be a hard error. But that's controversial, so instead we just return the original `;`-delimited string. It is probably the wrong thing, but users are welcome to cope with that somehow on their own.
2022-04-12cmake: Always use all compilers for LLVM (fixes #10249)Daniel Mensinger1-2/+2
2022-03-07Merge pull request #9743 from mensinda/cmakeGeneratorFixedJussi Pakkanen1-2/+2
cmake: Add TARGET_ generator expression support (fixes #9305)
2022-02-16flake8: fix wrong numbers of blank line separatorsEli Schwartz1-1/+0
2022-02-16flake8: fix typoed whitespace surrounding tokensEli Schwartz1-1/+1
2022-01-27fix some flake8 violations for unused importsEli Schwartz1-1/+1
And one undefined T.cast name in a file that isn't yet mypy-ready anyway.
2022-01-23cmake: Add TARGET_ generator expression support (fixes #9305)Daniel Mensinger1-2/+2
2022-01-10port from embedded data to importlib.resourcesEli Schwartz1-2/+2
2021-12-01cmake: Fix old style dependency lookup with imported targetsDaniel Mensinger1-91/+17
This also includes some refactoring, since the alternaticve would have been to duplicate the huge traceparser target code block again. fixes #9581
2021-11-20cmake: Use find_library() on bare library names in cmake dependenciesJon Turney1-6/+4
Convert bare library names to a dependency linker argument using find_library(), rather than hardcoding the MSVC transformation.
2021-10-24cmake: Add support for the Linux CMake registry (fixes #9418)Daniel Mensinger1-0/+6
2021-10-06cmake: Implement support for interpreting link "keywords"Daniel Mensinger1-10/+32
CMakes `target_link_libraries()` supports certain keywords to only enable specific libraries for specific CMake configurations. We now try our best to replicate this for Meson dependencies. Fixes #9197
2021-10-06cmake: Warn if we could use IMPORTED CMake targetsDaniel Mensinger1-1/+32
2021-07-13dependencies: drop Dependency.methods and Dependency.get_methods()Dylan Baker1-5/+1
Both of these are artifacts of the time before Dependency Factories, when a dependency that could be discovered multiple ways did ugly stuff like finding a specific dependency, then replacing it's own attributes with that dependency's attributes. We don't have cases of that left in the tree, so let's get rid of this code too
2021-06-29fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger1-1/+1
2021-06-14dependencies: Use a typing.NewType for Dependency.type_nameDylan Baker1-2/+2
This allow mypy to catch cases where we accidently assign the dependency name to the type_name, as it sees them as having different types (though at runtime they're all strings).
2021-06-06typing: Fully annotate dependencies.cmakeDaniel Mensinger1-59/+69
2021-06-03deps: Split dependencies.baseDaniel Mensinger1-0/+655
Split the Factory and dependency classes out of the base.py script to improve maintainability.