1# Copyright (c) 2020 Linumiz 2# SPDX-License-Identifier: Apache-2.0 3 4if(CONFIG_LZ4) 5 set(LZ4_DIR ${ZEPHYR_CURRENT_MODULE_DIR}) 6 7 zephyr_library() 8 9 zephyr_include_directories(${LZ4_DIR}/lib) 10 11 zephyr_library_compile_definitions_ifdef(CONFIG_LZ4_HEAPMODE_STACK 12 LZ4_HEAPMODE=0 13 ) 14 15 zephyr_library_compile_definitions_ifdef(CONFIG_LZ4_DISABLE_DYNAMIC_MEMORY_ALLOCATION 16 LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION 17 ) 18 19 zephyr_library_compile_definitions( 20 LZ4_MEMORY_USAGE=${CONFIG_LZ4_MEMORY_USAGE} 21 ) 22 23 zephyr_library_sources( 24 ${LZ4_DIR}/lib/lz4.c 25 ) 26 27 zephyr_library_sources_ifdef(CONFIG_LZ4_HIGH_COMPRESSION_VARIANT 28 ${LZ4_DIR}/lib/lz4hc.c 29 ) 30 31 zephyr_library_compile_definitions_ifdef(CONFIG_LZ4HC_HEAPMODE_STACK 32 LZ4HC_HEAPMODE=0 33 ) 34 35 zephyr_library_sources_ifdef(CONFIG_LZ4_XX_HASH 36 ${LZ4_DIR}/lib/xxhash.c 37 ) 38 39 zephyr_library_sources_ifdef(CONFIG_LZ4_FRAME_SUPPORT 40 ${LZ4_DIR}/lib/lz4frame.c 41 ) 42 43 zephyr_library_compile_definitions_ifdef(CONFIG_LZ4F_HEAPMODE_HEAP 44 LZ4F_HEAPMODE=1 45 ) 46endif() 47