Files
TheRock/compiler/amd-llvm/mlir/cmake/modules/Findocloc.cmake
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

77 lines
2.5 KiB
CMake

# Findocloc.cmake
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")
else()
set(OCLOC_SUFFIX "")
set(OCLOC_EXE_PATHS "${OCLOC_PACKAGE_DIR}/bin")
set(OCLOC_LIB_PATHS "${OCLOC_PACKAGE_DIR}/lib")
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
find_program(OCLOC_EXECUTABLE NAMES "ocloc" "ocloc${OCLOC_SUFFIX}"
PATHS ${OCLOC_EXE_PATHS} NO_DEFAULT_PATH)
find_program(OCLOC_EXECUTABLE NAMES "ocloc" "ocloc${OCLOC_SUFFIX}"
PATHS ${OCLOC_EXE_PATHS})
# Search for ocloc library
find_library(OCLOC_LIBRARY NAMES "ocloc${OCLOC_SUFFIX}"
PATHS ${OCLOC_LIB_PATHS} NO_DEFAULT_PATH)
find_library(OCLOC_LIBRARY NAMES "ocloc${OCLOC_SUFFIX}"
PATHS ${OCLOC_LIB_PATHS})
# Check if all components are found
if(OCLOC_EXECUTABLE AND OCLOC_LIBRARY)
set(OCLOC_FOUND TRUE)
else()
set(OCLOC_FOUND FALSE)
endif()
# Provide the results to the user
if(OCLOC_FOUND)
message(STATUS "Found ocloc executable: ${OCLOC_EXECUTABLE}")
message(STATUS "Found ocloc library: ${OCLOC_LIBRARY}")
else()
message(STATUS "ocloc not found")
endif()
# Set the variables for the user
set(OCLOC_EXECUTABLE ${OCLOC_EXECUTABLE} CACHE FILEPATH "Path to ocloc executable")
set(OCLOC_LIBRARY ${OCLOC_LIBRARY} CACHE FILEPATH "Path to ocloc library")
set(OCLOC_FOUND ${OCLOC_FOUND} CACHE BOOL "ocloc found")
# Only create imported targets when the underlying artifact was actually
# found, to avoid CMake errors from targets with empty IMPORTED_LOCATION.
if(OCLOC_EXECUTABLE)
add_executable(ocloc IMPORTED)
set_property(TARGET ocloc PROPERTY IMPORTED_LOCATION "${OCLOC_EXECUTABLE}")
endif()
if(OCLOC_LIBRARY)
add_library(libocloc SHARED IMPORTED)
set_target_properties(libocloc PROPERTIES
IMPORTED_LOCATION "${OCLOC_LIBRARY}")
endif()
endfunction()
# Call the function to find ocloc
find_ocloc()