ref: 0c0b9ef4585c6cc5217b505d5ea6486828b30fce
parent: 7783a5baf419999d74f36305f64ee1c58c023eff
author: Justin Bull <me@justinbull.ca>
date: Sun Mar 22 07:22:15 EDT 2020
Add crosscompile config files for 32, 64-bit Windows and 32-bit Linux
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -100,7 +100,7 @@
script:
- meson build --buildtype release
--werror
- --cross-file /opt/crossfiles/linux32.meson
+ --cross-file package/crossfiles/i686-linux32.meson
- ninja -C build
- cd build && meson test -v
@@ -120,7 +120,7 @@
--werror
--libdir lib
--prefix "$(pwd)/build/dav1d_install"
- --cross-file /opt/crossfiles/i686-w64-mingw32.meson
+ --cross-file package/crossfiles/i686-w64-mingw32.meson
-Ddefault_library=both
- ninja -C build
- ninja -C build install
@@ -138,7 +138,7 @@
- wineserver -p && wine wineboot
- meson build --buildtype release
--werror
- --cross-file /opt/crossfiles/i686-w64-mingw32.meson
+ --cross-file package/crossfiles/i686-w64-mingw32.meson
-Dstack_alignment=4
- ninja -C build
- cd build && meson test -v
@@ -151,7 +151,7 @@
--werror
--libdir lib
--prefix "$(pwd)/build/dav1d_install"
- --cross-file /opt/crossfiles/x86_64-w64-mingw32.meson
+ --cross-file package/crossfiles/x86_64-w64-mingw32.meson
-Ddefault_library=both
- ninja -C build
- ninja -C build install
@@ -382,7 +382,7 @@
- meson build --buildtype release
-Dtestdata_tests=true
-Dlogging=false
- --cross-file /opt/crossfiles/x86_64-w64-mingw32.meson
+ --cross-file package/crossfiles/x86_64-w64-mingw32.meson
- ninja -C build
- cd build && time meson test -v
--- a/README.md
+++ b/README.md
@@ -78,6 +78,28 @@
3. Run `meson ..` to configure meson, add `--default-library=static` if static linking is desired
4. Run `ninja` to compile
+## Cross-Compilation for 32- or 64-bit Windows, 32-bit Linux
+
+If you're on a linux build machine trying to compile .exe for a Windows target/host machine, run
+
+```
+meson build --cross-file=package/crossfiles/x86_64-w64-mingw32.meson
+```
+
+or, for 32-bit:
+
+```
+meson build --cross-file=package/crossfiles/i686-w64-mingw32.meson
+```
+
+`mingw-w64` is a pre-requisite and should be installed on your linux machine via your preferred method or package manager. Note the binary name formats may differ between distributions. Verify the names, and use `alias` if certain binaries cannot be found.
+
+For 32-bit linux, run
+
+```
+meson build --cross-file=package/crossfiles/i686-linux32.meson
+```
+
# Run tests
1. In the root directory, run `git clone https://code.videolan.org/videolan/dav1d-test-data.git tests/dav1d-test-data` to fetch the test data repository
--- /dev/null
+++ b/package/crossfiles/i686-linux32.meson
@@ -1,0 +1,15 @@
+[binaries]
+c = 'gcc'
+cpp = 'g++'
+ar = 'ar'
+strip = 'strip'
+
+[properties]
+c_link_args = ['-m32']
+c_args = ['-m32']
+
+[host_machine]
+system = 'linux'
+cpu_family = 'x86'
+cpu = 'i686'
+endian = 'little'
--- /dev/null
+++ b/package/crossfiles/i686-w64-mingw32.meson
@@ -1,0 +1,17 @@
+[binaries]
+c = 'i686-w64-mingw32-gcc'
+cpp = 'i686-w64-mingw32-g++'
+ar = 'i686-w64-mingw32-ar'
+strip = 'i686-w64-mingw32-strip'
+windres = 'i686-w64-mingw32-windres'
+exe_wrapper = ['wine']
+
+[properties]
+c_link_args = ['-static-libgcc']
+needs_exe_wrapper = true
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86'
+cpu = 'i686'
+endian = 'little'
--- /dev/null
+++ b/package/crossfiles/x86_64-w64-mingw32.meson
@@ -1,0 +1,17 @@
+[binaries]
+c = 'x86_64-w64-mingw32-gcc'
+cpp = 'x86_64-w64-mingw32-g++'
+ar = 'x86_64-w64-mingw32-ar'
+strip = 'x86_64-w64-mingw32-strip'
+windres = 'x86_64-w64-mingw32-windres'
+exe_wrapper = ['wine']
+
+[properties]
+c_link_args = ['-static-libgcc']
+needs_exe_wrapper = true
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86_64'
+cpu = 'x86_64'
+endian = 'little'