Skip to content

Commit

Permalink
Link the JSON library using vcpkg in test files (#257)
Browse files Browse the repository at this point in the history
Summary:
This PR removes the nlohmann/json header file from our test directory and
links it to the library imported through vcpkg. Additionally, it updates the
README file, making the vcpkg installation instructions more concise.
  • Loading branch information
shlomnissan authored Jun 20, 2024
1 parent 156b99e commit c2c56ac
Show file tree
Hide file tree
Showing 21 changed files with 29 additions and 24,644 deletions.
40 changes: 10 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,16 @@ This driver uses the following libraries:

We prefer using [vcpkg](https://vcpkg.io/en/) for dependency management, as it integrates well with CMake. Below are instructions for installing vcpkg locally and configuring it to fetch and compile the necessary dependencies (the steps are taken from [this vcpkg guide](https://learn.microsoft.com/en-us/vcpkg/get_started/get-started?pivots=shell-bash)).

**1. Clone the repository**

The repository contains scripts to acquire the vcpkg executable and a registry of curated open-source libraries maintained by the vcpkg community. To do this, run:
```
git clone https://github.com/microsoft/vcpkg.git
```
**2. Clone the repository**

Run the bootstrap script
```
cd vcpkg && ./bootstrap-vcpkg.sh
```

**3. Configure environment variables**

Add the following export commands to your shell's profile script (e.g., `~/.bashrc` or `~/.zshrc`).
```
export VCPKG_ROOT=/path/to/vcpkg
export PATH=$VCPKG_ROOT:$PATH
```

**4. Configure CMake**

This repository's root directory contains a `CMakePresets.json` file with a single "default" preset for CMake, which sets the `CMAKE_TOOLCHAIN_FILE` variable. This file simplifies the process of specifying the toolchain when running CMake. Before building your project, execute the following command:

```
cmake --preset=default
```

If you've built the driver before, consider deleting your build directory first. If you encounter any problems, refer to the [source vcpkg guide](https://learn.microsoft.com/en-us/vcpkg/get_started/get-started?pivots=shell-bash) or open an issue for help.
- `git clone https://github.com/microsoft/vcpkg.git`
- `cd vcpkg && ./bootstrap-vcpkg.sh `
- Add export commands to your shell's profile script (e.g., `~/.bashrc` or `~/.zshrc`)
- `export VCPKG_ROOT=/path/to/vcpkg`
- `export PATH=$VCPKG_ROOT:$PATH`
- [Click here](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.4#set-environment-variables-in-the-system-control-panel) to learn how to add environment variables on Windows.
- Select the default CMake preset before building (consider deleting your build directory first)
- `cmake --preset=default`
- If you're building this project on Windows, you might need to specify your compiler triplet. This ensures that all dependencies are built as static libraries. You can specify the triplet during the preset selection process.
- `cmake --preset=default -DVCPKG_TARGET_TRIPLET=x64-windows-static`

## Devices

Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ else ()
acquire-core-logger
acquire-core-platform
acquire-video-runtime
nlohmann_json::nlohmann_json
)

add_test(NAME test-${tgt} COMMAND ${tgt})
Expand Down
Loading

0 comments on commit c2c56ac

Please sign in to comment.