-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
56 lines (42 loc) · 1.39 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Copy this file as CMakeLists.txt in
# some directory. With a recent CMake
# (at least 3.15), in this directory do
#
# cmake -B build .
# cmake --build build
# ./build/repro
#
#
cmake_minimum_required(VERSION 3.15)
project(CrashRepro VERSION 0.1.0 LANGUAGES CXX)
include(FetchContent)
FetchContent_Declare(
simdjson
GIT_REPOSITORY https://github.com/simdjson/simdjson.git
GIT_SHALLOW TRUE
GIT_TAG tags/v1.0.0
)
FetchContent_MakeAvailable(simdjson)
file(WRITE main.cpp "
#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;
}")
add_executable(repro main.cpp)
target_link_libraries(repro PUBLIC simdjson)