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,11 +20,7 @@
if(CONFIG_MM_IOB)
set(SRCS)
list(
APPEND
SRCS
set(SRCS
iob_add_queue.c
iob_alloc.c
iob_alloc_qentry.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,11 +22,7 @@
if(CONFIG_MM_KERNEL_HEAP)
set(SRCS)
list(
APPEND
SRCS
set(SRCS
kmm_initialize.c
kmm_addregion.c
kmm_malloc_size.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,11 +21,8 @@
# An optional granule allocator
if(CONFIG_GRAN)
set(SRCS)
list(
APPEND
SRCS
set(SRCS
mm_graninit.c
mm_granrelease.c
mm_granreserve.c

View File

@ -22,11 +22,7 @@
if(CONFIG_MM_DEFAULT_MANAGER)
set(SRCS)
list(
APPEND
SRCS
set(SRCS
mm_initialize.c
mm_lock.c
mm_addfreechunk.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,11 +20,7 @@
# User heap allocator
set(SRCS)
list(
APPEND
SRCS
set(SRCS
umm_initialize.c
umm_addregion.c
umm_brkaddr.c
@ -37,7 +33,9 @@ list(
umm_realloc.c
umm_zalloc.c
umm_heapmember.c
umm_globals.c)
umm_globals.c
umm_memdump.c
umm_malloc_size.c)
if(CONFIG_BUILD_KERNEL)
list(APPEND SRCS umm_sbrk.c)