Skip to content

Commit 9424202

Browse files
committed
build pool libs as shared if umf is shared also
1 parent 8aa6060 commit 9424202

13 files changed

+108
-32
lines changed

benchmark/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ endif()
102102
add_umf_benchmark(
103103
NAME ubench
104104
SRCS ubench.c
105-
LIBS ${LIBS_OPTIONAL}
105+
LIBS ${LIBS_OPTIONAL} umf_utils
106106
LIBDIRS ${LIB_DIRS})
107107

108108
if(UMF_BUILD_BENCHMARKS_MT)
109109
add_umf_benchmark(
110110
NAME multithreaded
111111
SRCS multithread.cpp
112-
LIBS ${LIBS_OPTIONAL} ${CMAKE_THREAD_LIBS_INIT}
112+
LIBS ${LIBS_OPTIONAL} ${CMAKE_THREAD_LIBS_INIT} umf_utils
113113
LIBDIRS ${LIB_DIRS})
114114
endif()

src/pool/CMakeLists.txt

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,40 @@
44

55
if(UMF_BUILD_SHARED_LIBRARY)
66
set(POOL_EXTRA_SRCS ${BA_SOURCES})
7-
set(POOL_COMPILE_DEFINITIONS UMF_SHARED_LIBRARY)
8-
set(POOL_EXTRA_LIBS $<BUILD_INTERFACE:umf_utils>)
7+
set(POOL_COMPILE_DEFINITIONS UMF_SHARED_LIBRARY)
8+
set(POOL_EXTRA_LIBS $<BUILD_INTERFACE:umf> $<BUILD_INTERFACE:umf_utils>)
9+
set(POOL_LIBRARY_TYPE SHARED)
10+
else()
11+
set(POOL_LIBRARY_TYPE STATIC)
912
endif()
1013

1114
# libumf_pool_disjoint
1215
if(UMF_BUILD_LIBUMF_POOL_DISJOINT)
1316
add_umf_library(
1417
NAME disjoint_pool
15-
TYPE STATIC
18+
TYPE ${POOL_LIBRARY_TYPE}
1619
SRCS pool_disjoint.cpp ${POOL_EXTRA_SRCS}
20+
LINUX_MAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libdisjoint_pool.map
21+
WINDOWS_DEF_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libdisjoint_pool.def
1722
LIBS ${POOL_EXTRA_LIBS})
1823
target_compile_definitions(disjoint_pool
1924
PRIVATE ${POOL_COMPILE_DEFINITIONS})
20-
2125
add_library(${PROJECT_NAME}::disjoint_pool ALIAS disjoint_pool)
22-
23-
add_dependencies(disjoint_pool umf)
24-
25-
target_link_libraries(disjoint_pool PRIVATE umf)
26-
27-
target_include_directories(
28-
disjoint_pool
29-
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/umf/pools>
30-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
31-
3226
install(TARGETS disjoint_pool EXPORT ${PROJECT_NAME}-targets)
3327
endif()
3428

3529
# libumf_pool_jemalloc
3630
if(UMF_BUILD_LIBUMF_POOL_JEMALLOC)
3731
add_umf_library(
3832
NAME jemalloc_pool
39-
TYPE STATIC
33+
TYPE ${POOL_LIBRARY_TYPE}
4034
SRCS pool_jemalloc.c ${POOL_EXTRA_SRCS}
41-
LIBS jemalloc ${POOL_EXTRA_LIBS})
35+
LINUX_MAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libjemalloc_pool.map
36+
WINDOWS_DEF_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libjemalloc_pool.def
37+
LIBS jemalloc ${POOL_EXTRA_LIBS})
4238
target_include_directories(jemalloc_pool PRIVATE ${JEMALLOC_INCLUDE_DIRS})
43-
target_compile_definitions(jemalloc_pool
44-
PRIVATE ${POOL_COMPILE_DEFINITIONS})
39+
target_link_directories(jemalloc_pool PRIVATE ${JEMALLOC_LIBRARY_DIRS})
40+
target_compile_definitions(jemalloc_pool PRIVATE ${POOL_COMPILE_DEFINITIONS})
4541
add_library(${PROJECT_NAME}::jemalloc_pool ALIAS jemalloc_pool)
4642
install(TARGETS jemalloc_pool EXPORT ${PROJECT_NAME}-targets)
4743
endif()
@@ -56,10 +52,13 @@ if(UMF_BUILD_LIBUMF_POOL_SCALABLE)
5652

5753
add_umf_library(
5854
NAME scalable_pool
59-
TYPE STATIC
55+
TYPE ${POOL_LIBRARY_TYPE}
6056
SRCS pool_scalable.c ${POOL_EXTRA_SRCS}
57+
LINUX_MAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libscalable_pool.map
58+
WINDOWS_DEF_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libscalable_pool.def
6159
LIBS ${LIBS_POOL_SCALABLE})
6260
target_include_directories(scalable_pool PRIVATE ${TBB_INCLUDE_DIRS})
61+
target_link_directories(scalable_pool PRIVATE ${TBB_LIBRARY_DIRS})
6362
target_compile_definitions(scalable_pool
6463
PRIVATE ${POOL_COMPILE_DEFINITIONS})
6564
add_library(${PROJECT_NAME}::scalable_pool ALIAS scalable_pool)

src/pool/libdisjoint_pool.def

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
;;;; Begin Copyright Notice
2+
; Copyright (C) 2024 Intel Corporation
3+
; Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
4+
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
;;;; End Copyright Notice
6+
7+
LIBRARY libdisjoint_pool
8+
9+
VERSION 1.0
10+
11+
EXPORTS
12+
DllMain
13+
umfDisjointPoolOps
14+
umfDisjointPoolSharedLimitsCreate
15+
umfDisjointPoolSharedLimitsDestroy

src/pool/libdisjoint_pool.map

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
UMF_1.0 {
6+
global:
7+
umfDisjointPoolOps;
8+
umfDisjointPoolSharedLimitsCreate;
9+
umfDisjointPoolSharedLimitsDestroy;
10+
local:
11+
*;
12+
};

src/pool/libjemalloc_pool.def

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
;;;; Begin Copyright Notice
2+
; Copyright (C) 2024 Intel Corporation
3+
; Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
4+
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
;;;; End Copyright Notice
6+
7+
LIBRARY libjemalloc_pool
8+
9+
VERSION 1.0
10+
11+
EXPORTS
12+
DllMain
13+
umfJemallocPoolOps

src/pool/libjemalloc_pool.map

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
UMF_1.0 {
6+
global:
7+
umfJemallocPoolOps;
8+
local:
9+
*;
10+
};

src/pool/libscalable_pool.def

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
;;;; Begin Copyright Notice
2+
; Copyright (C) 2024 Intel Corporation
3+
; Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
4+
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
;;;; End Copyright Notice
6+
7+
LIBRARY libscalable_pool
8+
9+
VERSION 1.0
10+
11+
EXPORTS
12+
DllMain
13+
umfScalablePoolOps

src/pool/libscalable_pool.map

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
UMF_1.0 {
6+
global:
7+
umfScalablePoolOps;
8+
local:
9+
*;
10+
};

src/pool/pool_disjoint.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
#include <utility>
2020
#include <vector>
2121

22-
// TODO: replace with logger?
22+
// TODO use logger
2323
#include <iostream>
2424

25+
#include <umf/memory_pool.h>
26+
#include <umf/memory_pool_ops.h>
27+
#include <umf/pools/pool_disjoint.h>
28+
2529
#include "../cpp_helpers.hpp"
26-
#include "pool_disjoint.h"
27-
#include "umf.h"
2830
#include "utils_log.h"
2931
#include "utils_math.h"
3032
#include "utils_sanitizers.h"

test/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,14 @@ add_umf_test(
225225
if(UMF_PROXY_LIB_ENABLED AND UMF_BUILD_SHARED_LIBRARY)
226226
add_umf_test(
227227
NAME proxy_lib_basic
228-
SRCS test_proxy_lib.cpp
229-
LIBS umf_proxy)
228+
SRCS ${BA_SOURCES_FOR_TEST} test_proxy_lib.cpp
229+
LIBS umf_proxy ${UMF_UTILS_FOR_TEST})
230230

231231
# the memoryPool test run with the proxy library
232232
add_umf_test(
233233
NAME proxy_lib_memoryPool
234-
SRCS memoryPoolAPI.cpp malloc_compliance_tests.cpp
235-
LIBS umf_proxy)
234+
SRCS ${BA_SOURCES_FOR_TEST} memoryPoolAPI.cpp malloc_compliance_tests.cpp
235+
LIBS umf_proxy ${UMF_UTILS_FOR_TEST})
236236
target_compile_definitions(umf_test-proxy_lib_memoryPool
237237
PUBLIC UMF_PROXY_LIB_ENABLED=1)
238238
endif()

test/c_api/disjoint_pool.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
#include <stdlib.h>
66

7-
#include "pool_disjoint.h"
7+
#include <umf/pools/pool_disjoint.h>
8+
89
#include "provider_null.h"
910
#include "test_helpers.h"
1011

test/pools/disjoint_pool.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
#include <umf/pools/pool_disjoint.h>
6+
57
#include "pool.hpp"
68
#include "poolFixtures.hpp"
7-
#include "pool_disjoint.h"
89
#include "provider.hpp"
910
#include "provider_null.h"
1011
#include "provider_trace.h"

test/test_installation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ def _create_match_list(self) -> List[str]:
9393
f"lib/cmake/umf/umf-targets-{self.build_type}.cmake",
9494
"lib/cmake/umf/umf-targets.cmake",
9595
]
96-
for pool in self.pools:
97-
lib.append(f"lib/{lib_prefix}{pool}.{lib_ext_static}")
9896
lib_ext = lib_ext_shared if self.shared_library else lib_ext_static
97+
for pool in self.pools:
98+
lib.append(f"lib/{lib_prefix}{pool}.{lib_ext}")
9999
lib.append(f"lib/{lib_prefix}umf.{lib_ext}")
100100
if is_umf_proxy:
101101
lib.append(f"lib/{lib_prefix}umf_proxy.{lib_ext_shared}")

0 commit comments

Comments
 (0)