native_toolchain_xmake 0.0.9
native_toolchain_xmake: ^0.0.9 copied to clipboard
A library to invoke and build Xmake projects for Dart Native Assets.
xmake #
install #
dart run native_toolchain_xmake:install
-
windows:
irm https://xmake.io/psget.text | iex -
linux
curl -fsSL https://xmake.io/shget.text | bash或者
wget https://xmake.io/shget.text -O - | bash -
mac:
brew install xmakeNote
用官网的 bash 反而会陷入找不到库
example #
void main(List<String> args) async {
await build(args, (input, output) async {
if (input.config.buildCodeAssets) {
// flutter need to check this flag
await XmakeLibrary(
target: 'project_xmake',
assetName: 'src/project_xmake.g.dart',
).build(input: input, output: output);
}
});
}
xmake #
流程:configure -> build -> install
config #
android
xmake f --plat=android --arch=x86_64 --toolchain=ndk --ndk="C:/Users/<you>/AppData/Local/Android/Sdk/ndk/<version>" --mode=release --kind=shared -y
windows:
xmake f --plat=windows --arch=x64 --mode=release --kind=shared -y
issue #
- ✅ hooks 丢失环境变量
- ❌ 交叉编译问题
- ❌ tree-shaking
忘记为什么不用 cmake 了。好像是 compile_commands.json 生成的问题?
用 zig 交叉编译
winget install -e --id zig.zig
brew install zig
如果debug的时候,xmake正在下载程序,然后自己中断了,会导致比如curl子程序成为孤立的进程占用文件
用
xmake -vD
可以查看