Files
uc2/lib/CMakeLists.txt
Eremey Valetov 446158e855 ingest v1: streaming dedup sink (--ingest / --ingest-restore)
Reads stdin, splits via CDC, deduplicates chunks against a sidecar
block store at <archive>.blocks/, writes a chunk-hash manifest at
<archive>.  The reverse operation reads the manifest and reassembles
the byte stream from the block store.

Manifest format (magic UC2INGST) is a standalone container, not yet
unified with the master-block archive layout.  Tar boundaries are not
preserved; the input is treated as an opaque byte stream.  Follow-ups
filed for both.

Builds entirely on existing CDC + blockstore + merkle infrastructure.
No new compression or hashing primitives.

Tests cover small + 200 KB multichunk round-trip, idempotent dedup
(repeat ingest of the same data reports zero new chunks and exact
bytes_saved), empty stream, bad-magic rejection.  Lint gate stays
green.

Closes fa0c7d4.
2026-05-04 18:37:18 -04:00

40 lines
1.5 KiB
CMake

# libuc2 — UC2 decompression library
set(LIBUC2_SOURCES src/decompress.c src/compress.c src/uc2_tables.c src/uc2_cdc.c src/uc2_merkle.c src/uc2_blockstore.c src/uc2_simhash.c src/uc2_delta.c src/uc2_rans.c src/uc2_dict.c src/uc2_preprocess.c src/uc2_lz4.c src/uc2_blake3.c src/uc2_sha256.c src/uc2_ots.c src/uc2_ingest.c)
# Embed super.bin: use .S with .incbin on GCC/Clang, generated C array on MSVC
if(MSVC)
set(SUPER_C "${CMAKE_CURRENT_BINARY_DIR}/super_data.c")
add_custom_command(
OUTPUT "${SUPER_C}"
COMMAND "${CMAKE_COMMAND}"
-DINPUT="${CMAKE_CURRENT_SOURCE_DIR}/src/super.bin"
-DOUTPUT="${SUPER_C}"
-P "${PROJECT_SOURCE_DIR}/cmake/bin2c.cmake"
DEPENDS src/super.bin "${PROJECT_SOURCE_DIR}/cmake/bin2c.cmake"
COMMENT "Generating super_data.c from super.bin"
)
list(APPEND LIBUC2_SOURCES "${SUPER_C}")
else()
set(SUPER_BIN_ABS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src/super.bin")
configure_file(src/super_data.S.in "${CMAKE_CURRENT_BINARY_DIR}/super_data.S" @ONLY)
list(APPEND LIBUC2_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/super_data.S")
endif()
add_library(uc2 STATIC ${LIBUC2_SOURCES})
target_include_directories(uc2
PUBLIC include
PRIVATE src
"${PROJECT_BINARY_DIR}/lib" # for configured uc2_version.h
)
target_compile_features(uc2 PUBLIC c_std_99)
target_compile_definitions(uc2 PRIVATE NDEBUG)
configure_file(
include/uc2/uc2_version.h.in
"${PROJECT_BINARY_DIR}/lib/uc2/uc2_version.h"
@ONLY
)