Skip to content

Commit c9c3869

Browse files
author
Sheil Kumar
committed
Build opencv rather than checking in binaries
1 parent 6f0f0ea commit c9c3869

File tree

13 files changed

+181
-32
lines changed

13 files changed

+181
-32
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*.userprefs
1414

1515
# Build results
16+
[Bb]uild/
1617
[Dd]ebugPublic/
1718
[Rr]eleases/
1819
[Ii]nt/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "Samples/RustSqueezenet/winrt-rs"]
55
path = Samples/RustSqueezenet/winrt-rs
66
url = https://github.com/microsoft/winrt-rs.git
7+
[submodule "external/opencv"]
8+
path = external/opencv
9+
url = https://github.com/opencv/opencv.git

Samples/WinMLSamplesGallery/WinMLSamplesGallery (Package)/WinMLSamplesGallery (Package).wapproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
</ItemGroup>
129129
<ItemGroup>
130130
<None Include="$(SolutionDir)$(Platform)\$(Configuration)\WinMLSamplesGalleryNative\*.dll" Link="%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
131-
<None Include="$(SolutionDir)..\..\external\opencv\4.5.4\$(Platform)\$(Configuration)\bin\*.dll" Link="%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
131+
<None Include="$(SolutionDir)..\..\build\external\opencv\cmake_config\$(Platform)\bin\$(Configuration)\*.dll" Link="%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
132132
</ItemGroup>
133133
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
134134
<ItemGroup>

Samples/WinMLSamplesGallery/WinMLSamplesGallery/SampleMetadata/SampleMetadata.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ public static async Task<List<SampleMetadata>> GetAllSampleMetadata()
3939
for (int i = 0; i < metadataJsonArray.Count; i++)
4040
{
4141
JsonObject currentSampleMetadata = metadataJsonArray[i].GetObject();
42+
43+
bool shouldHideSample = false;
44+
#if !USE_OPENCV
45+
shouldHideSample |= currentSampleMetadata["Tag"].GetString() == "OpenCVInterop";
46+
#endif
47+
48+
if (shouldHideSample)
49+
{
50+
continue;
51+
}
52+
4253
allSampleMetadata.Add(new SampleMetadata
4354
{
4455
Title = currentSampleMetadata["Title"].GetString(),

Samples/WinMLSamplesGallery/WinMLSamplesGallery/Samples/OpenCVInterop/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,22 @@ Windows ML will be used to resize and tensorize the image into NCHW format, as w
2222
- [OpenCV LICENSE](../../../../../external/opencv/4.5.4/LICENSE)
2323

2424
## Getting Started
25-
- Check out the [source](https://github.com/microsoft/Windows-Machine-Learning/blob/91e493d699df80a633654929418f41bab136ae1d/Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/OpenCVImage.cpp#L21)
25+
In order to build this sample, OpenCV will need to be built and linked into the WinML Samples Gallery. The OpenCV project is included as a submodule, and will need to be synced and built for your Platform Architecture and Configuration before it will appear in the Windows ML Samples Gallery. To do so follow these instructions:
26+
- Launch a Visual Studio Developer Command Prompt.
27+
- Navigate to root.
28+
- Sync submodules with `git submodule update --init --recursive`
29+
- Launch Powershell with `powershell`
30+
- Build the OpenCV project with
31+
32+
`.\external\tools\BuildOpenCV.ps1 -Architecture <ARCH> -Configuration <CONFIGURATION>`
33+
34+
For example:
35+
36+
`.\external\tools\BuildOpenCV.ps1 -Architecture x64 -Configuration Debug`
37+
- Launch the `WinMLSamplesGallery.sln` and build with the same **Architecture** and **Configuration** to see the sample appear.
38+
39+
40+
You can check out the source [here](https://github.com/microsoft/Windows-Machine-Learning/blob/91e493d699df80a633654929418f41bab136ae1d/Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/OpenCVImage.cpp#L21).
2641

2742
## Feedback
2843
Please file an issue [here](https://github.com/microsoft/Windows-Machine-Learning/issues/new) if you encounter any issues with this sample.

Samples/WinMLSamplesGallery/WinMLSamplesGallery/WinMLSamplesGallery.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@
99
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
1010
<UseWinUI>true</UseWinUI>
1111
<UseLargeModels Condition="$(UseLargeModels) == ''">false</UseLargeModels>
12+
<OpenCVLib Condition="'$(Configuration)'=='Debug'">opencv_world454d.lib</OpenCVLib>
13+
<OpenCVLib Condition="'$(Configuration)'=='Release'">opencv_world454.lib</OpenCVLib>
14+
<OpenCVLibFullPath>$(SolutionDir)..\..\build\external\opencv\cmake_config\$(Platform)\lib\$(Configuration)\$(OpenCVLib)</OpenCVLibFullPath>
15+
<UseOpenCV>False</UseOpenCV>
16+
<UseOpenCV Condition="Exists('$(OpenCVLibFullPath)')">True</UseOpenCV>
1217
<DefineConstants Condition="$(UseLargeModels)">$(DefineConstants);USE_LARGE_MODELS</DefineConstants>
18+
<DefineConstants Condition="$(UseOpenCV)">$(DefineConstants);USE_OPENCV</DefineConstants>
1319
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1420
</PropertyGroup>
1521
<ItemGroup>

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/OpenCVImage.cpp

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
#include "winrt/Microsoft.AI.MachineLearning.h"
88

99
#include "WeakBuffer.h"
10-
1110
#include <wrl.h>
12-
1311
#include <sstream>
1412

1513
namespace wrl = ::Microsoft::WRL;
@@ -20,31 +18,44 @@ namespace winrt::WinMLSamplesGalleryNative::implementation
2018
{
2119
OpenCVImage::OpenCVImage(winrt::hstring path)
2220
{
21+
#ifdef USE_OPENCV
2322
image_ = cv::imread(winrt::to_string(path), cv::IMREAD_COLOR);
23+
#endif
2424
}
2525

26+
#ifdef USE_OPENCV
2627
OpenCVImage::OpenCVImage(cv::Mat&& image) : image_(std::move(image)) {
2728
}
29+
#endif
2830

2931
winrt::Windows::Storage::Streams::IBuffer OpenCVImage::AsWeakBuffer()
3032
{
33+
#ifdef USE_OPENCV
3134
auto cz_buffer = image_.ptr();
3235
auto size = image_.total()* image_.elemSize();
3336
winrt::com_ptr<abi_wss::IBuffer> ptr;
3437
wrl::MakeAndInitialize<details::WeakBuffer<uint8_t>>(ptr.put(), cz_buffer, cz_buffer + size);
3538
return ptr.as<winrt::Windows::Storage::Streams::IBuffer>();
39+
#else
40+
return nullptr;
41+
#endif
3642
}
3743

3844
winrt::Microsoft::AI::MachineLearning::ITensor OpenCVImage::AsTensor()
3945
{
46+
#ifdef USE_OPENCV
4047
auto buffer = AsWeakBuffer();
4148
return winrt::Microsoft::AI::MachineLearning::TensorUInt8Bit::CreateFromBuffer(
4249
std::vector<int64_t>{ 1, image_.rows, image_.cols, 3 }, buffer);
50+
#else
51+
return nullptr;
52+
#endif
4353
}
4454

4555

4656
winrt::Windows::Graphics::Imaging::SoftwareBitmap OpenCVImage::AsSoftwareBitmap()
4757
{
58+
#ifdef USE_OPENCV
4859
cv::Mat bgra_image;
4960
cv::cvtColor(image_, bgra_image, cv::COLOR_RGB2RGBA);
5061

@@ -55,18 +66,24 @@ namespace winrt::WinMLSamplesGalleryNative::implementation
5566
winrt::Windows::Graphics::Imaging::SoftwareBitmap::CreateCopyFromBuffer(
5667
bgra_buffer, winrt::Windows::Graphics::Imaging::BitmapPixelFormat::Bgra8, image_.cols, image_.rows);
5768
return software_bitmap;
69+
#else
70+
return nullptr;
71+
#endif
5872
}
5973

6074
void OpenCVImage::Close()
6175
{
76+
#ifdef USE_OPENCV
6277
image_.deallocate();
78+
#endif
6379
}
6480

6581
winrt::WinMLSamplesGalleryNative::OpenCVImage OpenCVImage::CreateFromPath(hstring const& path) {
6682
return winrt::make<OpenCVImage>(path);
6783
}
6884

6985
winrt::WinMLSamplesGalleryNative::OpenCVImage OpenCVImage::AddSaltAndPepperNoise(winrt::WinMLSamplesGalleryNative::OpenCVImage image) {
86+
#ifdef USE_OPENCV
7087
auto& image_mat = image.as<implementation::OpenCVImage>().get()->image_;
7188
cv::Mat saltpepper_noise = cv::Mat::zeros(image_mat.rows, image_mat.cols, CV_8U);
7289
randu(saltpepper_noise, 0, 255);
@@ -79,12 +96,19 @@ namespace winrt::WinMLSamplesGalleryNative::implementation
7996
saltpepper_img.setTo(0, black);
8097

8198
return winrt::make<OpenCVImage>(std::move(saltpepper_img));
99+
#else
100+
return nullptr;
101+
#endif
82102
}
83103

84104
winrt::WinMLSamplesGalleryNative::OpenCVImage OpenCVImage::DenoiseMedianBlur(winrt::WinMLSamplesGalleryNative::OpenCVImage image) {
105+
#ifdef USE_OPENCV
85106
auto& image_mat = image.as<implementation::OpenCVImage>().get()->image_;
86107
cv::Mat denoised;
87108
cv::medianBlur(image_mat, denoised, 5);
88109
return winrt::make<OpenCVImage>(std::move(denoised));
110+
#else
111+
return nullptr;
112+
#endif
89113
}
90114
}

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/OpenCVImage.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
#pragma once
22
#include "OpenCVImage.g.h"
33

4-
#include <opencv2/opencv.hpp>
4+
#ifdef USE_OPENCV
5+
#include <opencv2/opencv.hpp>
6+
#endif
7+
58

69
namespace winrt::WinMLSamplesGalleryNative::implementation
710
{
811
struct OpenCVImage : OpenCVImageT<OpenCVImage>
912
{
1013
OpenCVImage(winrt::hstring path);
11-
OpenCVImage(cv::Mat&& image);
14+
#ifdef USE_OPENCV
15+
OpenCVImage(cv::Mat&& image);
16+
#endif
1217

1318
static winrt::WinMLSamplesGalleryNative::OpenCVImage CreateFromPath(hstring const& path);
1419
static winrt::WinMLSamplesGalleryNative::OpenCVImage AddSaltAndPepperNoise(winrt::WinMLSamplesGalleryNative::OpenCVImage image);
@@ -20,7 +25,9 @@ namespace winrt::WinMLSamplesGalleryNative::implementation
2025
void Close();
2126

2227
private:
28+
#ifdef USE_OPENCV
2329
cv::Mat image_;
30+
#endif
2431
};
2532
}
2633
namespace winrt::WinMLSamplesGalleryNative::factory_implementation

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/WinMLSamplesGalleryNative.vcxproj

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -98,42 +98,44 @@
9898
<ModuleDefinitionFile>WinMLSamplesGalleryNative.def</ModuleDefinitionFile>
9999
</Link>
100100
</ItemDefinitionGroup>
101-
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
101+
102+
<ItemDefinitionGroup>
102103
<ClCompile>
103-
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
104-
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(SolutionDir)..\..\external\opencv\4.5.4\neutral\include;$(MSBuildThisFileDirectory)../../build/native/include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
105-
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\..\external\opencv\4.5.4\neutral\include;$(MSBuildThisFileDirectory)../../build/native/include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
106-
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\..\external\opencv\4.5.4\neutral\include;$(MSBuildThisFileDirectory)../../build/native/include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
104+
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)../../build/native/include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
105+
</ClCompile>
106+
</ItemDefinitionGroup>
107+
108+
<!-- OpenCV -->
109+
<PropertyGroup>
110+
<OpenCVLib Condition="'$(Configuration)'=='Debug'">opencv_world454d.lib</OpenCVLib>
111+
<OpenCVLib Condition="'$(Configuration)'=='Release'">opencv_world454.lib</OpenCVLib>
112+
<OpenCVLibFullPath>$(SolutionDir)..\..\build\external\opencv\cmake_config\$(PlatformString)\lib\$(Configuration)\$(OpenCVLib)</OpenCVLibFullPath>
113+
<UseOpenCV>False</UseOpenCV>
114+
<UseOpenCV Condition="Exists('$(OpenCVLibFullPath)')">True</UseOpenCV>
115+
</PropertyGroup>
116+
<ItemDefinitionGroup Condition="$(UseOpenCV)">
117+
<ClCompile>
118+
<AdditionalIncludeDirectories>$(SolutionDir)..\..\build\external\opencv\cmake_config\$(PlatformString)\install\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
119+
<AdditionalOptions>%(AdditionalOptions) /DUSE_OPENCV=1</AdditionalOptions>
107120
</ClCompile>
108121
<Link>
109-
<AdditionalLibraryDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\..\external\opencv\4.5.4\$(PlatformString)\$(Configuration)\lib</AdditionalLibraryDirectories>
110-
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">opencv_world454d.lib;%(AdditionalDependencies)</AdditionalDependencies>
111-
</Link>
112-
<Link>
113-
<AdditionalLibraryDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(SolutionDir)..\..\external\opencv\4.5.4\$(PlatformString)\$(Configuration)\lib</AdditionalLibraryDirectories>
114-
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">opencv_world454d.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
115-
</Link>
116-
<Link>
117-
<AdditionalLibraryDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\..\external\opencv\4.5.4\$(PlatformString)\$(Configuration)\lib</AdditionalLibraryDirectories>
118-
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">opencv_world454d.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
122+
<AdditionalLibraryDirectories>$(SolutionDir)..\..\build\external\opencv\cmake_config\$(PlatformString)\lib\$(Configuration)</AdditionalLibraryDirectories>
123+
<AdditionalDependencies>$(OpenCVLib);%(AdditionalDependencies)</AdditionalDependencies>
119124
</Link>
120125
</ItemDefinitionGroup>
126+
127+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
128+
<ClCompile>
129+
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
130+
</ClCompile>
131+
</ItemDefinitionGroup>
121132
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
122133
<ClCompile>
123134
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
124-
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(SolutionDir)..\..\external\opencv\4.5.4\neutral\include;$(MSBuildThisFileDirectory)../../build/native/include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
125-
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\..\external\opencv\4.5.4\neutral\include;$(MSBuildThisFileDirectory)../../build/native/include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
126-
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\..\external\opencv\4.5.4\neutral\include;$(MSBuildThisFileDirectory)../../build/native/include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
127135
</ClCompile>
128136
<Link>
129137
<EnableCOMDATFolding>true</EnableCOMDATFolding>
130138
<OptimizeReferences>true</OptimizeReferences>
131-
<AdditionalLibraryDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(SolutionDir)..\..\external\opencv\4.5.4\$(PlatformString)\$(Configuration)\lib</AdditionalLibraryDirectories>
132-
<AdditionalLibraryDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\..\external\opencv\4.5.4\$(PlatformString)\$(Configuration)\lib</AdditionalLibraryDirectories>
133-
<AdditionalLibraryDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\..\external\opencv\4.5.4\$(PlatformString)\$(Configuration)\lib</AdditionalLibraryDirectories>
134-
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">opencv_world454.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
135-
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">opencv_world454.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
136-
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">opencv_world454.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
137139
</Link>
138140
</ItemDefinitionGroup>
139141
<ItemGroup>

azure-pipelines-samples.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ steps:
5858
targetType: inline
5959
script: if (-not (Test-Path "${ENV:programfiles(x86)}\windows Kits\10\include\10.0.18362.0\")) { choco install windows-sdk-10-version-1903-all -y }
6060

61-
6261
- task: PowerShell@2
6362
displayName: 'Restore WinMLSamplesGalleryNative Nuget Packages'
6463
inputs:
@@ -74,7 +73,7 @@ steps:
7473
inputs:
7574
solution: 'Samples/WinMLSamplesGallery/WinMLSamplesGallery.sln'
7675
vsVersion: "16.0"
77-
msbuildArgs: '-v:diag /p:OutDir=$(System.DefaultWorkingDirectory)\bin\$(BuildPlatform)\$(BuildConfiguration)\WinMLSamplesGallery\ /p:WindowsTargetPlatformVersion=$(WindowsTargetPlatformVersion) /p:UseLargeModels=true /t:Restore,Clean,Build'
76+
msbuildArgs: '/p:OutDir=$(System.DefaultWorkingDirectory)\bin\$(BuildPlatform)\$(BuildConfiguration)\WinMLSamplesGallery\ /p:WindowsTargetPlatformVersion=$(WindowsTargetPlatformVersion) /p:UseLargeModels=true /t:Restore,Clean,Build'
7877
platform: '$(BuildPlatform)'
7978
configuration: '$(BuildConfiguration)'
8079
msbuildArchitecture: x64

external/opencv

Submodule opencv added at 4223495

external/tools/BuildOpenCV.ps1

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Param
2+
(
3+
# Build architecture.
4+
[ValidateSet(
5+
'x64',
6+
'x86',
7+
'ARM64')]
8+
[string]$Architecture = 'x64',
9+
10+
# Build configuration.
11+
[ValidateSet('Debug', 'Release')][string]$Configuration = 'Debug',
12+
13+
# Location to generate build files.
14+
[string]$CMakeBuildDirectory = "$PSScriptRoot\..\..\build\external\opencv\cmake_config\$Architecture\",
15+
16+
# Cleans build files before proceeding.
17+
[switch]$Clean
18+
)
19+
20+
if ($Clean) {
21+
Remove-Item -Recurse -Force $CMakeBuildDirectory
22+
}
23+
24+
& $PSScriptRoot\CMakeConfigureOpenCV.ps1 -Architecture $Architecture
25+
26+
# Build OpenCV
27+
$solution = $CMakeBuildDirectory + "OpenCV.sln"
28+
msbuild /p:Configuration=$Configuration /t:Build $solution
29+
30+
# Install
31+
$installProject = $CMakeBuildDirectory + "INSTALL.vcxproj"
32+
msbuild /p:Configuration=$Configuration $installProject
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Param
2+
(
3+
# Build architecture.
4+
[ValidateSet(
5+
'x64',
6+
'x86',
7+
'ARM64')]
8+
[string]$Architecture = 'x64',
9+
10+
# CMake generator.
11+
[ValidateSet(
12+
'Visual Studio 15 2017',
13+
'Visual Studio 16 2019')]
14+
[string]$Generator='Visual Studio 16 2019',
15+
16+
# Location to generate build files.
17+
[string]$BuildDirectory = "$PSScriptRoot\..\..\build\external\opencv\cmake_config\$Architecture",
18+
19+
# Cleans build files before proceeding.
20+
[switch]$Clean
21+
)
22+
23+
24+
$Args = New-Object Collections.Generic.List[String]
25+
26+
if ($Architecture -eq 'x86') {
27+
$Args.Add("-A Win32")
28+
}
29+
else {
30+
$Args.Add("-A " + $Architecture)
31+
}
32+
33+
$Args.Add("-G " + $Generator)
34+
$Args.Add("-DCMAKE_SYSTEM_NAME=Windows")
35+
$Args.Add("-DCMAKE_SYSTEM_VERSION=10.0")
36+
$Args.Add("-DWITH_OPENCL=OFF")
37+
$Args.Add("-DWITH_FFMPEG=OFF")
38+
$Args.Add("-DWITH_CUDA=OFF")
39+
$Args.Add("-DBUILD_EXAMPLES=OFF")
40+
$Args.Add("-DBUILD_TESTS=OFF")
41+
$Args.Add("-DBUILD_opencv_world=ON")
42+
43+
if ($Clean) {
44+
$Args.Add("--clean")
45+
}
46+
47+
$Args.Add("-B " + $BuildDirectory)
48+
cmake $Args "$PSScriptRoot\..\opencv"

0 commit comments

Comments
 (0)