Use QueryAdapter APIs as per MS directives
[platform/upstream/OpenCL-ICD-Loader.git] / README.md
1 # Building the OpenCL ICD Loader and Tests
2
3 The build system will build ICD Loader library (OpenCL.dll or libOpenCL.so), the
4 ICD Loader Test binary (icd_loader_test), and some helper libraries for the test.
5
6 1. See inc/readme.txt about downloading or symlink the OpenCL headers.
7     Ex: https://github.com/KhronosGroup/OpenCL-Headers
8
9 ## Linux
10
11 Run "make"
12
13 ## Windows
14
15 1. Install recent Windows WDK, for access to d3dkmthk.h
16     Currently at https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk
17
18 2. Establish environment variable WDK to include directory
19     Ex: set WDK=C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0
20
21 2. Modify environment for your compiler.
22     Ex: Command line builds should modify "build_using_cmake.bat" 
23     Ex: Visual Studio CMake integration should modify the "buildRoot" to match the BUILD_DIR in "build_using_cmake.bat"
24
25 3. Build either using the command line to run "build_using_cmake.bat" or with Visual Studio CMake integration
26
27 ## Running ICD Test
28
29 The ICD Test can be run using ctest, which is a companion to cmake. It can also be
30 run directly by executing icd_loader_test(.exe) executable from the bin folder.
31
32 ### Linux
33
34 1. Add driver stub as an ICD
35     echo full/path/to/libOpenCLDriverStub.so > /etc/OpenCL/vendors/test.icd
36
37 2. Run test using ctest
38     make test
39
40 ### Windows
41
42 1. Add driver stub as an ICD by adding appropriate registry value
43     Key for 32-bit apps: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Khronos\OpenCL\Vendors
44     Key for 64-bit apps: HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors
45
46     Add a REG_DWORD value:
47         Name: c:/full/path/to/OpenCLDriverStub.dll
48         Data: 0
49
50     Note: The build_using_cmake.bat builds ICD test as a 32-bit binary.
51     
52 2. Run test using ctest.exe
53     cd build
54     ctest.exe
55
56 ### Cleanup
57
58 Manually remove the registry key or .icd files added for running the ICD test.
59
60 The "build" and "bin" folders are autogenerated by the build so those may be
61 safely deleted without losing any source code (on Linux "make clobber" will
62 delete them).