~aleteoryx/muditaos

67c5de4da621e5927d2b48c0f4d55c78f3a9d0db — Lucjan Bryndza 4 years ago aa8a698
[EGD-7741] Cmake changes in the lwext4 project

Cmake changes in the LWEXT4 project

Signed-off-by: Lucjan Bryndza <lucjan.bryndza@mudita.com>
4 files changed, 17 insertions(+), 34 deletions(-)

M cmake/modules/ProjectConfig.cmake
M third-party/lwext4/CMakeLists.txt
A third-party/lwext4/ext4_config.h.in
D third-party/lwext4/lwext4_macros.cmake
M cmake/modules/ProjectConfig.cmake => cmake/modules/ProjectConfig.cmake +7 -0
@@ 39,6 39,13 @@ else()
    set (LOG_LUART_ENABLED 0 CACHE INTERNAL "")
endif()

# Config option for the lwext4
# LWEXT4 debug options
option(LWEXT4_DEBUG_PRINTF "LWEXT4 debug printf enable" ON)
option(LWEXT4_DEBUG_ASSERT "LWEXT4 assert printf enable" OFF)
# LWEXT4 sectors cache size
set(LWEXT4_CACHE_SIZE 256 CACHE INTERNAL "")

# add Development Configuration option
option(WITH_DEVELOPMENT_FEATURES "Include development features" OFF)
set(DEVELOPER_SETTINGS_OPTIONS_DEFAULT ${WITH_DEVELOPMENT_FEATURES} CACHE INTERNAL "")

M third-party/lwext4/CMakeLists.txt => third-party/lwext4/CMakeLists.txt +5 -11
@@ 2,7 2,10 @@ cmake_minimum_required(VERSION 3.13)
add_library(lwext4 STATIC)
add_library(lwext4::lwext4 ALIAS lwext4)

include(lwext4_macros.cmake)

set( CONFIG_DEBUG_PRINTF ${LWEXT4_DEBUG_PRINTF})
set( CONFIG_DEBUG_ASSERT ${LWEXT4_DEBUG_ASSERT})


target_include_directories(lwext4
    PUBLIC


@@ 10,14 13,6 @@ target_include_directories(lwext4
        $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
)

target_compile_definitions(lwext4
    PRIVATE
    CONFIG_DEBUG_PRINTF=1
    CONFIG_DEBUG_ASSERT=0
    CONFIG_HAVE_OWN_OFLAGS=0
    CONFIG_HAVE_OWN_ERRNO=0
    CONFIG_BLOCK_DEV_CACHE_SIZE=256
)
target_compile_options(lwext4
    PRIVATE
    -Wno-format


@@ 77,5 72,4 @@ target_sources(lwext4
        lwext4/include/misc/tree.h
)

lwext4_output_configure()

configure_file( ext4_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/generated/ext4_config.h @ONLY)

A third-party/lwext4/ext4_config.h.in => third-party/lwext4/ext4_config.h.in +5 -0
@@ 0,0 1,5 @@
#cmakedefine01 CONFIG_DEBUG_PRINTF
#cmakedefine01 CONFIG_DEBUG_ASSERT
#define CONFIG_BLOCK_DEV_CACHE_SIZE @LWEXT4_CACHE_SIZE@
#define CONFIG_HAVE_OWN_OFLAGS 0
#define CONFIG_HAVE_OWN_ERRNO 0

D third-party/lwext4/lwext4_macros.cmake => third-party/lwext4/lwext4_macros.cmake +0 -23
@@ 1,23 0,0 @@
macro(lwext4_output_configure)
    get_property(
        definitions
        TARGET lwext4::lwext4
        PROPERTY COMPILE_DEFINITIONS
    )
    file(WRITE
         ${CMAKE_CURRENT_BINARY_DIR}/include/generated/ext4_config.h
         "")
    foreach(item ${definitions})
        string(REGEX MATCH "^CONFIG_" match_res ${item})
        if(match_res)
            string(REGEX REPLACE "=(.+)$" "" replace_res ${item})
            string(CONFIGURE
                   "#define ${replace_res} ${CMAKE_MATCH_1}"
                   output_str)
            file(APPEND
                 ${CMAKE_CURRENT_BINARY_DIR}/include/generated/ext4_config.h
                 "${output_str}\n")
        endif()
    endforeach()
endmacro()
lwext4_output_configure()
\ No newline at end of file