mirror of
https://git.vladimir.cc/vladimir/wdsp.git
synced 2026-08-25 17:27:33 +00:00
Add Windows cross-compilation support via MinGW-w64
Makefile.windows builds libwdsp.dll and libwdsp.a for 64-bit Windows on Linux. FFTW 3.3.11 Windows binaries are downloaded automatically from fftw.org and import libraries are generated with dlltool. README updated with Windows build instructions and FFTW version bump. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,14 +13,18 @@ wdsp/
|
||||
├── org_openhpsdr_dsp_Wdsp.c/.h — JNI bridge
|
||||
├── Makefile — host build (Linux / macOS)
|
||||
├── Makefile.android — Android cross-build
|
||||
├── Makefile.windows — Windows cross-build (MinGW-w64, runs on Linux)
|
||||
├── java/
|
||||
│ └── org/openhpsdr/dsp/Wdsp.java
|
||||
├── third_party/
|
||||
│ ├── fftw/ — FFTW source (download manually, see below)
|
||||
│ ├── fftw/ — FFTW source (download manually, Android only)
|
||||
│ ├── fftw-win64/ — FFTW Windows binaries (downloaded automatically)
|
||||
│ ├── rnnoise/ — RNNoise noise suppression
|
||||
│ └── libspecbleach/ — spectral noise reduction
|
||||
├── obj/ — object files (generated)
|
||||
└── lib/ — built libraries (generated)
|
||||
├── obj_win/ — Windows object files (generated)
|
||||
├── lib/ — built libraries (generated)
|
||||
└── lib_win/ — Windows libraries (generated)
|
||||
```
|
||||
|
||||
---
|
||||
@@ -81,6 +85,85 @@ make clean
|
||||
|
||||
---
|
||||
|
||||
## Windows build (кросс-компиляция с Linux)
|
||||
|
||||
Сборка выполняется на Linux с помощью MinGW-w64. FFTW скачивается автоматически.
|
||||
|
||||
### Зависимости
|
||||
|
||||
```bash
|
||||
# Arch
|
||||
sudo pacman -S mingw-w64-gcc unzip
|
||||
|
||||
# Debian / Ubuntu
|
||||
sudo apt install gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64 unzip
|
||||
|
||||
# Fedora
|
||||
sudo dnf install mingw64-gcc mingw64-binutils unzip
|
||||
```
|
||||
|
||||
Также нужен `wget` или `curl`.
|
||||
|
||||
### Сборка
|
||||
|
||||
```bash
|
||||
# DLL + статическая библиотека (рекомендуется)
|
||||
make -f Makefile.windows
|
||||
|
||||
# Только DLL
|
||||
make -f Makefile.windows dll
|
||||
|
||||
# Только статическая библиотека
|
||||
make -f Makefile.windows static
|
||||
```
|
||||
|
||||
Результат в `lib_win/`:
|
||||
|
||||
| Файл | Назначение |
|
||||
|---|---|
|
||||
| `libwdsp.dll` | DLL для Windows |
|
||||
| `libwdsp.dll.a` | Import library для MinGW (`-lwdsp`) |
|
||||
| `libwdsp.a` | Статическая библиотека |
|
||||
| `libfftw3-3.dll` | Runtime dependency — распространять вместе с DLL |
|
||||
| `libfftw3f-3.dll` | Runtime dependency — распространять вместе с DLL |
|
||||
|
||||
### Линковка приложения
|
||||
|
||||
**MinGW:**
|
||||
```bash
|
||||
gcc myapp.c -Llib_win -lwdsp -o myapp.exe
|
||||
```
|
||||
|
||||
**MSVC** — переименовать `libwdsp.dll.a` в `libwdsp.lib` и подключить обычным образом.
|
||||
|
||||
**Статически** (MinGW):
|
||||
```bash
|
||||
gcc myapp.c libwdsp.a third_party/rnnoise/librnnoise.a \
|
||||
third_party/libspecbleach/libspecbleach.a \
|
||||
-Lthird_party/fftw-win64 -lfftw3-3 -lfftw3f-3 -lavrt -lm -o myapp.exe
|
||||
```
|
||||
|
||||
### Параметры
|
||||
|
||||
| Переменная | По умолчанию | Описание |
|
||||
|---|---|---|
|
||||
| `MINGW_PREFIX` | `x86_64-w64-mingw32` | Префикс MinGW toolchain |
|
||||
| `FFTW_VERSION` | `3.3.11` | Версия FFTW |
|
||||
| `CFLAGS` | `-O3 -Wno-parentheses` | Флаги компилятора |
|
||||
|
||||
```bash
|
||||
make -f Makefile.windows MINGW_PREFIX=i686-w64-mingw32 # 32-bit Windows
|
||||
```
|
||||
|
||||
### Очистка
|
||||
|
||||
```bash
|
||||
make -f Makefile.windows clean # артефакты сборки
|
||||
make -f Makefile.windows distclean # + удалить скачанный FFTW
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Android build
|
||||
|
||||
### Prerequisites
|
||||
@@ -89,9 +172,9 @@ make clean
|
||||
2. **FFTW source** — download and extract into `third_party/fftw/`:
|
||||
|
||||
```bash
|
||||
wget https://www.fftw.org/fftw-3.3.10.tar.gz
|
||||
tar xf fftw-3.3.10.tar.gz
|
||||
mv fftw-3.3.10 third_party/fftw
|
||||
wget https://www.fftw.org/fftw-3.3.11.tar.gz
|
||||
tar xf fftw-3.3.11.tar.gz
|
||||
mv fftw-3.3.11 third_party/fftw
|
||||
```
|
||||
|
||||
3. **Java compiler** — for building the `.class` file (Android Studio's JBR or any JDK)
|
||||
|
||||
Reference in New Issue
Block a user