install_openvino_dependencies: Updated copyrights (#2306)
[platform/upstream/dldt.git] / scripts / setupvars / setupvars.bat
1 @echo off
2
3 :: Copyright (c) 2018-2020 Intel Corporation
4 ::
5 :: Licensed under the Apache License, Version 2.0 (the "License");
6 :: you may not use this file except in compliance with the License.
7 :: You may obtain a copy of the License at
8 ::
9 ::      http://www.apache.org/licenses/LICENSE-2.0
10 ::
11 :: Unless required by applicable law or agreed to in writing, software
12 :: distributed under the License is distributed on an "AS IS" BASIS,
13 :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 :: See the License for the specific language governing permissions and
15 :: limitations under the License.
16
17 set ROOT=%~dp0
18 call :GetFullPath "%ROOT%\.." ROOT
19 set SCRIPT_NAME=%~nx0
20
21 set "INTEL_OPENVINO_DIR=%ROOT%"
22 set "INTEL_CVSDK_DIR=%INTEL_OPENVINO_DIR%"
23
24 :: OpenCV
25 if exist "%INTEL_OPENVINO_DIR%\opencv\setupvars.bat" (
26 call "%INTEL_OPENVINO_DIR%\opencv\setupvars.bat"
27 ) else (
28 set "OpenCV_DIR=%INTEL_OPENVINO_DIR%\opencv\x64\vc14\lib"
29 set "PATH=%INTEL_OPENVINO_DIR%\opencv\x64\vc14\bin;%PATH%"
30 )
31
32 :: Model Optimizer
33 if exist %INTEL_OPENVINO_DIR%\deployment_tools\model_optimizer (
34 set PYTHONPATH=%INTEL_OPENVINO_DIR%\deployment_tools\model_optimizer;%PYTHONPATH%
35 set "PATH=%INTEL_OPENVINO_DIR%\deployment_tools\model_optimizer;%PATH%"
36 )
37
38 :: Inference Engine
39 set "InferenceEngine_DIR=%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\share"
40 set "HDDL_INSTALL_DIR=%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\external\hddl"
41 set "PATH=%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\external\tbb\bin;%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\bin\intel64\Release;%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\bin\intel64\Debug;%HDDL_INSTALL_DIR%\bin;%PATH%"
42 if exist %INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\bin\intel64\arch_descriptions (
43 set ARCH_ROOT_DIR=%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\bin\intel64\arch_descriptions
44 )
45
46 :: nGraph
47 if exist %INTEL_OPENVINO_DIR%\deployment_tools\ngraph (
48 set "PATH=%INTEL_OPENVINO_DIR%\deployment_tools\ngraph\lib;%PATH%"
49 set "ngraph_DIR=%INTEL_OPENVINO_DIR%\deployment_tools\ngraph\cmake"
50 )
51
52 :: Check if Python is installed
53 python3 --version 2>NUL
54 if errorlevel 1 (
55    echo Error^: Python is not installed. Please install Python 3.6 or higher ^(64-bit^) from https://www.python.org/downloads/
56    exit /B 1
57 )
58
59 :: Check Python version
60 for /F "tokens=* USEBACKQ" %%F IN (`python3 --version 2^>^&1`) DO (
61    set version=%%F
62 )
63
64 for /F "tokens=1,2,3 delims=. " %%a in ("%version%") do (
65    set Major=%%b
66    set Minor=%%c
67 )
68
69 if "%Major%" geq "3" (
70    if "%Minor%" geq "6" (
71       set python_ver=okay
72    )
73 )
74
75 if not "%python_ver%"=="okay" (
76    echo Unsupported Python version. Please install Python 3.6 or higher ^(64-bit^) from https://www.python.org/downloads/
77    exit /B 1
78 )
79
80 :: Check Python bitness
81 python3 -c "import sys; print(64 if sys.maxsize > 2**32 else 32)" 2 > NUL
82 if errorlevel 1 (
83    echo Error^: Error during installed Python bitness detection
84    exit /B 1
85 )
86
87 for /F "tokens=* USEBACKQ" %%F IN (`python -c "import sys; print(64 if sys.maxsize > 2**32 else 32)" 2^>^&1`) DO (
88    set bitness=%%F
89 )
90
91 if not "%bitness%"=="64" (
92    echo Unsupported Python bitness. Please install Python 3.6 or higher ^(64-bit^) from https://www.python.org/downloads/
93    exit /B 1
94 )
95
96 set PYTHONPATH=%INTEL_OPENVINO_DIR%\python\python%Major%.%Minor%;%INTEL_OPENVINO_DIR%\python\python3;%PYTHONPATH%
97
98 if exist %INTEL_OPENVINO_DIR%\deployment_tools\open_model_zoo\tools\accuracy_checker (
99     set PYTHONPATH=%INTEL_OPENVINO_DIR%\deployment_tools\open_model_zoo\tools\accuracy_checker;%PYTHONPATH%
100 )
101
102 if exist %INTEL_OPENVINO_DIR%\deployment_tools\tools\post_training_optimization_toolkit (
103     set PYTHONPATH=%INTEL_OPENVINO_DIR%\deployment_tools\tools\post_training_optimization_toolkit;%PYTHONPATH%
104 )
105
106 echo [setupvars.bat] OpenVINO environment initialized
107
108 exit /B 0
109
110 :GetFullPath
111 SET %2=%~f1
112
113 GOTO :EOF