From 0685c491cd8f680b40e733adbbc367b48ec1801e Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 10 Dec 2021 19:50:58 +0100 Subject: [PATCH] Improve crossbuild configuration Use meson native features to detect crossbuild, and remove the user-provided option crossbuild_windows. --- app/meson.build | 4 +++- meson_options.txt | 1 - release.mk | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/meson.build b/app/meson.build index 4c0e909d..38393f0c 100644 --- a/app/meson.build +++ b/app/meson.build @@ -82,7 +82,9 @@ endif cc = meson.get_compiler('c') -if not get_option('crossbuild_windows') +crossbuild_windows = meson.is_cross_build() and host_machine.system() == 'windows' + +if not crossbuild_windows # native build dependencies = [ diff --git a/meson_options.txt b/meson_options.txt index 66ad5b25..d64e357f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,6 +1,5 @@ option('compile_app', type: 'boolean', value: true, description: 'Build the client') option('compile_server', type: 'boolean', value: true, description: 'Build the server') -option('crossbuild_windows', type: 'boolean', value: false, description: 'Build for Windows from Linux') option('prebuilt_server', type: 'string', description: 'Path of the prebuilt server') option('portable', type: 'boolean', value: false, description: 'Use scrcpy-server from the same directory as the scrcpy executable') option('server_debugger', type: 'boolean', value: false, description: 'Run a server debugger and wait for a client to be attached') diff --git a/release.mk b/release.mk index 05ddbe46..cb6c9b2e 100644 --- a/release.mk +++ b/release.mk @@ -70,7 +70,6 @@ build-win32: prepare-deps-win32 meson "$(WIN32_BUILD_DIR)" \ --cross-file cross_win32.txt \ --buildtype release --strip -Db_lto=true \ - -Dcrossbuild_windows=true \ -Dcompile_server=false \ -Dportable=true ) ninja -C "$(WIN32_BUILD_DIR)" @@ -83,7 +82,6 @@ build-win64: prepare-deps-win64 meson "$(WIN64_BUILD_DIR)" \ --cross-file cross_win64.txt \ --buildtype release --strip -Db_lto=true \ - -Dcrossbuild_windows=true \ -Dcompile_server=false \ -Dportable=true ) ninja -C "$(WIN64_BUILD_DIR)"