2020-11-01 05:26:58 +01:00
# Windows
## Requirements
**Windows**:
You must be running 64 bit Windows 10, version 1703 or newer.
The build system requires [Developer Mode ](https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development ) to be enabled.
**Visual Studio**:
2020-11-11 13:17:37 +01:00
Install the [Visual Studio build tools ](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019 ).
2020-11-05 11:12:18 +01:00
Make sure the "C++ build tools" box is selected, and leave the default optional
components enabled on the right.
2020-11-01 05:26:58 +01:00
**Python 3.8**:
2021-01-31 11:54:43 +01:00
Download the 64 bit Python 3.8 from < https: / / python . org > . Run the installer,
and customize the installation. Select "install for all users", and choose
2020-11-01 05:26:58 +01:00
the install path as c:\python. Currently the build scripts require
Python to be installed in that location.
2020-11-05 11:12:18 +01:00
When the install is done, click on the "remove the path limit" button.
2020-12-02 02:23:01 +01:00
Python 3.9 is not currently recommended, as pylint does not support it yet.
2020-11-01 05:26:58 +01:00
**MSYS**:
2020-11-05 11:12:18 +01:00
Install [msys2 ](https://www.msys2.org/ ) into the default folder location.
2020-11-01 05:26:58 +01:00
2020-11-05 11:12:18 +01:00
After installation completes, run msys2, and run the following command:
2020-11-01 05:26:58 +01:00
```
2020-11-18 04:22:51 +01:00
$ pacman -S git
2020-11-01 05:26:58 +01:00
```
**Bazelisk**:
Use Start>Run to open PowerShell. Create a folder to store Bazelisk
2020-11-12 02:01:08 +01:00
and its working data. Anki's build scripts expect to find it in \bazel on the same drive as the source folder.
2020-11-01 05:26:58 +01:00
```
PS> mkdir \bazel
PS> cd \bazel
```
Then grab Bazelisk:
```
PS> \msys64\usr\bin\curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-windows-amd64.exe -o bazel.exe
```
2020-11-11 05:52:18 +01:00
NOTE: At the time of writing, Windows Defender is claiming this file has a virus. If it disappears
the first time you run Bazel, restoring it from the Defender settings should allow you to proceed.
2020-11-01 05:26:58 +01:00
**Source folder**:
2020-11-12 11:06:35 +01:00
Anki's source files do not need to be in a specific location other than on the
same drive as `\bazel` , but it's best to avoid long paths, as they can cause
problems.
2020-11-01 05:26:58 +01:00
## Running Anki during development
Open PowerShell and change to the top level of Anki's source folder,
then run
```
.\run
```
This will build Anki and run it in place.
2020-12-08 00:08:51 +01:00
The first build will take a while, as it downloads and builds a bunch of
2020-11-01 05:26:58 +01:00
dependencies. When the build is complete, Anki will automatically start.
2021-06-21 05:23:03 +02:00
The Javascript build code is currently a bit flaky, so the initial
build may fail with an error. If you get an error when running/building,
try repeating the command once or twice - it should pick up where it left off.
2020-12-16 10:09:45 +01:00
To play and record audio, mpv.exe and lame.exe must be on the path.
2020-11-01 05:26:58 +01:00
2020-12-07 02:50:03 +01:00
## Optimized builds
The `.\run` command will create a non-optimized build by default. This is faster
to compile, but will mean Anki will run considerably slower.
To run Anki in optimized mode, use:
```
.\scripts\runopt
```
2020-11-04 05:01:14 +01:00
## More
2020-11-01 05:26:58 +01:00
2020-11-05 02:01:30 +01:00
For info on running tests, building wheels and so on, please see
[Development ](./development.md ).
2020-11-01 05:26:58 +01:00
2020-11-04 05:01:14 +01:00
Note that where the instructions on that page say "bazel", please use ".\bazel"
instead. This runs bazel.bat inside the Anki source folder, instead of
calling Bazel directly. This takes care of setting up the path and output folder
correctly, which avoids issues with long path names.