1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 06:01:16 +02:00

meson: Add support for ni845x_spi on Windows

TEST=On MSYS32 MINGW32 with ni845x library installed:
     meson setup -Dprogrammer=ni845x_spi build
     meson compile -C build
     ./build/flashrom.exe lists the ni845x_spi as choice.
     Without ni845x library installed but ni845x_spi disabled,
     build succeeds on all platforms.

Change-Id: I2d32f11852ac1a5184af8e8683ca1914a6e72973
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/75236
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Thomas Heijligen
2023-05-15 21:48:38 +02:00
committed by Anastasia Klimchuk
parent 7538b74a11
commit 81c3f31f90
3 changed files with 44 additions and 1 deletions

View File

@ -12,6 +12,8 @@ project('flashromutils', 'c',
],
)
fs = import('fs')
if get_option('classic_cli').enabled() and get_option('default_library') == 'shared'
error('''
Cannot build cli_classic with shared libflashrom. Use \'-Dclassic_cli=disabled\' to disable the cli,
@ -149,6 +151,30 @@ libusb1 = dependency('libusb-1.0', required : group_usb)
libftdi1 = dependency('libftdi1', required : group_ftdi)
libjaylink = dependency('libjaylink', required : group_jlink, version : '>=0.3.0')
if host_machine.system() == 'windows'
# Specifying an include_path that doesn't exist is an error,
# but we only use this if the library is found in the same directory.
ni845x_search_path = get_option('ni845x_search_path')
if fs.is_dir(ni845x_search_path)
ni845x_include_path = [ni845x_search_path]
else
ni845x_include_path = []
endif
libni845x = declare_dependency(
dependencies : [
cc.find_library(
'ni845x',
dirs : get_option('ni845x_search_path'),
required : get_option('programmer').contains('ni845x_spi')
),
],
include_directories : ni845x_include_path,
)
else
libni845x = dependency('', required : false)
endif
subdir('platform')
if systems_hwaccess.contains(host_machine.system())
@ -369,6 +395,14 @@ programmer = {
'flags' : [ '-DCONFIG_MSTARDDC_SPI=1' ],
'default' : false
},
'ni845x_spi' : {
'systems' : [ 'windows' ],
'cpu_families' : [ 'x86' ], # The required ni845x library is 32-bit only
'deps' : [ libni845x ],
'srcs' : files('ni845x_spi.c'),
'flags' : [ '-DCONFIG_NI845X_SPI=1' ],
'default' : false,
},
'nic3com' : {
'systems' : systems_hwaccess,
'cpu_families' : cpus_port_io,