Any chance to get access to the target OS or target triple in the build phase? #81
Closed
FrankenApps
started this conversation in
General
Replies: 2 comments
-
|
Hey! I think targetOS is supposed to be filled in for all builds, and especially Flutter ones. The fact it’s not filled in might be an upstream bug. Would recommend filing an issue there https://github.com/dart-lang/native |
Beta Was this translation helpful? Give feedback.
0 replies
-
Apparently not, because the latest version reports this more detailed error: For this reason I adjusted my build hook like this and now it seems to work just fine: import 'package:hooks/hooks.dart';
import 'package:code_assets/code_assets.dart';
import 'package:native_toolchain_rust/native_toolchain_rust.dart';
void main(List<String> args) async {
await build(args, (input, output) async {
final buildCodeAssets = input.config.buildCodeAssets;
if (!buildCodeAssets) {
return;
}
final targetOs = input.config.code.targetOS;
final cargoEnvironmentVariables = {
'RUSTFLAGS': '--cfg reqwest_unstable'
};
if (targetOs == OS.iOS) {
cargoEnvironmentVariables['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0';
cargoEnvironmentVariables['RUSTFLAGS'] = '--cfg reqwest_unstable -C link-arg=-mios-version-min=13.0';
} else if (targetOs == OS.macOS) {
cargoEnvironmentVariables['MACOSX_DEPLOYMENT_TARGET'] = '10.15';
cargoEnvironmentVariables['RUSTFLAGS'] = '--cfg reqwest_unstable -C link-arg=-mmacosx-version-min=10.15';
}
await RustBuilder(
assetName: 'src/rust/frb_generated.dart',
extraCargoEnvironmentVariables: cargoEnvironmentVariables,
).run(input: input, output: output);
});
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, awesome work, I really like how easy this was to set up.
I am currently working on a PR to
rhttpand I was trying to add different environment variables based on the current target platform like this (they are needed due to intricacies of thecccrate):Unfortunately when I do this at that point, I keep running into this error (way after the build and after the app was already started):
Do you think there maybe is a practical way to expose the information about the targetOS and / or target triple to the user?
Beta Was this translation helpful? Give feedback.
All reactions