CMake:LivoxGen1: Require OpenCL 1.2+, printf & WRITE_INVALIDATE_REGION

This commit is contained in:
2025-11-12 20:26:29 -04:00
parent 7e672bcc9a
commit df58f324a9
2 changed files with 80 additions and 2 deletions
+18 -2
View File
@@ -9,8 +9,8 @@ if(ENABLE_STIMBUFFAPI_livoxGen1)
# Find liburing using pkg-config
pkg_check_modules(URING REQUIRED liburing)
# Find OpenCL: try find_package first, fall back to pkg-config
find_package(OpenCL QUIET)
# Find OpenCL 1.2 or higher: try find_package first, fall back to pkg-config
find_package(OpenCL 1.2 QUIET)
if(OpenCL_FOUND)
# Normalize find_package variables to match pkg_check_modules naming
set(OPENCL_FOUND TRUE)
@@ -23,6 +23,19 @@ if(ENABLE_STIMBUFFAPI_livoxGen1)
endif()
set(OPENCL_LIBRARY_DIRS "")
message(STATUS "Found OpenCL using find_package")
# Check if version is available and validate
if(OpenCL_VERSION)
if(OpenCL_VERSION VERSION_LESS "1.2")
message(FATAL_ERROR
"OpenCL version ${OpenCL_VERSION} found, but 1.2 or higher is required")
endif()
message(STATUS "OpenCL version: ${OpenCL_VERSION}")
else()
message(WARNING
"OpenCL version could not be determined. "
"Version 1.2+ is required at runtime.")
endif()
else()
# Fall back to pkg-config
pkg_check_modules(OPENCL OpenCL)
@@ -35,6 +48,9 @@ if(ENABLE_STIMBUFFAPI_livoxGen1)
)
endif()
message(STATUS "Found OpenCL using pkg-config")
message(WARNING
"OpenCL version could not be determined via pkg-config. "
"Version 1.2+ is required at runtime.")
endif()
# Enable assembly language