blob: b11f03f582beb8e5206ce616121c722f71bfb942 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# Visual Studio's external build projects
Visual Studio supports developing projects that have an external build
system. If you wish to use this integration method, here is how you
set it up. This documentation describes Visual Studio 2019. Other
versions have not been tested, but they should work roughly in the
same way.
## Creating and compiling
Check out your entire project in some directory. Then open Visual
Studio and select `File -> New -> Project` and from the list of
project types select `Makefile project`. Click `Next`.
Type your project's name In the `Project name` entry box. In this
example we're going to use `testproj`. Next select the `Location`
entry and browse to the root of your project sources. Make sure that
the checkbox `Place solution and project in the same directory` is
checked. Click `Create`.
The next dialog page defines build commands, which you should set up
as follows:
| entry | value |
| ----- | ----- |
|build | `meson compile -C $(Configuration)` |
|clean | `meson compile -C $(Configuration) --clean` |
|rebuild| `meson compile -C $(Configuration) --clean && meson compile -C $(Configuration)` |
|Output | `$(Configuration)\name_of_your_executable.exe|
Then click `Finish`.
Visual Studio has created a subdirectory in your source root. It is
named after the project name. In this case it would be `testproj`. Now
you need to set up Meson for building both Debug and Release versions
in this directory. Open a VS dev tool terminal, go to the source root
and issue the following commands.
```
meson testproj\Debug
meson testproj\Release --buildtype=debugoptimized
```
Now you should have a working VS solution that compiles and runs both
in Debug and Release modes.
## Adding sources to the project
This project is not very useful on its own, because it does not list
any source files. VS does not seem to support adding entire source
trees at once, so you have to add sources to the solution manually.
In the main view go to `Solution Explorer`, right click on the project
you just created and select `Add -> Existing Item`, browse to your
source tree and select all files you want to have in this project. Now
you can use the editor and debugger as in a normal VS project.
|