diff --git a/src/docs/BUILD.md b/src/docs/BUILD.md index 452fc17bb0..54d7faeec3 100644 --- a/src/docs/BUILD.md +++ b/src/docs/BUILD.md @@ -36,7 +36,7 @@ The preferred approach is to build both OpenVINO and OpenVINO GenAI from sources ## Build Instructions -### Build OpenVINO, OpenVINO Tokenizers, and OpenVINO GenAI from sources +### Build OpenVINO, OpenVINO Tokenizers, and OpenVINO GenAI From Source 1. Build and install OpenVINO from sources following the [instructions](https://github.com/openvinotoolkit/openvino/wiki#how-to-build). The path to the OpenVINO install directory is referred as `` throughout the document. @@ -45,39 +45,103 @@ The path to the OpenVINO install directory is referred as `` throug git clone --recursive https://github.com/openvinotoolkit/openvino.genai.git cd openvino.genai ``` -3. Build the project: +3. Set up the environment: + + #### Option 1 - using OpenVINO `setupvars` script: + + Linux and macOS: ```sh source /setupvars.sh - cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - cmake --build ./build/ --config Release -j - cmake --install ./build/ --config Release --prefix ``` - > **NOTE**: For running setupvars script on Windows, use command `call \setupvars.bat` for Windows Command Prompt or `. /setupvars.ps1` for Windows PowerShell. -To optimize the package size, you can reduce the ICU (International Components for Unicode) data size when building OpenVINO Tokenizers. -For more information please refer to the [OpenVINO Tokenizers instructions](https://github.com/openvinotoolkit/openvino_tokenizers?tab=readme-ov-file#reducing-the-icu-data-size). + Windows Command Prompt: + ```cmd + call \setupvars.bat + ``` -### Build OpenVINO GenAI only + Windows PowerShell: + ```cmd + . /setupvars.ps1 + ``` -Assuming that you have OpenVINO installed at ``: + #### Option 2 - setting environment variables manually: -1. Clone OpenVINO GenAI repository and init submodules: + Linux: ```sh - git clone --recursive https://github.com/openvinotoolkit/openvino.genai.git - cd openvino.genai + export OpenVINO_DIR=/runtime + export PYTHONPATH=/python:./build/:$PYTHONPATH + export LD_LIBRARY_PATH=/runtime/lib/intel64:$LD_LIBRARY_PATH ``` -2. Build the project: + + macOS: ```sh export OpenVINO_DIR=/runtime + export PYTHONPATH=/python:./build/:$PYTHONPATH + export DYLD_LIBRARY_PATH=/runtime/lib/intel64:$LD_LIBRARY_PATH + ``` + + Windows Command Prompt: + ```cmd + set OpenVINO_DIR=\runtime + set PYTHONPATH=\python;%CD%\build;%PYTHONPATH% + set PATH=\runtime\lib\intel64;%PATH% + ``` + + Windows PowerShell: + ```sh + $env:OpenVINO_DIR = "\runtime" + $env:PYTHONPATH = "\python;$PWD\build;$env:PYTHONPATH" + $env:PATH = "\runtime\lib\intel64;$env:PATH" + ``` + +4. Build the project: + ```sh cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - cmake --build ./build/ --config Release --target package -j + cmake --build ./build/ --config Release -j ``` -3. Set environment variables: + +5. Install OpenVINO GenAI: + + #### Option 1 - using cmake: + + The following command will store built OpenVINO GenAI artifacts along with OpenVINO in ``: + ```sh - export PYTHONPATH=/python:./build/:${PYTHONPATH} - export LD_LIBRARY_PATH=/runtime/lib/intel64:${LD_LIBRARY_PATH} + cmake --install ./build/ --config Release --prefix ``` + #### Option 2 - setting paths to built OpenVINO GenAI artifacts manually: + + The path to the OpenVINO GenAI root directory is referred as `` throughout the document. + + Linux: + ```sh + export PYTHONPATH=/build/:$PYTHONPATH + export LD_LIBRARY_PATH=/build/openvino_genai/:$LD_LIBRARY_PATH + ``` + + macOS: + ```sh + export PYTHONPATH=/build:$PYTHONPATH + export DYLD_LIBRARY_PATH=/build/openvino_genai:$DYLD_LIBRARY_PATH + ``` + + Windows Command Prompt: + ```cmd + set PYTHONPATH=\build;%PYTHONPATH% + set PATH=\build\openvino_genai;%PATH% + ``` + + Windows PowerShell: + ```sh + $env:PYTHONPATH = "\build;$env:PYTHONPATH" + $env:PATH = "\build\openvino_genai;$env:PATH" + ``` + +To optimize the package size, you can reduce the ICU (International Components for Unicode) data size when building OpenVINO Tokenizers. +For more information please refer to the [OpenVINO Tokenizers instructions](https://github.com/openvinotoolkit/openvino_tokenizers?tab=readme-ov-file#reducing-the-icu-data-size). + + ### Build OpenVINO GenAI Wheel 1. Clone OpenVINO GenAI repository and init submodules: @@ -90,11 +154,11 @@ Assuming that you have OpenVINO installed at ``: ```sh source /setupvars.sh ``` - - Option 2 - setting environment variable manually: + - Option 2 - setting environment variables manually: ```sh export OpenVINO_DIR=/runtime - export PYTHONPATH=/python:./build/:${PYTHONPATH} - export LD_LIBRARY_PATH=/runtime/lib/intel64:${LD_LIBRARY_PATH} + export PYTHONPATH=/python:./build/:$PYTHONPATH + export LD_LIBRARY_PATH=/runtime/lib/intel64:$LD_LIBRARY_PATH ``` 3. Upgrade pip to ensure you have the latest version: ```sh @@ -117,11 +181,11 @@ Assuming that you have OpenVINO installed at ``: ```sh source /setupvars.sh ``` - - Option 2 - setting environment variable manually: + - Option 2 - setting environment variables manually: ```sh export OpenVINO_DIR=/runtime - export PYTHONPATH=/python:./build/:${PYTHONPATH} - export LD_LIBRARY_PATH=/runtime/lib/intel64:${LD_LIBRARY_PATH} + export PYTHONPATH=/python:./build/:$PYTHONPATH + export LD_LIBRARY_PATH=/runtime/lib/intel64:$LD_LIBRARY_PATH ``` 3. Upgrade pip to ensure you have the latest version: ```sh