Skip to content

Commit c8dd8bd

Browse files
committed
build pool libs as shared if umf is shared also
1 parent 47ce308 commit c8dd8bd

13 files changed

+100
-26
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: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,33 @@ if(UMF_BUILD_SHARED_LIBRARY)
66
set(POOL_EXTRA_SRCS ${BA_SOURCES})
77
set(POOL_COMPILE_DEFINITIONS UMF_SHARED_LIBRARY)
88
set(POOL_EXTRA_LIBS $<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 PUBLIC ${POOL_COMPILE_DEFINITIONS})
19-
2024
add_library(${PROJECT_NAME}::disjoint_pool ALIAS disjoint_pool)
21-
22-
add_dependencies(disjoint_pool umf)
23-
24-
target_link_libraries(disjoint_pool PRIVATE umf)
25-
26-
target_include_directories(
27-
disjoint_pool
28-
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/umf/pools>
29-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
30-
3125
install(TARGETS disjoint_pool EXPORT ${PROJECT_NAME}-targets)
3226
endif()
3327

3428
# libumf_pool_jemalloc
3529
if(UMF_BUILD_LIBUMF_POOL_JEMALLOC)
3630
add_umf_library(
3731
NAME jemalloc_pool
38-
TYPE STATIC
32+
TYPE ${POOL_LIBRARY_TYPE}
3933
SRCS pool_jemalloc.c ${POOL_EXTRA_SRCS}
34+
LINUX_MAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libjemalloc_pool.map
35+
WINDOWS_DEF_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libjemalloc_pool.def
4036
LIBS jemalloc ${POOL_EXTRA_LIBS})
4137
target_include_directories(jemalloc_pool PRIVATE ${JEMALLOC_INCLUDE_DIRS})
4238
target_compile_definitions(jemalloc_pool PUBLIC ${POOL_COMPILE_DEFINITIONS})
@@ -54,8 +50,10 @@ if(UMF_BUILD_LIBUMF_POOL_SCALABLE)
5450

5551
add_umf_library(
5652
NAME scalable_pool
57-
TYPE STATIC
53+
TYPE ${POOL_LIBRARY_TYPE}
5854
SRCS pool_scalable.c ${POOL_EXTRA_SRCS}
55+
LINUX_MAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libscalable_pool.map
56+
WINDOWS_DEF_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libscalable_pool.def
5957
LIBS ${LIBS_POOL_SCALABLE})
6058
target_include_directories(scalable_pool PRIVATE ${TBB_INCLUDE_DIRS})
6159
target_compile_definitions(scalable_pool PUBLIC ${POOL_COMPILE_DEFINITIONS})

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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
#include <iostream>
2424

2525
#include "../cpp_helpers.hpp"
26-
#include "pool_disjoint.h"
27-
#include "umf.h"
2826
#include "utils_math.h"
2927
#include "utils_sanitizers.h"
3028

29+
#include <umf/memory_pool.h>
30+
#include <umf/memory_pool_ops.h>
31+
#include <umf/pools/pool_disjoint.h>
32+
3133
typedef struct umf_disjoint_pool_shared_limits_t {
3234
size_t MaxSize;
3335
std::atomic<size_t> TotalSize;

test/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,13 @@ 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
235+
malloc_compliance_tests.cpp
236+
LIBS umf_proxy ${UMF_UTILS_FOR_TEST})
236237
endif()

test/c_api/disjoint_pool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
#include <stdlib.h>
66

7-
#include "pool_disjoint.h"
87
#include "provider_null.h"
98
#include "test_helpers.h"
9+
#include "umf/pools/pool_disjoint.h"
1010

1111
void test_disjoint_pool_default_params(void) {
1212
umf_memory_provider_handle_t provider = nullProviderCreate();

test/pools/disjoint_pool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
#include "pool.hpp"
66
#include "poolFixtures.hpp"
7-
#include "pool_disjoint.h"
87
#include "provider.hpp"
98
#include "provider_null.h"
109
#include "provider_trace.h"
10+
#include "umf/pools/pool_disjoint.h"
1111

1212
umf_disjoint_pool_params_t poolConfig() {
1313
umf_disjoint_pool_params_t config{};

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)