aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
AgeCommit message (Collapse)AuthorFilesLines
2021-02-03environment: fix typosAli Alnubani1-4/+4
Fixed typos and reworded some sentences. Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
2021-01-23split mesonlib into a packageDylan Baker1-2/+2
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-11make some Environment methods protectedDylan Baker1-5/+5
they're really not public methods, they'r only meant to be called from the initializer. Let's mark them as such.
2021-01-11clean up get_env_var_pairDylan Baker1-14/+8
This function returns both the name and the value, but we never actually use the name, just the value. Also make this module private. We really want to keep all environment variable reading in the Environment class so it's done once up front. This should help with that goal.
2021-01-11move get_env_var_pair to environmentDylan Baker1-4/+30
This is only used in environment, so it should live there too.
2021-01-11boost: default machine file properties to env var valuesDylan Baker1-0/+21
This both moves the env reading to configuration time, which is useful, and also simplifies the implementation of the boost dependency. The simplification comes from being able to delete basically duplicated code since the values will be in the Properties if they exist at all.
2021-01-11Move BinaryTable environment lookups to EnvironmentDylan Baker1-6/+20
This means that all the env lookups are done once, at initial configure time. This has all of the expected advantages.
2021-01-11move handling of CFLAGS and friends to environmentDylan Baker1-30/+53
This has a bunch of nice features. It obviously centralizes everything, which is nice. It also means that env is only re-read at `meson --wipe`, not `meson --reconfigure`. And it's going to allow more cleanups.
2021-01-11move CMAKE_PREFIX_PATH env var handling to environmentDylan Baker1-6/+20
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-04Use a single coredata dictionary for optionsDylan Baker1-9/+10
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-04move OptionKey to mesonlibDylan Baker1-12/+12
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-9/+11
2021-01-04use the OptionKey type for command line and machine filesDylan Baker1-43/+50
2020-12-29Implement support of dlang -makedeps switch (#8119)Remi Thebault1-1/+1
* Implement support of dlang -makedeps switch Fix #8118 * resolve code review comments
2020-12-17environment.py: Detect all mips* architectures (#8108)Persian Prince1-3/+9
* environment.py: Detect all mips* architectures We have more than those values, like: mipsel mipsel-nf mips32el mips33el-nf mipsisa32r6 mipsisa32r6el So lets just detect them all. Sorry I forgot about 64bit and closed https://github.com/mesonbuild/meson/pull/8106 But now it even detects: mipsisa64r6 mipsisa64r6el * Make dcbaker happy
2020-12-13Add support for driving lld-link indirectly through clang on WindowsLaurin-Luis Lehning1-1/+5
2020-11-26Bump Ninja requirement to 1.8.Jussi Pakkanen1-2/+2
2020-11-13environment: Fix detection of rust compilers, moreDylan Baker1-11/+27
2020-11-13compilers/rust: warn about setting -C linker in your compiler argsDylan Baker1-0/+7
2020-11-13compilers/rust: add and use an implementation of use_linker_argsDylan Baker1-7/+7
2020-11-13environment: Properly pass linker to rustcDylan Baker1-7/+9
rustc is very different than other compilers, in that it doesn't generate object files, it just creates a final target out of the intermediate sources. As such, it needs to know about the linker args in the compiler invocation.
2020-10-30environment: Fix detection of swift linkerDylan Baker1-2/+2
Apparently in some cases swift prints to stderr instead of stdout
2020-10-19fix typo "machintosh" -> "macintosh"Ken Cunningham1-1/+1
fixes machine detection for power macintosh systems
2020-10-16Machine file pkg_config_path overrides environmentXavier Claessens1-5/+5
This is consistent with c_args in machine file overriding CFLAGS from env. This also spotted an issue where in a native build this resulted in pkg_config_path being /bar instead of /foo: `-Dpkg_config_path=/foo -Dbuild.pkg_config_path=/bar` Fixes: #7573
2020-10-16Refactor handling of machine file optionsXavier Claessens1-139/+68
It is much easier to not try to parse options into complicated structures until we actually collected all options: machine files, command line, project()'s default_options, environment.
2020-10-13cmake: Add cross compilation supportDaniel Mensinger1-3/+10
2020-10-06environment: provide a more detailed explanation of linker detection failuresDylan Baker1-2/+8
Just saying "it failed" is accurate, but not useful to helping someone figure out why it failed. Giving them the stdout and stderr (like we might with compilers) should help people resolve the issue. Fixes: #7173
2020-10-01compilers/fortran: make ifort on windows signature match ICL'sDylan Baker1-2/+2
2020-10-01compilers/cpp: Add type annotationsDylan Baker1-6/+6
2020-10-01compilers: fully type annotate the C compilersDylan Baker1-2/+2
2020-09-24environment: Pass defines to clang based ObjC[++] compilersDylan Baker1-1/+5
mypy noticed that we were passing [] (instead of a dict or None) to the ClangCompiler class in objc, which made me noticed that for C and C++ we set the defines, but not for ObjC and ObjC++
2020-09-24compilers: make is_cross part of the base Compiler classDylan Baker1-1/+2
Every class needs to set this, so it should be part of the base. For classes that require is_cross, the positional argument remains in their signature. For those that don't, they just allow the base class to set their value to it's default of False.
2020-09-15Add support for the CompCert C CompilerSebastian Meyer1-1/+16
* Add preliminary support for the CompCert C Compiler The intention is to use this with the picolibc, so some GCC flags are automatically filtered. Since CompCert uses GCC is for linking, those GCC-linker flags which are used by picolibc, are automatically prefixed with '-WUl', so that they're passed to GCC. Squashed commit of the following: commit 4e0ad66dca9de301d2e41e74aea4142afbd1da7d Author: Sebastian Meyer <meyer@absint.com> Date: Mon Aug 31 14:20:39 2020 +0200 remove '-fall' from default arguments, also filter -ftls-model=.* commit 41afa3ccc62ae72824eb319cb8b34b7e6693cb67 Author: Sebastian Meyer <meyer@absint.com> Date: Mon Aug 31 14:13:55 2020 +0200 use regex for filtering ccomp args commit d68d242d0ad22f8bf53923ce849da9b86b696a75 Author: Sebastian Meyer <meyer@absint.com> Date: Mon Aug 31 13:54:36 2020 +0200 filter some gcc arguments commit 982a01756266bddbbd211c54e8dbfa2f43dec38f Author: Sebastian Meyer <meyer@absint.com> Date: Fri Aug 28 15:03:14 2020 +0200 fix ccomp meson configuration commit dce0bea00b1caa094b1ed0c6c77cf6c12f0f58d9 Author: Sebastian Meyer <meyer@absint.com> Date: Thu Aug 27 13:02:19 2020 +0200 add CompCert to meson (does not fully work, yet) * remove unused import and s/cls/self/ fixes the two obvious LGTM warnings * CompCert: Do not ignore unsupported GCC flags Some are safe to ignore, however, as per https://github.com/mesonbuild/meson/pull/7674, they should not be ignored by meson itself. Instead the meson.build should take care to select only those which are actually supported by the compiler. * remove unused variable * Only add arguments once. * Apply suggestions from code review Co-authored-by: Dylan Baker <dylan@pnwbakers.com> * Remove erroneous ' ' from '-o {}'.format() As noticed by @dcbaker * added release note snippet for compcert * properly split parameters As suggested by @dcbaker, these parameters should be properly split into multiple strings. Co-authored-by: Dylan Baker <dylan@pnwbakers.com> * Update add_compcert_compiler.md Added a sentence about the state of the implementation (experimental); use proper markdown * properly separate arguments Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2020-09-13Improve regexp for MSVC target arch detection againTamás Bálint Misius1-1/+1
2020-09-11Store first line of VisualStudio compiler output as full_versionJon Turney1-1/+1
Store the first line of VisualStudio compiler output as full_version, so it gets output when we report compiler details.
2020-09-08typing: get rid of most T.castDaniel Mensinger1-4/+3
2020-09-08typing: more fixesDaniel Mensinger1-11/+14
2020-09-04environment: use ExternalProgram to find ninjaPaolo Bonzini1-6/+10
This allows the NINJA environment variable to support all the Windows special cases, especially allowing an absolute path without extension. Based on a patch by Yonggang Luo. Fixes: #7659 Suggested-by: Nirbheek Chauhan <nirbheek@centricular.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-02environment: do not raise exception in detect_cuda_compilerMatt Madison1-2/+0
when the compiler is not a string. When the compiler is set in the build configuration (required, for example, in a cross-build setup), the compiler setting is already a list, which is the desired type. Signed-off-by: Matt Madison <matt@madison.systems>
2020-08-30Be stricter when detecting Windows/CygwinChristoph Reiter1-3/+2
This removes the check for "mingw" for platform.system(). The only case I know where "mingw" is return is if using a msys Python under a msys2 mingw environment. This combination is not really supported by meson and will result in weird errors, so remove the check. The second change is checking sys.platform for cygwin instead of platform.system(). The former is document to return "cygwin", while the latter is not and just returns uname(). While under Cygwin it uname() always starts with "cygwin" it's not hardcoded in MSYS2 and starts with the environment name. Using sys.platform is safer here. Fixes #7552
2020-08-25Merge pull request #7581 from peterh/aixJussi Pakkanen1-4/+17
Add AIX support
2020-08-23Merge pull request #7600 from alexrp/masterJussi Pakkanen1-1/+2
Add C2x option support.
2020-08-22Merge pull request #7609 from dcbaker/submit/2020-08/cmake-fix-apple-clangJussi Pakkanen1-2/+7
Fix mapping of apple compilers in cmake
2020-08-22compilers: Add Apple subclasses for ObjC and ObjC++Dylan Baker1-2/+7
These are needed because in some cases we need to be able to know if we're using vanilla clang or Apple's clang.
2020-08-22Update LLVM tool versions for LLVM/Clang 10.Alex Rønne Petersen1-1/+2
2020-08-22Merge pull request #7447 from scivision/nvcJussi Pakkanen1-3/+24
Add support for NVidia HPC SDK compilers
2020-08-12aix: allow both 32-bit and 64-bit objects in a static libraryPeter Harris1-2/+2
Without the -Xany flag, the ar command will complain when an .o file is compiled for the non-default bit width. This change is necessary to allow 64-bit builds via a native (or cross) file.
2020-08-12aix: detect and support the AIX dynamic linkerPeter Harris1-0/+9
2020-08-12aix: fix cpu family detectionPeter Harris1-2/+6
Like the BSDs, AIX does not return anything useful in platform.machine().
2020-08-08Use uname -p to detect x86_64 on QNX.Elad Lahav1-1/+1