Skip to content

Commit b9cf873

Browse files
authored
Merge pull request #257 from ldorau/Add_searching_for_libnuma_in_CMake
Add searching for libnuma in CMake
2 parents 6f25dfc + 7dcb2c2 commit b9cf873

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

.github/workflows/pr_push.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979
-B ${{github.workspace}}/build
8080
-DUMF_FORMAT_CODE_STYLE=ON
8181
-DUMF_BUILD_OS_MEMORY_PROVIDER=OFF
82+
-DUMF_BUILD_TESTS=OFF
8283
8384
- name: Build
8485
run: >

cmake/FindLIBNUMA.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
message(STATUS "Checking for module 'libnuma' using find_library()")
6+
7+
find_library(LIBNUMA_LIBRARY NAMES libnuma numa)
8+
set(LIBNUMA_LIBRARIES ${LIBNUMA_LIBRARY})
9+
10+
if(LIBNUMA_LIBRARY)
11+
message(STATUS " Found libnuma using find_library()")
12+
else()
13+
set(MSG_NOT_FOUND "libnuma NOT found (set CMAKE_PREFIX_PATH to point the location)")
14+
if(LIBNUMA_FIND_REQUIRED)
15+
message(FATAL_ERROR ${MSG_NOT_FOUND})
16+
else()
17+
message(WARNING ${MSG_NOT_FOUND})
18+
endif()
19+
endif()

test/CMakeLists.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,25 @@ else()
110110
endif()
111111

112112
if(UMF_BUILD_OS_MEMORY_PROVIDER AND LINUX) # OS-specific functions are implemented only for Linux now
113+
if(PkgConfig_FOUND)
114+
pkg_check_modules(LIBNUMA numa)
115+
endif()
116+
if(NOT LIBNUMA_FOUND)
117+
find_package(LIBNUMA REQUIRED numa)
118+
endif()
119+
113120
add_umf_test(NAME provider_os_memory
114121
SRCS provider_os_memory.cpp
115122
LIBS umf_utils)
116123
add_umf_test(NAME provider_os_memory_multiple_numa_nodes
117124
SRCS provider_os_memory_multiple_numa_nodes.cpp
118-
LIBS umf_utils numa)
125+
LIBS umf_utils ${LIBNUMA_LIBRARIES})
119126
add_umf_test(NAME memspace_numa
120127
SRCS memspace_numa.cpp
121-
LIBS numa)
128+
LIBS ${LIBNUMA_LIBRARIES})
122129
add_umf_test(NAME provider_os_memory_config
123130
SRCS provider_os_memory_config.cpp
124-
LIBS umf_utils numa)
131+
LIBS umf_utils ${LIBNUMA_LIBRARIES})
125132
endif()
126133

127134
if(UMF_BUILD_SHARED_LIBRARY)

0 commit comments

Comments
 (0)