diff --git a/build-aux/cargo_build.py b/build-aux/cargo_build.py index 7188266811..3b2c94e332 100644 --- a/build-aux/cargo_build.py +++ b/build-aux/cargo_build.py @@ -11,6 +11,7 @@ cargo_options = sys.argv[5] bin_output = sys.argv[6] output_file = sys.argv[7] +rustflags = sys.argv[8] print(f""" ### executing cargo build script with arguments: ### @@ -21,17 +22,9 @@ cargo_options: {cargo_options} bin_output: {bin_output} output_file: {output_file} + rustflags: {rustflags} """, file=sys.stderr) -# Detecting architecture -if sys.platform == 'win32': - if platform.machine().lower() == 'arm64': - rustflags = '-C linker=clang' - else: - rustflags = '' -else: - rustflags = '' - cargo_call = f"env {cargo_env} RUSTFLAGS='{rustflags}' {cargo_cmd} build {cargo_options}" cp_call = f"cp {bin_output} {output_file}" diff --git a/meson.build b/meson.build index 6d587268d9..d2657a8d03 100644 --- a/meson.build +++ b/meson.build @@ -204,8 +204,12 @@ if build_ui == true ui_cargo_options += ['--release'] endif + rust_flags = [''] if host_machine.system() == 'windows' ui_output = app_name + '.exe' + if host_machine.cpu_family() == 'aarch64' + rust_flags += ['-C linker=clang'] + endif else ui_output = app_name endif @@ -261,6 +265,7 @@ if build_ui == true ' '.join(ui_cargo_options), cargo_target_dir / rust_target_folder / app_name, meson.project_build_root() / '@OUTPUT@', + rust_flags, ], ) @@ -343,12 +348,17 @@ if build_cli == true cli_cargo_options += ['--release'] endif + rust_flags = [''] if host_machine.system() == 'windows' cli_output = cli_name + '.exe' + if host_machine.cpu_family() == 'aarch64' + rust_flags += ['-C linker=clang'] + endif else cli_output = cli_name endif + cli_sources = [ rnote_compose_sources, rnote_engine_sources, @@ -413,6 +423,7 @@ if build_cli == true ' '.join(cli_cargo_options), cargo_target_dir / rust_target_folder / cli_name, meson.project_build_root() / '@OUTPUT@', + rust_flags, ], ) endif