File tree Expand file tree Collapse file tree 7 files changed +48
-16
lines changed Expand file tree Collapse file tree 7 files changed +48
-16
lines changed Original file line number Diff line number Diff line change @@ -114,13 +114,17 @@ install(
114
114
EXPORT ${PROJECT_NAME} -targets )
115
115
116
116
if (UMF_BUILD_OS_MEMORY_PROVIDER AND (LINUX OR WINDOWS ))
117
- # Do not use pkgconfig, because it sets wrong paths on Windows
118
- find_package (LIBHWLOC REQUIRED hwloc )
117
+ pkg_check_modules (LIBHWLOC hwloc )
118
+ if (NOT LIBHWLOC_FOUND )
119
+ find_package (LIBHWLOC REQUIRED hwloc )
120
+ endif ()
119
121
endif ()
120
122
121
123
if (UMF_BUILD_LIBUMF_POOL_SCALABLE AND (LINUX OR WINDOWS ))
122
- # Do not use pkgconfig, because it sets wrong paths on Windows
123
- find_package (LIBTBB REQUIRED tbb )
124
+ pkg_check_modules (TBB tbb )
125
+ if (NOT TBB_FOUND )
126
+ find_package (TBB REQUIRED tbb )
127
+ endif ()
124
128
endif ()
125
129
126
130
add_subdirectory (src )
Original file line number Diff line number Diff line change @@ -30,8 +30,15 @@ add_dependencies(ubench
30
30
umf
31
31
${LIBS_OPTIONAL} )
32
32
33
+ if (UMF_BUILD_OS_MEMORY_PROVIDER )
34
+ set (LIBS_OPTIONAL ${LIBS_OPTIONAL} ${LIBHWLOC_LIBRARIES} )
35
+ set (LIB_DIRS_OPTIONAL ${LIB_DIRS_OPTIONAL} ${LIBHWLOC_LIBRARY_DIRS} )
36
+ endif ()
37
+
33
38
target_include_directories (ubench PRIVATE ${UMF_CMAKE_SOURCE_DIR} /include/ ${UMF_CMAKE_SOURCE_DIR} /src/utils/ )
34
39
40
+ target_link_directories (ubench PRIVATE ${LIB_DIRS_OPTIONAL} )
41
+
35
42
target_link_libraries (ubench
36
43
umf
37
44
${LIBS_OPTIONAL}
@@ -40,6 +47,7 @@ target_link_libraries(ubench
40
47
41
48
if (UMF_BUILD_BENCHMARKS_MT )
42
49
add_executable (multithread_bench multithread.cpp )
50
+ target_link_directories (multithread_bench PRIVATE ${LIB_DIRS_OPTIONAL} )
43
51
target_link_libraries (multithread_bench
44
52
umf
45
53
${LIBS_OPTIONAL}
Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ message(STATUS "Checking for module 'libhwloc' using find_library()")
7
7
find_library (LIBHWLOC_LIBRARY NAMES libhwloc hwloc )
8
8
set (LIBHWLOC_LIBRARIES ${LIBHWLOC_LIBRARY} )
9
9
10
+ get_filename_component (LIBHWLOC_LIB_DIR ${LIBHWLOC_LIBRARIES} DIRECTORY )
11
+ set (LIBHWLOC_LIBRARY_DIRS ${LIBHWLOC_LIB_DIR} )
12
+
10
13
find_file (LIBHWLOC_HEADER NAMES hwloc.h )
11
14
get_filename_component (LIBHWLOC_INCLUDE_DIR ${LIBHWLOC_HEADER} DIRECTORY )
12
15
set (LIBHWLOC_INCLUDE_DIRS ${LIBHWLOC_INCLUDE_DIR} )
@@ -21,6 +24,7 @@ if(LIBHWLOC_LIBRARY)
21
24
message (STATUS " Found libhwloc using find_library()" )
22
25
message (STATUS " LIBHWLOC_LIBRARIES = ${LIBHWLOC_LIBRARIES} " )
23
26
message (STATUS " LIBHWLOC_INCLUDE_DIRS = ${LIBHWLOC_INCLUDE_DIRS} " )
27
+ message (STATUS " LIBHWLOC_LIBRARY_DIRS = ${LIBHWLOC_LIBRARY_DIRS} " )
24
28
if (WINDOWS )
25
29
message (STATUS " LIBHWLOC_DLL_DIRS = ${LIBHWLOC_DLL_DIRS} " )
26
30
endif ()
Original file line number Diff line number Diff line change 2
2
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3
3
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
4
5
- if (UMF_BUILD_OS_MEMORY_PROVIDER
6
- AND UMF_BUILD_LIBUMF_POOL_SCALABLE
7
- AND UMF_ENABLE_POOL_TRACKING )
5
+ if (UMF_BUILD_OS_MEMORY_PROVIDER AND UMF_BUILD_LIBUMF_POOL_SCALABLE AND UMF_ENABLE_POOL_TRACKING )
8
6
set (EXAMPLE_NAME umf_example_basic )
7
+
9
8
add_umf_executable (NAME ${EXAMPLE_NAME}
10
9
SRCS basic/basic.c
11
10
LIBS umf
11
+ ${LIBHWLOC_LIBRARIES}
12
12
scalable_pool )
13
+
13
14
target_include_directories (${EXAMPLE_NAME} PRIVATE
14
15
${UMF_CMAKE_SOURCE_DIR} /src/utils
15
16
${UMF_CMAKE_SOURCE_DIR} /include )
16
17
18
+ target_link_directories (${EXAMPLE_NAME} PRIVATE ${LIBHWLOC_LIBRARY_DIRS} )
19
+
17
20
add_test (NAME ${EXAMPLE_NAME}
18
21
COMMAND ${EXAMPLE_NAME}
19
22
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
@@ -23,11 +26,11 @@ if(UMF_BUILD_OS_MEMORY_PROVIDER
23
26
if (WINDOWS )
24
27
# append PATH to DLLs
25
28
set (DLL_PATH_LIST "PATH=path_list_append:../bin/$<CONFIG>" )
26
- if (LIBHWLOC_DLL_DIRS )
27
- set (DLL_PATH_LIST "${DLL_PATH_LIST} ;PATH=path_list_append:${LIBHWLOC_DLL_DIRS} " )
29
+ if (LIBHWLOC_LIBRARY_DIRS )
30
+ set (DLL_PATH_LIST "${DLL_PATH_LIST} ;PATH=path_list_append:${LIBHWLOC_LIBRARY_DIRS} /../bin " )
28
31
endif ()
29
- if (LIBTBB_DLL_DIRS )
30
- set (DLL_PATH_LIST "${DLL_PATH_LIST} ;PATH=path_list_append:${LIBTBB_DLL_DIRS} " )
32
+ if (TBB_LIBRARY_DIRS )
33
+ set (DLL_PATH_LIST "${DLL_PATH_LIST} ;PATH=path_list_append:${TBB_LIBRARY_DIRS} /../bin " )
31
34
endif ()
32
35
set_property (TEST ${EXAMPLE_NAME} PROPERTY ENVIRONMENT_MODIFICATION "${DLL_PATH_LIST} " )
33
36
endif ()
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ if(UMF_BUILD_OS_MEMORY_PROVIDER)
72
72
set (UMF_LIBS ${UMF_LIBS} ${LIBHWLOC_LIBRARIES} )
73
73
# Currently, OS provider is only built for Linux and Windows
74
74
set (UMF_PUBLIC_COMPILE_DEFINITIONS ${UMF_PUBLIC_COMPILE_DEFINITIONS} "UMF_BUILD_OS_MEMORY_PROVIDER=1" )
75
+ set (UMF_PRIVATE_LIBRARY_DIRS ${UMF_PRIVATE_LIBRARY_DIRS} ${LIBHWLOC_LIBRARY_DIRS} )
75
76
endif ()
76
77
endif ()
77
78
@@ -121,6 +122,8 @@ else()
121
122
LIBS ${UMF_LIBS} )
122
123
endif ()
123
124
125
+ target_link_directories (umf PRIVATE ${UMF_PRIVATE_LIBRARY_DIRS} )
126
+
124
127
target_compile_definitions (umf PUBLIC ${UMF_PUBLIC_COMPILE_DEFINITIONS} )
125
128
126
129
if (UMF_ENABLE_POOL_TRACKING )
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ if(UMF_BUILD_LIBUMF_POOL_SCALABLE)
65
65
TYPE STATIC
66
66
SRCS pool_scalable.c ${POOL_EXTRA_SRCS}
67
67
LIBS ${LIBS_POOL_SCALABLE} )
68
- target_include_directories (scalable_pool PRIVATE ${LIBTBB_INCLUDE_DIRS } )
68
+ target_include_directories (scalable_pool PRIVATE ${TBB_INCLUDE_DIRS } )
69
69
target_compile_definitions (scalable_pool PUBLIC ${POOL_COMPILE_DEFINITIONS} )
70
70
add_library (${PROJECT_NAME} ::scalable_pool ALIAS scalable_pool )
71
71
install (TARGETS scalable_pool
Original file line number Diff line number Diff line change @@ -31,12 +31,22 @@ function(add_umf_test)
31
31
set (TEST_NAME umf-${ARG_NAME} )
32
32
set (TEST_TARGET_NAME umf_test-${ARG_NAME} )
33
33
34
+ if (UMF_BUILD_OS_MEMORY_PROVIDER )
35
+ set (LIBS_OPTIONAL ${LIBS_OPTIONAL} ${LIBHWLOC_LIBRARIES} )
36
+ set (LIB_DIRS_OPTIONAL ${LIB_DIRS_OPTIONAL} ${LIBHWLOC_LIBRARY_DIRS} )
37
+ endif ()
38
+
34
39
set (TEST_LIBS test_common
35
40
umf
36
41
GTest::gtest_main
42
+ ${LIBS_OPTIONAL}
37
43
${ARG_LIBS} )
38
44
add_umf_executable (NAME ${TEST_TARGET_NAME} SRCS ${ARG_SRCS} LIBS ${TEST_LIBS} )
39
45
46
+ if (LIB_DIRS_OPTIONAL )
47
+ target_link_directories (${TEST_TARGET_NAME} PRIVATE ${LIB_DIRS_OPTIONAL} )
48
+ endif ()
49
+
40
50
target_include_directories (${TEST_TARGET_NAME} PRIVATE
41
51
${UMF_CMAKE_SOURCE_DIR} /include
42
52
${UMF_CMAKE_SOURCE_DIR} /src
@@ -52,11 +62,11 @@ function(add_umf_test)
52
62
53
63
if (WIN32 )
54
64
set (PATH_LIST "PATH=path_list_append:../bin/$<CONFIG>" )
55
- if (LIBHWLOC_DLL_DIRS )
56
- set (PATH_LIST "${PATH_LIST} ;PATH=path_list_append:${LIBHWLOC_DLL_DIRS} " )
65
+ if (LIBHWLOC_LIBRARY_DIRS )
66
+ set (PATH_LIST "${PATH_LIST} ;PATH=path_list_append:${LIBHWLOC_LIBRARY_DIRS} /../bin " )
57
67
endif ()
58
- if (LIBTBB_DLL_DIRS )
59
- set (PATH_LIST "${PATH_LIST} ;PATH=path_list_append:${LIBTBB_DLL_DIRS} " )
68
+ if (TBB_LIBRARY_DIRS )
69
+ set (PATH_LIST "${PATH_LIST} ;PATH=path_list_append:${TBB_LIBRARY_DIRS} /../bin " )
60
70
endif ()
61
71
set_property (TEST ${TEST_NAME} PROPERTY ENVIRONMENT_MODIFICATION "${PATH_LIST} " )
62
72
endif ()
You can’t perform that action at this time.
0 commit comments