forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Copyright (C) 2018-2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Arguments parsing | ||
param ( | ||
[string]$BuildDirectory = "", | ||
[string]$InstallDirectory = "", | ||
[switch]$Help, | ||
[switch]$h | ||
) | ||
|
||
$SourceDirectory = Split-Path $MyInvocation.MyCommand.Path | ||
$SamplesType = (Get-Item $SourceDirectory).Name | ||
$BuildDirectory = if ($BuildDirectory) {$BuildDirectory} else {"$Env:USERPROFILE/Documents/Intel/OpenVINO/openvino_${SamplesType}_samples_build"} | ||
|
||
if ($Help -or $h) { | ||
Write-Host " | ||
Build OpenVINO Runtime samples | ||
Options: | ||
-Help/-h Print the help message and exit | ||
-BuildDirectory Specify the samples build directory. Default is $BuildDirectory | ||
-InstallDirectory Specify the samples install directory | ||
" | ||
exit 0 | ||
} | ||
|
||
if (-not $Env:INTEL_OPENVINO_DIR) { | ||
$SetupVars = Join-Path $SourceDirectory "../../setupvars.ps1" | ||
if (Test-Path $SetupVars) { | ||
& $SetupVars | ||
} | ||
else | ||
{ | ||
Write-Host " | ||
Failed to set the environment variables automatically. To fix, run the following command: | ||
<INTEL_OPENVINO_DIR>/setupvars.ps1 | ||
where INTEL_OPENVINO_DIR is the OpenVINO installation directory | ||
" | ||
exit 1 | ||
} | ||
} | ||
|
||
Set-Location -Path $SourceDirectory | ||
New-Item -Path $BuildDirectory -ItemType Directory -Force | ||
Set-Location $BuildDirectory | ||
cmake -DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=ON $SourceDirectory | ||
|
||
Write-Host "Building command: cmake --build "$BuildDirectory" --config Release --parallel" | ||
cmake --build "$BuildDirectory" --config Release --parallel | ||
|
||
if ($InstallDirectory) { | ||
cmake -DCMAKE_INSTALL_PREFIX="$InstallDirectory" -DCOMPONENT=samples_bin -P "$BuildDirectory/cmake_install.cmake" | ||
Write-Host "Samples are built and installed into $InstallDirectory" | ||
} | ||
else | ||
{ | ||
Write-Host "Samples are built in $BuildDirectory" | ||
} |