15f3584d4SLei YUoe_sdk = get_option('oe-sdk') 2*ce6c5c54SPatrick Williamsif oe_sdk.allowed() 35f3584d4SLei YU # Setup OE SYSROOT 45f3584d4SLei YU OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip() 55f3584d4SLei YU if OECORE_TARGET_SYSROOT == '' 65f3584d4SLei YU error('Unable to get $OECORE_TARGET_SYSROOT, check your environment.') 75f3584d4SLei YU endif 85f3584d4SLei YU message('OE_SYSROOT: ' + OECORE_TARGET_SYSROOT) 95f3584d4SLei YU rpath = ':'.join([OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib']) 105f3584d4SLei YU ld_so = run_command('sh', '-c', 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1').stdout().strip() 115f3584d4SLei YU dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so] 125f3584d4SLei YUelse 135f3584d4SLei YU dynamic_linker = [] 145f3584d4SLei YUendif 155f3584d4SLei YU 165f3584d4SLei YUexamples = [ 175f3584d4SLei YU 'get_version', 186520748dSLei YU 'get_latest_version', 195f3584d4SLei YU] 205f3584d4SLei YU 215f3584d4SLei YUforeach example : examples 225f3584d4SLei YU executable(example, example + '.cpp', 235f3584d4SLei YU implicit_include_directories: false, 245f3584d4SLei YU link_args: dynamic_linker, 25*ce6c5c54SPatrick Williams build_rpath: oe_sdk.allowed() ? rpath : '') 265f3584d4SLei YUendforeach 275f3584d4SLei YU 28