summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Add prefix option for link argsPhillip Cao2018-11-081-0/+6
|
* Add support for Renesas CC-RX toolchainPhillip Cao2018-11-081-1/+121
|
* Add new compiler.get_argument_syntax methodDylan Baker2018-11-031-0/+14
| | | | | | | | | | | Some compilers try very had to pretend they're another compiler (ICC pretends to be GCC and Linux and MacOS, and MSVC on windows), Clang behaves much like GCC, but now also has clang-cl, which behaves like MSVC. This method provides an easy way to determine whether testing for MSVC like arguments `/w1234` or gcc like arguments `-Wfoo` are likely to succeed, without having to check for dozens of compilers and the host operating system, (as you would otherwise have to do with ICC).
* Hoist gen_vs_module_defs_args from Gnu to GnuLike.Josh Gao2018-10-301-10/+10
| | | | | | Support vs_module_defs when cross-compiling to Windows with clang. Fixes #4434.
* Generalize gnulike-targeting-windows checks.Josh Gao2018-10-301-2/+2
| | | | | | | | | Replace several checks against GCC_MINGW or (GCC_MINGW, GCC_CYGWIN) with is_windows_compiler instead, so that clang and other gcc-like compilers using MinGW work appropriately with vs_module_defs, c_winlibs, and cpp_winlibs. Fixes #4434.
* get_base_compile_args: Add -fprofile-correction to -fprofile-useJan Alexander Steffens (heftig)2018-10-281-2/+2
| | | | | | | | | This allows using the imperfect profiles generated by multithreaded programs. Without the argument, GCC fails to load them. Clang just ignores the argument AFAICT. Fixes https://github.com/mesonbuild/meson/issues/2159
* add implib support for ArmclangCompiler (#4420)pbl2018-10-261-0/+14
|
* Order rpaths so that internal ones come first.Jussi Pakkanen2018-10-201-1/+17
|
* Keep absolute rpaths to libraries outside the build dir.Jussi Pakkanen2018-10-201-10/+13
|
* Add 'b_pie' compiler optionXavier Claessens2018-10-201-1/+22
| | | | | On Android executables must be position independent, many distributions enable it by default too for security reasons.
* Use relative build-tree RPATHs on macOSDavid Seifert2018-10-141-26/+32
| | | | | | | | | | | | * This helps with reproducibility on macOS in the same way `$ORIGIN` improves reproducibility on Linux-like systems. * This makes the build-tree more resilient to users injecting rpaths via `LDFLAGS`. Currently Meson on macOS crashes when a build-tree rpath and a user-provided `-Wl,-rpath` in LDFLAGS collide, leading to `install_name_tool` failures. While this still does not solve the root cause, it makes the occurrence much less likely, as users will generally pass absolute `-Wl,-rpath` arguments into Meson.
* Adding "compiler_type" flag to ARM compilers.Mohammed Amer Khalidi2018-10-071-3/+7
|
* msvc: Don't use /O3 with MSVCMartin Storsjö2018-10-011-1/+1
| | | | | MSVC doesn't support that option, and warns about ignoring an unknown option.
* linker flags --as-needed and --no-undefined aren't meaningful for PEJon Turney2018-09-231-2/+4
| | | | | | | | | | | --as-needed controls ELF-specific functionality (the emission of DT_NEEDED tags) --no-undefined is effectively always on for PE/COFF, as the linkage model always requires symbols to be defined binutils ld silently ignores these flags for PE targets, but lld warns that it's ignoring them, so just don't bother emitting them for PE targets.
* Updating compilers.py to add functions - get_optimization_args, ↔Mohammed Amer Khalidi2018-09-211-0/+28
| | | | get_debug_args in ARMCC and ARMCLANG classes.
* Fix setting `-Doptimization` breaking buildDavid Seifert2018-09-191-2/+19
| | | | Closes #4206
* ICC does not support `-Og`David Seifert2018-09-171-1/+1
|
* Abstract shared GCC/Clang/ICC methods in GnuLikeCompilerDavid Seifert2018-09-171-159/+84
|
* Fix ICC on macOSDavid Seifert2018-09-161-2/+17
|
* Fix GCC on macOSDavid Seifert2018-09-161-4/+12
| | | | | * `common/40 has function` still fails due to alloca being a GCC builtin.
* Use enum instead of `int` for compiler variantsDavid Seifert2018-09-161-68/+69
| | | | | | | | * Enums are strongly typed and make the whole `gcc_type`/`clang_type`/`icc_type` distinction redundant. * Enums also allow extending via member functions, which makes the code more generalisable.
* Sprinkle functools.lru_cache() in a few more placesNirbheek Chauhan2018-09-111-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | This improves the backend generation time for gst-build from 7.4s to 6.6s. This is probably all the low-hanging fruit we can get, further improvements will probably require refactoring, moving to pathlib.Path or reimplementing CompilerArgs: 222045 0.551 0.000 1.324 0.000 compilers.py:666(__iadd__) 3691 0.230 0.000 0.885 0.000 ninjabackend.py:99(write) 233560 0.441 0.000 0.701 0.000 posixpath.py:75(join) 882 0.141 0.000 0.636 0.001 backends.py:509(generate_basic_compiler_args) 256301 0.248 0.000 0.576 0.000 compilers.py:562(_can_dedup) 37369 0.035 0.000 0.466 0.000 compilers.py:652(extend_direct) 74650 0.067 0.000 0.431 0.000 compilers.py:641(append_direct) 158153 0.089 0.000 0.405 0.000 ninjabackend.py:129(<lambda>) 845 0.064 0.000 0.391 0.000 ninjabackend.py:279(get_target_generated_sources) 58161 0.070 0.000 0.317 0.000 backends.py:217(get_target_generated_dir) 216825 0.175 0.000 0.275 0.000 ninjabackend.py:48(ninja_quote) 845 0.058 0.000 0.255 0.000 ninjabackend.py:2289(guess_external_link_dependencies) 845 0.068 0.000 0.239 0.000 backends.py:793(get_custom_target_provided_libraries) 52101 0.030 0.000 0.237 0.000 compilers.py:716(append) 1319326 0.231 0.000 0.231 0.000 {built-in method builtins.isinstance} 1189117 0.229 0.000 0.229 0.000 {method 'startswith' of 'str' objects} 3235 0.102 0.000 0.228 0.000 compilers.py:614(to_native) Note: there are 845 build targets.
* Add method to check for C/C++ function attributesDylan Baker2018-09-071-0/+4
| | | | | | | | | | | | | | | It's fairly common on Linux and *BSD platforms to check for these attributes existence, so it makes sense to me to have this checking build into meson itself. Autotools also has a builtin for handling these, and by building them in we can short circuit cases that we know that these don't exist (MSVC). Additionally this adds support for two common MSVC __declspec attributes, dllimport and dllexport. This implements the declspec version (even though GCC has an __attribute__ version that both it and clang support), since GCC and Clang support the MSVC version as well. Thus it seems reasonable to assume that most projects will use the __declspec version over teh __attribute__ version.
* Improve support for macOS dylib versioningNirbheek Chauhan2018-08-291-15/+15
| | | | | | | | | | | | | | We now use the soversion to set compatibility_version and current_version by default. This is the only sane thing we can do by default because of the restrictions on the values that can be used for compatibility and current version. Users can override this value with the `darwin_versions:` kwarg, which can be a single value or a two-element list of values. The first one is the compatibility version and the second is the current version. Fixes https://github.com/mesonbuild/meson/issues/3555 Fixes https://github.com/mesonbuild/meson/issues/1451
* Deduplicate build-tree RPATHs on macOSDavid Seifert2018-08-281-2/+4
| | | | | | | | | | * Currently, RPATHs coming from dependencies and `build_rpath` provided by the user might contain the same path. Apple's `install_name` tool is allergic to providing the same argument twice when removing RPATHs: error: install_name_tool: "-delete_rpath /usr/lib" specified more than once
* CompilerArgs: -Wl,-lfoo is also a valid way to pass a libraryNirbheek Chauhan2018-08-281-2/+2
| | | | | | | | | Treat it the same as -lfoo by deduping and adding to --start/end-group Reported at https://gitlab.gnome.org/GNOME/glib/issues/1496 We don't do any advanced transformation for MSVC or de-dup because this is a very rare syntax.
* Merge pull request #3981 from GoaLitiuM/d-win-fixesJussi Pakkanen2018-08-271-6/+15
|\ | | | | Fix D support on Windows
| * Handle proper linking of MSVC runtime librariesGoaLitiuM2018-08-201-0/+9
| | | | | | | | DMD expects mscrtlib arguments while compiling, whereas LDC2 expects these while linking.
| * Remove optimization related arguments from buildtype args, inline release buildsGoaLitiuM2018-08-201-6/+6
| | | | | | | | Dub enables inlining by default for release builds, so meson should do it as well.
* | CompilerArgs: Allow calling to_native() multiple timesNirbheek Chauhan2018-08-231-5/+9
| | | | | | | | | | | | | | | | | | Add a keyword argument to to_native() to operate on a copy so that we can call it multiple times instead of modifying the original compiler args while iterating. This is used in the unit test, and might be used in Meson at some point too.
* | compilers: Handle dupes in the --start/end-group logicOle André Vadla RavnÄs2018-08-231-3/+4
| | | | | | | | | | The index calculated through `self.index()` may find the same flag earlier in the list and end up putting `--end-group` in the wrong spot.
* | compilers: Reduce sizes of MSVC linked binariesOle André Vadla RavnÄs2018-08-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | - For optimization=s add /O1: Use Maximum Optimization (Favor Size), and remove /Os as it's implied by /O1. - Because we add /O1, this implies /Gy, i.e. Function-Level Linking, so unused code can be omitted. - Add /Gw: Optimize Global Data, so unused data can be omitted. With buildtype=minsize on x86 this reduces the size of a statically linked Vala compiler binary from 5 MB down to just 1.87 MB.
* | find_library: Use _build_wrapper to get library dirsBruce Richardson2018-08-221-10/+14
| | | | | | | | | | | | | | | | | | | | This means that we will take into account all the flags set in the cross file when fetching the list of library dirs, which means we won't incorrectly look for 64-bit libraries when building for 32-bit. Signed-off-by: Nirbheek Chauhan <nirbheek@centricular.com> Closes https://github.com/mesonbuild/meson/issues/3881
* | UserArrayOption: Allow duplicates when used as <lang>_args optionXavier Claessens2018-08-201-2/+2
|/ | | | Closes: #4021.
* Convert buildtype to optimization and debug options (#3489)Jussi Pakkanen2018-08-181-25/+77
|
* Unconditionally use get_gui_app_args()Jon Turney2018-08-151-0/+3
| | | | | Add get_gui_app_args() to the Compiler class so it can be unconditionally used
* Explicitly set the Windows subsystem for ninja/VisualCJon Turney2018-08-151-2/+2
|
* Merge pull request #3831 from mesonbuild/symvisibilityJussi Pakkanen2018-08-111-0/+15
|\ | | | | Add gnu_symbol_visibility keyword argument
| * Call it gnu_symbol_visibility instead.Jussi Pakkanen2018-08-091-12/+12
| |
| * Add kwarg for specifying symbol visibility.Jussi Pakkanen2018-08-091-0/+15
| |
* | PkgConfigDependency: Don't try to resolve internal compiler libsNirbheek Chauhan2018-08-111-0/+3
|/ | | | | | | -lc -lm -ldl -lrt -lpthread are special linker arguments that should never be resolved to on-disk libraries. Closes https://github.com/mesonbuild/meson/issues/3879
* Implement get_link_whole_for() for IntelCompiler (#3863)Alberto Sartori2018-07-101-0/+3
| | | closes #3862
* Added ARMCLANG compiler support for C/C++ (#3717)Vasu Penugonda2018-06-211-0/+80
|
* Rename clike_langs to clink_langs for clarityNirbheek Chauhan2018-06-201-11/+11
| | | | | | | D is not a 'c-like' language, but it can link to C libraries. The same might be true of Rust in the future and Go when we add support for it. This contains no functionality changes.
* dependencies: Don't assume self.compiler is a C compilerNirbheek Chauhan2018-06-201-1/+5
| | | | | | | | | | | All dependencies were using find_library, has_header, get_define, etc on self.compiler assuming that it's a compiler that outputs and consumes C-like libraries. This is not true for D (and in the future, for Rust) since although they can consume C libraries, they do not use the C ecosystem. For such purposes, we now have self.clib_compiler. Nothing uses self.compiler anymore as a result, and it has been removed.
* Add missing stubs to Compiler.Christoph Behle2018-06-181-0/+12
| | | | | | | | Added missing stubs to class Compiler for the methods: * compute_int * has_members * has_type * symbols_have_underscore_prefix
* Use stub to report misuse of get_defineChristoph Behle2018-06-181-0/+3
| | | | | Instead of checking on the call site add a stub to Compiler which raises an exception.
* macos: Rewrite install_name for dependent built libraries on installNirbheek Chauhan2018-06-181-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | On macOS, we set the install_name for built libraries to @rpath/libfoo.dylib, and when linking to the library, we set the RPATH to its path in the build directory. This allows all built binaries to be run as-is from the build directory (uninstalled). However, on install, we have to strip all the RPATHs because they point to the build directory, and we change the install_name of all built libraries to the absolute path to the library. This causes the install name in binaries to be out of date. We now change that install name to point to the absolute path to each built library after installation. Fixes https://github.com/mesonbuild/meson/issues/3038 Fixes https://github.com/mesonbuild/meson/issues/3077 With this, the default workflow on macOS matches what everyone seems to do, including Autotools and CMake. The next step is providing a way for build files to override the install_name that is used after installation for use with, f.ex., private libraries when combined with the install_rpath: kwarg on targets.
* vala: fix extract_all_objects() resultPaolo Bonzini2018-06-101-2/+2
| | | | | | | | Because vala is not listed in clike_langs, is_source(fname) is returning False for Vala source files. Therefore, extract_all_objects() is completely empty for Vala programs. Fixes #791
* compilers: Use RUSTFLAGS from the env as default rust_args valueXavier Claessens2018-06-061-1/+2
|