2023-08-16 00:20:26 +10:00
|
|
|
# SPDX-FileCopyrightText: 2006 Blender Authors
|
2023-06-14 22:49:59 +10:00
|
|
|
#
|
2022-02-11 09:07:11 +11:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2022-08-18 08:04:56 +10:00
|
|
|
if(HAVE_MALLOC_STATS_H)
|
|
|
|
|
add_definitions(-DHAVE_MALLOC_STATS_H)
|
|
|
|
|
endif()
|
|
|
|
|
|
2023-12-05 16:31:58 +11:00
|
|
|
if(WITH_MEM_VALGRIND)
|
|
|
|
|
add_definitions(-DWITH_MEM_VALGRIND)
|
|
|
|
|
endif()
|
|
|
|
|
|
2011-05-31 01:15:44 +00:00
|
|
|
set(INC
|
2023-07-10 18:44:19 +02:00
|
|
|
PUBLIC .
|
2011-05-31 01:15:44 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
set(INC_SYS
|
|
|
|
|
|
|
|
|
|
)
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2010-09-18 03:55:56 +00:00
|
|
|
set(SRC
|
2020-07-24 12:26:11 +02:00
|
|
|
./intern/leak_detector.cc
|
2024-04-15 13:02:12 +02:00
|
|
|
./intern/mallocn.cc
|
2024-04-12 16:44:49 +02:00
|
|
|
./intern/mallocn_guarded_impl.cc
|
|
|
|
|
./intern/mallocn_lockfree_impl.cc
|
2023-01-04 14:55:21 +01:00
|
|
|
./intern/memory_usage.cc
|
2010-11-29 04:35:56 +00:00
|
|
|
|
|
|
|
|
MEM_guardedalloc.h
|
2024-07-03 16:04:18 +02:00
|
|
|
./intern/mallocn_inline.hh
|
|
|
|
|
./intern/mallocn_intern.hh
|
2024-07-03 17:23:03 +02:00
|
|
|
./intern/mallocn_intern_function_pointers.hh
|
2013-10-31 14:09:01 +00:00
|
|
|
|
|
|
|
|
# only so the header is known by cmake
|
|
|
|
|
../atomic/atomic_ops.h
|
2019-10-29 01:32:33 +11:00
|
|
|
../atomic/intern/atomic_ops_ext.h
|
|
|
|
|
../atomic/intern/atomic_ops_msvc.h
|
|
|
|
|
../atomic/intern/atomic_ops_unix.h
|
|
|
|
|
../atomic/intern/atomic_ops_utils.h
|
2010-09-18 03:55:56 +00:00
|
|
|
)
|
|
|
|
|
|
2019-04-14 15:18:44 +02:00
|
|
|
set(LIB
|
2023-07-07 15:37:02 +02:00
|
|
|
PRIVATE bf::intern::atomic
|
2019-04-14 15:18:44 +02:00
|
|
|
)
|
|
|
|
|
|
2010-11-21 13:41:43 +00:00
|
|
|
if(WIN32 AND NOT UNIX)
|
2020-05-20 02:14:49 +02:00
|
|
|
list(APPEND INC_SYS
|
|
|
|
|
${PTHREADS_INC}
|
|
|
|
|
)
|
2023-01-19 17:07:23 +11:00
|
|
|
if(DEFINED PTHREADS_LIBRARIES)
|
|
|
|
|
list(APPEND LIB
|
|
|
|
|
${PTHREADS_LIBRARIES}
|
|
|
|
|
)
|
|
|
|
|
endif()
|
2010-11-21 13:41:43 +00:00
|
|
|
endif()
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2023-07-29 13:47:57 +10:00
|
|
|
if(WITH_MEM_JEMALLOC)
|
2025-05-21 19:10:57 +02:00
|
|
|
add_definitions(-DWITH_MEM_JEMALLOC)
|
2018-10-03 11:10:08 +02:00
|
|
|
endif()
|
|
|
|
|
|
2019-04-14 15:18:44 +02:00
|
|
|
blender_add_lib(bf_intern_guardedalloc "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
2023-07-10 18:44:19 +02:00
|
|
|
add_library(bf::intern::guardedalloc ALIAS bf_intern_guardedalloc)
|
2009-08-18 15:20:29 +00:00
|
|
|
|
2020-08-07 16:43:42 +02:00
|
|
|
if(WITH_GTESTS)
|
|
|
|
|
set(TEST_SRC
|
|
|
|
|
tests/guardedalloc_alignment_test.cc
|
|
|
|
|
tests/guardedalloc_overflow_test.cc
|
2021-03-14 18:11:24 +05:30
|
|
|
tests/guardedalloc_test_base.h
|
2020-08-07 16:43:42 +02:00
|
|
|
)
|
|
|
|
|
set(TEST_INC
|
|
|
|
|
../../source/blender/blenlib
|
|
|
|
|
)
|
|
|
|
|
set(TEST_LIB
|
|
|
|
|
bf_intern_guardedalloc
|
|
|
|
|
bf_blenlib
|
|
|
|
|
)
|
2024-01-03 18:35:50 +01:00
|
|
|
blender_add_test_suite_executable(guardedalloc "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}")
|
2020-08-07 16:43:42 +02:00
|
|
|
endif()
|