aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/cmake.py
AgeCommit message (Collapse)AuthorFilesLines
2022-03-03interpreter: replace build_def_files with OrderedSetDylan Baker1-2/+1
We do a bunch of backbending to make sure we don't have duplicates, let's just use the right datastructure to begin with.
2022-03-03interpreter: add cm_interpreter to SubprojectHolderDylan Baker1-3/+4
This is used in the cmake module, as an extra attribute we just tack on. Instead, let's actually define and type it.
2022-03-03interpreter: use typed_kwargs for subproject()Dylan Baker1-3/+10
2022-03-03modules/cmake: add type annotations for subproject methodDylan Baker1-12/+31
This will be used to handle the interpreter subproject as well
2022-02-27cmake: configure_package_config_file can now take a dictAndrea Pappacoda1-2/+5
2022-02-27cmake: typed_kwargs for configure_package_config_fileAndrea Pappacoda1-24/+26
2022-02-01cmake: add arch_independent kwargAndrea Pappacoda1-1/+5
CMake's write_basic_package_version_file has supported since version 3.14 an ARCH_INDEPENDENT option that makes it skip its architecture check in the Version file. With this patch Meson now supports it as well, and the change is also compatible with older CMake versions, as they will simply ignore the option. This also slightly changes the contents of the generated Version file when arch_independent is not set: previously, the if() needed to skip the arch check was always filled with an empty string, while CMake puts "FALSE" (or "TRUE") in it. Now, that if() will always be filled with either "False" or "True", better matching CMake's behaviour.
2022-02-01cmake: typed_kwargs for write_basic_package_version_fileAndrea Pappacoda1-18/+24
2022-01-18interpreter: replace ConfigurationDataObject with ConfigurationDataHolderDylan Baker1-4/+4
This is much cleaner, and more in line with the way we handle interpreter objects in modern meson practice
2021-12-31add FeatureNew decorators for various modules that were lacking themEli Schwartz1-0/+1
Going back to 0.38, though some of them are far older. The original implementation of FeatureNew only added backdated feature checks that far, anyway.
2021-12-21modules: use find_program implementation to find programsEli Schwartz1-4/+3
Do not use ExternalProgram as that is too low-level and doesn't handle e.g. machine file overrides. Fixes #9733
2021-11-21Make the generated reproducible .cmake files reproducible.Chris Lamb1-1/+1
Whilst working on the Reproducible Builds effort [0], I noticed that meson did not generate reproducible .cmake files: they include the full path name. This commit not only makes the build reproducible, but it also matches CMake's own behaviour. Specifically, CMakePackageConfigHelpers.cmake does the equivalent transformation using: get_filename_component(inputFileName "${_inputFile}" NAME) I originally filed this in Debian as bug #1000327 [1]. [0] https://reproducible-builds.org/ [1] https://bugs.debian.org/1000327
2021-10-27do not repeat magic regexes for cmake define replacementsEli Schwartz1-2/+2
We already have this magic string in mesonlib, and this should always have used the cmake@ format which is identical to the meson format other than the regex.
2021-10-04f-stringsEli Schwartz1-1/+1
2021-10-03cmake module: if cmake cannot be found, do not tracebackEli Schwartz1-0/+3
We ended up passing a NoneType as the program binary, which is a very awkward way to communicate an error when failing to write a basic package version file.
2021-09-06mintro: add installed_planFilipe Laíns1-3/+4
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-08-31pylint: turn on superflous-parensDylan Baker1-3/+3
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-05cmake: Improved error message for using dependency for executablesDaniel Mensinger1-0/+2
fixes #8893
2021-06-29fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger1-1/+1
2021-06-18holders: remove unholderDaniel Mensinger1-8/+9
2021-05-28modules: Add methods dict everywhereXavier Claessens1-0/+6
This fix calling random internal methods from meson.build as long as they were not prefixed by underscore.
2021-05-28modules: Stop using ModuleReturnValue where it's not neededXavier Claessens1-3/+2
It is only needed in functions that need to add targets to the interpreter.
2021-05-28modules: Stop using InterpreterObjectXavier Claessens1-30/+26
Custom objects returned by modules must be subclass of ModuleObject and have the state argument in its methods. Add MutableModuleObject base class for objects that needs to be deep copied on assignation.
2021-05-28modules: Remove snippet methodsXavier Claessens1-8/+6
The only advantage they have is they have the interpreter in arguments, but it's already available as self.interpreter. We should discourage usage of the interpreter API and rely on ModuleState object instead in the future. This also lift the restriction that a module method cannot add build targets, but that was not enforced for snippet methods anyway (and some modules were doing it) and it's really loose restriction as it should check for many other things if we wanted to make it consistent.
2021-04-01interpreter: Move to its own folder and split itXavier Claessens1-1/+2
2021-03-19split program related classes and functions out of dependenciesDylan Baker1-2/+3
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 Schwartz1-7/+7
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04various python neatness cleanupsEli Schwartz1-2/+2
All changes were created by running "pyupgrade --py3-only --keep-percent-format" and committing the results. I have not touched string formatting for now. - use set literals - simplify .format() parameter naming - remove __future__ - remove default "r" mode for open() - use OSError rather than compatibility aliases - remove stray parentheses in function(generator) scopes
2021-02-22minstall: Add --skip-subprojects optionXavier Claessens1-2/+2
By default all subprojects are installed. If --skip-subprojects is given with no value only the main project is installed. If --skip-subprojects is given with a value, it should be a coma separated list of subprojects to skip and all others will be installed. Fixes: #2550.
2021-01-13build/interperter: Add annotations and move input validation to interpreterDylan Baker1-2/+2
This moves the user input validation to the interpreter, instead of being in the build module, and adds type annotations.
2021-01-04Use a single coredata dictionary for optionsDylan Baker1-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).
2020-10-13include_type: Add CMake subporject dependency method (fixes #6879)Daniel Mensinger1-3/+10
2020-08-09cmake: Make the CMake targte not found error more useful (see #7567)Daniel Mensinger1-1/+3
2020-07-01Merge pull request #7231 from mensinda/cmOverrideJussi Pakkanen1-9/+101
cmake: Add more advanced subproject configuration options
2020-06-12modules/cmake: Fix setting install_dirDylan Baker1-2/+1
Fixes: #7301
2020-06-05cmake: Add more advanced subproject configuration optionsDaniel Mensinger1-9/+101
This is done with the new cmake subprojects options object that is similar to the already exisiting configuration data object. It is consumed by the new `options` kwarg of the cmake.subproject function.
2020-02-19modules/cmake: Add a found() method to the cmake subprojectDylan Baker1-0/+8
Just like the native meson subproject has.
2020-02-19modules/cmake: Use the noPosargs helperDylan Baker1-3/+2
2019-11-06Fix typos found by codespellWolfgang Stöggl1-1/+1
- Typos were found by codespell v1.16.0
2019-10-01cmake: subproject() supports the 'required' kwargXavier Claessens1-1/+1
2019-09-26cmake: define set_and_check in CMake package config (fixes #5889)Daniel Mensinger1-0/+12
2019-07-13cmake: Handle disabling subprojectsThibault Saunier1-1/+4
2019-06-09Purge `is_cross` and friends without changing user interfacesJohn Ericson1-1/+1
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-06-06cmake: moved subprojects into the CMake moduleDaniel Mensinger1-2/+68
2019-05-20Remove compilers from ModuleState objectJon Turney1-2/+3
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-04-28cmake: Use CMAKE_ROOT instead of _INCLUDE_FILE (closes #5218)Daniel Mensinger1-10/+2
2019-04-25Don't use len() to test for container emptinessDylan Baker1-1/+1
I ran the numbers once before (it's in the meson history) but it's *much* faster to *not* use len for testing if a container is empty or not.
2019-01-17add support for generating cmake filesDavid Fort1-0/+221
This new cmake module allows to generate cmake package files. This may ease the porting for cmake projects that are exporting cmake package informations for other depending projects. The module uses as much as possible the templates provided by the cmake installation (and so cmake needs to be installed).