Commit Graph

6237 Commits

Author SHA1 Message Date
Paolo Bonzini 08a8043f19 interpreter: add feature.allowed()
This method simplifies the conversion of Feature objects to booleans.
Often, one has to use the "not" operator in order to treat "auto"
and "enabled" the same way.

"allowed()" also works well in conjunction with the require method that
is introduced in the next patch.  For example,

  if get_option('foo').require(host_machine.system() == 'windows').allowed() then
    src += ['foo.c']
    config.set10('HAVE_FOO', 1)
  endif

can be used instead of

  if host_machine.system() != 'windows'
    if get_option('foo').enabled()
      error('...')
    endif
  endif
  if not get_option('foo').disabled() then
    src += ['foo.c']
    config.set10('HAVE_FOO', 1)
  endif

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-05-31 16:01:57 +02:00
Dylan Baker 6aef800ba8 modules/fs: Use typed_kwargs 2021-05-30 23:32:15 -07:00
Dylan Baker 521b92e499 interpreterbase: Add a function for type checking keyword arguments 2021-05-30 23:32:15 -07:00
Naveen M K 7a6ad2953a Don't use `os.path.relpath` in dist command
This is problematic when we meson is installed in the different 
root(say C:) while building from another root(say D:).
This is how it is done in mesonpep517 and causes problems
because of that.
2021-05-30 00:49:43 +03:00
Dylan Baker c6ec13e6bf
Only try to get RSP syntax if RSP is supported (#8804) 2021-05-30 00:24:53 +03:00
Xavier Claessens 25fa2d4f7b vsenv: Recommend using "meson compile" wrapper
When meson has setup the VS environment, running ninja to build won't
work, user should use meson wrapper to compile.
2021-05-28 17:34:25 -04:00
Xavier Claessens 2fb24b18e1 unstable_external_project: Remove unused imports 2021-05-28 15:17:10 -04:00
Xavier Claessens 8abbc5cc5d modules: Replace find_program_impl() by state.find_program() 2021-05-28 15:17:10 -04:00
Xavier Claessens 2e02ef6592 modules: Add methods dict everywhere
This fix calling random internal methods from meson.build as long as
they were not prefixed by underscore.
2021-05-28 15:17:10 -04:00
Xavier Claessens a734bcfc83 modules: Stop using ModuleReturnValue where it's not needed
It is only needed in functions that need to add targets to the
interpreter.
2021-05-28 15:17:10 -04:00
Xavier Claessens 3340284805 modules: Stop using InterpreterObject
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-28 15:17:10 -04:00
Xavier Claessens 723c5227a4 modules: Remove snippet methods
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-05-28 15:17:10 -04:00
Naveen M K 495e76d10a Remove `Microsoft.VisualStudio.Workload.WDExpress` 2021-05-28 15:16:37 -04:00
Naveen M K 7ec5267939 Find Visual Studio Build Tools 2019
Got the Idea from setuptools
a5131f0b82/setuptools/msvc.py (L176)
2021-05-28 15:16:37 -04:00
Xavier Claessens a9959a3859 Vala: Add missing FeatureNew() when C is missing
It was previously an hard error, only permitted since 0.59.0.
2021-05-28 10:20:08 -04:00
Dylan Baker a5b43aa16c Add a helper to simplify the usage of PerMachineDefaultable 2021-05-28 09:26:38 -04:00
Dylan Baker d2e7bdccd7 build: Use a PerMachineDefaultable for (project|global)[_link]_args 2021-05-28 09:26:38 -04:00
Dylan Baker 76b98459ac coredata: Use a PerMachineDefaultable for the deps cache 2021-05-28 09:26:38 -04:00
Dylan Baker f9a9faba92 build: Use a PerMachineDefaultable for dependency override cache
This way if we're doing a host == build configuration then the build and
host dependencies will be stored correctly.
2021-05-28 09:26:38 -04:00
Dylan Baker 012d60b100 mesonlib: Allow PerMachineDefaultable to take arguments at initialization 2021-05-28 09:26:38 -04:00
Dylan Baker 49b5037496 dependencies/zlib: System Dependency needs a clib_compiler on windows
Otherwise it'll except when it tries to get an attribute from None that
doesn't exist.
2021-05-28 09:26:38 -04:00
Dylan Baker 7114a9015e mesonlib: Fix return type of PerMachineDefaultable.default_missing() 2021-05-28 09:26:38 -04:00
Dylan Baker 76768eaf20 build: fix type annotation import 2021-05-28 09:26:38 -04:00
Dylan Baker f1e053fa44 modules/gnome: Correctly handle generated sources for generate_gir
We need to pass any generated sources down the CustomTarget
inititalizers so that they will generate a dependency correctly,
otherwise we get race conditions.
2021-05-28 08:47:11 -04:00
Chun-wei Fan bbb6f2c51c ninjabackend.py: Implement `link_whole:` for pre-VS2015
...Update 2, to be exact, since the Visual Studio linker only gained the
`/WHOLEARCHIVE:` feature since Visual Studio 2015 Update 2.

This checks whether we have the corresponding `cl.exe` which is
versioned at or after Visual Studio 2015 Update 2 before we try to apply
the `/WHOLEARCHIVE:xxx` linker flag.  If we aren't, use built-in methods
in Meson to grab the object files of the dependent static lib's, along
with the objects that were `link_whole:`'ed into them, and feed this
list into the linker instead.

This would make `link_whole:` work on Visual Studio 2015 Update 1 and
earlier, including previous Visual Studio versions.
2021-05-27 09:54:37 -07:00
Jussi Pakkanen 799b96f753 Also skip VS activation if gcc is found. 2021-05-23 21:33:24 +01:00
Jon Turney 7e7a23293b Fix double negative in 'No CMake binary not found' 2021-05-23 17:59:43 +01:00
Jussi Pakkanen 43f0aa17b7 Add swift executable support in Xcode. 2021-05-23 17:59:14 +01:00
Jussi Pakkanen e23fd086bf Remove unnecessary hierarchical layer. 2021-05-23 13:28:25 +03:00
Jussi Pakkanen b84265052e Remove top level sources entry as unnecessary. 2021-05-23 13:28:25 +03:00
Jussi Pakkanen 7ceba6388c Add meson.build files to pbxgroup. 2021-05-23 13:28:25 +03:00
Jussi Pakkanen 818685ec18 Write project info in a tree structure rather than the current flat one. 2021-05-23 13:28:25 +03:00
Jacob Nielsen 3e5ec00a40
Better detection of Visual Studio compiler 2021-05-22 01:05:18 +03:00
Dylan Baker 17eb224aa7 interpreter: Automatically add 'c' to languages when 'vala' is used
This is so dumb, we can just insert C for you without you having to know
that you're using C under the hood. This is nicer because:
1) Meson doesn't make the user add a language they're not explicitly
   using
2) If there was ever an implementaiton of Vala that didn't use C as
   it's assembly language, this wouldn't make any sense.
2021-05-19 23:28:17 +03:00
Dylan Baker bfd06783bd backends: use a set for processed targets instead of a dict
We're only interested in the keys, not in the value (which was always
set to True), so a set is a better data structure anyway.
2021-05-19 23:28:17 +03:00
Dylan Baker 156d6160d1 compilers: Add `get_debug_args` to base Compiler
This was missed, there should be an implementation in the base Compiler
class, if for nothing else to help mypy
2021-05-19 23:28:17 +03:00
Dylan Baker 7659ae50a0 ninjabackend: Fix vala type annotations 2021-05-19 23:28:17 +03:00
Dylan Baker b1b8e777a2 rust: override get_linker_always_args
instead of opencoding what should be there in the rust compile rule
2021-05-19 23:28:17 +03:00
Dylan Baker 189545c2a8 build: annotate can_compile_remove_sources 2021-05-19 23:28:17 +03:00
Dylan Baker 0fd907a8cc build: Simplify BuildTarget.process_sourcelist 2021-05-19 23:28:17 +03:00
Dylan Baker 7bd7d1cd73 interpreter: Pass unholdered sources into BuildTarget
The build level shouldn't be deal with interpreter objects, by the time
they leave the intpreter they should be in the Meson middle layer
representaiton
2021-05-19 23:28:17 +03:00
Dylan Baker f2ae92368a interpreter: Add docstring and fix types of source_strings_to_files 2021-05-19 23:28:17 +03:00
Volker-Weissmann 4ca9a16288
.C files are now treated as C++ code 2021-05-19 17:10:22 +03:00
Xavier Claessens 69a5c950a3 pkgconfig: Do not escape custom variables
We need to escape space in variables that gets into cflags or libs
because otherwise we cannot split compiler args when paths contains
spaces. But custom variables are unlikely to be path that gets used in
cflags/libs, and escaping them cause regression in GStreamer that use
space as separator in a list variable.
2021-05-18 18:03:37 -04:00
Jussi Pakkanen 2a0c2e5137
Merge pull request #8403 from dcbaker/submit/rust-fix-shared-internal-linking
Submit/rust fix shared internal linking
2021-05-18 23:29:34 +03:00
Randy Yates d7cb58e57d add cpu family csky 2021-05-18 23:17:12 +03:00
Dylan Baker e7e04c814b Add a rust test for internal c linkage
We have code to support this, but no tests. That seems pretty bad.
And better yet, it doesn't work on MSVC in some cases.
2021-05-18 09:34:36 -07:00
Dylan Baker 11d123332d ninjabackend: fix linking dynamic c libraries with rust
The correct name is "dylib" not "shared"
2021-05-17 15:21:27 -07:00
Peter Harris be015a37d7
Visual Studio Address Sanitizer updates
* Allow address sanitizer for Visual Studio 2019 version 16.9

Address Sanitizer was first supported with the current syntax in Visual
Studio 16.9.0 (cl version 19.28.29910).

* VS: Convert /fsanitize=address to project file setting
2021-05-15 18:47:04 +03:00
Jussi Pakkanen ab0b727427 Add gnuXX stds to Objective C. 2021-05-15 18:45:54 +03:00