Skip to content

Commit

Permalink
Add toolchain for Raspberry Pi cross compilation (open-quantum-safe#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstebila authored Feb 17, 2020
1 parent 410caa7 commit f8bfb1a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .CMake/toolchain-rasppi.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# apt install gcc-8-arm-linux-gnueabihf
# cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../.CMake/toolchain-rasppi.cmake -DUSE_OPENSSL=OFF ..

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc-8)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,17 @@ If the build fails on macOS, you might have to run `cmake -GNinja -DCMAKE_BUILD_

Binaries can be generated using Visual Studio 2019 with the [CMake Tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) extension installed.

### Cross compilation

You can cross compile liboqs for various platform by supplying CMake with an appropriate [toolchain](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html) file.

For example, to cross compile for a Raspberry Pi from Ubuntu Bionic:

apt install gcc-8-arm-linux-gnueabihf
mkdir build && cd build
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../.CMake/toolchain-rasppi.cmake -DUSE_OPENSSL=OFF ..
ninja

## Documentation

Further information can be found in the [wiki](https://github.com/open-quantum-safe/liboqs/wiki).
Expand Down

0 comments on commit f8bfb1a

Please sign in to comment.