libvroom uses Google Highway for portable SIMD acceleration:
x86-64: SSE4.2, AVX2
ARM64: NEON
The library automatically detects and uses the best available SIMD instruction set at runtime.
Installation Methods
Method 1: Build from Source
# Clone the repositorygit clone https://github.com/jimhester/libvroom.gitcd libvroom# Configure and build (Release mode)cmake-B build -DCMAKE_BUILD_TYPE=Releasecmake--build build
The build produces:
build/liblibvroom_lib.a - Static library
build/vroom - Command-line tool
Method 2: CMake FetchContent (Recommended for Projects)
Add libvroom as a dependency in your CMakeLists.txt:
include(FetchContent)FetchContent_Declare(libvroomGIT_REPOSITORY https://github.com/jimhester/libvroom.gitGIT_TAG v0.1.0# Pin to a specific version for reproducibility)FetchContent_MakeAvailable(libvroom)target_link_libraries(your_targetPRIVATE libvroom_lib)
TipPin to Specific Versions
For reproducible builds, always pin to a specific version tag (e.g., v0.1.0) rather than main. This ensures your project builds consistently even as libvroom is updated.
# Install Xcode Command Line Tools (if not already installed)xcode-select--install# Or install CMake via Homebrewbrew install cmake# Clone and buildgit clone https://github.com/jimhester/libvroom.gitcd libvroomcmake-B build -DCMAKE_BUILD_TYPE=Releasecmake--build build
Running Tests
The test suite includes comprehensive coverage across multiple test executables:
# Run all tests with CTestcd build &&ctest--output-on-failure# Run specific test executables./build/libvroom_test# Well-formed CSV parsing tests./build/error_handling_test# Error handling tests./build/csv_parsing_test# Integration tests./build/dialect_detection_test# Dialect auto-detection tests./build/streaming_test# Streaming parser tests./build/c_api_test# C API tests./build/cli_test# CLI integration tests
The build produces an vroom command line tool for working with CSV files:
# Count rows in a CSV file./build/vroom count data.csv# Display first 10 rows./build/vroom head data.csv# Select specific columns by name or index./build/vroom select -c name,age data.csv# Pretty-print with aligned columns./build/vroom pretty data.csv# Get file info (rows, columns, detected dialect)./build/vroom info data.csv# Detect CSV dialect (delimiter, quoting, line endings)./build/vroom dialect data.csv
cmake_minimum_required(VERSION3.14)project(my_csv_app LANGUAGESCXX)set(CMAKE_CXX_STANDARD 17)set(CMAKE_CXX_STANDARD_REQUIREDON)# Fetch libvroominclude(FetchContent)FetchContent_Declare(libvroomGIT_REPOSITORY https://github.com/jimhester/libvroom.gitGIT_TAG v0.1.0# Pin to a specific version for reproducibility)# Optionally disable tests/benchmarks to speed up buildset(BUILD_TESTINGOFFCACHEBOOL""FORCE)set(BUILD_BENCHMARKS OFFCACHEBOOL""FORCE)FetchContent_MakeAvailable(libvroom)# Your applicationadd_executable(my_app main.cpp)target_link_libraries(my_appPRIVATE libvroom_lib)
Linking to the Library
The library target is libvroom_lib. It exports the include directories automatically:
The library will automatically fall back to scalar implementations if SIMD instructions aren’t available. Performance will be reduced but functionality is preserved.
Tests Fail with “Test data not found”
Ensure the test data directory exists:
ls test/data/# Should contain subdirectories: basic, quoted, separators, etc.