Skip to content

Commit a954d50

Browse files
authored
This improves our documentation. (simdjson#1128)
* This improves our documentation. * Removing tags for doxygen. * You need a recent cmake remark.
1 parent 5be4d37 commit a954d50

File tree

2 files changed

+57
-14
lines changed

2 files changed

+57
-14
lines changed

doc/basics.md

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,49 @@ c++ myproject.cpp simdjson.cpp
4646
```
4747

4848
Note:
49-
- Users on macOS and other platforms were default compilers do not provide C++11 compliant by default should request it with the appropriate flag (e.g., `c++ myproject.cpp simdjson.cpp`).
49+
- Users on macOS and other platforms were default compilers do not provide C++11 compliant by default should request it with the appropriate flag (e.g., `c++ -std=c++17 myproject.cpp simdjson.cpp`).
5050
- Visual Studio users should compile with the `_CRT_SECURE_NO_WARNINGS` flag to avoid warnings with respect to our use of standard C functions such as `fopen`.
5151

52+
53+
Using simdjson with package managers
54+
------------------
55+
56+
You can install the simdjson library on your system or in your project using multiple package managers such as MSYS2, the conan package manager, vcpkg, brew, the apt package manager (debian-based Linux systems), the FreeBSD package manager (FreeBSD), and so on. [Visit our wiki for more details](https://github.com/simdjson/simdjson/wiki/Installing-simdjson-with-a-package-manager).
57+
5258
Using simdjson as a CMake dependency
5359
------------------
5460

55-
You can include the simdjson repository as a folder in your CMake project. In the parent
56-
`CMakeLists.txt`, include the following lines:
61+
You can include the simdjson as a CMake dependency by including the following lines in your `CMakeLists.txt`:
5762

63+
```cmake
64+
include(FetchContent)
65+
66+
FetchContent_Declare(
67+
simdjson
68+
GIT_REPOSITORY https://github.com/simdjson/simdjson.git
69+
GIT_TAG v0.4.7
70+
GIT_SHALLOW TRUE)
71+
72+
set(SIMDJSON_JUST_LIBRARY ON CACHE INTERNAL "")
73+
set(SIMDJSON_BUILD_STATIC ON CACHE INTERNAL "")
74+
75+
FetchContent_MakeAvailable(simdjson)
5876
```
59-
set(SIMDJSON_JUST_LIBRARY ON CACHE STRING "Build just the library, nothing else." FORCE)
60-
add_subdirectory(simdjson EXCLUDE_FROM_ALL)
61-
```
77+
78+
You should replace `GIT_TAG v0.4.7` by the version you need (e.g., `GIT_TAG v0.5.0`). If you omit `GIT_TAG v0.5.0`, you will work from the main branch of simdjson: we recommend that if you are working on production code,
6279

6380
Elsewhere in your project, you can declare dependencies on simdjson with lines such as these:
6481

65-
```
82+
```cmake
6683
add_executable(myprogram myprogram.cpp)
6784
target_link_libraries(myprogram simdjson)
6885
```
6986

70-
See [our CMake demonstration](https://github.com/simdjson/cmakedemo).
87+
We recommend CMake version 3.15 or better.
88+
89+
See [our CMake demonstration](https://github.com/simdjson/cmake_demo_single_file). It works under Linux, FreeBSD, macOS and Windows (including Visual Studio).
90+
91+
7192

7293
The CMake build in simdjson can be taylored with a few variables. You can see the available variables and their default values by entering the `cmake -LA` command.
7394

doc/basics_doxygen.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,50 @@ c++ myproject.cpp simdjson.cpp
2828
```
2929

3030
Note:
31-
- Users on macOS and other platforms were default compilers do not provide C++11 compliant by default should request it with the appropriate flag (e.g., `c++ myproject.cpp simdjson.cpp`).
31+
- Users on macOS and other platforms were default compilers do not provide C++11 compliant by default should request it with the appropriate flag (e.g., `c++ -std=c++17 myproject.cpp simdjson.cpp`).
3232
- Visual Studio users should compile with the `_CRT_SECURE_NO_WARNINGS` flag to avoid warnings with respect to our use of standard C functions such as `fopen`.
3333

34+
Using simdjson with package managers
35+
------------------
36+
37+
You can install the simdjson library on your system or in your project using multiple package managers such as MSYS2, the conan package manager, vcpkg, brew, the apt package manager (debian-based Linux systems), the FreeBSD package manager (FreeBSD), and so on. [Visit our wiki for more details](https://github.com/simdjson/simdjson/wiki/Installing-simdjson-with-a-package-manager).
38+
3439
Using simdjson as a CMake dependency
3540
------------------
3641

37-
You can include the simdjson repository as a folder in your CMake project. In the parent
38-
`CMakeLists.txt`, include the following lines:
42+
You can include the simdjson as a CMake dependency by including the following lines in your `CMakeLists.txt`:
3943

4044
```
41-
set(SIMDJSON_JUST_LIBRARY ON CACHE STRING "Build just the library, nothing else." FORCE)
42-
add_subdirectory(simdjson EXCLUDE_FROM_ALL)
45+
include(FetchContent)
46+
47+
FetchContent_Declare(
48+
simdjson
49+
GIT_REPOSITORY https://github.com/simdjson/simdjson.git
50+
GIT_TAG v0.4.7
51+
GIT_SHALLOW TRUE)
52+
53+
set(SIMDJSON_JUST_LIBRARY ON CACHE INTERNAL "")
54+
set(SIMDJSON_BUILD_STATIC ON CACHE INTERNAL "")
55+
56+
FetchContent_MakeAvailable(simdjson)
4357
```
4458

59+
You should replace `GIT_TAG v0.4.7` by the version you need (e.g., `GIT_TAG v0.5.0`). If you omit `GIT_TAG v0.5.0`, you will work from the main branch of simdjson: we recommend that if you are working on production code,
60+
4561
Elsewhere in your project, you can declare dependencies on simdjson with lines such as these:
4662

4763
```
4864
add_executable(myprogram myprogram.cpp)
4965
target_link_libraries(myprogram simdjson)
5066
```
5167

52-
See [our CMake demonstration](https://github.com/simdjson/cmakedemo).
68+
We recommend CMake version 3.15 or better.
69+
70+
See [our CMake demonstration](https://github.com/simdjson/cmake_demo_single_file). It works under Linux, FreeBSD, macOS and Windows (including Visual Studio).
71+
72+
The CMake build in simdjson can be taylored with a few variables. You can see the available variables and their default values by entering the `cmake -LA` command.
73+
74+
5375

5476
The Basics: Loading and Parsing JSON Documents
5577
----------------------------------------------

0 commit comments

Comments
 (0)