Skip to content

Commit

Permalink
move logic back into the meson build file
Browse files Browse the repository at this point in the history
  • Loading branch information
Doublonmousse committed Nov 2, 2024
1 parent a9bb491 commit f45fd78
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
11 changes: 2 additions & 9 deletions build-aux/cargo_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: ###
Expand All @@ -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}"

Expand Down
11 changes: 11 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
],
)

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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

0 comments on commit f45fd78

Please sign in to comment.