aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/cmake
AgeCommit message (Collapse)AuthorFilesLines
2022-07-03move various unused typing-only imports into type-checking blocksEli Schwartz3-5/+12
2022-07-03sort imports for neatnessEli Schwartz1-6/+6
2022-05-24cmake: fix detecting directories as input files (fixes #10244)Daniel Mensinger1-1/+1
2022-04-18Fix generator expression list problems (fixes #10288)Daniel Mensinger1-6/+7
2022-04-03cmake: Better error message when configuring a CMake subproject fails.Daniel Mensinger2-4/+23
2022-03-29Fix CMake deprecation warning generated from interpreterTristan Partin1-1/+1
2022-03-07Merge pull request #9743 from mensinda/cmakeGeneratorFixedJussi Pakkanen4-7/+100
cmake: Add TARGET_ generator expression support (fixes #9305)
2022-02-16flake8: fix wrong numbers of blank line separatorsEli Schwartz1-0/+1
2022-02-03cmake: Deprecate CMake <3.17 supportDaniel Mensinger2-12/+11
2022-02-03cmake: Drop CMake server support and bump min. CMake to >= 3.14Daniel Mensinger3-434/+17
2022-01-23cmake: Add TARGET_ generator expression support (fixes #9305)Daniel Mensinger4-11/+72
2022-01-23cmake: Move generator expression evaluation to the end of the traceparserDaniel Mensinger2-3/+35
2022-01-10port from embedded data to importlib.resourcesEli Schwartz2-2/+2
2021-12-02cmake: Deprecate CMake <3.14 and warn for <3.17 (#9677)Daniel Mensinger1-0/+14
* cmake: Deprecate CMake <3.14 and warn for <3.17 See: - #7832 - #9676 * cmake: Add deprecation release note snippet
2021-12-01cmake: Fix old style dependency lookup with imported targetsDaniel Mensinger4-78/+140
This also includes some refactoring, since the alternaticve would have been to duplicate the huge traceparser target code block again. fixes #9581
2021-11-21Support Visual Studio 2022 backendCrend King1-0/+1
2021-10-10Fix typos discovered by codespellChristian Clauss1-1/+1
2021-10-08cmake: handle arguments in the [binaries] section of the machine filePaolo Bonzini1-6/+17
Sometimes, the machine file can include compiler command line options, in order to pick the correct multilib. For example, Meson uses "$cc --print-search-dirs" to find the library search path, where $cc is the cc from the machine file. Because the outputs of "gcc -m32 --print-search-dirs" and "gcc --print-search-dirs" are different, this only works if you have [binaries] cc = ['gcc', '-m32'] in the machine file. Right now, however, the cmake module assumes that the compiler listed in the machine file is either a compiler, or a "launcher" followed by the compiler. Check if the second argument starts with a slash (for Microsoft-like compilers) or a dash (for everyone else), and if so presume that the CMAKE_*_COMPILER_LAUNCHER need not be defined.
2021-10-04remove double importEli Schwartz1-2/+2
Imported both inside and outside of T.TYPE_CHECKING, the runtime import can be removed by quote-deferring one of the use sites. Update: In between then and now, this got removed from T.TYPE_CHECKING, move it back there rather than preserving the runtime import.
2021-09-24pylint: check for duplicate importsDylan Baker1-1/+0
I ran into one of these from LGTM, and it would be nice if pylint could warn me as part of my local development process instead of waiting for the CI to tell me.
2021-09-14apply flake8 fixes for unused imports and missing importsEli Schwartz1-1/+0
2021-09-14semicolons are not needed in pythonEli Schwartz1-1/+1
2021-08-31pylint: turn on superflous-parensDylan Baker3-12/+12
We have a lot of these. Some of them are harmless, if unidiomatic, such as `if (condition)`, others are potentially dangerous `assert(...)`, as `assert(condtion)` works as expected, but `assert(condition, message)` will result in an assertion that never triggers, as what you're actually asserting is `bool(tuple[2])`, which will always be true.
2021-07-05more f-strings too complex to be caught by pyupgradeEli Schwartz1-2/+2
2021-07-05fix typo in log messageEli Schwartz1-1/+1
2021-07-05cmake: Only use the `cm_` prefix when it is actually required (fixes #8955)Daniel Mensinger1-1/+4
2021-06-29fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger3-8/+8
2021-06-22Add Visual Studio 2012/2013 backends (#8803)fanc9991-1/+3
* backends: Add a Visual Studio 2013 backend This is more-or-less a quick port from the VS2015 backend, except that we update the Visual Studio version strings and toolset versions accordingly. Also correct the generator string for Visual Studio 2015 in mesonbuild/cmake/common.py. * backend: Add VS2012 backend Similar to what we did for Visual Studio 2013, add a Visual Studio 2012 backend. * vs2010backend.py: Implement `link_whole:` if needed We actually need Visual Studio 2015 Update 2 to use `/WHOLEARCHIVE:`, which is what we are currently using for `link_whole:` on Visual Studio. For Visual Studio versions before that, we need to expand from the static targets that were indicated by `link_whole:`, and any of the sub-dependent targets that were pulled in via the dependent target's `link_whole:`. This wil ensure `link_whole:` would actually work in such cases. * vs2010backend.py: Handle objects from generated sources Unforunately, we can't use backends.determine_ext_objs() reliably, as the Visual Studio backends handle this differently. * vs2010backend.py: Fix generating VS2010 projects Visual Studio 2010 (at least the Express Edition) does not set the envvar %VisualStudioVersion% in its command prompt, so fix generating VS2010 projects by taking account into this, so that we can determine the location of vcvarsall.bat correctly. * whole archive test: Disable on vs2012/2013 backends too The Visual Studio 2012/2013 IDE has problems handling the items that would be generated from this test case, so skip this test when using --backend=vs[2012|2013]. This test does work for the Ninja backend when VS2012 or VS2013 is used, though. Consolidate this error message with XCode along with the vs2010 backend. * docs: Add the new vs2012 and vs2013 backends Let people know that we have backends for vs2012 and 2013. Also let people know that generating Visual Studio 2010 projects have been fixed and the pre-vs2015 backends now handle the `link_whole:` project option.
2021-06-22Fix for Issue 8910 (Meson filters CMake asm files)Justin Handville1-2/+2
2021-06-07upgrade percent formatted strings pyupgrade did not catchEli Schwartz1-3/+3
2021-06-02use an immutable list for an lru_cached functionsDylan Baker1-2/+3
When mutable items are stored in an lru cache, changing the returned items changes the cached items as well. Therefore we want to ensure that we're not mutating them. Using the ImmutableListProtocol allows mypy to find mutations and reject them. This doesn't solve the problem of mutable values inside the values, so you could have to do things like: ```python ImmutableListProtocol[ImmutableListProtocol[str]] ``` or equally hacky. It can also be used for input types and acts a bit like C's const: ```python def foo(arg: ImmutableListProtocol[str]) -> T.List[str]: arg[1] = 'foo' # works while running, but mypy errors ```
2021-05-30cmake: select correct generator in toolchain.pyDaniel Mensinger4-16/+29
2021-05-29cmake: exclude generated files from the buildsystem files listDaniel Mensinger1-0/+2
2021-05-29cmake: Fix CMakeToolchain (fixes #8293)Daniel Mensinger2-66/+94
Instead of guessing the internal compiler variables, Meson now runns CMake once to determine what they actually are.
2021-05-29cmake: CMakeTraceParser improvementsDaniel Mensinger2-13/+45
- handle cached CMake variables differently - associate variables with source files - better performance (str to Path and generator expressions)
2021-03-19split program related classes and functions out of dependenciesDylan Baker2-6/+5
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 Schwartz7-64/+64
performed by running "pyupgrade --py36-plus" and committing the results
2021-01-23split mesonlib into a packageDylan Baker1-1/+1
Currently mesonlib does some import tricks to figure out whether it needs to use windows or posix specific functions. This is a little hacky, but works fine. However, the way the typing stubs are implemented for the msvcrt and fnctl modules will cause mypy to fail on the other platform, since the functions are not implemented. To aleviate this (and for slightly cleaner design), I've split mesonlib into a pacakge with three modules. A universal module contains all of the platform agnositc code, a win32 module contains window specific code, a posix module contains the posix specific code, and a platform module contains no-op implementations. Then the package's __init__ file imports all of the universal functions and all of the functions from the approriate platform module, or the no-op versions as fallbacks. This makes mypy happy, and avoids `if`ing all over the code to switch between the platform specific code.
2021-01-13Fix misspellsAntonin Décimo3-4/+4
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2021-01-11move CMAKE_PREFIX_PATH env var handling to environmentDylan Baker1-18/+0
This causes the variable to be read up front and stored, rather than be re-read on each invocation of meson. This does have two slight behavioral changes. First is the obvious one that changing the variable between `meson --reconfigure` invocations has no effect. This is the way PKG_CONFIG_PATH already works. The second change is that CMAKE_PREFIX_PATH the env var is no longer appended to the values set in the machine file or on the command line, and is instead replaced by them. CMAKE_PREFIX_PATH is the only env var in meson that works this way, every other one is replaced not appended, so while this is a behavioral change, I also think its a bug fix.
2021-01-04Merge pull request #8080 from dcbaker/submit/option-key-typeJussi Pakkanen2-7/+7
Use an object for option keys
2021-01-04Use a single coredata dictionary for optionsDylan Baker2-3/+3
This patches takes the options work to it's logical conclusion: A single flat dictionary of OptionKey: UserOptions. This allows us to simplify a large number of cases, as we don't need to check if an option is in this dict or that one (or any of 5 or 6, actually).
2021-01-04use OptionKey for builtin and base optionsDylan Baker2-3/+3
I would have prefered to do these seperatately, but they are combined in some cases, so it was much easier to convert them together. this eliminates the builtins_per_machine dict, as it's duplicated with the OptionKey's machine parameter.
2021-01-04move OptionKey to mesonlibDylan Baker1-2/+1
There's starting to be a lot of things including coredata that coredata needs to itself include. putting it in mesonlib makes more sense
2021-01-04use OptionKey for compiler_optionsDylan Baker1-3/+4
2021-01-04cmake: fix missing languages from CMake (fixes #8132)Daniel Mensinger1-8/+29
2020-12-29cmake: fix -framework dependencies (fixes #8045)Daniel Mensinger1-0/+14
2020-12-16cmake: Revert to using self.for_machine instead of MachineChoice.BUILD ↵Daniel Mensinger1-0/+1
(fixes #8028)
2020-11-20use real pathlib moduleDylan Baker7-7/+7
We added the _pathlib module to work around defeciencies in python 3.5's implementation, since we now rely on 3.6 lets drop this
2020-10-24cmake: set CMP0054 to new in preload.cmakeDaniel Mensinger1-0/+5
https://cmake.org/cmake/help/latest/policy/CMP0054.html