Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ cmake --install build

### Notes on cross-compiling

#### CMake

On Windows, you will need to pass the `-A` flag when configuring the project. For instance, to target ARM64:

```bash
Expand All @@ -53,6 +55,30 @@ On other platforms you will have to specify which Rust target to use, as well as
cmake -S . -B build -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=x86 -DRust_CARGO_TARGET=i686-unknown-linux-gnu
```

#### Meson

For cross-compiling with Meson, create a cross file and use the `triplet` option to specify the Rust target. For example, to cross-compile for ARM Linux (`arm-unknown-linux-gnueabihf`), create a cross file `arm-linux-gnueabihf.txt`:

```ini
[binaries]
c = 'arm-linux-gnueabihf-gcc'
ar = 'arm-linux-gnueabihf-ar'
strip = 'arm-linux-gnueabihf-strip'

[host_machine]
system = 'linux'
cpu_family = 'arm'
cpu = 'armv7l'
endian = 'little'
```

Then configure and build:

```bash
meson setup build --cross-file arm-linux-gnueabihf.txt -Dtriplet=arm-unknown-linux-gnueabihf
meson compile -C build
```

### Regenerating the header file

If you modify the C bindings, you need to regenerate the header file and commit it. To do this, in addition to the above requirements, you will need:
Expand Down
Loading