Skip to content

Add searching for libnuma in CMake #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pr_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
-B ${{github.workspace}}/build
-DUMF_FORMAT_CODE_STYLE=ON
-DUMF_BUILD_OS_MEMORY_PROVIDER=OFF
-DUMF_BUILD_TESTS=OFF

- name: Build
run: >
Expand Down
19 changes: 19 additions & 0 deletions cmake/FindLIBNUMA.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (C) 2024 Intel Corporation
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

message(STATUS "Checking for module 'libnuma' using find_library()")

find_library(LIBNUMA_LIBRARY NAMES libnuma numa)
set(LIBNUMA_LIBRARIES ${LIBNUMA_LIBRARY})

if(LIBNUMA_LIBRARY)
message(STATUS " Found libnuma using find_library()")
else()
set(MSG_NOT_FOUND "libnuma NOT found (set CMAKE_PREFIX_PATH to point the location)")
if(LIBNUMA_FIND_REQUIRED)
message(FATAL_ERROR ${MSG_NOT_FOUND})
else()
message(WARNING ${MSG_NOT_FOUND})
endif()
endif()
13 changes: 10 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,25 @@ else()
endif()

if(UMF_BUILD_OS_MEMORY_PROVIDER AND LINUX) # OS-specific functions are implemented only for Linux now
if(PkgConfig_FOUND)
pkg_check_modules(LIBNUMA numa)
endif()
if(NOT LIBNUMA_FOUND)
find_package(LIBNUMA REQUIRED numa)
endif()

add_umf_test(NAME provider_os_memory
SRCS provider_os_memory.cpp
LIBS umf_utils)
add_umf_test(NAME provider_os_memory_multiple_numa_nodes
SRCS provider_os_memory_multiple_numa_nodes.cpp
LIBS umf_utils numa)
LIBS umf_utils ${LIBNUMA_LIBRARIES})
add_umf_test(NAME memspace_numa
SRCS memspace_numa.cpp
LIBS numa)
LIBS ${LIBNUMA_LIBRARIES})
add_umf_test(NAME provider_os_memory_config
SRCS provider_os_memory_config.cpp
LIBS umf_utils numa)
LIBS umf_utils ${LIBNUMA_LIBRARIES})
endif()

if(UMF_BUILD_SHARED_LIBRARY)
Expand Down