Skip to content

build: add aaruformatread CMake target#37

Open
kwinsch wants to merge 1 commit intoaaru-dps:develfrom
RomTholos:build/add-aaruformatread-target
Open

build: add aaruformatread CMake target#37
kwinsch wants to merge 1 commit intoaaru-dps:develfrom
RomTholos:build/add-aaruformatread-target

Conversation

@kwinsch
Copy link
Copy Markdown
Contributor

@kwinsch kwinsch commented Apr 3, 2026

Add a read-only library target (aaruformatread) alongside the existing full read/write target (aaruformat). The reader target excludes four writer-only source files: create.c, write.c, close_write.c, and metadata_write.c.

Writer functions in shared source files are guarded with #ifndef AARUFORMAT_READER_ONLY so the reader target exports zero writer symbols:

  • open.c: resume-mode block (sets finalize_write, calls create_map)
  • ddt/ddt_v2.c: set_ddt_* functions (call aaruf_close_current_block)
  • dump.c: aaruf_set_dumphw
  • blocks/optical.c: aaruf_set_tracks
  • blocks/tape.c: aaruf_set_tape_file, aaruf_set_tape_partition
  • blocks/flux.c: aaruf_write_flux_capture, aaruf_clear_flux_captures

CMakeLists.txt refactored to use AARUFORMAT_COMMON_SOURCES and AARUFORMAT_WRITER_SOURCES variables. Both targets share the same include directories, third-party dependencies, and compiler flags via a foreach loop over AARUFORMAT_TARGETS.

Verified:

  • Both targets build cleanly (shared libraries)
  • nm -D libaaruformatread.so shows zero set_/clear_/write_/create symbols
  • Reader library is ~1 MB vs ~5 MB for the full library

Add a read-only library target (aaruformatread) alongside the existing
full read/write target (aaruformat). The reader target excludes four
writer-only source files: create.c, write.c, close_write.c, and
metadata_write.c.

Writer functions in shared source files are guarded with
#ifndef AARUFORMAT_READER_ONLY so the reader target exports zero
writer symbols:
- open.c: resume-mode block (sets finalize_write, calls create_map)
- ddt/ddt_v2.c: set_ddt_* functions (call aaruf_close_current_block)
- dump.c: aaruf_set_dumphw
- blocks/optical.c: aaruf_set_tracks
- blocks/tape.c: aaruf_set_tape_file, aaruf_set_tape_partition
- blocks/flux.c: aaruf_write_flux_capture, aaruf_clear_flux_captures

CMakeLists.txt refactored to use AARUFORMAT_COMMON_SOURCES and
AARUFORMAT_WRITER_SOURCES variables. Both targets share the same
include directories, third-party dependencies, and compiler flags
via a foreach loop over AARUFORMAT_TARGETS.

Verified:
- Both targets build cleanly (shared libraries)
- Full test suite passes (163/165, 2 pre-existing failures)
- nm -D libaaruformatread.so shows zero set_/clear_/write_/create symbols
- Reader library is ~1 MB vs ~5 MB for the full library
@claunia
Copy link
Copy Markdown
Collaborator

claunia commented Apr 3, 2026

should get also in build.sh and a nuget package don't you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants