parent
e94a9c8fcf
commit
72a6683c6f
7 changed files with 102 additions and 9 deletions
@ -0,0 +1,15 @@ |
|||||||
|
# Can override executables in the cross file |
||||||
|
|
||||||
|
The cross file can now be used for overriding the result of |
||||||
|
`find_program`. As an example if you want to find the `objdump` |
||||||
|
command and have the following definition in your cross file: |
||||||
|
|
||||||
|
[binaries] |
||||||
|
... |
||||||
|
objdump = '/usr/bin/arm-linux-gnueabihf-objdump-6' |
||||||
|
|
||||||
|
Then issuing the command `find_program('objdump')` will return the |
||||||
|
version specified in the cross file. If you need the build machine's |
||||||
|
objdump, you can specify the `native` keyword like this: |
||||||
|
|
||||||
|
native_objdump = find_program('objdump', native : true) |
@ -0,0 +1,12 @@ |
|||||||
|
project('cross find program', 'c') |
||||||
|
|
||||||
|
native_exe = find_program('sometool.py', native : true) |
||||||
|
cross_exe = find_program('sometool.py') |
||||||
|
|
||||||
|
native_out = run_command(native_exe).stdout().strip() |
||||||
|
cross_out = run_command(cross_exe).stdout().strip() |
||||||
|
|
||||||
|
assert(native_out == 'native', |
||||||
|
'Native output incorrect:' + native_out) |
||||||
|
assert(cross_out == 'cross', |
||||||
|
'Cross output incorrect:' + cross_out) |
@ -0,0 +1,5 @@ |
|||||||
|
#!/usr/bin/env python |
||||||
|
|
||||||
|
from __future__ import print_function |
||||||
|
|
||||||
|
print('cross') |
@ -0,0 +1,5 @@ |
|||||||
|
#!/usr/bin/env python |
||||||
|
|
||||||
|
from __future__ import print_function |
||||||
|
|
||||||
|
print('native') |
Loading…
Reference in new issue