This guide covers building EDN.C on Windows using various toolchains.
EDN.C requires a C11-compliant compiler with SIMD support. Choose one of the following:
- Visual Studio 2019 or later (Community Edition is free)
- Includes CMake and all necessary build tools
- Download: https://visualstudio.microsoft.com/downloads/
- MinGW-w64 with GCC 7.0 or later
- Download: https://www.mingw-w64.org/downloads/
- Recommended distribution: MSYS2 (https://www.msys2.org/)
- LLVM/Clang 10.0 or later
- Download: https://releases.llvm.org/download.html
CMake provides the easiest cross-platform build experience.
Download and install CMake from https://cmake.org/download/ (version 3.10 or later).
Open a terminal (PowerShell, Command Prompt, or Developer Command Prompt for VS):
# Create build directory
mkdir build
cd build
# Configure (auto-detects compiler)
cmake ..
# Build
cmake --build . --config Release
# Run tests
ctest -C ReleaseFor a specific compiler:
# MSVC (Visual Studio)
cmake .. -G "Visual Studio 16 2019" -A x64
# MinGW
cmake .. -G "MinGW Makefiles" -DCMAKE_C_COMPILER=gcc
# Ninja (fast, works with any compiler)
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release- Open Developer Command Prompt for VS 2019 (or later)
- Navigate to the project directory
- Build:
mkdir build
cd build
cmake .. -G "Visual Studio 16 2019" -A x64
cmake --build . --config Release- Open Visual Studio
- Select File → Open → CMake...
- Open
CMakeLists.txtfrom the project root - Visual Studio will automatically configure the project
- Build: Build → Build All (or press
Ctrl+Shift+B) - Run tests from the Test Explorer
MSYS2 provides a Unix-like environment on Windows with GCC.
Download from https://www.msys2.org/ and install.
Open the MSYS2 terminal and run:
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake makeOpen MINGW64 terminal (not MSYS2!) and run:
cd /path/to/edn.c
mkdir build && cd build
cmake .. -G "MinGW Makefiles"
cmake --build .Or use the traditional Makefile:
make
make testIf you have make available (via MSYS2 or standalone):
# Build library
make
# Build and run tests
make test
# Build benchmarks
make bench
# Clean
make cleanNote: The Makefile is primarily designed for Unix/macOS. For Windows, CMake is recommended.
EDN.C automatically detects and uses SIMD instructions:
- SSE4.2 is used by default (available on all modern x86_64 CPUs)
- MSVC: Enabled with
/arch:AVX(includes SSE4.2) - GCC/Clang: Enabled with
-msse4.2
- NEON is enabled by default on ARM64
- MSVC: Automatic
- GCC/Clang: Automatic with
-march=armv8-a
- Scalar (non-SIMD) code is automatically used on unsupported architectures
EDN.C handles MSVC-specific differences automatically:
- Uses
_BitScanForwardinstead of__builtin_ctzfor bit scanning - Uses
<intrin.h>for all intrinsics (instead of separate headers) - Compatible with
/W4warning level
- Debug builds on GCC/Clang include AddressSanitizer and UndefinedBehaviorSanitizer
- MSVC users can enable
/analyzefor static analysis
- Use forward slashes
/or double backslashes\\\\in paths - CMake handles path conversion automatically
- MSVC: Update to Visual Studio 2019 or later
- MinGW: Ensure you're using MinGW-w64 (not old MinGW)
- Add CMake to your PATH, or use full path:
C:\Program Files\CMake\bin\cmake.exe
- MSVC: Run from "Developer Command Prompt for VS"
- MinGW: Use MINGW64 terminal (not MSYS2 terminal)
- Windows may require
.\test\test_name.exeinstead of./test/test_name - Use CMake's
ctestfor automatic test discovery
After building, link against edn.lib (MSVC) or libedn.a (MinGW):
CMake:
target_link_libraries(your_app edn)MSVC Command Line:
cl your_app.c /I path\to\edn.c\include edn.libMinGW/GCC:
gcc your_app.c -I path/to/edn.c/include -L path/to/edn.c/build -ledn#include <edn.h>For production builds, use Release configuration:
CMake:
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config ReleaseMSVC:
cmake --build . --config ReleaseThis enables full optimizations (/O2 on MSVC, -O2 on GCC/Clang).
- Issues: https://github.com/yourusername/edn.c/issues
- Documentation: See
README.mdanddocs/DESIGN.md - Examples: See
examples/directory
On Windows, EDN.C achieves comparable performance to Unix/macOS:
- SIMD-accelerated parsing for hot paths
- Zero-copy design minimizes allocations
- Arena allocator reduces allocation overhead
Benchmark on Windows with:
.\build\bench_integration.exeTypical performance: 1-30 ns/op for common operations on modern CPUs.