Lei YU | 5f3584d | 2019-08-27 16:28:53 +0800 | [diff] [blame] | 1 | oe_sdk = get_option('oe-sdk') |
| 2 | if oe_sdk.enabled() |
| 3 | # Setup OE SYSROOT |
| 4 | OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip() |
| 5 | if OECORE_TARGET_SYSROOT == '' |
| 6 | error('Unable to get $OECORE_TARGET_SYSROOT, check your environment.') |
| 7 | endif |
| 8 | message('OE_SYSROOT: ' + OECORE_TARGET_SYSROOT) |
| 9 | rpath = ':'.join([OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib']) |
| 10 | ld_so = run_command('sh', '-c', 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1').stdout().strip() |
| 11 | dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so] |
| 12 | else |
| 13 | dynamic_linker = [] |
| 14 | endif |
| 15 | |
| 16 | examples = [ |
| 17 | 'get_version', |
Lei YU | 6520748 | 2019-10-11 16:39:36 +0800 | [diff] [blame] | 18 | 'get_latest_version', |
Lei YU | 5f3584d | 2019-08-27 16:28:53 +0800 | [diff] [blame] | 19 | ] |
| 20 | |
| 21 | foreach example : examples |
| 22 | executable(example, example + '.cpp', |
| 23 | implicit_include_directories: false, |
| 24 | link_args: dynamic_linker, |
| 25 | build_rpath: oe_sdk.enabled() ? rpath : '') |
| 26 | endforeach |
| 27 | |