[Mlir-commits] [mlir] [mlir][XeVM] Use libocloc API for binary generation. (PR #188353)
Artem Kroviakov
llvmlistbot at llvm.org
Tue Apr 7 00:51:40 PDT 2026
================
@@ -0,0 +1,82 @@
+# Findocloc.cmake
+
+# Define a function to search for ocloc
+function(find_ocloc)
+ message(STATUS "Searching for ocloc")
+
+ if(WIN32)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(OCLOC_SUFFIX "64")
+ else()
+ set(OCLOC_SUFFIX "32")
+ endif()
+
+ set(OCLOC_EXE_PATHS "${OCLOC_PACKAGE_DIR}" "${OCLOC_PACKAGE_DIR}/bin")
+ set(OCLOC_LIB_PATHS "${OCLOC_PACKAGE_DIR}" "${OCLOC_PACKAGE_DIR}/lib")
+ set(OCLOC_INC_PATHS "${OCLOC_PACKAGE_DIR}" "${OCLOC_PACKAGE_DIR}/include")
+ else()
+ set(OCLOC_SUFFIX "")
+
+ set(OCLOC_EXE_PATHS "${OCLOC_PACKAGE_DIR}/bin")
+ set(OCLOC_LIB_PATHS "${OCLOC_PACKAGE_DIR}/lib")
+ set(OCLOC_INC_PATHS "${OCLOC_PACKAGE_DIR}/include")
+
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ list(APPEND OCLOC_LIB_PATHS
+ "${OCLOC_PACKAGE_DIR}/lib64"
+ "${OCLOC_PACKAGE_DIR}/lib/x86_64-linux-gnu")
+ endif()
+ endif()
+
+ # Search for ocloc executable
----------------
akroviakov wrote:
CMake [`find_program` doc](https://cmake.org/cmake/help/latest/command/find_program.html) says:
> Prior to searching, find_program checks if variable <VAR> is defined. If the variable is not defined, the search will be performed
The 1st call with `NO_DEFAULT_PATH` is to prioritize the `CMAKE` parameter
`OCLOC_PACKAGE_DIR` over the system paths like `/usr/lib/libocloc.so`
or `/usr/include/ocloc_api.h`.
https://github.com/llvm/llvm-project/pull/188353
More information about the Mlir-commits
mailing list