Skip to content

Commit

Permalink
support compiling with custom ext2fs
Browse files Browse the repository at this point in the history
Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>
  • Loading branch information
yuchen0cc committed Dec 8, 2022
1 parent d552d1f commit cb6f5f9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
15 changes: 15 additions & 0 deletions CMake/Findext2fs.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
include(FetchContent)
set(FETCHCONTENT_QUIET false)

FetchContent_Declare(
ext2fs
URL https://github.com/data-accelerator/e2fsprogs/releases/download/latest/libext2fs.tar.gz
)

FetchContent_GetProperties(ext2fs)
if (NOT ext2fs_POPULATED)
FetchContent_Populate(ext2fs)
endif()

set(EXT2FS_INCLUDE_DIR ${ext2fs_SOURCE_DIR}/include)
find_library(EXT2FS_LIBRARY ext2fs HINTS ${ext2fs_SOURCE_DIR}/lib/)
10 changes: 9 additions & 1 deletion src/extfs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
if(CUSTOM_EXT2FS)
find_package(ext2fs REQUIRED)
include_directories(${EXT2FS_INCLUDE_DIR})
set(LIB_EXT2FS ${EXT2FS_LIBRARY})
else()
set(LIB_EXT2FS ext2fs)
endif()

add_library(extfs_lib
extfs_io.cpp
extfs.cpp
Expand All @@ -8,7 +16,7 @@ target_include_directories(extfs_lib PUBLIC
target_link_libraries(extfs_lib
photon_static
overlaybd_lib
ext2fs
${LIB_EXT2FS}
)

if(BUILD_TESTING)
Expand Down

0 comments on commit cb6f5f9

Please sign in to comment.