|
| 1 | +# Build using Visual Studio and vcpkg |
| 2 | + |
| 3 | +Follow these steps to build OpenSCAD with Microsoft Visual Studio: |
| 4 | + |
| 5 | +- Make sure you have git installed and in your PATH. For installing Git, follow the |
| 6 | + instructions [here](https://github.com/git-guides/install-git). |
| 7 | + To add a variable to PATH, a tutorial is available [here](https://www.eukhost.com/kb/how-to-add-to-the-path-on-windows-10-and-windows-11/) |
| 8 | +- Install Visual Studio 2022. Check the 'Desktop development with C++' component |
| 9 | + in the VS installer. |
| 10 | +- Download WinFlexBison binaries from the project's Github page: |
| 11 | + https://github.com/lexxmark/winflexbison. Unzip it somewhere convenient and |
| 12 | + add that location to your PATH. |
| 13 | +- Install vcpkg in a convenient location with a short path (this is important), |
| 14 | + e.g. c:\vcpkg or d:\vcpkg. Instructions are at |
| 15 | + https://vcpkg.io/en/getting-started but an even shorter version is to do: |
| 16 | + |
| 17 | + ``` |
| 18 | + cd d:\vcpkg |
| 19 | + git clone https://github.com/Microsoft/vcpkg.git |
| 20 | + .\vcpkg\bootstrap-vcpkg.bat |
| 21 | + ``` |
| 22 | +- Then add d:\vcpkg to your PATH. |
| 23 | + Clone the OpenSCAD repo somewhere (in this example, d:\openscad) and run |
| 24 | + scripts\win-msvc-build.bat in it: |
| 25 | + |
| 26 | + ``` |
| 27 | + git clone https://github.com/openscad/openscad.git |
| 28 | + cd openscad |
| 29 | + scripts\win-msvc-build.bat |
| 30 | + ``` |
| 31 | +
|
| 32 | +What that batch file does is first install all required packages through vcpkg, |
| 33 | +then generate Visual Studio project files in the 'build' directory and finally |
| 34 | +builds Release and Debug versions. Results will be in build\Debug and |
| 35 | +build\Release. |
| 36 | +
|
| 37 | +If you encounter issues installing vcpkg packages, a solution is manually installing via `vcpkg install dep:x64-windows`, and disabling manifest mode installation. A helpful command for doing this can be found in `scripts/win-msvc-build.bat` |
| 38 | +
|
| 39 | +For building OpenSCAD with GUI mode on (Work in Progress), a [branch](https://github.com/Sparsh-N/openscad/tree/msvc-gui) can be used. For this, you would need Qt and QScintilla installed and compiled from source, not vcpkg. |
0 commit comments