Skip to content

Commit

Permalink
Avoid OpenCL package search when unsupported
Browse files Browse the repository at this point in the history
  • Loading branch information
mav-intel committed Apr 23, 2024
1 parent a68499c commit 452ab25
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
21 changes: 11 additions & 10 deletions tools/cli/val-surface-sharing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,18 @@ else()
target_sources(${TARGET} PRIVATE src/hw-device-vaapi.cpp)
endif()

# if OpenCL is not configured, disable use of it in this tool and print warning
find_package(OpenCL CONFIG)
if(NOT OpenCL_FOUND)
message(
WARNING "*** OpenCL not found. OpenCL surface sharing will be disabled.")
set(TOOLS_ENABLE_OPENCL OFF)
endif()

# OpenCL is currently supported on Windows only for this tool
if(TOOLS_ENABLE_OPENCL)
if(WIN32)
if(WIN32)
# if OpenCL is not configured, disable use of it in this tool and print
# warning
find_package(OpenCL CONFIG)
if(NOT OpenCL_FOUND)
message(
WARNING "*** OpenCL not found. OpenCL surface sharing will be disabled.")
set(TOOLS_ENABLE_OPENCL OFF)
endif()

if(TOOLS_ENABLE_OPENCL)
target_compile_definitions(${TARGET} PRIVATE -DTOOLS_ENABLE_OPENCL)
target_sources(${TARGET} PRIVATE src/process-frames-ocl-d3d11.cpp)
target_link_libraries(${TARGET} PRIVATE OpenCL::OpenCL)
Expand Down
21 changes: 11 additions & 10 deletions tools/cli/vpl-import-export/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,18 @@ if(TOOLS_ENABLE_RENDER)
endif()
endif()

# if OpenCL is not configured, disable use of it in this tool and print warning
find_package(OpenCL CONFIG)
if(NOT OpenCL_FOUND)
message(
WARNING "*** OpenCL not found. OpenCL surface sharing will be disabled.")
set(TOOLS_ENABLE_OPENCL OFF)
endif()

# OpenCL is currently supported on Windows only for this tool
if(TOOLS_ENABLE_OPENCL)
if(WIN32)
if(WIN32)
# if OpenCL is not configured, disable use of it in this tool and print
# warning
find_package(OpenCL CONFIG)
if(NOT OpenCL_FOUND)
message(
WARNING "*** OpenCL not found. OpenCL surface sharing will be disabled.")
set(TOOLS_ENABLE_OPENCL OFF)
endif()

if(TOOLS_ENABLE_OPENCL)
target_compile_definitions(${TARGET} PRIVATE -DTOOLS_ENABLE_OPENCL)
target_sources(${TARGET} PRIVATE src/process-frames-ocl-d3d11.cpp)
target_link_libraries(${TARGET} PRIVATE OpenCL::OpenCL)
Expand Down

0 comments on commit 452ab25

Please sign in to comment.