Commit Graph

233 Commits

Author SHA1 Message Date
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
Nicolas Schneider 06268665cd vs: use project references in vcxproj instead of the sln file
This shows dependencies clearly in the 'references' view of VS and properly
propagates the dependencies when building a single vcxproj with msbuild.
2019-02-13 20:49:54 +01:00
Nicolas Schneider e004e711b1 vs: refactor regen target creation 2019-02-12 23:31:59 +01:00
Nicolas Schneider b1c3d150fe vs: always consider run, install, and test targets out-of-date
Pre/PostBuildEvents do not run if no other build steps are out-of-date.
For most run targets (including install and test) that have no other
build steps, VS considers these to be always up-to-date after they have
been built once.

On the other hand, CustomBuild has clearly defined inputs and outputs
that define whether the target is up-to-date or not. By using a
nonexistent file as output of CustomBuild, it is always considered
out-of-date.

This aligns the VS behavior with ninja. `ninja install` unconditionally
installs, `ninja test` always runs the tests, and a run target always
gets executed, without any checks whether it is up-to-date or not.
2019-02-12 23:31:49 +01:00
Nicolas Schneider ccdac894ee vs: remove regen project dependency from solution file
We now set up the project as a reference inside the vcxproj, so the
explicit order in the solution is not needed anymore.
2019-02-12 20:02:28 +02:00
Nicolas Schneider a0112cfb26 vs: add reconfigure checks for each target
Previously, this was only added to C/C++ targets, but not for others.
Thus, if you'd change a setting through `meson configure`, this was not
picked up, e.g. the install target said it was up-to-date and when force
rebuilding it, it also did not use the new settings until the build dir
was manually reconfigured.
2019-02-12 20:02:28 +02:00
Jussi Pakkanen 902aaf2ce6
Merge pull request #4626 from Ericson2314/consolidate-properties
Go through coreutils.compiler_options.{build.host.target}
2019-02-04 23:06:46 +01:00
Nicolas Schneider c1fa61b7d9 vs: add PCH headers to project
Otherwise, they will not be visible in the IDE.
2019-02-04 20:27:57 +01:00
John Ericson 19f81d3e33 Never access environment.properties downstream
Instead use coredata.compiler_options.<machine>. This brings the cross
and native code paths closer together, since both now use that.

Command line options are interpreted just as before, for backwards
compatibility. This does introduce some funny conditionals. In the
future, I'd like to change the interpretation of command line options so

 - The logic is cross-agnostic, i.e. there are no conditions affected by
   `is_cross_build()`.

 - Compiler args for both the build and host machines can always be
   controlled by the command line.

 - Compiler args for both machines can always be controlled separately.
2019-02-02 13:59:14 -05:00
Michael Hirsch, Ph.D da34bea893 pep8 py37 2019-01-29 22:06:11 +02:00
Nicolas Schneider 09739284be vs: fix PCH 2019-01-29 22:03:47 +02:00
Nicolas Schneider 2dcb6eb0b3 vs: escape embedded quotes of run targets 2019-01-27 20:10:09 +02:00
Nicolas Schneider f1b32aa4bb vs: respect 'b_pch' option
Fixes #4681.
2019-01-02 22:17:36 +02:00
John Preston ca2e378c98 Update VS files only if something changed.
If you change only some project in meson.build,
only that .vcxproj file will be updated and reloaded.

If you change something not related to VS solution and projects
or simply touch the meson.build file, nothing will be reloaded.
2018-12-07 21:36:48 +02:00
John Preston c17a80f47b Use correct environment for REGEN in VS backend.
Try to guess which VS Command Prompt was used for the Meson call.
If one is chosen invoke it before calling Meson in REGEN command.
2018-12-04 20:19:19 +02:00
Jussi Pakkanen 509afe752c Use /O1 instead of /Os for MSVC as the latter is deprecated. 2018-11-28 00:17:08 +02:00
Jussi Pakkanen 50d5bcff87 Remove MinimalRebuild as it is deprecated. Closes #4539. 2018-11-22 22:30:34 +02:00
John Preston 5d6dcf8850 Fix ProjectGuid values in VS projects. 2018-11-15 21:07:33 +02:00
John Preston 16144fd61b Add 'meson.build' to VS project files. 2018-11-15 21:06:31 +02:00
Jussi Pakkanen 54aed1a92c Added "native" kwarg to add_XXX_args. Closes #3669. 2018-08-22 23:22:48 +03:00
Jussi Pakkanen d83f77109a
Convert buildtype to optimization and debug options (#3489) 2018-08-18 20:39:47 +03:00
Emil Styrke 2e3e2abceb Fix @CURRENT_SOURCE_DIR@ in generator()
Fix @CURRENT_SOURCE_DIR@ pointing to the wrong directory if generator() is called from a subdir.
2018-08-07 04:57:34 -07:00
Jussi Pakkanen e75f6e4305
Merge pull request #3850 from mesonbuild/nirbheek/exe-wrapper-compiler-fallbacks
Be more permissive about not-found exe_wrapper
2018-07-31 19:33:06 +03:00
Jussi Pakkanen 7bb5f82736 Added install target to VS. Closes #3841. 2018-07-22 16:05:09 +03:00