cmake:complete missing changes during cmake reforming for mm

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
This commit is contained in:
xuxin19 2023-09-06 17:07:56 +08:00 committed by Petro Karashchenko
parent b1cc5b50b1
commit 5b6488f09f
10 changed files with 192 additions and 108 deletions

View File

@ -20,38 +20,34 @@
if(CONFIG_MM_IOB)
set(SRCS)
list(
APPEND
SRCS
iob_add_queue.c
iob_alloc.c
iob_alloc_qentry.c
iob_clone.c
iob_concat.c
iob_copyin.c
iob_copyout.c
iob_contig.c
iob_free.c
iob_free_chain.c
iob_free_qentry.c
iob_free_queue.c
iob_initialize.c
iob_pack.c
iob_peek_queue.c
iob_remove_queue.c
iob_statistics.c
iob_trimhead.c
iob_trimhead_queue.c
iob_trimtail.c
iob_navail.c
iob_free_queue_qentry.c
iob_tailroom.c
iob_get_queue_size.c
iob_reserve.c
iob_update_pktlen.c
iob_count.c)
set(SRCS
iob_add_queue.c
iob_alloc.c
iob_alloc_qentry.c
iob_clone.c
iob_concat.c
iob_copyin.c
iob_copyout.c
iob_contig.c
iob_free.c
iob_free_chain.c
iob_free_qentry.c
iob_free_queue.c
iob_initialize.c
iob_pack.c
iob_peek_queue.c
iob_remove_queue.c
iob_statistics.c
iob_trimhead.c
iob_trimhead_queue.c
iob_trimtail.c
iob_navail.c
iob_free_queue_qentry.c
iob_tailroom.c
iob_get_queue_size.c
iob_reserve.c
iob_update_pktlen.c
iob_count.c)
if(CONFIG_IOB_NOTIFIER)
list(APPEND SRCS iob_notifier.c)
@ -61,6 +57,9 @@ if(CONFIG_MM_IOB)
list(APPEND SRCS iob_dump.c)
endif()
if(CONFIG_IOB_SECTION)
target_compile_options(mm PRIVATE -DIOB_SECTION=CONFIG_IOB_SECTION)
endif()
target_sources(mm PRIVATE ${SRCS})
endif()

View File

@ -22,24 +22,20 @@
if(CONFIG_MM_KERNEL_HEAP)
set(SRCS)
list(
APPEND
SRCS
kmm_initialize.c
kmm_addregion.c
kmm_malloc_size.c
kmm_brkaddr.c
kmm_calloc.c
kmm_extend.c
kmm_free.c
kmm_mallinfo.c
kmm_malloc.c
kmm_memalign.c
kmm_realloc.c
kmm_zalloc.c
kmm_heapmember.c)
set(SRCS
kmm_initialize.c
kmm_addregion.c
kmm_malloc_size.c
kmm_brkaddr.c
kmm_calloc.c
kmm_extend.c
kmm_free.c
kmm_mallinfo.c
kmm_malloc.c
kmm_memalign.c
kmm_realloc.c
kmm_zalloc.c
kmm_heapmember.c)
if(CONFIG_DEBUG_MM)
list(APPEND SRCS kmm_checkcorruption.c)

View File

@ -17,8 +17,7 @@
# the License.
#
# ##############################################################################
set(SRCS)
list(APPEND SRCS mm_map.c)
set(SRCS mm_map.c)
if(CONFIG_ARCH_VMA_MAPPING)
list(APPEND SRCS vm_region.c)

View File

@ -17,8 +17,7 @@
# the License.
#
# ##############################################################################
set(SRCS)
list(APPEND SRCS mempool.c mempool_multiple.c)
set(SRCS mempool.c mempool_multiple.c)
if(CONFIG_FS_PROCFS)
if(NOT CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL)

View File

@ -21,19 +21,16 @@
# An optional granule allocator
if(CONFIG_GRAN)
set(SRCS)
list(
APPEND
SRCS
mm_graninit.c
mm_granrelease.c
mm_granreserve.c
mm_granalloc.c
mm_granmark.c
mm_granfree.c
mm_graninfo.c
mm_grancritical.c)
set(SRCS
mm_graninit.c
mm_granrelease.c
mm_granreserve.c
mm_granalloc.c
mm_granmark.c
mm_granfree.c
mm_graninfo.c
mm_grancritical.c)
# A page allocator based on the granule allocator

View File

@ -22,29 +22,25 @@
if(CONFIG_MM_DEFAULT_MANAGER)
set(SRCS)
list(
APPEND
SRCS
mm_initialize.c
mm_lock.c
mm_addfreechunk.c
mm_size2ndx.c
mm_malloc_size.c
mm_shrinkchunk.c
mm_brkaddr.c
mm_calloc.c
mm_extend.c
mm_free.c
mm_mallinfo.c
mm_malloc.c
mm_foreach.c
mm_memalign.c
mm_realloc.c
mm_zalloc.c
mm_heapmember.c
mm_memdump.c)
set(SRCS
mm_initialize.c
mm_lock.c
mm_addfreechunk.c
mm_size2ndx.c
mm_malloc_size.c
mm_shrinkchunk.c
mm_brkaddr.c
mm_calloc.c
mm_extend.c
mm_free.c
mm_mallinfo.c
mm_malloc.c
mm_foreach.c
mm_memalign.c
mm_realloc.c
mm_zalloc.c
mm_heapmember.c
mm_memdump.c)
if(CONFIG_DEBUG_MM)
list(APPEND SRCS mm_checkcorruption.c)

View File

@ -21,5 +21,5 @@
# Shared memory allocator
if(CONFIG_MM_SHM)
target_sources(mm PRIVATE shm_initialize.c shmat.c shmctl.c shmdt.c shmget.c)
target_sources(mm PRIVATE shmat.c shmctl.c shmdt.c shmget.c)
endif()

75
mm/tlsf/CMakeLists.txt Normal file
View File

@ -0,0 +1,75 @@
# ##############################################################################
# mm/tlsf/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################
if(CONFIG_MM_TLSF_MANAGER)
# ############################################################################
# Config and Fetch tlsf
# ########################################################################TLSF
set(TLSF_DIR ${CMAKE_CURRENT_LIST_DIR}/tlsf)
if(NOT EXISTS ${TLSF_DIR})
FetchContent_Declare(
tlsf_fetch
GIT_REPOSITORY https://github.com/mattconte/tlsf.git
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/tlsf BINARY_DIR
${CMAKE_BINARY_DIR}/mm/tlsf/tlsf
PATCH_COMMAND
patch -p1 -d ${CMAKE_CURRENT_LIST_DIR} <
${CMAKE_CURRENT_LIST_DIR}/0001-Add-TLSF_API-and-tlsf_printf.patch &&
patch -p1 -d ${CMAKE_CURRENT_LIST_DIR} <
${CMAKE_CURRENT_LIST_DIR}/0002-Define-_DEBUG-to-0-if-not-done-yet.patch
&& patch -p1 -d ${CMAKE_CURRENT_LIST_DIR} <
${CMAKE_CURRENT_LIST_DIR}/0003-Support-customize-FL_INDEX_MAX-to-reduce-the-memory-.patch
&& patch -p1 -d ${CMAKE_CURRENT_LIST_DIR} <
${CMAKE_CURRENT_LIST_DIR}/0004-Add-tlsf_extend_pool-function.patch &&
patch -p1 -d ${CMAKE_CURRENT_LIST_DIR} <
${CMAKE_CURRENT_LIST_DIR}/0005-Fix-warnining-on-implicit-pointer-conversion.patch
DOWNLOAD_NO_PROGRESS true
TIMEOUT 30)
FetchContent_GetProperties(tlsf_fetch)
if(NOT tlsf_fetch_POPULATED)
FetchContent_Populate(tlsf_fetch)
endif()
endif()
# ############################################################################
# Flags
# ############################################################################
set(CFLAGS -Dtlsf_printf=if\(0\)printf)
# ############################################################################
# Sources
# ############################################################################
set(CSRCS mm_tlsf.c ${TLSF_DIR}/tlsf.c)
# ############################################################################
# Library Configuration
# ############################################################################
target_sources(mm PRIVATE ${CSRCS})
target_compile_options(mm PRIVATE ${CFLAGS})
endif()

25
mm/ubsan/CMakeLists.txt Normal file
View File

@ -0,0 +1,25 @@
# ##############################################################################
# mm/ubsan/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################
if(CONFIG_MM_UBSAN)
target_sources(mm PRIVATE ubsan.c)
endif()

View File

@ -20,24 +20,22 @@
# User heap allocator
set(SRCS)
list(
APPEND
SRCS
umm_initialize.c
umm_addregion.c
umm_brkaddr.c
umm_calloc.c
umm_extend.c
umm_free.c
umm_mallinfo.c
umm_malloc.c
umm_memalign.c
umm_realloc.c
umm_zalloc.c
umm_heapmember.c
umm_globals.c)
set(SRCS
umm_initialize.c
umm_addregion.c
umm_brkaddr.c
umm_calloc.c
umm_extend.c
umm_free.c
umm_mallinfo.c
umm_malloc.c
umm_memalign.c
umm_realloc.c
umm_zalloc.c
umm_heapmember.c
umm_globals.c
umm_memdump.c
umm_malloc_size.c)
if(CONFIG_BUILD_KERNEL)
list(APPEND SRCS umm_sbrk.c)