@@ -42,7 +42,7 @@ For more information, see the [Python bindings repository](https://github.com/kr
42
42
- ** Clean and flexible** code base
43
43
- Warning-free even on high warning levels such as ` -Wall ` , ` -Wextra ` , ` -pedantic `
44
44
- Follows [ SOLID] ( https://en.wikipedia.org/wiki/SOLID ) design principles
45
- - Extensive unit tests
45
+ - Extensive [ unit tests] ( #building-the-unit-tests )
46
46
- Linted with [ Clang-Tidy] ( https://clang.llvm.org/extra/clang-tidy/ )
47
47
48
48
For a complete guide, please see the [ documentation] ( docs/index.md#top ) .
@@ -147,10 +147,10 @@ Steps to compile and run the example:
147
147
148
148
## Using it with CMake
149
149
150
- If you are using CMake, you can use the `FetchContent` module to download and include the library in your project.
151
- Here is an example of how to use AutoDiff in a CMake project:
150
+ ### Including it in your project with CMake
152
151
153
- ### Project files
152
+ If you are using CMake, you can use the `FetchContent` module to download and include the library in your project.
153
+ Here is an example of how to use AutoDiff in a CMake project.
154
154
155
155
Create a `CMakeLists.txt` file:
156
156
@@ -184,23 +184,35 @@ int main()
184
184
std::cout << "y(1.0) = " << y() << ' \n ' ;
185
185
AutoDiff::Function f(y);
186
186
f.pushTangentAt(x);
187
- std::cout << "dy /dx = " << d(y) << ' \n ' ;
187
+ std::cout << "df /dx = " << d(y) << ' \n ' ;
188
188
}
189
189
```
190
190
191
+ Build the project:
192
+
193
+ ```bash
194
+ mkdir build && cd build
195
+ cmake .. -DFETCHCONTENT_UPDATES_DISCONNECTED=ON
196
+ cmake --build .
197
+ ```
198
+
199
+ This will download the repository into your build folder and build the project.
200
+ Use the setting `FETCHCONTENT_UPDATES_DISCONNECTED=ON` to avoid downloading the repository every time you configure your project.
201
+
191
202
### Building the unit tests
192
203
193
- Configure CMake for GCC/Clang:
204
+ Make sure you have `Catch2` (v3) and `Eigen` (v3.4) installed.
205
+
206
+ Download the repository and configure CMake/Clang:
194
207
195
208
```bash
196
- cmake --preset tests-ninja-linux-release -DFETCHCONTENT_UPDATES_DISCONNECTED=ON
209
+ git clone https://github.com/krippner/auto-diff.git
210
+ cd auto-diff
211
+ cmake --preset tests-ninja-linux-release
197
212
```
198
213
199
214
For Visual Studio, you can use the `tests-msvc2022` preset.
200
215
201
- This will download the repository into your build folder.
202
- Use the setting `FETCHCONTENT_UPDATES_DISCONNECTED=ON` to avoid downloading the repository every time you configure your project.
203
-
204
216
Build and run:
205
217
206
218
```bash
@@ -211,7 +223,7 @@ ctest
211
223
212
224
## Using it with Conan
213
225
214
- ### Installation
226
+ ### Installation with Conan
215
227
216
228
Download the repository and install the library to your Conan cache:
217
229
@@ -223,7 +235,7 @@ conan create . --build=missing
223
235
224
236
This will also build and run the unit tests, unless your Conan configuration `tools.build:skip_test` is set to `True`.
225
237
226
- ### Including it in your project
238
+ ### Including it in your project with Conan
227
239
228
240
Add the following line to your `conanfile.txt`:
229
241
0 commit comments