Commit Graph

29 Commits

Author SHA1 Message Date
Eli Schwartz 6a0fabc647
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04 17:16:11 -05:00
Dylan Baker 3949c2a0e0 move CMAKE_PREFIX_PATH env var handling to environment
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-11 11:15:06 -08:00
Dylan Baker e81acbd606 Use a single coredata dictionary for options
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-04 12:20:58 -08:00
Dylan Baker 71db6b04a3 use OptionKey for builtin and base options
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-04 12:20:40 -08:00
Dylan Baker f6672c7a19 use real pathlib module
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-11-20 15:08:40 -08:00
Daniel Mensinger 7e58f33376
cmake: Add cross compilation support 2020-10-13 17:04:19 +02:00
Daniel Mensinger 1dfaccfd91 pathlib: Fix resolve() by overriding it in Python 3.5 2020-10-04 10:45:48 +02:00
Daniel Mensinger 77b5c82d07 cmake: switch to pathlib (fixes #7322) 2020-10-04 10:45:48 +02:00
Daniel Mensinger d9419a4f2a
typing: fully annotate cmake.executor 2020-09-28 13:51:14 +02:00
Dylan Baker 2845f5a230 cmake: Fix detection of AppleClang
It's not enough to detect that the linker is ld64: gcc, icc, and vanilla
clang all use ld64 on macoOS. Instead we have to detect the class of the
compiler, and determine if it's an Apple Compiler or a vanilla one.
2020-08-22 10:49:35 -07:00
Nirbheek Chauhan 4b0e1850a0 cmake: Use a mapping when writing compiler ID
Meson and CMake compiler ids are different. This commit adds a mapping
from the meson list:

https://mesonbuild.com/Reference-tables.html#compiler-ids

to the CMake list:

https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html

The mapping is not 1-1, and not all entries are mapped, so this is
a best-effort attempt. Fallback to GNU as before to try to limp along
and hope that the build files don't rely on an accurate compiler ID.
2020-08-12 12:21:32 +00:00
Nirbheek Chauhan bc64e1d6b0 cmake: Fix hard-coded values in fake CMakeLists for MSVC
Without this, MSVC and MSVC_VERSION won't be set by CMake during
platform detection, and the compiler will be an undefined mixture of
GNU and MSVC. In particular, find_package(opencv) will fail on Windows
when building with MSVC.
2020-08-12 12:21:32 +00:00
Nirbheek Chauhan adbed4c636 cmake: Do not split CMAKE_PREFIX_PATH with ':' on Windows
This is obviously wrong, since on Windows ':' is in the drive letter.
Causes us to call cmake with `-DCMAKE_PREFIX_PATH=c;\foo\bar`.
2020-08-05 19:57:05 +02:00
Daniel Mensinger edcddb3a28 cmake: Fix handling of path seperators (fixes #7294) 2020-06-13 11:05:28 +00:00
Dylan Baker f5bd3254e9 dependencies: Don't allow using the default binary for host on cross compiles
Otherwise we can end up finding dependencies from the build machine for
the host machine, which is incorrect. This alters cmake, pkg-config, and
all config-tool based dependencies.

Fixes: #7276
2020-06-12 11:16:24 -07:00
Dylan Baker 01e0cc6735 cmake: Use shared find_external_program instead of open coding 2020-06-12 11:16:24 -07:00
Daniel Mensinger 0332d7e350 cmake: Subprojects support CMAKE_PREFIX_PATH (fixes #7249) 2020-06-12 15:50:05 +00:00
Reza Housseini 10dc8f3c7c More robust cmake version detection 2020-05-08 22:47:09 +03:00
Alexandre Lavigne bfea80677e Issue: 7009: CMake/Centos7 Unable to find CMake even though it is installed
On some systems the binary 'cmake' for version 3 is named 'cmake3',
therefor printing its version number prints:
'cmake3 version X.Y.Z' instead of 'cmake version X.Y.Z'
This '3' digit in the middle breaks the regular expression
extracting the version number.

The following fix permit both way to work and the regexp to
match the proper version number.

Signed-off-by: Alexandre Lavigne <alexandre.lavigne@scality.com>
2020-04-22 00:10:25 +03:00
John Ericson 3a4388e51d Fix legacy env var support with cross
Fix #3969
2020-03-23 17:51:36 +02:00
Daniel Mensinger 83960ea050 cmake: Fix crash when no C++ compiler is not installed (fixes #6559) 2020-02-15 00:54:05 +05:30
Daniel Mensinger 3607f50d7f
cmake: Refactor CMakeExecutor and CMakeTraceParser
This moves most of the execution code from the CMakeInterpreter
into CMakeExecutor. Also, CMakeTraceParser is now responsible
for determining the trace cmd arguments.
2020-01-26 18:23:34 +01:00
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Michael Hirsch, Ph.D 5da1a6e586 cmake: subprocess external .decode(errors='ignore') to avoid traceback
mesonlib.Popen_safe() doesn't work with the case where undecodeable
binary data comes back from CMake or compiler, so we use subprocess.run()
2019-12-10 19:57:51 +02:00
Michael Hirsch, Ph.D 419a7a8f51 cmake: add fortran cache content 2019-12-09 11:15:58 -05:00
Michael Hirsch, Ph.D 11e34ca7fc correct logic for too old cmake 2019-08-23 00:39:12 +03:00
Norbert Nemec 1cb6177f03 avoid cmake syntax error due to "\" path separators on windows 2019-08-17 13:20:40 +03:00
Daniel Mensinger 5bd21a96b8 cmake: Fix dependencies with try_compile (closes #5605) 2019-07-11 02:07:00 +03:00
Daniel Mensinger 6083cfa6c8
cmake: Moved finding and running CMake out of dependency 2019-06-12 13:58:19 +02:00