Add some words about windows cross-compilation
This commit is contained in:
parent
85e13251ae
commit
80f4ed11aa
4 changed files with 84 additions and 6 deletions
44
.github/workflows/rust.yml
vendored
44
.github/workflows/rust.yml
vendored
|
@ -10,7 +10,7 @@ env:
|
|||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-test-lint-linux:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
@ -34,3 +34,45 @@ jobs:
|
|||
run: cargo +nightly-2022-02-16 bench --verbose --features=bench --no-run
|
||||
- name: Build examples
|
||||
run: cargo build --examples --verbose --features=serde
|
||||
|
||||
build-test-lint-windows:
|
||||
name: Windows - build, test and lint
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- ffmpeg_version: latest
|
||||
ffmpeg_download_url: https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z
|
||||
fail-fast: false
|
||||
env:
|
||||
FFMPEG_DOWNLOAD_URL: ${{ matrix.ffmpeg_download_url }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
|
||||
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n"
|
||||
Invoke-WebRequest "${env:FFMPEG_DOWNLOAD_URL}" -OutFile ffmpeg-release-full-shared.7z
|
||||
7z x ffmpeg-release-full-shared.7z
|
||||
mkdir ffmpeg
|
||||
mv ffmpeg-*/* ffmpeg/
|
||||
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n"
|
||||
Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n"
|
||||
- name: Set up Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- name: Build
|
||||
run: |
|
||||
cargo build --examples
|
||||
- name: Test
|
||||
run: |
|
||||
cargo test --examples
|
||||
- name: Lint
|
||||
run: |
|
||||
cargo clippy --examples -- -D warnings
|
||||
- name: Check format
|
||||
run: |
|
||||
cargo fmt -- --check
|
||||
|
|
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -376,9 +376,9 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
|
|||
|
||||
[[package]]
|
||||
name = "ffmpeg-next"
|
||||
version = "5.0.0"
|
||||
version = "5.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "154799d4348e5105d775d72fe53eb32ebb31e7019d963914c687633e894ded92"
|
||||
checksum = "70a1fc87054b079ade0b081b023c5fef309cd4bbcb569c09eed2aa39b25a0a11"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"ffmpeg-sys-next",
|
||||
|
@ -387,9 +387,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ffmpeg-sys-next"
|
||||
version = "5.0.0"
|
||||
version = "5.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f81bd9adbcd2903847d680e0d2b0df95f0d514ad5f037a5504e1be1706bd98e0"
|
||||
checksum = "6ba12dea33516e30c160ce557c7e43dd857276368eb1cd0eef4fce6529f2dee5"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"cc",
|
||||
|
|
|
@ -35,7 +35,7 @@ lazy_static = "1.4.0"
|
|||
rayon = "1.5.0"
|
||||
crossbeam = "0.8.0"
|
||||
noisy_float = "0.2.0"
|
||||
ffmpeg-next = "5.0.0"
|
||||
ffmpeg-next = "5.0.2"
|
||||
log = "0.4.14"
|
||||
env_logger = "0.8.3"
|
||||
thiserror = "1.0.24"
|
||||
|
|
36
README.md
36
README.md
|
@ -97,6 +97,42 @@ library (with multithreading), and to make playlists easily.
|
|||
See [blissify](https://crates.io/crates/blissify) for a reference
|
||||
implementation.
|
||||
|
||||
## Cross-compilation
|
||||
|
||||
To cross-compile bliss-rs from linux to x86_64 windows, install the
|
||||
`x86_64-pc-windows-gnu` target via:
|
||||
|
||||
rustup target add x86_64-pc-windows-gnu
|
||||
|
||||
Make sure you have `x86_64-w64-mingw32-gcc` installed on your computer.
|
||||
|
||||
Then after downloading and extracting [ffmpeg's prebuilt binaries](https://www.gyan.dev/ffmpeg/builds/),
|
||||
running:
|
||||
|
||||
FFMPEG_DIR=/path/to/prebuilt/ffmpeg cargo build --target x86_64-pc-windows-gnu --release
|
||||
|
||||
Will produce a `.rlib` library file. If you want to generate a shared `.dll`
|
||||
library, add:
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
to `Cargo.toml` before compiling, and if you want to generate a `.lib` static
|
||||
library, add:
|
||||
|
||||
[lib]
|
||||
crate-type = ["staticlib"]
|
||||
|
||||
You can of course test the examples yourself by compiling them as .exe:
|
||||
|
||||
FFMPEG_DIR=/path/to/prebuilt/ffmpeg cargo build --target x86_64-pc-windows-gnu --release --examples
|
||||
|
||||
WARNING: Doing all of the above and making it work on windows requires to have
|
||||
ffmpeg's dll on your Windows `%PATH%` (`avcodec-59.dll`, etc).
|
||||
Usually installing ffmpeg on the target windows is enough, but you can also just
|
||||
extract them from `/path/to/prebuilt/ffmpeg/bin` and put them next to the thing
|
||||
you generated from cargo (either bliss' dll or executable).
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
* This library relies heavily on [aubio](https://aubio.org/)'s
|
||||
|
|
Loading…
Reference in a new issue