meson: Add option to pass cpu

This helps with cross compile setups, where host_cpu != target_cpu
therefore detecting it on the fly will end up with wrong cpu to build
for

Signed-off-by: Khem Raj <raj.khem@gmail.com>
pull/28/head
Khem Raj 2021-05-30 08:30:28 -07:00
parent 335ee864ef
commit a530eed9e7
2 changed files with 8 additions and 2 deletions

View File

@ -6,7 +6,11 @@ project(
version : run_command('head', files('VERSION')).stdout()
)
cpu = host_machine.cpu_family()
cpu = get_option('cpu')
if cpu == ''
cpu = host_machine.cpu_family()
endif
if cpu == 'sh4'
cpu = 'sh'
endif

View File

@ -2,3 +2,5 @@ option('freestanding', type : 'boolean', value : false,
description: 'Do not use system headers')
option('export_unprefixed', type : 'boolean', value : true,
description: 'Export POSIX 2004 ucontext names as alises')
option('cpu', type : 'string', value : '',
description: 'Target CPU architecture for cross compile')