Skip to content

Commit

Permalink
Created iphone cross file and made it possible to specify compile and…
Browse files Browse the repository at this point in the history
… link args in the cross file.
  • Loading branch information
jpakkane committed Sep 5, 2015
1 parent 70f4e38 commit 2c56884
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 4 deletions.
34 changes: 34 additions & 0 deletions cross/iphone.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This is a cross compilation file from OSX Yosemite to iPhone
# Apple keeps changing the location and names of files so
# these might not work for you. Use the googels and xcrun.

[binaries]
c = 'clang'
cpp = 'clang++'
ar = 'ar'
strip = 'strip'

[properties]
root = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer'

c_args = ['-arch', 'armv7', '-miphoneos-version-min=8.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk']
cpp_args = ['-arch', 'armv7', '-miphoneos-version-min=8.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk']
c_link_args = ['-arch', 'armv7', '-miphoneos-version-min=8.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk']
cpp_link_args = ['-arch', 'armv7', '-miphoneos-version-min=8.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk']

sizeof_int = 4
sizeof_wchar_t = 4
sizeof_void* = 4

alignment_char = 1
alignment_void* = 4
alignment_double = 4 # Don't know if this is correct...

has_function_printf = true
has_function_hfkerhisadf = false

[host_machine]
system = 'ios'
cpu = 'armv7'
endian = 'little'

2 changes: 1 addition & 1 deletion environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ def parse_datafile(self, filename):
for i in res:
if not self.ok_type(i):
raise EnvironmentException('Malformed value in cross file variable %s.' % varname)
self.items[varname] = res
self.config[s][entry] = res
else:
raise EnvironmentException('Malformed value in cross file variable %s.' % varname)

Expand Down
27 changes: 24 additions & 3 deletions ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,11 +815,17 @@ def generate_dynamic_link_rules(self, outfile):
langname == 'rust' or langname == 'cs':
continue
crstr = ''
cross_args = []
if is_cross:
crstr = '_CROSS'
try:
cross_args = self.environment.cross_info.config['properties'][langname + '_link_args']
except KeyError:
pass
rule = 'rule %s%s_LINKER\n' % (langname, crstr)
command = ' command = %s $ARGS %s $in $LINK_ARGS $aliasing\n' % \
command = ' command = %s %s $ARGS %s $in $LINK_ARGS $aliasing\n' % \
(' '.join(compiler.get_linker_exelist()),\
' '.join(cross_args),\
' '.join(compiler.get_linker_output_args('$out')))
description = ' description = Linking target $out'
outfile.write(rule)
Expand Down Expand Up @@ -940,8 +946,15 @@ def generate_compile_rule_for(self, langname, compiler, qstr, is_cross, outfile)
if d != '$out' and d != '$in':
d = qstr % d
quoted_depargs.append(d)
command = " command = %s $ARGS %s %s %s $in\n" % \
cross_args = []
if is_cross:
try:
cross_args = self.environment.cross_info.config['properties'][langname + '_args']
except KeyError:
pass
command = " command = %s %s $ARGS %s %s %s $in\n" % \
(' '.join(compiler.get_exelist()),\
' '.join(cross_args),
' '.join(quoted_depargs),\
' '.join(compiler.get_output_args('$out')),\
' '.join(compiler.get_compile_only_args()))
Expand All @@ -966,6 +979,13 @@ def generate_pch_rule_for(self, langname, compiler, qstr, is_cross, outfile):
crstr = ''
rule = 'rule %s%s_PCH\n' % (langname, crstr)
depargs = compiler.get_dependency_gen_args('$out', '$DEPFILE')
cross_args = []
if is_cross:
try:
cross_args = self.environment.cross_info.config['properties'][langname + '_args']
except KeyError:
pass

quoted_depargs = []
for d in depargs:
if d != '$out' and d != '$in':
Expand All @@ -975,8 +995,9 @@ def generate_pch_rule_for(self, langname, compiler, qstr, is_cross, outfile):
output = ''
else:
output = ' '.join(compiler.get_output_args('$out'))
command = " command = %s $ARGS %s %s %s $in\n" % \
command = " command = %s %s $ARGS %s %s %s $in\n" % \
(' '.join(compiler.get_exelist()),\
' '.join(cross_args),\
' '.join(quoted_depargs),\
output,\
' '.join(compiler.get_compile_only_args()))
Expand Down

0 comments on commit 2c56884

Please sign in to comment.