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