2008-01-07 19:13:47 +00:00
|
|
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
2006-11-17 02:27:12 +00:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
2008-01-07 19:13:47 +00:00
|
|
|
# of the License, or (at your option) any later version.
|
2006-11-17 02:27:12 +00:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-11-17 02:27:12 +00:00
|
|
|
#
|
|
|
|
# The Original Code is Copyright (C) 2006, Blender Foundation
|
|
|
|
# All rights reserved.
|
2008-01-07 19:13:47 +00:00
|
|
|
# ***** END GPL LICENSE BLOCK *****
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2011-05-31 01:15:44 +00:00
|
|
|
set(INC
|
|
|
|
.
|
2013-08-19 10:51:40 +00:00
|
|
|
../atomic
|
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 10:26:11 +00:00
|
|
|
./intern/leak_detector.cc
|
2010-09-18 03:55:56 +00:00
|
|
|
./intern/mallocn.c
|
2013-10-10 11:58:01 +00:00
|
|
|
./intern/mallocn_guarded_impl.c
|
|
|
|
./intern/mallocn_lockfree_impl.c
|
2010-11-29 04:35:56 +00:00
|
|
|
|
|
|
|
MEM_guardedalloc.h
|
2018-01-14 20:53:32 +00:00
|
|
|
./intern/mallocn_inline.h
|
2013-10-10 11:58:01 +00:00
|
|
|
./intern/mallocn_intern.h
|
2013-10-31 14:09:01 +00:00
|
|
|
|
|
|
|
# only so the header is known by cmake
|
|
|
|
../atomic/atomic_ops.h
|
2019-10-28 14:32:33 +00: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 13:18:44 +00:00
|
|
|
set(LIB
|
|
|
|
)
|
|
|
|
|
2010-11-21 13:41:43 +00:00
|
|
|
if(WIN32 AND NOT UNIX)
|
2020-05-20 00:14:49 +00:00
|
|
|
list(APPEND INC_SYS
|
|
|
|
${PTHREADS_INC}
|
|
|
|
)
|
|
|
|
|
|
|
|
list(APPEND LIB
|
|
|
|
${PTHREADS_LIBRARIES}
|
|
|
|
)
|
2010-11-21 13:41:43 +00:00
|
|
|
endif()
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2018-10-03 09:10:08 +00:00
|
|
|
# Jemalloc 5.0.0+ needs extra configuration.
|
2018-10-03 10:54:21 +00:00
|
|
|
if(WITH_MEM_JEMALLOC AND NOT ("${JEMALLOC_VERSION}" VERSION_LESS "5.0.0"))
|
2018-10-03 09:10:08 +00:00
|
|
|
add_definitions(-DWITH_JEMALLOC_CONF)
|
|
|
|
endif()
|
|
|
|
|
2019-04-14 13:18:44 +00:00
|
|
|
blender_add_lib(bf_intern_guardedalloc "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
2009-08-18 15:20:29 +00:00
|
|
|
|
2010-09-18 03:55:56 +00:00
|
|
|
# Override C++ alloc, optional.
|
2009-08-18 15:20:29 +00:00
|
|
|
if(WITH_CXX_GUARDEDALLOC)
|
2010-11-29 04:35:56 +00:00
|
|
|
set(SRC
|
|
|
|
cpp/mallocn.cpp
|
|
|
|
)
|
2019-04-14 13:18:44 +00:00
|
|
|
blender_add_lib(bf_intern_guardedalloc_cpp "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
2009-08-18 15:20:29 +00:00
|
|
|
endif()
|
2020-08-07 14:43:42 +00:00
|
|
|
|
|
|
|
if(WITH_GTESTS)
|
|
|
|
set(TEST_SRC
|
|
|
|
tests/guardedalloc_alignment_test.cc
|
|
|
|
tests/guardedalloc_overflow_test.cc
|
|
|
|
)
|
|
|
|
set(TEST_INC
|
|
|
|
../../source/blender/blenlib
|
|
|
|
)
|
|
|
|
set(TEST_LIB
|
|
|
|
bf_intern_guardedalloc
|
|
|
|
bf_blenlib
|
|
|
|
)
|
|
|
|
include(GTestTesting)
|
2020-09-15 09:16:35 +00:00
|
|
|
blender_add_test_executable(guardedalloc "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}")
|
2020-08-07 14:43:42 +00:00
|
|
|
endif()
|