Skip to content

Commit d9ee4f8

Browse files
Add detailed installation instructions for Vcpkg, Conan, and homebrew (#1031)
CXX-2623 CXX-2759 --------- Co-authored-by: bisht2050 <[email protected]>
1 parent 5b1b515 commit d9ee4f8

File tree

1 file changed

+102
-0
lines changed
  • docs/content/mongocxx-v3/installation

1 file changed

+102
-0
lines changed

docs/content/mongocxx-v3/installation/_index.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,108 @@ To configure and install the driver, follow the instructions for your platform:
3535
The Mongo C++ driver is available in the following package managers.
3636
- [Vcpkg](https://vcpkg.io/) (search for mongo-cxx-driver)
3737
- [Conan](https://conan.io/center/recipes/mongo-cxx-driver)
38+
- [Homebrew](https://formulae.brew.sh/formula/mongo-cxx-driver)
39+
40+
### Vcpkg Install Instructions
41+
42+
If you do not already have Vcpkg installed, install it with the following
43+
command:
44+
```
45+
$ git clone https://github.com/Microsoft/vcpkg.git
46+
$ cd vcpkg
47+
$ ./bootstrap-vcpkg.sh
48+
```
49+
50+
Optionally, to install with Visual Studio integration:
51+
```
52+
vcpkg integrate install
53+
```
54+
55+
Install the driver. (You may need to `git pull` to get the latest version of the
56+
driver)
57+
```
58+
$ ./vcpkg install mongo-cxx-driver
59+
```
60+
61+
You can use the toolchain file, `vcpkg.cmake`, to instruct CMake where to find
62+
the development files, for example:
63+
```
64+
-DCMAKE_TOOLCHAIN_FILE=/<path to vcpkg repo>/vcpkg/scripts/buildsystems/vcpkg.cmake
65+
```
66+
67+
You can find the header files in:
68+
```
69+
vcpkg/installed/<CPU ARCHITECTURE>-<OPERATING SYSTEM>/include/
70+
```
71+
72+
The library files are in:
73+
```
74+
vcpkg/installed/<CPU ARCHITECTURE>-<OPERATING SYSTEM>/lib/
75+
```
76+
77+
### Conan Install Instructions
78+
79+
Package Specifier: `mongo-cxx-driver/3.8.0`
80+
81+
If you do not already have Conan installed, then install it and run the Conan
82+
initalization command below:
83+
```
84+
$ pip install conan
85+
$ conan profile detect --force
86+
```
87+
88+
Add the following to your `conanfile.txt`
89+
```
90+
[requires]
91+
mongo-cxx-driver/3.8.0
92+
[generators]
93+
CMakeDeps
94+
CMakeToolchain
95+
```
96+
97+
Install the driver via Conan, and build your project:
98+
```
99+
$ conan install conanfile.txt --output-folder=build --build=missing
100+
$ cmake \
101+
-B build \
102+
-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake \
103+
-DCMAKE_BUILD_TYPE=Release
104+
$ cmake --build build
105+
```
106+
107+
### Homebrew
108+
109+
For MacOS users, homebrew is a convienent way to install the C++ driver.
110+
111+
```
112+
brew install mongo-cxx-driver
113+
```
114+
115+
#### For an Apple Silicon Mac
116+
117+
Headers can be found in:
118+
```
119+
/opt/homebrew/include/mongocxx/v_noabi/
120+
/opt/homebrew/include/bsoncxx/v_noabi/
121+
```
122+
123+
Library files can be found in:
124+
```
125+
/opt/homebrew/lib/
126+
```
127+
128+
#### For an Intel Mac
129+
130+
Headers can be found in:
131+
```
132+
/usr/local/include/mongocxx/v_noabi/
133+
/usr/local/include/bsoncxx/v_noabi/
134+
```
135+
136+
Library files can be found in:
137+
```
138+
/usr/local/lib/
139+
```
38140

39141
## Docker Image
40142

0 commit comments

Comments
 (0)