From f705a73149e37cd075b1d9fd41d8eac2451aa26d Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Tue, 5 Jun 2018 20:43:47 +0200 Subject: [PATCH] Use a meson option to crossbuild for Windows Meson decided to crossbuild for Windows as soon as meson.is_cross_build() returned true. This made non-Windows crossbuilds fail. Instead, add an explicit option "crossbuild_windows". Fixes . --- Makefile.CrossWindows | 4 ++++ app/meson.build | 2 +- meson_options.txt | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile.CrossWindows b/Makefile.CrossWindows index 3186193a..2dd6c192 100644 --- a/Makefile.CrossWindows +++ b/Makefile.CrossWindows @@ -55,6 +55,7 @@ build-win32: prepare-deps-win32 meson "$(WIN32_BUILD_DIR)" \ --cross-file cross_win32.txt \ --buildtype release --strip -Db_lto=true \ + -Dcrossbuild_windows=true \ -Dbuild_server=false \ -Doverride_server_path=scrcpy-server.jar ) ninja -C "$(WIN32_BUILD_DIR)" @@ -64,6 +65,7 @@ build-win32-noconsole: prepare-deps-win32 meson "$(WIN32_NOCONSOLE_BUILD_DIR)" \ --cross-file cross_win32.txt \ --buildtype release --strip -Db_lto=true \ + -Dcrossbuild_windows=true \ -Dbuild_server=false \ -Dwindows_noconsole=true \ -Doverride_server_path=scrcpy-server.jar ) @@ -77,6 +79,7 @@ build-win64: prepare-deps-win64 meson "$(WIN64_BUILD_DIR)" \ --cross-file cross_win64.txt \ --buildtype release --strip -Db_lto=true \ + -Dcrossbuild_windows=true \ -Dbuild_server=false \ -Doverride_server_path=scrcpy-server.jar ) ninja -C "$(WIN64_BUILD_DIR)" @@ -86,6 +89,7 @@ build-win64-noconsole: prepare-deps-win64 meson "$(WIN64_NOCONSOLE_BUILD_DIR)" \ --cross-file cross_win64.txt \ --buildtype release --strip -Db_lto=true \ + -Dcrossbuild_windows=true \ -Dbuild_server=false \ -Dwindows_noconsole=true \ -Doverride_server_path=scrcpy-server.jar ) diff --git a/app/meson.build b/app/meson.build index 9aa994be..1a2ece31 100644 --- a/app/meson.build +++ b/app/meson.build @@ -19,7 +19,7 @@ src = [ 'src/tinyxpm.c', ] -if not meson.is_cross_build() +if not get_option('crossbuild_windows') # native build dependencies = [ diff --git a/meson_options.txt b/meson_options.txt index baacd19b..567f0a39 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,5 +1,6 @@ option('build_app', type: 'boolean', value: true, description: 'Build the client') option('build_server', type: 'boolean', value: true, description: 'Build the server') +option('crossbuild_windows', type: 'boolean', value: false, description: 'Build for Windows from Linux') option('windows_noconsole', type: 'boolean', value: false, description: 'Disable console on Windows (pass -mwindows flag)') option('prebuilt_server', type: 'string', description: 'Path of the prebuilt server') option('override_server_path', type: 'string', description: 'Hardcoded path to find the server at runtime')