Skip to content

Commit 60536da

Browse files
committed
Added MSVC section to the compilation manual
1 parent 8a78643 commit 60536da

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

doc/compiling.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Compiling from sources
22

33

4-
## Microsoft Windows (10, 11)
4+
## Microsoft Windows - MINGW (10, 11)
55

66
### Common Requirements
77

@@ -39,6 +39,48 @@ Depending on the flavour of compilation the final executables will be placed in
3939
[ST-LINK drivers](https://www.st.com/en/development-tools/stsw-link009.html) are required for programmers to work with `stlink`.
4040

4141

42+
## Microsoft Windows - MSVC (10, 11)
43+
44+
### Common Requirements
45+
46+
On Windows users should ensure that the following software is installed:
47+
48+
- `git` (Required for building LibUSB if missing)
49+
- `7zip`
50+
- `cmake`
51+
- `MSVC` Compiler (Tested with Visual Studio 2022 and Build Tools for Visual Studio 2022)
52+
53+
### Installation
54+
55+
1. Install `Build Tools for Visual Studio` from <https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022>
56+
2. Install `cmake` from <https://cmake.org/download/#latest> --> Binary distributions --> Windows x64 Installer<br />
57+
Ensure that you add cmake to the $PATH system variable when following the instructions by the setup assistant.
58+
Follow the installation instructions on the website.
59+
3. Fetch the project source files by running `git clone https://github.com/stlink-org/stlink.git` from the command-line (`cmd.exe`/`powershell.exe`)<br />
60+
or download and extract (`7zip`) the latest stlink `.zip` release from the Release page on GitHub.
61+
62+
### Building
63+
64+
1. Open the command-line (`cmd.exe`/`powershell.exe`) with administrator privileges
65+
2. Move to the `stlink` directory with `cd C:\$Path-to-your-stlink-folder$\`
66+
3. Create a new `build` subdirectory and move into it with `cd .\build`.
67+
4. Configure the project, using the following command: `cmake -G "Visual Studio 17 2022" .. -DCMAKE_BUILD_TYPE="Release"`
68+
5. Build the project, using the following command: `cmake --build . --target ALL_BUILD`
69+
6. Install the project, using the following command: `cmake --build . --target INSTALL`
70+
7. Add the `bin` folder of the installation path (`C:\Program Files (x86)\stlink\bin`) to the `PATH` environment variables:
71+
1. Run `SystemPropertiesAdvanced.exe`
72+
2. press on `Environment Variables` button
73+
3. On `System Variables` list, find and select `Path` variable
74+
4. Press `Edit..` button bellow the list
75+
5. On the new Window, press `New` button
76+
6. On the new row, type the `bin` path of your installation (`C:\Program Files (x86)\stlink\bin`)
77+
7. Press `OK` button to all three windows to save your changes
78+
79+
**NOTE:**
80+
81+
1. [ST-LINK drivers](https://www.st.com/en/development-tools/stsw-link009.html) are required for programmers to work with `stlink`.
82+
2. Package generation for MSVC is not yet implemented/tested.
83+
4284
## Linux
4385

4486
### Common requirements

0 commit comments

Comments
 (0)