1# SPDX-License-Identifier: Apache-2.0
2
3if(CONFIG_FILE_SYSTEM)
4  zephyr_interface_library_named(FS)
5
6  zephyr_library()
7  zephyr_library_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
8  zephyr_library_sources(fs.c fs_impl.c)
9  zephyr_library_sources_ifdef(CONFIG_FAT_FILESYSTEM_ELM   fat_fs.c)
10  zephyr_library_sources_ifdef(CONFIG_FILE_SYSTEM_LITTLEFS littlefs_fs.c)
11  zephyr_library_sources_ifdef(CONFIG_FILE_SYSTEM_SHELL    shell.c)
12
13  zephyr_library_compile_definitions_ifdef(CONFIG_FILE_SYSTEM_LITTLEFS
14                                           LFS_CONFIG=zephyr_lfs_config.h
15  )
16
17  add_subdirectory_ifdef(CONFIG_FILE_SYSTEM_EXT2 ext2)
18
19  zephyr_library_link_libraries(FS)
20
21  target_link_libraries_ifdef(CONFIG_FAT_FILESYSTEM_ELM   FS INTERFACE ELMFAT)
22  target_link_libraries_ifdef(CONFIG_FILE_SYSTEM_LITTLEFS FS INTERFACE LITTLEFS)
23  target_link_libraries_ifdef(CONFIG_FILE_SYSTEM_EXT2     FS INTERFACE EXT2)
24endif()
25
26add_subdirectory_ifdef(CONFIG_FCB  ./fcb)
27add_subdirectory_ifdef(CONFIG_NVS  ./nvs)
28
29if(CONFIG_FUSE_FS_ACCESS)
30  zephyr_library_named(FS_FUSE)
31  find_package(PkgConfig REQUIRED)
32  pkg_search_module(FUSE REQUIRED fuse)
33  zephyr_include_directories(${FUSE_INCLUDE_DIR})
34  zephyr_link_libraries(${FUSE_LIBRARIES})
35  zephyr_library_compile_definitions(_FILE_OFFSET_BITS=64)
36  zephyr_library_sources(fuse_fs_access.c)
37endif()
38