PrusaSlicer-NonPlainar/doc/How to build - Windows.md

99 lines
5.5 KiB
Markdown
Raw Normal View History

2018-11-27 11:16:36 +00:00
# Building Slic3r PE on Microsoft Windows
2019-01-03 18:33:57 +00:00
The currently supported way of building Slic3r PE on Windows is with CMake and MS Visual Studio 2013.
You can use the free [Visual Studio 2013 Community Edition](https://www.visualstudio.com/vs/older-downloads/).
CMake installer can be downloaded from [the official website](https://cmake.org/download/).
2019-01-03 18:33:57 +00:00
Building with newer versions of MSVS (2015, 2017) may work too as reported by some of our users.
_Note:_ Thanks to [**@supermerill**](https://github.com/supermerill) for testing and inspiration on this guide.
2019-01-07 14:26:53 +00:00
2019-01-03 18:33:57 +00:00
### Dependencies
2019-01-03 18:33:57 +00:00
On Windows Slic3r is built against statically built libraries.
We provide a prebuilt package of all the needed dependencies.
The package comes in a several variants:
2019-01-07 14:26:53 +00:00
- [64 bit, Release mode only](https://bintray.com/vojtechkral/Slic3r-PE/download_file?file_path=destdir-64.7z) (41 MB, 578 MB unpacked)
- [64 bit, Release and Debug mode](https://bintray.com/vojtechkral/Slic3r-PE/download_file?file_path=destdir-64-dev.7z) (88 MB, 1.3 GB unpacked)
- [32 bit, Release mode only](https://bintray.com/vojtechkral/Slic3r-PE/download_file?file_path=destdir-32.7z) (38 MB, 520 MB unpacked)
- [32 bit, Release and Debug mode](https://bintray.com/vojtechkral/Slic3r-PE/download_file?file_path=destdir-32-dev.7z) (74 MB, 1.1 GB unpacked)
2019-01-03 18:33:57 +00:00
When unsure, use the _Release mode only_ variant, the _Release and Debug_ variant is only needed for debugging & developement.
2019-01-03 18:33:57 +00:00
If you're unsure where to unpack the package, unpack it into `C:\local\` (but it can really be anywhere).
2019-01-03 18:33:57 +00:00
Alternatively you can also compile the dependencies yourself, see below.
2019-01-03 18:33:57 +00:00
### Building Slic3r PE with Visual Studio
2019-01-03 18:33:57 +00:00
First obtain the Slic3 PE sources via either git or by extracting the source archive.
2019-01-03 18:33:57 +00:00
Then you will need to note down the so-called 'prefix path' to the dependencies, this is the location of the dependencies packages + `\usr\local` appended.
For example on 64 bits this would be `C:\local\destdir-64\usr\local`. The prefix path will need to be passed to CMake.
2019-01-03 18:33:57 +00:00
When ready, open the relevant Visual Studio command line and `cd` into the directory with Slic3r sources.
Use these commands to prepare Visual Studio solution file:
2019-01-03 18:33:57 +00:00
mkdir build
cd build
cmake .. -G "Visual Studio 12 Win64" -DCMAKE_PREFIX_PATH="<insert prefix path here>"
2019-01-03 18:33:57 +00:00
Note that if you're building a 32-bit variant, you will need to change the `"Visual Studio 12 Win64"` to just `"Visual Studio 12"`.
2019-01-03 18:33:57 +00:00
Conversely, if you're using Visual Studio version other than 2013, the version number will need to be changed accordingly.
2019-01-03 18:33:57 +00:00
If `cmake` has finished without errors, go to the build directory and open the `Slic3r.sln` solution file in Visual Studio.
Before building, make sure you're building the right project (use one of those starting with `slic3r_app_...`) and that you're building
with the right configuration, ie. _Release_ vs. _Debug_. When unsure, choose _Release_.
Note that you won't be able to build a _Debug_ variant against a _Release_-only dependencies package.
2019-01-07 14:26:53 +00:00
#### Installing using the `INSTALL` project
Slic3r PE can be run from the Visual Studio or from Visual Studio's build directory (`src\Release` or `src\Debug`),
but for longer-term usage you migth want to install somewhere using the `INSTALL` project.
By default, this installs into `C:\Program Files\Slic3r`.
To customize the install path, use the `-DCMAKE_INSTALL_PREFIX=<path of your choice>` when invoking `cmake`.
2019-01-03 18:33:57 +00:00
### Building from the command line
2019-01-03 18:33:57 +00:00
There are several options for building from the command line:
2019-01-03 18:33:57 +00:00
- [msbuild](https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-reference?view=vs-2017&viewFallbackFrom=vs-2013)
- [Ninja](https://ninja-build.org/)
- [nmake](https://docs.microsoft.com/en-us/cpp/build/nmake-reference?view=vs-2017)
2019-01-03 18:33:57 +00:00
To build with msbuild, use the same CMake command as in previous paragraph and then build using
2019-01-03 18:33:57 +00:00
msbuild /P:Configuration=Release ALL_BUILD.vcxproj
2019-01-07 14:26:53 +00:00
To build with Ninja or nmake, replace the `-G` option in the CMake call with `-G Ninja` or `-G "NMake Makefiles"` , respectively.
2019-01-03 18:33:57 +00:00
Then use either `ninja` or `nmake` to start the build.
2019-01-07 14:26:53 +00:00
To install, use `msbuild /P:Configuration=Release INSTALL.vcxproj` , `ninja install` , or `nmake install` .
2019-01-03 18:33:57 +00:00
### Building the dependencies package yourself
2019-01-03 18:33:57 +00:00
The dependencies package is built using CMake scripts inside the `deps` subdirectory of Slic3r PE sources.
(This is intentionally not interconnected with the CMake scripts in the rest of the sources.)
2019-01-07 14:26:53 +00:00
Open the preferred Visual Studio command line (64 or 32 bit variant) and `cd` into the directory with Slic3r sources.
2019-01-03 18:33:57 +00:00
Then `cd` into the `deps` directory and use these commands to build:
2019-01-03 18:33:57 +00:00
mkdir build
cd build
cmake .. -G "Visual Studio 12 Win64" -DDESTDIR="C:\local\destdir-custom"
msbuild ALL_BUILD.vcxproj
2019-01-03 18:33:57 +00:00
You can also use the Visual Studio GUI or other generators as mentioned above.
2019-01-03 18:33:57 +00:00
The `DESTDIR` option is the location where the bundle will be installed.
This may be customized. If you leave it empty, the `DESTDIR` will be places inside the same `build` directory.
2019-01-03 18:33:57 +00:00
Note that the build variant that you may choose using Visual Studio (ie. _Release_ or _Debug_ etc.) when building the dependency package is **not relevant**.
The dependency build will by default build _both_ the _Release_ and _Debug_ variants regardless of what you choose in Visual Studio.
You can disable building of the debug variant by passing the `-DDEP_DEBUG=OFF` option to CMake, this will only produce a _Release_ build.
2019-01-03 18:33:57 +00:00
Refer to the CMake scripts inside the `deps` directory to see which dependencies are built in what versions and how this is done.