add_library(liblp STATIC
        core/fs_mgr/liblp/builder.cpp
        core/fs_mgr/liblp/super_layout_builder.cpp
        core/fs_mgr/liblp/images.cpp
        core/fs_mgr/liblp/partition_opener.cpp
        core/fs_mgr/liblp/property_fetcher.cpp
        core/fs_mgr/liblp/reader.cpp
        core/fs_mgr/liblp/utility.cpp
        core/fs_mgr/liblp/writer.cpp)

target_link_libraries(liblp PRIVATE
	libbase libext4 libsparse crypto z)
target_include_directories(liblp PRIVATE
	boringssl/include)
target_include_directories(liblp PUBLIC
	core/fs_mgr/liblp/include)

protobuf_generate_cpp(DYNAMIC_PARTITIONS_DEVICE_INFO_PROTO_SRCS DYNAMIC_PARTITIONS_DEVICE_INFO_PROTO_HDRS
	extras/partition_tools/dynamic_partitions_device_info.proto)

add_library(libjsonpbparse STATIC
	extras/libjsonpb/parse/jsonpb.cpp)
target_link_libraries(libjsonpbparse PRIVATE libbase)
target_include_directories(libjsonpbparse PUBLIC
	extras/libjsonpb/parse/include)

add_library(liblpdump STATIC
	${DYNAMIC_PARTITIONS_DEVICE_INFO_PROTO_SRCS} ${DYNAMIC_PARTITIONS_DEVICE_INFO_PROTO_HDRS}
	extras/partition_tools/lpdump.cc)
target_link_libraries(liblpdump PRIVATE
	libbase libjsonpbparse liblp protobuf::libprotobuf)

add_executable(lpdump
	extras/partition_tools/lpdump_host.cc)
target_link_libraries(lpdump
	libbase liblpdump libsparse)

add_executable(lpmake
	extras/partition_tools/lpmake.cc)
target_link_libraries(lpmake
	libbase liblog liblp libsparse)

add_executable(lpadd
	extras/partition_tools/lpadd.cc)
target_link_libraries(lpadd
	libbase liblog liblp libsparse)

add_executable(lpflash
	extras/partition_tools/lpflash.cc)
target_link_libraries(lpflash
	libbase liblog liblp libsparse)

add_executable(lpunpack
	extras/partition_tools/lpunpack.cc)
target_link_libraries(lpunpack
	libbase liblog liblp libsparse)
