Peter Marheine has uploaded this change for review.
ni845x_spi: support building with Meson
This adds a dependency definition for the ni845x library (attempting to
find it in the default install location, allowing the user to specify a
custom path) and adds ni845x_spi as a supported programmer for Meson.
Full functionality has not been verified because the ni845x.h header
shipped with driver version 2022 Q3 causes compile errors relating to
`kNI845XExport` not being defined when built with GCC 12 as shipped by
MSYS2, but this seems to be unrelated to Meson specifically and likely
needs to be fixed more comprehensively through some other method.
Build configuration has been manually inspected to check that the
library is being linked appropriately, since I am unable to compile
the ni845x_spi programmer successfully.
Ticket: https://ticket.coreboot.org/issues/487
Change-Id: I90e85c424f97898b47bf0a3d78672d6c25af12b0
---
M meson.build
M meson_options.txt
2 files changed, 55 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/63/74963/1
diff --git a/meson.build b/meson.build
index 2784c34..f987abc 100644
--- a/meson.build
+++ b/meson.build
@@ -12,6 +12,8 @@
],
)
+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,
@@ -140,6 +142,24 @@
libftdi1 = dependency('libftdi1', required : group_ftdi)
libjaylink = dependency('libjaylink', required : group_jlink)
+ni845x_path = []
+foreach p : get_option('ni845x_search_dir')
+ # include_directories() below fails if any given directory doesn't exist
+ if fs.is_dir(p)
+ ni845x_path += p
+ endif
+endforeach
+libni845x = declare_dependency(
+ dependencies : cc.find_library(
+ 'ni845x',
+ dirs : ni845x_path,
+ has_headers : [ 'ni845x.h' ],
+ header_include_directories : include_directories(ni845x_path),
+ required : get_option('programmer').contains('ni845x_spi'),
+ ),
+ include_directories : [ni845x_path],
+)
+
subdir('platform')
if systems_hwaccess.contains(host_machine.system())
@@ -361,6 +381,13 @@
'flags' : [ '-DCONFIG_MSTARDDC_SPI=1' ],
'default' : false
},
+ 'ni845x_spi': {
+ 'systems' : [ 'windows' ],
+ 'deps' : [ libni845x ],
+ 'srcs' : files('ni845x_spi.c'),
+ 'flags' : [ '-DCONFIG_NI845X_SPI=1' ],
+ 'default' : false
+ },
'nic3com' : {
'systems' : systems_hwaccess,
'cpu_families' : cpus_port_io,
diff --git a/meson_options.txt b/meson_options.txt
index 91d3045..c2b2d12 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -13,10 +13,13 @@
'asm106x', 'atahpt', 'atapromise', 'atavia', 'buspirate_spi', 'ch341a_spi', 'ch347_spi','dediprog',
'developerbox_spi', 'digilent_spi', 'dirtyjtag_spi', 'drkaiser', 'dummy', 'ft2232_spi',
'gfxnvidia', 'internal', 'it8212', 'jlink_spi', 'linux_mtd', 'linux_spi', 'mediatek_i2c_spi',
- 'mstarddc_spi', 'nic3com', 'nicintel', 'nicintel_eeprom', 'nicintel_spi', 'nicnatsemi',
+ 'mstarddc_spi', 'ni845x_spi', 'nic3com', 'nicintel', 'nicintel_eeprom', 'nicintel_spi', 'nicnatsemi',
'nicrealtek', 'ogp_spi', 'parade_lspcon', 'pickit2_spi', 'pony_spi', 'raiden_debug_spi',
'rayer_spi', 'realtek_mst_i2c_spi', 'satamv', 'satasii', 'serprog', 'stlinkv3_spi', 'usbblaster_spi',
], description: 'Active programmers')
+option('ni845x_search_dir', type : 'array',
+ value : ['C:/Program Files (x86)/National Instruments/NI-845x/MS Visual C/', 'C:/Program Files/National Instruments/NI-845x/MS Visual C/'],
+ description : 'directories to search for NI-845x libraries')
option('llvm_cov', type : 'feature', value : 'disabled', description : 'build for llvm code coverage')
option('man-pages', type : 'feature', value : 'auto', description : 'build the man-page for classic_cli')
option('documentation', type : 'feature', value : 'auto', description : 'build the html documentation')
To view, visit change 74963. To unsubscribe, or for help writing mail filters, visit settings.