[Mlir-commits] [mlir] [mlir][XeVM] Use libocloc API for binary generation. (PR #188353)

Sang Ik Lee llvmlistbot at llvm.org
Mon Apr 6 15:56:58 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
----------------
silee2 wrote:

find_program, find_library, find_path is called twice. First with NO_DEFAULT_PATH and second without it. Don't you need to check if the first search is a success before issuing the second search, unless second search has higher priority and always guaranteed to succeed if the first search was successful.  

https://github.com/llvm/llvm-project/pull/188353


More information about the Mlir-commits mailing list