Skip to content

feat(windows): add full Windows/MSVC support#10

Closed
sashml wants to merge 2 commits into
mainfrom
feat/windows-support
Closed

feat(windows): add full Windows/MSVC support#10
sashml wants to merge 2 commits into
mainfrom
feat/windows-support

Conversation

@sashml
Copy link
Copy Markdown
Collaborator

@sashml sashml commented Apr 27, 2026

Summary

Closes #9 — full Windows/MSVC build support for bfc.

  • New compat headers: bfc_win32_compat.h (lib) and cli_win32_compat.h (CLI) provide POSIX shims: ssize_t, usleep, clock_gettime, S_IS* macros, fseeko/ftello, mkdir, fileno, getopt, fnmatch, dirent
  • MSVC warning fixes: resolved C4206 (empty TU in bfc_iter.c), C4244 (narrowing in bfc_crc32c.c, bfc_reader.c), C4267 (size_t conversions in bfc_reader.c), C4456 (variable shadowing in bfc_reader.c), C4100 (unused params in bfc_os.c, cmd_extract.c), C4702 (unreachable code in test_compress.c)
  • CMakeLists.txt: MSVC flags block (/W4 /WX /wd4996, _CRT_SECURE_NO_WARNINGS, debug /Od /Zi /RTC1, release /O2)
  • CI: Added windows-latest matrix entry with vcpkg (zstd, libsodium), separate configure/build/test steps; guarded POSIX-only steps
  • Release workflow: Windows build produces bfc-<version>-windows-x86_64.zip with bfc.exe, bfc.lib, headers, install.bat
  • Test fixes: corrected pre-existing assertion bug in test_reader.c (wrong expected string in partial-read test); replaced early-return ZSTD guards with #ifdef BFC_WITH_ZSTD body wrapping to avoid MSVC C4702
  • README: Windows build instructions, MSVC 2019+ / vcpkg prerequisites, symlink/FUSE limitation notes

Test plan

  • All 10 unit tests pass on Windows (MSVC 19.x, no ZSTD): ctest -C Debug100% tests passed
  • Clean build with /W4 /WX — zero warnings
  • Smoke test CLI: create, list, info, verify, extract all succeed on Windows
  • CI matrix green on windows-latest (GitHub Actions)
  • Linux/macOS CI jobs unaffected (guarded with if: matrix.os != 'windows-latest')

- Add bfc_win32_compat.h with POSIX shims (ssize_t, usleep, clock_gettime,
  S_IS* macros, fseeko/ftello, mkdir, fileno)
- Add cli_win32_compat.h for CLI-layer POSIX shims (getopt, fnmatch,
  dirent, symlink stubs)
- Fix MSVC warnings-as-errors: C4206 (empty TU), C4244 (narrowing),
  C4267 (size_t conversions), C4456 (variable shadowing), C4100 (unused params),
  C4702 (unreachable code after ZSTD guard)
- Update CMakeLists.txt with MSVC /W4 /WX flags and _CRT_SECURE_NO_WARNINGS
- Add GitHub Actions CI matrix for windows-latest with vcpkg (zstd, libsodium)
- Add Windows release workflow with ZIP packaging and install.bat
- Fix test_reader.c pre-existing assertion bug (wrong expected string in
  partial-read test)
- Guard ZSTD-only test functions with #ifdef BFC_WITH_ZSTD body wrapping
- Update README with Windows build instructions
- Guard POSIX-only includes in benchmarks and examples with #ifndef _WIN32
@sashml sashml closed this Apr 28, 2026
@sashml sashml deleted the feat/windows-support branch April 28, 2026 05:50
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.

Add Windows support

2 participants