Skip to content

Commit

Permalink
Restructure the building section according to the systems
Browse files Browse the repository at this point in the history
  • Loading branch information
sirkrypt0 committed Aug 31, 2022
1 parent 2a4ffb6 commit a60b5c9
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,37 @@ It is heavily inspired by the [`libfido2`](https://github.com/Yubico/libfido2) a

## Building

Building the library depends on the framework you use for your microcontroller.
We provide examples for the [ESP-32 using ESP-IDF](examples/esp32/) and the [nRF52 using Zephyr](examples/nrf52/).
The build system is based on `cmake >= 3.10`.

In case you only want to build a static library and use that later for linking, proceed as follows.
Use one of the provided toolchain files (currently only for the ATmega, see [#37](https://github.com/All-Your-Locks-Are-Belong-To-Us/libmicrofido2/issues/37)).
### Desktops

You need to install `cmake >= 3.10`. Having done that you can do:
You can build the library for desktops (we tested Linux and macOS):

```bash
mkdir -p build && cd build
# for AVR8 Debug builds
cmake .. -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_TOOLCHAIN_FILE=../avr.toolchain -DCMAKE_BUILD_TYPE=Debug
# for AVR8 Release builds
cmake .. -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_TOOLCHAIN_FILE=../avr.toolchain -DCMAKE_BUILD_TYPE=Release
cmake .. -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=Debug # Or Release
make -j
```

Similarily, you can build the library for desktops (we tested Linux and macOS) by omitting the `CMAKE_TOOLCHAIN_FILE` option:
### Using Toolchains (AVR-only)

Currently, we only provide a toolchain file for the ATmega (see [#37](https://github.com/All-Your-Locks-Are-Belong-To-Us/libmicrofido2/issues/37)).
With that, you can easily build the library as a static library as follows:

```bash
mkdir -p build && cd build
cmake .. -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=Debug # Or Release
# for AVR8 Debug builds
cmake .. -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_TOOLCHAIN_FILE=../avr.toolchain -DCMAKE_BUILD_TYPE=Debug
# for AVR8 Release builds
cmake .. -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_TOOLCHAIN_FILE=../avr.toolchain -DCMAKE_BUILD_TYPE=Release
make -j
```

### Other Systems

Building the library for other systems depends on the framework you use for your microcontroller.
We provide examples for the [ESP-32 using ESP-IDF](examples/esp32/) and the [nRF52 using Zephyr](examples/nrf52/).

## Usage

We provide fairly extensive examples of using this library in the [examples](examples/) directory.
Expand Down

0 comments on commit a60b5c9

Please sign in to comment.