Commit Graph

256 Commits

Author SHA1 Message Date
Peter Harris 8b8a610ea4 vs: add static_from_buildtype to b_vscrt 2020-10-14 19:35:28 +03:00
Jussi Pakkanen 1a0603835e Add win_subsystem kwarg. Closes #7765. 2020-10-07 18:55:25 +03:00
Daniel Mensinger 1dfaccfd91 pathlib: Fix resolve() by overriding it in Python 3.5 2020-10-04 10:45:48 +02:00
Jussi Pakkanen 400ec2d685
Merge pull request #7762 from jon-turney/meson-exe-output-improve
Improve the output for meson wrapped commands
2020-09-29 19:28:51 +03:00
Vili Väinölä d1638a4fde compilers/VS: fix build to use optimization and debug flags
- Fixed using debug and optimization built-in options in MSVC.
- Fixed that VS backend does not create pdb files in release mode.
VS implicitly adds the debug fields if left out.
- Fix that it is possible to add debug info with ninja backend with
optimizations.
2020-09-29 19:25:50 +03:00
Jon Turney c72625c2a7
Improve description of meson wrapped custom commands
I've always found ninja reporting 'a meson_exe.py custom command'
unclear and confusing. Instead say we are invoking a custom command,
wrapped by meson, and why.
2020-09-20 12:57:44 +01:00
Nirbheek Chauhan faba48d853 backends: Treat build target as generator only when it's the first arg
Otherwise it might be an argument to a script that just inspects the
binary itself.
2020-09-17 22:25:37 +00:00
Vili Väinölä 416b47c915 Remove redudant checks in vs2010 backend
- Implicit include dirs was checked twice in a row
- Add define only if it does not yet exist rather than remove.
2020-09-13 06:27:00 +00:00
Vili Väinölä 25ad10e501 Add VS include directories to projects as well
- "Go To Document" action previously only worked
on c/cpp files which had the include directories
 set but it was not possible to move from header to another header.
2020-09-13 06:27:00 +00:00
Daniel Mensinger 23818fc5a3
typing: more fixes 2020-09-08 20:15:58 +02:00
Dylan Baker 93c3ec7e2d compilers: Return CompilerArgs from compiler instance
Since the CompileArgs class already needs to know about the compiler,
and we really need at least per-lanaguage if not per-compiler
CompilerArgs classes, let's get the CompilerArgs instance from the
compiler using a method.
2020-06-22 12:06:10 -07:00
Dylan Baker 9d0ad66c29 compilers: Split CompilerArgs into a separate module
I've also moved this out of the compilers pacakge because we're soon
going to need it in linkers, and that creates some serious spagetti
2020-06-22 12:06:10 -07:00
Vili Väinölä 8905a637be Add exception handling to be also written to the VS project xml
When changing meson option cpp_eh, it was passed to cl with AdditionalOptions and resulted in unsuppressable warning "cl : command line warning D9025: overriding '/EHs' with '/EHa'"
2020-06-15 06:08:32 +00:00
Peter Harris 6db9630cf1 backend/vs: Fix OpenMP support
Use the IDE's OpenMP flag instead of adding /openmp to additional
arguments. The IDE appears to override /openmp in additional arguments
with the IDE setting, which defaults to false, leading to binaries built
without OpenMP.
2020-06-06 12:04:28 -04:00
Jussi Pakkanen b4b1a2c5a1 Build private directory name from output file name. 2020-05-19 00:22:45 +03:00
Peter Harris f1d00e86f1 backend/vs: Fix b_vscrt=from_buildtype for debugoptimized
The ninja backend only uses the debug C runtime for 'debug', not for
'debugoptimized'.

The ninja backend always uses the DLL C runtime for all configurations.

The documentation matches the ninja backend.

Make the visual studio backend follow the documentation (and the precedent
set by the ninja backend).
2020-05-14 18:56:01 +00:00
GustavoLCR 27bbf37cf0
Fix incremental debug builds in VS 2020-05-04 02:21:20 +03:00
Peter Harris 7c68fe8008 backend/vs: Fix build when not all languages have pch
It is not unheard-of for a project to use pch for C++ but not for C
(because C usually builds fast enough anyway, so it's not worth the
developer overhead of maintaining the pch file).

This code was trying to optimize the vcxproj file size by detecting
"only one language", but it was only looking at the number of
pch-languages defined. This is incorrect when pch is not defined for all
languages in use.

Instead of tweaking the optimization further, remove it. This makes the
vs backend behave more like the ninja backend.
2020-04-24 22:19:16 +03:00
John Ericson 278c294aa4 Compiler options per lang
A current rather untyped storage of options is one of the things that
contributes to the options code being so complex. This takes a small
step in synching down by storing the compiler options in dicts per
language.

Future work might be replacing the langauge strings with an enum, and
defaultdict with a custom struct, just like `PerMachine` and
`MachineChoice`.
2020-04-20 23:23:15 +03:00
Marc-André Lureau a54506fe46 Handle BuildTarget as custom_target() argument #6914 2020-04-11 23:18:43 +03:00
Jesse Natalie 700cca809b Fixes meson bug to allow arm64 build 2020-04-10 16:11:03 +03:00
Peter Harris 0e50974f80 backend/vs: Fix link of wmain / wWinMain based apps
Executables may have an entry point of wmain or wWinMain. These
executables link successfully with ninja. Rather than add more flags to
executable() in meson.build, remove the EntryPointSymbol override. This
makes the vs backend behave more like the ninja backend.

Fixes #6698
2020-04-04 21:46:09 +03:00
Peter Harris d84daf3e95 backend/vs: Fix debug information and runtime checks
Both DebugInformationFormat and BasicRuntimeChecks need to be in clconf
(not type_config) for Visual Studio to recognize them.

Fixes #6699
2020-04-03 00:52:40 +03:00
Daniel Mensinger 668610c0d2 backend: refactor: set self.interpreter in the constructor 2020-01-28 21:18:25 +02:00
Nirbheek Chauhan b293852d07 vs: Write checksums in PE binaries (DLLs and EXEs)
This is needed for detecting data corruption, and its absence (or
an incorrect value) is also used as a hint by anti-viruses that the
binary may be malware.

Flag is only supported by MSVC `link.exe`, not `lld-link.exe`

https://docs.microsoft.com/en-us/cpp/build/reference/release-set-the-checksum
2020-01-22 19:34:05 +05:30
Luca Bacci 279f72f8cd Prevent the presence of duplicated items in .vcxproj files
Visual Studio refuses to open projects that present duplicated
items, for example:

<ItemGroup>
  <CLInclude Include="glib-enumtypes.h"/>
  <CLInclude Include="glib-enumtypes.h"/>
</ItemGroup>

Note that MSBuild handles duplicated items without any issue,
this is useful only for compatibility with the VS IDE.

See pull request mesonbuild#6151
Fixes issue mesonbuild#6147
2019-11-30 22:02:18 +02:00
Paolo Bonzini f95c965043 backends: choose whether to serialize in as_meson_exe_cmdline
This removes more duplicate code between custom targets and generators.
In addition, generators can now have arguments with newlines in them.
2019-07-19 00:17:29 +02:00
Paolo Bonzini eb5aff8b76 vs2010backend: always serialize executables for generators
Do the same as for custom targets.
2019-07-19 00:17:29 +02:00
Paolo Bonzini 3ef7b23178 backends: hide meson --internal exe cmdline from backends
Return the command line from serialize_executable, which is then
renamed to as_meson_exe_cmdline.  This avoids repeating code that
is common to custom targets and generators.
2019-07-19 00:17:29 +02:00
Xavier Claessens d8b3af00ac vs backend: commandrunner.py takes source dir first 2019-07-10 15:01:18 -04:00
Xavier Claessens 12d4031f52 Add alias_target() function 2019-07-10 15:01:18 -04:00
John Ericson 07777e15d4 Purge `is_cross` and friends without changing user interfaces
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-09 13:13:25 -04:00
filippocrocchini 431a9ea664 Moved RuntimeLibrary property to ItemDefinitionGroup/ClCompile 2019-06-08 21:41:57 +03:00
Jussi Pakkanen 1f4023fa47
Merge pull request #5311 from mensinda/flake8Plugins
Added flake8 plugins and some code fixes
2019-05-02 23:30:29 +03:00
TheQwertiest 61f9cdf962 Added special handling of CustomTargetIndex in VS backend 2019-04-29 17:12:02 +03:00
TheQwertiest 8c9a25456d Added custom_target[i] support for link_with and link_whole 2019-04-29 16:07:50 +03:00
Daniel Mensinger 236221061a
Fixed unnecessary .items() 2019-04-29 12:23:13 +02:00
Daniel Mensinger 3581839f4c
Fix unused variables warnings 2019-04-29 12:22:50 +02:00
Paolo Bonzini c8b414f6b9 vs2010backend: emit dependencies for generators
This is the VS-specific part of the previous commit; the Visual Studio
backend was ignoring dependencies, add an AdditionalInputs element
similar to what add_custom_build does.
2019-04-16 01:46:31 +00:00
Paolo Bonzini 5952256566 vs2010backend: fix flake8 issue
mesonbuild/backend/vs2010backend.py:506:9: F841 local variable action is assigned to but never used
2019-04-16 01:46:31 +00:00
Anton Kochkov ad0ba6a911 Add VS2019 backend CI and docs. 2019-04-16 00:11:02 +03:00
Jussi Pakkanen 04710b087a Add support for VS2019. Closes #4640. 2019-04-10 23:13:47 +03:00
Steve Lhomme cb9b151985 Move the optimization options in the compiler config
They have no effect in the "Configuration" PropertyGroup at least in VS2017
2019-03-02 12:40:56 +02:00
Nicolas Schneider ded0defc3f auto generate msvc pch source file if none is provided by the user 2019-03-01 21:50:31 +02:00
Nicolas Schneider 72370faef0 vs: add support for `build_always_stale` for custom targets 2019-02-24 23:53:18 +02:00
Nicolas Schneider 76db753286 vs: use CustomBuild instead of CustomBuildStep for custom targets
This allows to view the build step in VS and reuses the same concept that
we use for run targets instead of maintaining two different behaviors.
2019-02-21 23:07:18 +02:00
Jussi Pakkanen 3ac7df6a6a
Merge pull request #4917 from nioncode/vs-fixTargetDependencies
vs: use project references in vcxproj instead of the sln file
2019-02-16 14:17:19 +02:00
John Ericson d87744138a Remove remaining cross-specific compiler-args code
Since the consolidation of flags in `compiler_options.*`, this
cross/native special casing is not needed.
2019-02-15 09:17:24 -08:00
Nicolas Schneider 907fb59f67 vs: link dependencies of link_whole targets
Otherwise, msbuild will not create any output for targets that don't have
any sources.
2019-02-13 20:49:54 +01:00
Nicolas Schneider 9c55e50bea vs: do not automatically link dependencies 2019-02-13 20:49:54 +01:00