You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-6Lines changed: 21 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,15 +39,17 @@ twitter.json:
39
39
40
40
## Requirements
41
41
42
-
- Linux or macOS (currently)
42
+
-We support platforms like Linux or macOS, as well as Windows through Visual Studio 2017 or better.
43
43
- A processor with AVX2 (i.e., Intel processors starting with the Haswell microarchitecture released 2013, and processors from AMD starting with the Rizen)
44
-
- A recent C++ compiler (e.g., GNU GCC or LLVM CLANG), we assume C++17
45
-
-Bash (for benchmark scripts) and other common utilities (optional)
44
+
- A recent C++ compiler (e.g., GNU GCC or LLVM CLANG or Visual Studio 2017), we assume C++17
45
+
-Some benchmark scripts assume bash and other common utilities, but they are optional.
46
46
47
47
## License
48
48
49
49
This code is made available under the Apache License 2.0.
50
50
51
+
Under Windows, we build some tools using the windows/dirent_portable.h file (which is outside our library code): it under the liberal (business-friendly) MIT license.
52
+
51
53
## Code example
52
54
53
55
```C
@@ -80,14 +82,14 @@ of memory allocation with each new JSON document:
80
82
const char * filename = ... //
81
83
std::string_view p = get_corpus(filename);
82
84
ParsedJson pj = build_parsed_json(p); // do the parsing
83
-
// you no longer need p at this point, can do free((void*)p.data())
85
+
// you no longer need p at this point, can do aligned_free((void*)p.data())
84
86
if( ! pj.isValid() ) {
85
87
// something went wrong
86
88
}
87
89
```
88
90
89
91
90
-
## Usage (old-school Makefile)
92
+
## Usage (old-school Makefile on platforms like Linux or macOS)
91
93
92
94
Requirements: clang or gcc and make. A system like Linux or macOS is expected.
93
95
@@ -112,7 +114,7 @@ To run comparative benchmarks (with other parsers):
112
114
make benchmark
113
115
```
114
116
115
-
## Usage (CMake)
117
+
## Usage (CMake on platforms like Linux or macOS)
116
118
117
119
While in the project repository, do the following:
118
120
@@ -136,6 +138,19 @@ make
136
138
make test
137
139
```
138
140
141
+
## Usage (CMake on Windows using Visual Studio)
142
+
143
+
144
+
We are assuming that you have a common Windows PC with at least Visual Studio 2017, and an x64 processor with AVX2 support (2013 Haswell or better).
145
+
146
+
- Grab the simdjosn code from GitHub, e.g., by cloning it using [GitHub Desktop](https://desktop.github.com/).
147
+
- Install [CMake](https://cmake.org/download/). When you install it, make sure to ask that ``cmake`` be made available from the command line.
148
+
- Create a subdirectory within simdjson, such as ``VisualStudio``.
149
+
- Using a shell, go to this newly created directory.
150
+
- Type ``cmake -DCMAKE_GENERATOR_PLATFORM=x64 ..`` in the shell while in the ``VisualStudio`` repository. (Alternatively, if you want to build a DLL, you may use the command line ``cmake -DCMAKE_GENERATOR_PLATFORM=x64 -DSIMDJSON_BUILD_STATIC=OFF ..``.)
151
+
- This last command created a Visual Studio solution file in the newly created directory (e.g., ``simdjson.sln``). Open this file in Visual Studio. You should now be able to build the project and run the tests. For example, in the ``Solution Explorer`` window (available from the ``View`` menu), right-click ``ALL_BUILD`` and select ``Build``. To test the code, still in the ``Solution Explorer`` window, select ``RUN_TESTS`` and select ``Build``.
152
+
153
+
139
154
## Tools
140
155
141
156
-`json2json mydoc.json` parses the document, constructs a model and then dumps back the result to standard output.
0 commit comments