Only compile when doing cross compilation sanity checks because linking gets way too complicated.

pull/281/head
Jussi Pakkanen 9 years ago
parent a05f0385e3
commit 1c186d4a30
  1. 11
      compilers.py
  2. 2
      interpreter.py
  3. 4
      ninjabackend.py

@ -263,7 +263,16 @@ class CCompiler(Compiler):
ofile = open(source_name, 'w') ofile = open(source_name, 'w')
ofile.write('int main(int argc, char **argv) { int class=0; return class; }\n') ofile.write('int main(int argc, char **argv) { int class=0; return class; }\n')
ofile.close() ofile.close()
pc = subprocess.Popen(self.exelist + [source_name, '-o', binary_name]) if self.is_cross and self.exe_wrapper is None:
# Linking cross built apps is painful. You can't really
# tell if you should use -nostdlib or not and for example
# on OSX the compiler binary is the same but you need
# a ton of compiler flags to differentiate between
# arm and x86_64. So just compile.
extra_flags = ['-c']
else:
extra_flags = []
pc = subprocess.Popen(self.exelist + extra_flags + [source_name, '-o', binary_name])
pc.wait() pc.wait()
if pc.returncode != 0: if pc.returncode != 0:
raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string()) raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string())

@ -1526,7 +1526,7 @@ class Interpreter():
i = i.held_object i = i.held_object
except AttributeError: except AttributeError:
pass pass
if not isinstance(i, (str, build.BuildTarget)): if not isinstance(i, (str, build.BuildTarget, build.CustomTarget)):
mlog.debug('Wrong type:', str(i)) mlog.debug('Wrong type:', str(i))
raise InterpreterException('Invalid argument to run_target.') raise InterpreterException('Invalid argument to run_target.')
cleaned_args.append(i) cleaned_args.append(i)

@ -354,13 +354,13 @@ class NinjaBackend(backends.Backend):
for i in target.args: for i in target.args:
if isinstance(i, str): if isinstance(i, str):
arg_strings.append(i) arg_strings.append(i)
elif isinstance(i, build.BuildTarget): elif isinstance(i, (build.BuildTarget, build.CustomTarget)):
relfname = self.get_target_filename(i) relfname = self.get_target_filename(i)
deps.append(relfname) deps.append(relfname)
arg_strings.append(os.path.join(self.environment.get_build_dir(), relfname)) arg_strings.append(os.path.join(self.environment.get_build_dir(), relfname))
else: else:
mlog.debug(str(i)) mlog.debug(str(i))
raise MesonException('Unreachable code.') raise MesonException('Unreachable code in generate_run_target.')
elem = NinjaBuildElement(target.name, 'CUSTOM_COMMAND', deps) elem = NinjaBuildElement(target.name, 'CUSTOM_COMMAND', deps)
cmd = [sys.executable, runnerscript, self.environment.get_source_dir(), self.environment.get_build_dir(), target.subdir] cmd = [sys.executable, runnerscript, self.environment.get_source_dir(), self.environment.get_build_dir(), target.subdir]
texe = target.command texe = target.command

Loading…
Cancel
Save