---
# System prepended metadata

title: Setting up Windows environment for modmesh viewer
tags: [note]

---

# Setting up Windows environment for modmesh viewer

###### tags: `note`

## Tools

* [Python](https://www.python.org/downloads/)
* [CMake](https://cmake.org/download/)
* [Git](https://git-scm.com/downloads)
* [Visual Studio](https://visualstudio.microsoft.com/zh-hant/downloads/) (or Build Tools for Visual Studio if you only want command-line toolset)
    * ![](https://i.imgur.com/je64YGm.png)


## Dependencies

### python

``` ps
pip install PySide6 pybind11 numpy matplotlib pytest flake8 setuptools
```

### Qt

Tested on Qt 6.3.0 ~ 6.3.2

Download Qt installer(open-source version) click [here](https://www.qt.io/download)

![](https://i.imgur.com/1x1PYg4.png)

remember to restart the PC

#### Add Qt to PATH

1. Click on the Start Button
1. Search “環境變數(Enviroment variables)”
1. Click “環境變數…”
1. Click variable called “Path” and click “編輯…”
1. Click “新增”
1. Enter the path to the folder on your PATH. For example: `
    - `C:\Qt\6.3.0\msvc2019_64\bin`
    - `C:\Qt\6.3.2\msvc2019_64\lib\cmake`

### Windows 10 SDK

## Generating sln and vcxproj

```ps
cmake `
    -Dpybind11_DIR="$(pybind11-config --cmakedir)" 
    -S<path-to-source> `
    -B<path-to-build> 
```

i.g.
```
cd modmesh; mkdir build
cmake  -Dpybind11_DIR="$(pybind11-config --cmakedir)"  -S .  -B build
```

## Building from command line

```ps
cmake `
    --build <path-to-build>`
    --config <Debug|Release>`
    --target ALL_BUILD`
    --
```

i.g.
```
cmake --build build --config Release  --target ALL_BUILD
```

## Install modmesh Python package

```ps
cd <path-to-source>
mv ./build/cpp/binary/pymod_modmesh/<Debug|Release>/* ./modmesh
```
comment line 72 & 73 in `setup.py` and run
```ps
python setup.py install
```
run pytest
```ps
cd <path-to-source>/modmesh
python -m pytest ../tests/
```