Skip to content

simdjson/simdjson-vcpkg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

Simple simdjson demo for vcpkg

Windows-Linux-CI

This project builds a simple executable that depends on simdjson, under Windows and Linux.

After installing vcpkg and installing simdjson through it (e.g., vcpkg install simdjson:x64-windows or simply vcpkg install simdjson), you can build with CMake using a couple of command lines.

You need to pass the location of your vcpkg/scripts/buildsystems/vcpkg.cmake file to CMake:

cmake -DCMAKE_TOOLCHAIN_FILE=<location> -B build
cmake --build build

The CMake will generate and compile the following source file:

#include "simdjson.h"
#include <iostream>
int main(void) {
    auto cars_json = R"( [
      { "make": "Toyota", "model": "Camry",  "year": 2018, "tire_pressure": [ 40.1, 39.9, 37.7, 40.4 ] },
      { "make": "Kia",    "model": "Soul",   "year": 2012, "tire_pressure": [ 30.1, 31.0, 28.6, 28.7 ] },
      { "make": "Toyota", "model": "Tercel", "year": 1999, "tire_pressure": [ 29.8, 30.0, 30.2, 30.5 ] }
    ] )"_padded;
    std::cout << "parsing : " << cars_json << std::endl;
    simdjson::dom::parser parser;
    simdjson::dom::array obj;
    auto err = parser.parse(cars_json).get(obj);
    if (err) {
      std::cerr << "Failed to parse json" << std::endl;
      std::cerr << err << std::endl;
      return EXIT_FAILURE;
    }
    std::cout << "Success" << std::endl;
    return EXIT_SUCCESS;
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages