Make IDE recognize we are targeting Android

This commit is contained in:
topjohnwu 2022-08-09 14:09:39 -07:00
parent 4c0f72f68f
commit 40aab13601
2 changed files with 8 additions and 0 deletions

View File

@ -232,6 +232,9 @@ def run_cargo_build(args):
# Install cxxbridge and generate C++ bindings # Install cxxbridge and generate C++ bindings
native_out = op.join('..', 'out') 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') cxx_src = op.join('external', 'cxx-rs', 'gen', 'cmd')
local_cargo_root = op.join(native_out, '.cargo') local_cargo_root = op.join(native_out, '.cargo')
mkdir_p(local_cargo_root) mkdir_p(local_cargo_root)
@ -239,6 +242,7 @@ def run_cargo_build(args):
if not args.verbose: if not args.verbose:
cmds.append('-q') cmds.append('-q')
proc = execv(cmds, env) proc = execv(cmds, env)
mv(cfg_bak, cfg)
if proc.returncode != 0: if proc.returncode != 0:
error('cxxbridge-cmd installation failed!') error('cxxbridge-cmd installation failed!')
cxxbridge = op.join(local_cargo_root, 'bin', 'cxxbridge' + EXE_EXT) cxxbridge = op.join(local_cargo_root, 'bin', 'cxxbridge' + EXE_EXT)

View File

@ -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"