blender/intern/guardedalloc/CMakeLists.txt
Campbell Barton e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00

85 lines
1.8 KiB
CMake

# SPDX-FileCopyrightText: 2006 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later
if(HAVE_MALLOC_STATS_H)
add_definitions(-DHAVE_MALLOC_STATS_H)
endif()
set(INC
PUBLIC .
)
set(INC_SYS
)
set(SRC
./intern/leak_detector.cc
./intern/mallocn.c
./intern/mallocn_guarded_impl.c
./intern/mallocn_lockfree_impl.c
./intern/memory_usage.cc
MEM_guardedalloc.h
./intern/mallocn_inline.h
./intern/mallocn_intern.h
# only so the header is known by cmake
../atomic/atomic_ops.h
../atomic/intern/atomic_ops_ext.h
../atomic/intern/atomic_ops_msvc.h
../atomic/intern/atomic_ops_unix.h
../atomic/intern/atomic_ops_utils.h
)
set(LIB
PRIVATE bf::intern::atomic
)
if(WIN32 AND NOT UNIX)
list(APPEND INC_SYS
${PTHREADS_INC}
)
if(DEFINED PTHREADS_LIBRARIES)
list(APPEND LIB
${PTHREADS_LIBRARIES}
)
endif()
endif()
# Jemalloc 5.0.0+ needs extra configuration.
if(WITH_MEM_JEMALLOC)
if(NOT ("${JEMALLOC_VERSION}" VERSION_LESS "5.0.0"))
add_definitions(-DWITH_JEMALLOC_CONF)
endif()
endif()
blender_add_lib(bf_intern_guardedalloc "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
add_library(bf::intern::guardedalloc ALIAS bf_intern_guardedalloc)
# Override C++ alloc, optional.
if(WITH_CXX_GUARDEDALLOC)
set(SRC
cpp/mallocn.cpp
)
blender_add_lib(bf_intern_guardedalloc_cpp "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
endif()
if(WITH_GTESTS)
set(TEST_SRC
tests/guardedalloc_alignment_test.cc
tests/guardedalloc_overflow_test.cc
tests/guardedalloc_test_base.h
)
set(TEST_INC
../../source/blender/blenlib
)
set(TEST_LIB
bf_intern_guardedalloc
bf_blenlib
)
include(GTestTesting)
blender_add_test_executable(guardedalloc "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}")
endif()