Skip to content

Commit 1347342

Browse files
RyzhtusRyzhtusValeriy Fedyuninfavorart
authored
Update installation docs (#484)
* Update C++ and add PythonWrapper installation docs Signed-off-by: Ryzhtus <shkunkov.a@yandex.ru> * Fix link to the Troubleshooting section in cpp.md Signed-off-by: Ryzhtus <shkunkov.a@yandex.ru> --------- Signed-off-by: Ryzhtus <shkunkov.a@yandex.ru> Co-authored-by: Ryzhtus <shkunkov.a@yandex.ru> Co-authored-by: Valeriy Fedyunin <valery.fedyunin@abbyy.com> Co-authored-by: Kirill Golikov <kirill.golikov@abbyy.com>
1 parent d266726 commit 1347342

File tree

4 files changed

+121
-2
lines changed

4 files changed

+121
-2
lines changed

NeoML/docs/en/Installation/cpp.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- [Linux/macOS](#linux/macos)
88
- [Android](#android)
99
- [iOS](#ios)
10+
- [Troubleshooting](#troubleshooting)
1011

1112
<!-- /TOC -->
1213

@@ -36,6 +37,7 @@ cmake -G "Visual Studio 14 2015" -A <arch> <path_to_src>/NeoML -DCMAKE_INSTALL_P
3637
```
3738

3839
* \<arch> can be win32 or x64.
40+
* \<install_path> is the **Build** directory created at the previous step.
3941

4042
Now you can build the project using Visual Studio or this command line:
4143

@@ -103,4 +105,15 @@ cmake --build . --target install --config <cfg>
103105

104106
* \<cfg> can take the values: Debug, Release, RelWithDebInfo, MinSizeRel.
105107

106-
You will get three frameworks as a result: **NeoML.framework**, **NeoMathEngine.framework**, and **NeoOnnx.framework**.
108+
You will get three frameworks as a result: **NeoML.framework**, **NeoMathEngine.framework**, and **NeoOnnx.framework**.
109+
110+
## Troubleshooting
111+
112+
**Protobuf**
113+
114+
On Windows, CMake sometimes can't see the path to the Protobuf library. To handle this, you can specify it yourself by adding `-DCMAKE_PREFIX_PATH=<path_to_Protobuf>` to the CMake command, that creates a project.
115+
116+
In this case, you will get the following CMake command:
117+
``` console
118+
cmake -G "Visual Studio 14 2015" -A <arch> <path_to_src>/NeoML -DCMAKE_INSTALL_PREFIX=<install_path> -DCMAKE_PREFIX_PATH=<path_to_Protobuf>
119+
```
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Build the Python Wrapper
2+
3+
<!-- TOC -->
4+
5+
- [Before build](#before-build)
6+
- [Windows](#windows)
7+
8+
<!-- /TOC -->
9+
10+
## Before build
11+
12+
Download the library sources from the repository:
13+
14+
``` sh
15+
git clone https://github.com/neoml-lib/neoml <path_to_src>
16+
```
17+
18+
Create a working directory next to the sources:
19+
20+
``` sh
21+
mkdir PythonBuild
22+
cd PythonBuild
23+
```
24+
25+
The sample command lines below use [the standard CMake commands and options](https://cmake.org/cmake/help/latest/index.html) that specify build architecture, configuration, compiler to use, etc. Change the options as needed.
26+
27+
## Windows
28+
The installation procces is similar to the C++ instruction, except that you have to specify a path to the Python Wrapper, instead of NeoML C++ version. This is because Python Wrapper has it's own CMakeLists file stored in **NeoML/Python**.
29+
You need Microsoft Visual Studio 2015 or later to create a project. Here is a sample command line that does it:
30+
31+
``` console
32+
cmake -G "Visual Studio 14 2015" -A <arch> <path_to_src>/NeoML/Python -DCMAKE_INSTALL_PREFIX=<install_path>
33+
```
34+
35+
* \<arch> can be win32 or x64.
36+
* \<install_path> is the **PythonBuild** directory created at the previous step.
37+
38+
Now you can build the project using Visual Studio or this command line:
39+
40+
``` console
41+
cmake --build . --target install --config <cfg>
42+
```
43+
44+
* \<cfg> can take the values: Debug, Release, RelWithDebInfo, MinSizeRel.
45+

NeoML/docs/ru/Installation/cpp.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- [Linux/macOS](#linux/macos)
88
- [Android](#android)
99
- [iOS](#ios)
10+
- [Troubleshooting](#troubleshooting)
1011

1112
<!-- /TOC -->
1213

@@ -38,6 +39,8 @@ cmake -G "Visual Studio 14 2015" -A <arch> <path_to_src>/NeoML -DCMAKE_INSTALL_P
3839
```
3940

4041
* \<arch> может принимать значение win32 или x64.
42+
* \<install_path> путь к **Build** директории, созданной на предыдущем шаге.
43+
4144

4245
Теперь можно открыть проект и собрать его с помощью Visual Studio, либо воспользоваться командой:
4346

@@ -105,4 +108,15 @@ cmake --build . --target install --config <cfg>
105108

106109
* \<cfg> может принимать одно из следующих значений: Debug, Release, RelWithDebInfo, MinSizeRel.
107110

108-
Результатами сборки будут три фреймворка: **NeoML.framework**, **NeoMathEngine.framework** и **NeoOnnx.framework**.
111+
Результатами сборки будут три фреймворка: **NeoML.framework**, **NeoMathEngine.framework** и **NeoOnnx.framework**.
112+
113+
## Troubleshooting
114+
115+
**Protobuf**
116+
117+
Иногда на ОС Windows, CMake не может найти путь к библиотеке Protobuf во время генерации проекта. Чтобы это исправить, можно самому указать путь к корневой папке библиотеке с помощью добавления аргумента `-DCMAKE_PREFIX_PATH=<path_to_Protobuf>` к команде CMake, которая генерирует проект.
118+
119+
В этом случае, команда CMake выглядит следующим образом:
120+
``` console
121+
cmake -G "Visual Studio 14 2015" -A <arch> <path_to_src>/NeoML -DCMAKE_INSTALL_PREFIX=<install_path> -DCMAKE_PREFIX_PATH=<path_to_Protobuf>
122+
```
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Build the Python Wrapper
2+
3+
<!-- TOC -->
4+
5+
- [Перед сборкой](#перед-сборкой)
6+
- [Windows](#windows)
7+
8+
<!-- /TOC -->
9+
10+
## Перед сборкой
11+
12+
Скачайте исходный код библиотеки из репозитория:
13+
14+
``` sh
15+
git clone https://github.com/neoml-lib/neoml <path_to_src>
16+
```
17+
18+
Создайте рабочую директорию рядом с исходным кодом:
19+
20+
``` sh
21+
mkdir PythonBuild
22+
cd PythonBuild
23+
```
24+
25+
В приведённых примерах мы используем [стандартные команды и опции CMake](https://cmake.org/cmake/help/latest/index.html), с помощью которых задаётся архитектура, конфигурация сборки, компилятор и т.п. Поменяйте настройки под себя, если нужно.
26+
27+
## Windows
28+
Процесс установки аналогичен инструкции по сборке С++ версии, но нужно указать другой путь к Python-обертке, поскольку у нее свой CMakeLists файл. Он находится в директории **NeoML/Python**.
29+
Чтобы создать проект, потребуется Microsoft Visual Studio версии 2015 или выше.
30+
31+
Пример команды для генерации проекта:
32+
33+
``` console
34+
cmake -G "Visual Studio 14 2015" -A <arch> <path_to_src>/NeoML/Python -DCMAKE_INSTALL_PREFIX=<install_path>
35+
```
36+
37+
* \<arch> может принимать значение win32 или x64.
38+
* \<install_path> путь к **PythonBuild** директории, созданной на предыдущем шаге.
39+
40+
41+
Теперь можно открыть проект и собрать его с помощью Visual Studio, либо воспользоваться командой:
42+
43+
``` console
44+
cmake --build . --target install --config <cfg>
45+
```
46+
47+
* \<cfg> может принимать одно из следующих значений: Debug, Release, RelWithDebInfo, MinSizeRel.

0 commit comments

Comments
 (0)