From 40aab136019f4c1950f0789baf92a0686cd0a29e Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 9 Aug 2022 14:09:39 -0700 Subject: [PATCH] Make IDE recognize we are targeting Android --- build.py | 4 ++++ native/src/.cargo/config.toml | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 native/src/.cargo/config.toml diff --git a/build.py b/build.py index 8074a2560..f26ba9648 100755 --- a/build.py +++ b/build.py @@ -232,6 +232,9 @@ def run_cargo_build(args): # Install cxxbridge and generate C++ bindings native_out = op.join('..', 'out') + cfg = op.join('.cargo', 'config.toml') + cfg_bak = op.join('.cargo', 'config.toml.bak') + mv(cfg, cfg_bak) cxx_src = op.join('external', 'cxx-rs', 'gen', 'cmd') local_cargo_root = op.join(native_out, '.cargo') mkdir_p(local_cargo_root) @@ -239,6 +242,7 @@ def run_cargo_build(args): if not args.verbose: cmds.append('-q') proc = execv(cmds, env) + mv(cfg_bak, cfg) if proc.returncode != 0: error('cxxbridge-cmd installation failed!') cxxbridge = op.join(local_cargo_root, 'bin', 'cxxbridge' + EXE_EXT) diff --git a/native/src/.cargo/config.toml b/native/src/.cargo/config.toml new file mode 100644 index 000000000..6f2e10465 --- /dev/null +++ b/native/src/.cargo/config.toml @@ -0,0 +1,4 @@ +[build] +# This is only used to make the IDE happy, the actual compilation will +# have the target overriden by command-line +target = "aarch64-linux-android"