Files
TheRock/rocm-systems/projects/rocprofiler-systems/external/timemory/cmake/Modules/FindLIKWID.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

159 lines
5.4 KiB
CMake

# Try to find the LIKWID library and headers Usage of this module is as follows
#
# find_package( LIKWID ) if(LIKWID_FOUND) include_directories(${LIKWID_INCLUDE_DIRS})
# add_executable(foo foo.cc) target_link_libraries(foo ${LIKWID_LIBRARIES}) endif()
#
# You can provide a minimum version number that should be used. If you provide this
# version number and specify the REQUIRED attribute, this module will fail if it can't
# find a LIKWID of the specified version or higher. If you further specify the EXACT
# attribute, then this module will fail if it can't find a LIKWID with a version eaxctly
# as specified.
#
# ===========================================================================
# Variables used by this module which can be used to change the default behaviour, and
# hence need to be set before calling find_package:
#
# LIKWID_ROOT_DIR The preferred installation prefix for searching for LIKWID Set this if
# the module has problems finding the proper LIKWID installation.
#
# If you don't supply LIKWID_ROOT_DIR, the module will search on the standard system
# paths.
#
# ============================================================================
# Variables set by this module:
#
# LIKWID_FOUND System has LIKWID.
#
# LIKWID_INCLUDE_DIRS LIKWID include directories: not cached.
#
# LIKWID_LIBRARIES Link to these to use the LIKWID library: not cached.
#
# ===========================================================================
# If LIKWID is installed in a non-standard way, e.g. a non GNU-style install of
# <prefix>/{lib,include}, then this module may fail to locate the headers and libraries as
# needed. In this case, the following cached variables can be editted to point to the
# correct locations.
#
# LIKWID_INCLUDE_DIR The path to the LIKWID include directory: cached
#
# LIKWID_LIBRARY The path to the LIKWID library: cached
#
# You should not need to set these in the vast majority of cases
#
# ----------------------------------------------------------------------------------------#
include(CMakeParseArguments)
include(TimemoryFindUtilities)
# ----------------------------------------------------------------------------------------#
# search for likwid marker because if this file does not exist, we cannot forward to
# Likwid
find_path(
LIKWID_ROOT_DIR
NAMES include/likwid.h
HINTS ENV LIKWID_ROOT_DIR
DOC "LIKWID root installation directory")
# ----------------------------------------------------------------------------------------#
find_path(
LIKWID_INCLUDE_DIR
NAMES likwid-marker.h
HINTS ${LIKWID_ROOT_DIR} ENV LIKWID_ROOT_DIR ENV CPATH
PATH_SUFFIXES include
DOC "Path to the LIKWID headers")
# ----------------------------------------------------------------------------------------#
find_library(
LIKWID_LIBRARY
NAMES likwid
HINTS ${LIKWID_ROOT_DIR}
ENV
LIKWID_ROOT_DIR
ENV
LIBRARY_PATH
ENV
LD_LIBRARY_PATH
ENV
DYLD_LIBRARY_PATH
PATH_SUFFIXES lib lib64
DOC "Path to the LIKWID library")
# ----------------------------------------------------------------------------------------#
find_library(
LIKWID_hwloc_LIBRARY
NAMES likwid-hwloc
HINTS ${LIKWID_ROOT_DIR}
ENV
LIKWID_ROOT_DIR
ENV
LIBRARY_PATH
ENV
LD_LIBRARY_PATH
ENV
DYLD_LIBRARY_PATH
PATH_SUFFIXES lib lib64
DOC "Path to the LIKWID HWLOC library")
# ----------------------------------------------------------------------------------------#
find_library(
LIKWID_lua_LIBRARY
NAMES likwid-lua
HINTS ${LIKWID_ROOT_DIR}
ENV
LIKWID_ROOT_DIR
ENV
LD_LIBRARY_PATH
ENV
LIBRARY_PATH
ENV
DYLD_LIBRARY_PATH
PATH_SUFFIXES lib lib64
DOC "Path to the LIKWID lua library")
# ----------------------------------------------------------------------------------------#
timemory_find_static_library(
LIKWID_lua_STATIC_LIBRARY
NAMES likwid-lua
HINTS ${LIKWID_ROOT_DIR}
ENV
LIKWID_ROOT_DIR
ENV
LD_LIBRARY_PATH
ENV
LIBRARY_PATH
ENV
DYLD_LIBRARY_PATH
PATH_SUFFIXES lib lib64
DOC "Path to the LIKWID lua library")
# ----------------------------------------------------------------------------------------#
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIKWID_FOUND to TRUE if all listed
# variables are TRUE
find_package_handle_standard_args(LIKWID DEFAULT_MSG LIKWID_INCLUDE_DIR LIKWID_LIBRARY)
# ----------------------------------------------------------------------------------------#
if(LIKWID_FOUND)
add_library(LIKWID::likwid INTERFACE IMPORTED)
add_library(LIKWID::likwid-hwloc INTERFACE IMPORTED)
target_link_libraries(LIKWID::likwid INTERFACE ${LIKWID_LIBRARY})
target_include_directories(LIKWID::likwid INTERFACE ${LIKWID_INCLUDE_DIR})
get_filename_component(LIKWID_INCLUDE_DIRS ${LIKWID_INCLUDE_DIR} REALPATH)
get_filename_component(LIKWID_LIBRARIES ${LIKWID_LIBRARY} REALPATH)
if(LIKWID_hwloc_LIBRARY)
target_link_libraries(LIKWID::likwid-hwloc INTERFACE ${LIKWID_hwloc_LIBRARY})
target_link_libraries(LIKWID::likwid INTERFACE ${LIKWID_hwloc_LIBRARY})
list(APPEND LIKWID_LIBRARIES ${LIKWID_hwloc_LIBRARY})
endif()
endif()
mark_as_advanced(LIKWID_INCLUDE_DIR LIKWID_LIBRARY)