Skip to content

Commit e0e8016

Browse files
authored
Fix MSVC build/runtime issues in oneVPL samples (oneapi-src#160)
Merging as override
1 parent 1931e54 commit e0e8016

File tree

11 files changed

+69
-62
lines changed

11 files changed

+69
-62
lines changed

Libraries/oneVPL/dpcpp-blur/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ project(dpcpp-blur LANGUAGES CXX)
2727
set(TARGET dpcpp-blur)
2828
set(SOURCES src/dpcpp-blur.cpp)
2929
set(VPL_NAME mfx)
30-
set(CMAKE_MSVCIDE_RUN_PATH $ENV{PATH})
3130
set(RUNARGS ${CMAKE_CURRENT_SOURCE_DIR}/content/cars_128x96.i420 128 96)
3231

3332
set(CMAKE_CXX_STANDARD 17)
@@ -36,6 +35,9 @@ add_executable(${TARGET} ${SOURCES})
3635

3736
if(MSVC)
3837
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
38+
if(NOT DEFINED ENV{VSCMD_VER})
39+
set(CMAKE_MSVCIDE_RUN_PATH $ENV{PATH})
40+
endif()
3941
endif()
4042

4143
if(DPCPP_COMPILER)

Libraries/oneVPL/dpcpp-blur/README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# `dpcpp-blur` Sample
22

3-
This sample shows how to use a DPC++ kernel together with oneAPI Video
4-
Processing Library (oneVPL) to perform a simple video content blur.
3+
This sample shows how to use a DPC++ kernel together with
4+
oneAPI Video Processing Library to perform a simple video content blur.
55

66
| Optimized for | Description
77
|---------------- | ----------------------------------------
88
| OS | Ubuntu* 18.04; Windows* 10
99
| Hardware | Intel® Processor Graphics GEN9 or newer
10-
| Software | Intel® oneAPI Video Processing Library(oneVPL)
10+
| Software | Intel® oneAPI Video Processing Library (oneVPL)
1111
| What You Will Learn | How to use oneVPL and DPC++ to convert I420 raw video file in to RGB32 and blur each frame.
1212
| Time to Complete | 5 minutes
1313

@@ -19,7 +19,7 @@ I420 format video elementary stream as an argument, converts it to RGB32 with
1919
oneVPL and blurs each frame with DPC++ by using SYCL kernel, and writes the
2020
decoded output to `out.rgba` in RGB32 format.
2121

22-
If a DPC++ compiler is not found the blur operation will be disabled
22+
If the oneAPI DPC++ Compiler is not found the blur operation will be disabled.
2323

2424

2525

@@ -52,7 +52,7 @@ Perform the following steps:
5252

5353
2. Set up your environment using the following command.
5454
```
55-
$ source <oneapi_install_dir>/setvars.sh
55+
source <oneapi_install_dir>/setvars.sh
5656
```
5757
Here `<oneapi_install_dir>` represents the root folder of your oneAPI
5858
installation, which is `/opt/intel/oneapi/` when installed as root, and
@@ -61,15 +61,15 @@ Perform the following steps:
6161

6262
3. Build the program using the following commands:
6363
```
64-
$ mkdir build
65-
$ cd build
66-
$ cmake ..
67-
$ cmake --build .
64+
mkdir build
65+
cd build
66+
cmake ..
67+
cmake --build .
6868
```
6969

7070
4. Run the program using the following command:
7171
```
72-
$ cmake --build . --target run
72+
cmake --build . --target run
7373
```
7474

7575

@@ -85,7 +85,7 @@ Perform the following steps:
8585

8686
2. Set up your environment using the following command.
8787
```
88-
> <oneapi_install_dir>\setvars.bat
88+
<oneapi_install_dir>\setvars.bat
8989
```
9090
Here `<oneapi_install_dir>` represents the root folder of your oneAPI
9191
installation, which is which is `C:\Program Files (x86)\Intel\oneAPI\`
@@ -96,15 +96,15 @@ Perform the following steps:
9696

9797
3. Build the program using the following commands:
9898
```
99-
$ mkdir build
100-
$ cd build
101-
$ cmake ..
102-
$ cmake --build .
99+
mkdir build
100+
cd build
101+
cmake .. -T "Intel(R) oneAPI DPC++ Compiler"
102+
cmake --build .
103103
```
104104

105105
4. Run the program using the following command:
106106
```
107-
$ cmake --build . --target run
107+
cmake --build . --target run
108108
```
109109

110110

@@ -127,7 +127,6 @@ The instructions given above run the sample executable with the argument
127127
### Example of Output
128128

129129
```
130-
Running on Intel(R) Core(TM) i7-6770HQ CPU @ 2.60GHz
131130
Processing dpcpp-blur/content/cars_128x96.i420 -> out.rgba
132131
Processed 60 frames
133132
```

Libraries/oneVPL/dpcpp-blur/dpcpp-blur.vcxproj.user

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
44
<LocalDebuggerCommandArguments>"content\cars_128x96.i420" 128 96</LocalDebuggerCommandArguments>
55
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
6-
<LocalDebuggerEnvironment>PATH=$(ONEAPI_ROOT)\vpl\latest\bin;%PATH%
6+
<LocalDebuggerEnvironment>PATH=$(ONEAPI_ROOT)\vpl\latest\bin;$(ONEAPI_ROOT)\compiler\latest\windows\lib\oclfpga\windows64\bin;$(ONEAPI_ROOT)\compiler\latest\windows\bin;$(ONEAPI_ROOT)\compiler\latest\windows\redist\intel64_win\compiler;$(ONEAPI_ROOT)\compiler\latest\windows\lib\oclfpga\bin;$(ONEAPI_ROOT)\compiler\latest\windows\lib\oclfpga\windows64\bin;$(ONEAPI_ROOT)\compiler\latest\windows\lib\oclfpga\host\windows64\bin;$(ONEAPI_ROOT)\compiler\latest\windows\lib\oclfpga\board\intel_a10gx_pac\windows64\bin;$(ONEAPI_ROOT)\compiler\latest\windows..\lib\oclgpu;$(ONEAPI_ROOT)\compiler\latest\windows..\windows\bin\intel64;$(ONEAPI_ROOT)\compiler\latest\windows..\windows\redist\intel64_win\compiler;$(ONEAPI_ROOT)\compiler\latest\windows..\windows\bin;$(ONEAPI_ROOT)\compiler\latest\windows..\windows\lib;$(ONEAPI_ROOT)\compiler\latest\windows..\windows\ioc\bin;$(ONEAPI_ROOT)\compiler\latest\windows..\windows\lib\ocloc;$(ONEAPI_ROOT)\compiler\latest\windows......\tbb\latest\redist\intel64\vc_mt;%PATH%
77
</LocalDebuggerEnvironment>
88
</PropertyGroup>
99
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
1010
<LocalDebuggerCommandArguments>"content\cars_128x96.i420" 128 96</LocalDebuggerCommandArguments>
1111
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
12-
<LocalDebuggerEnvironment>PATH=$(ONEAPI_ROOT)\vpl\latest\bin;%PATH%
12+
<LocalDebuggerEnvironment>PATH=$(ONEAPI_ROOT)\vpl\latest\bin;$(ONEAPI_ROOT)\compiler\latest\windows\lib\oclfpga\windows64\bin;$(ONEAPI_ROOT)\compiler\latest\windows\bin;$(ONEAPI_ROOT)\compiler\latest\windows\redist\intel64_win\compiler;$(ONEAPI_ROOT)\compiler\latest\windows\lib\oclfpga\bin;$(ONEAPI_ROOT)\compiler\latest\windows\lib\oclfpga\windows64\bin;$(ONEAPI_ROOT)\compiler\latest\windows\lib\oclfpga\host\windows64\bin;$(ONEAPI_ROOT)\compiler\latest\windows\lib\oclfpga\board\intel_a10gx_pac\windows64\bin;$(ONEAPI_ROOT)\compiler\latest\windows..\lib\oclgpu;$(ONEAPI_ROOT)\compiler\latest\windows..\windows\bin\intel64;$(ONEAPI_ROOT)\compiler\latest\windows..\windows\redist\intel64_win\compiler;$(ONEAPI_ROOT)\compiler\latest\windows..\windows\bin;$(ONEAPI_ROOT)\compiler\latest\windows..\windows\lib;$(ONEAPI_ROOT)\compiler\latest\windows..\windows\ioc\bin;$(ONEAPI_ROOT)\compiler\latest\windows..\windows\lib\ocloc;$(ONEAPI_ROOT)\compiler\latest\windows......\tbb\latest\redist\intel64\vc_mt;%PATH%
1313
</LocalDebuggerEnvironment>
1414
</PropertyGroup>
1515
</Project>

Libraries/oneVPL/dpcpp-blur/sample.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"steps": [
2828
"mkdir build",
2929
"cd build",
30-
"cmake ..",
30+
"cmake .. -T \"Intel(R) oneAPI DPC++ Compiler\"",
3131
"cmake --build .",
3232
"cmake --build . --target run"
3333
] }

Libraries/oneVPL/dpcpp-blur/src/dpcpp-blur.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ int main(int argc, char *argv[]) {
147147
mfxI32 input_height = isize;
148148

149149
// initialize session
150-
mfxInitParam init_params = { 0 };
150+
mfxInitParam init_params = {};
151151
init_params.Version.Major = 2;
152152
init_params.Version.Minor = 0;
153153
init_params.Implementation = MFX_IMPL_SOFTWARE;
@@ -294,7 +294,7 @@ int main(int argc, char *argv[]) {
294294
}
295295

296296
// Prepare bit stream buffer
297-
mfxBitstream bitstream = { 0 };
297+
mfxBitstream bitstream = {};
298298
bitstream.MaxLength = 2000000;
299299
std::vector<mfxU8> bitstream_data(bitstream.MaxLength);
300300
bitstream.Data = bitstream_data.data();

Libraries/oneVPL/hello-decode/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ project(hello-decode)
44
set(TARGET hello-decode)
55
set(SOURCES src/hello-decode.cpp)
66
set(VPL_NAME mfx)
7-
set(CMAKE_MSVCIDE_RUN_PATH $ENV{PATH})
87
set(RUNARGS ${CMAKE_CURRENT_SOURCE_DIR}/content/cars_128x96.h265)
98

109
# Set default build type to RelWithDebInfo if not specified
@@ -29,6 +28,9 @@ endif()
2928

3029
if(MSVC)
3130
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
31+
if(NOT DEFINED ENV{VSCMD_VER})
32+
set(CMAKE_MSVCIDE_RUN_PATH $ENV{PATH})
33+
endif()
3234
endif()
3335

3436
if(TARGET mfx)

Libraries/oneVPL/hello-decode/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Perform the following steps:
4848

4949
2. Set up your environment using the following command.
5050
```
51-
$ source <oneapi_install_dir>/setvars.sh
51+
source <oneapi_install_dir>/setvars.sh
5252
```
5353
Here `<oneapi_install_dir>` represents the root folder of your oneAPI
5454
installation, which is `/opt/intel/oneapi/` when installed as root, and
@@ -57,15 +57,15 @@ Perform the following steps:
5757

5858
3. Build the program using the following commands:
5959
```
60-
$ mkdir build
61-
$ cd build
62-
$ cmake ..
63-
$ cmake --build .
60+
mkdir build
61+
cd build
62+
cmake ..
63+
cmake --build .
6464
```
6565

6666
4. Run the program using the following command:
6767
```
68-
$ cmake --build . --target run
68+
cmake --build . --target run
6969
```
7070

7171

@@ -81,7 +81,7 @@ Perform the following steps:
8181

8282
2. Set up your environment using the following command.
8383
```
84-
> <oneapi_install_dir>\setvars.bat
84+
<oneapi_install_dir>\setvars.bat
8585
```
8686
Here `<oneapi_install_dir>` represents the root folder of your oneAPI
8787
installation, which is which is `C:\Program Files (x86)\Intel\oneAPI\`
@@ -92,15 +92,15 @@ Perform the following steps:
9292

9393
3. Build the program using the following commands:
9494
```
95-
$ mkdir build
96-
$ cd build
97-
$ cmake ..
98-
$ cmake --build .
95+
mkdir build
96+
cd build
97+
cmake ..
98+
cmake --build .
9999
```
100100

101101
4. Run the program using the following command:
102102
```
103-
$ cmake --build . --target run
103+
cmake --build . --target run
104104
```
105105

106106

Libraries/oneVPL/hello-encode/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ project(hello-encode)
44
set(TARGET hello-encode)
55
set(SOURCES src/hello-encode.cpp)
66
set(VPL_NAME mfx)
7-
set(CMAKE_MSVCIDE_RUN_PATH $ENV{PATH})
87
set(RUNARGS ${CMAKE_CURRENT_SOURCE_DIR}/content/cars_128x96.i420 128 96)
98

109
# Set default build type to RelWithDebInfo if not specified
@@ -29,6 +28,9 @@ endif()
2928

3029
if(MSVC)
3130
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
31+
if(NOT DEFINED ENV{VSCMD_VER})
32+
set(CMAKE_MSVCIDE_RUN_PATH $ENV{PATH})
33+
endif()
3234
endif()
3335

3436
if(TARGET mfx)

Libraries/oneVPL/hello-encode/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Perform the following steps:
4848

4949
2. Set up your environment using the following command.
5050
```
51-
$ source <oneapi_install_dir>/setvars.sh
51+
source <oneapi_install_dir>/setvars.sh
5252
```
5353
Here `<oneapi_install_dir>` represents the root folder of your oneAPI
5454
installation, which is `/opt/intel/oneapi/` when installed as root, and
@@ -57,15 +57,15 @@ Perform the following steps:
5757

5858
3. Build the program using the following commands:
5959
```
60-
$ mkdir build
61-
$ cd build
62-
$ cmake ..
63-
$ cmake --build .
60+
mkdir build
61+
cd build
62+
cmake ..
63+
cmake --build .
6464
```
6565

6666
4. Run the program using the following command:
6767
```
68-
$ cmake --build . --target run
68+
cmake --build . --target run
6969
```
7070

7171

@@ -81,7 +81,7 @@ Perform the following steps:
8181

8282
2. Set up your environment using the following command.
8383
```
84-
> <oneapi_install_dir>\setvars.bat
84+
<oneapi_install_dir>\setvars.bat
8585
```
8686
Here `<oneapi_install_dir>` represents the root folder of your oneAPI
8787
installation, which is which is `C:\Program Files (x86)\Intel\oneAPI\`
@@ -92,15 +92,15 @@ Perform the following steps:
9292

9393
3. Build the program using the following commands:
9494
```
95-
$ mkdir build
96-
$ cd build
97-
$ cmake ..
98-
$ cmake --build .
95+
mkdir build
96+
cd build
97+
cmake ..
98+
cmake --build .
9999
```
100100

101101
4. Run the program using the following command:
102102
```
103-
$ cmake --build . --target run
103+
cmake --build . --target run
104104
```
105105

106106

Libraries/oneVPL/hello-vpp/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ project(hello-vpp)
44
set(TARGET hello-vpp)
55
set(SOURCES src/hello-vpp.cpp)
66
set(VPL_NAME mfx)
7-
set(CMAKE_MSVCIDE_RUN_PATH $ENV{PATH})
87
set(RUNARGS ${CMAKE_CURRENT_SOURCE_DIR}/content/cars_128x96.i420 128 96)
98

109
# Set default build type to RelWithDebInfo if not specified
@@ -29,6 +28,9 @@ endif()
2928

3029
if(MSVC)
3130
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
31+
if(NOT DEFINED ENV{VSCMD_VER})
32+
set(CMAKE_MSVCIDE_RUN_PATH $ENV{PATH})
33+
endif()
3234
endif()
3335

3436
if(TARGET mfx)

Libraries/oneVPL/hello-vpp/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Perform the following steps:
4444

4545
2. Set up your environment using the following command.
4646
```
47-
$ source <oneapi_install_dir>/setvars.sh
47+
source <oneapi_install_dir>/setvars.sh
4848
```
4949
Here `<oneapi_install_dir>` represents the root folder of your oneAPI
5050
installation, which is `/opt/intel/oneapi/` when installed as root, and
@@ -53,15 +53,15 @@ Perform the following steps:
5353

5454
3. Build the program using the following commands:
5555
```
56-
$ mkdir build
57-
$ cd build
58-
$ cmake ..
59-
$ cmake --build .
56+
mkdir build
57+
cd build
58+
cmake ..
59+
cmake --build .
6060
```
6161

6262
4. Run the program using the following command:
6363
```
64-
$ cmake --build . --target run
64+
cmake --build . --target run
6565
```
6666

6767

@@ -77,7 +77,7 @@ Perform the following steps:
7777

7878
2. Set up your environment using the following command.
7979
```
80-
> <oneapi_install_dir>\setvars.bat
80+
<oneapi_install_dir>\setvars.bat
8181
```
8282
Here `<oneapi_install_dir>` represents the root folder of your oneAPI
8383
installation, which is which is `C:\Program Files (x86)\Intel\oneAPI\`
@@ -88,15 +88,15 @@ Perform the following steps:
8888

8989
3. Build the program using the following commands:
9090
```
91-
$ mkdir build
92-
$ cd build
93-
$ cmake ..
94-
$ cmake --build .
91+
mkdir build
92+
cd build
93+
cmake ..
94+
cmake --build .
9595
```
9696

9797
4. Run the program using the following command:
9898
```
99-
$ cmake --build . --target run
99+
cmake --build . --target run
100100
```
101101

102102

0 commit comments

Comments
 (0)