Commit Graph

298 Commits

Author SHA1 Message Date
Luke Elliott 26b102e817 Fix '# Visual Studio <>' comment in sln files with VS backend
such that Visual Studio Version Selector works.
2021-11-27 20:06:54 +02:00
Luke Elliott 39856daf9a Stop backend_startup_project from erasing the last project in a VS solution
if it is not the specified project.
2021-11-25 18:14:54 +02:00
Crend King 809792c223 Support Visual Studio 2022 backend 2021-11-21 08:08:11 -05:00
GustavoLCR 5924510188 Run pylint 2021-11-21 01:42:02 -05:00
GustavoLCR 2771e352bd Fix vs backend cross compilation regression 2021-11-21 01:42:02 -05:00
Moroz Oleg b72624171b Move language standard in separate method within vsbackend 2021-11-02 18:50:44 +02:00
Олег Мороз 387e846568 Fixes .vcxproj for vs2017 vs2019
fixes #6314

in case of backend is vs2017 or vs2019 place LanguageStandard tag with stdcpp version and LanguageStandard_C tag with stdc version in .vcxproj file
2021-11-02 18:50:44 +02:00
Eli Schwartz 038b31e72b
various manual conversion of percent-formatted strings to f-strings 2021-11-01 20:26:18 -04:00
Eli Schwartz ab1741659e
fix typoed vs backend token 2021-11-01 20:22:34 -04:00
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Andres Freund 14096260c4 backend/vs: Parallelize compilation inside one project.
UseMultiToolTask allows parallelism inside a project, without requiring cl.exe
internal multi-threading (which meson generated projects currently can't use,
mainly due to specifying output filenames for each object).

TODO:
- think about making behaviour conditional on msbuild version / add comment
  why not
2021-10-08 10:10:19 -07:00
Andres Freund 1fb2818d42 backend/vs: Deduplicate basic project template.
Note that a few minor details of the output changed for some target types. I
think I called them out with XXXs in the code for now.
2021-10-08 10:09:20 -07:00
Andres Freund f2e4177c76 backend/vs: Name pch pdb files to avoid naming & lock conflicts. 2021-10-08 09:17:16 -07:00
Andres Freund 157f11dc9e backend/vs: Move Microsoft.Cpp.props to before ItemDefinitionGroup.
The main reason for this move is to make it easier to merge the copies of
project generation. But as far as I can tell, the Microsoft.Cpp.props import
also belongs before the ItemDefinitionGroup.

Originally the order seems to have been that way, but 431a9ea664 changed it in
the course of other changes.
2021-10-08 09:16:19 -07:00
Andres Freund a161873948 backend/vs: process link dependencies.
Partially-Fixes: #1799
2021-10-04 22:34:57 -04:00
Eli Schwartz 5a8e066c56
remove useless variables that are no longer or were never used 2021-10-04 16:29:31 -04:00
Andres Freund a8370e6d3f backends/vs: Set ObjectFileName for generated sources.
When a static library B to a static library A with generated sources, B
directly references the object file corresponding to the generated source in
A. For that reference in B object_filename_from_source() is used.  But A did
not specify the object file name, ending up with cl.exe's default.

Fixes: #9235
2021-09-20 09:53:49 -07:00
Andres Freund fddf88ba08 backends/vs: Do not emit dummy command for alias_command().
Alias commands did not work with the vs backend, due to trying to access
target.command[0] with an empty command. Fix this by just not emitting a
CustomBuild node for alias targets - the project references are enough to
trigger the necessary actions.

Fixes: #9247
2021-09-14 13:38:04 -04:00
Dylan Baker b60bd0e299 pyllint: enable consider-user-enumerate
This caught a couple of cases of us doing:
```python
for i in range(len(x)):
   v = x[i]
```
which are places to use enumerate instead.

It also caught a couple of cases of:
```python
assert len(x) == len(y)
for i in range(len(x)):
    xv = x[i]
    yv = y[i]
```
Which should instead be using zip()
```python
for xv, yv in zip(x, y):
    ...
```
2021-08-31 16:28:54 -04:00
Dylan Baker 4d7031437c pylint: turn on superflous-parens
We have a lot of these. Some of them are harmless, if unidiomatic, such
as `if (condition)`, others are potentially dangerous `assert(...)`, as
`assert(condtion)` works as expected, but `assert(condition, message)`
will result in an assertion that never triggers, as what you're actually
asserting is `bool(tuple[2])`, which will always be true.
2021-08-31 16:28:54 -04:00
Dylan Baker 0ca0e6116c backends: remove unused name parameter from as_meson_exe_cmdline
This parameter isn't used, at all, so just remove it
2021-08-20 18:57:19 +02:00
Dylan Baker adddb9af21 backends/vs: add a missing annotation 2021-08-20 18:57:19 +02:00
GustavoLCR 6a1157b2e5 Fix native targets for vs backend cross compilation 2021-08-09 11:27:10 -07:00
Simon Ser 1f3adc4dbe Add feed arg to custom_target() 2021-06-29 20:54:13 +03:00
Daniel Mensinger 3e396b3782
fix: Always explicitly set encoding for text files (fixes #8263) 2021-06-29 11:28:08 +02:00
fanc999 edfe24178d
Add Visual Studio 2012/2013 backends (#8803)
* backends: Add a Visual Studio 2013 backend

This is more-or-less a quick port from the VS2015 backend, except that
we update the Visual Studio version strings and toolset versions
accordingly.  Also correct the generator string for Visual Studio 2015
in mesonbuild/cmake/common.py.

* backend: Add VS2012 backend

Similar to what we did for Visual Studio 2013, add a Visual Studio 2012
backend.

* vs2010backend.py: Implement `link_whole:` if needed

We actually need Visual Studio 2015 Update 2 to use `/WHOLEARCHIVE:`,
which is what we are currently using for `link_whole:` on Visual Studio.
For Visual Studio versions before that, we need to expand from the
static targets that were indicated by `link_whole:`, and any of the
sub-dependent targets that were pulled in via the dependent target's
`link_whole:`.  This wil ensure `link_whole:` would actually work in
such cases.

* vs2010backend.py: Handle objects from generated sources

Unforunately, we can't use backends.determine_ext_objs() reliably, as
the Visual Studio backends handle this differently.

* vs2010backend.py: Fix generating VS2010 projects

Visual Studio 2010 (at least the Express Edition) does not set the envvar
%VisualStudioVersion% in its command prompt, so fix generating VS2010
projects by taking account into this, so that we can determine the location
of vcvarsall.bat correctly.

* whole archive test: Disable on vs2012/2013 backends too

The Visual Studio 2012/2013 IDE has problems handling the items that would be
generated from this test case, so skip this test when using
--backend=vs[2012|2013].  This test does work for the Ninja backend when
VS2012 or VS2013 is used, though.

Consolidate this error message with XCode along with the vs2010 backend.

* docs: Add the new vs2012 and vs2013 backends

Let people know that we have backends for vs2012 and 2013.  Also let
people know that generating Visual Studio 2010 projects have been fixed
and the pre-vs2015 backends now handle the `link_whole:` project option.
2021-06-22 21:00:23 +03: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 6f76fce904 Xcode: regenerato project file when build conf changes. 2021-04-19 17:59:40 +03:00
Jesse Natalie e901581ede VS: Disable MSBuild warnings for always-generated targets
Without this, VS will generate
warning MSB8065: Custom build for item "<path>\custom_target.rule" succeeded, but specified output "<path>\outofdate.file" has not been created. This may cause incremental build to work incorrectly.
2021-04-11 13:18:16 +03:00
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
Matthias Klumpp 4e5efd3897
Allow custom target output to be processed by generators 2021-02-25 20:53:41 +02:00
Jussi Pakkanen 71784e1002 Fix exe wrapper detection for run targets. 2021-02-08 23:19:41 +02:00
Xavier Claessens b52794b24b backend: Do not check for exe wrapper twice
It is already checked by as_meson_exe_cmdline().
2021-02-05 18:17:08 -05:00
Xavier Claessens 522392e755 run_target: Add env kwarg
Re-implement it in backend using the same code path as for
custom_target(). This for example handle setting PATH on Windows when
command is an executable.
2021-02-05 17:53:09 -05:00
Xavier Claessens 633264984b custom_target: Add env kwarg 2021-01-27 09:00:54 -05:00
Ben Niu f0881cf365 Add ARM64EC as a new conceptual cpu type of arm64
ARM64EC is a new ARM64 ABI made by Microsoft. The ARM64EC binaries can be loaded in x64 processes on the latest Windows Insider Preview on ARM64, and they don't need to be emulated for the sake of performance.

To support the ARM64EC build target, a new conceptual arm64 cpu type 'arm64ec' is added. The cpu can be specified in cross files like below to generate msbuild solution/vcxproj files with platform set to ARM64EC.

[target_machine]
system = 'windows'
cpu_family = 'aarch64'
cpu = 'arm64ec'
endian = 'little'
2021-01-25 18:20:13 +00: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 f9b19e73a5 move OptionKey to mesonlib
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-04 12:20:40 -08:00
Dylan Baker fe973d9fc4 use OptionKey for compiler_options 2021-01-04 12:20:39 -08:00
Dylan Baker 7142c92285 use OptionKey for backend_options 2021-01-04 12:15:41 -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
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