Zane Shelley | 2215d23 | 2023-04-07 14:43:40 -0500 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Chip Data Files |
| 3 | #------------------------------------------------------------------------------- |
| 4 | |
| 5 | build_cdb = find_program('parse_chip_data.py') |
| 6 | |
| 7 | # The key for each entry in this dictionary is a subdirectory containing XML for |
| 8 | # a chip model. The value for each entry contains the expected output files that |
| 9 | # will be produced for each chip model. It is important to note that the script |
| 10 | # will generate all output files, regardless of what is listed, when the script |
| 11 | # is run. However, this list must be kept in sync with the expected output so |
| 12 | # that meson will know to run the script when an output file has changed or is |
| 13 | # missing. |
| 14 | cdb_files = {} |
| 15 | |
| 16 | chip_config = get_option('chip_config') |
| 17 | |
| 18 | if 'p10' in chip_config |
| 19 | cdb_files += {'p10_10' : ['chip_data_p10_10.cdb']} |
| 20 | cdb_files += {'p10_20' : ['chip_data_p10_20.cdb']} |
| 21 | endif |
| 22 | |
| 23 | if 'explorer' in chip_config |
| 24 | cdb_files += {'explorer' : ['chip_data_explorer_11.cdb', |
| 25 | 'chip_data_explorer_20.cdb']} |
| 26 | endif |
| 27 | |
| 28 | if 'odyssey' in chip_config |
| 29 | cdb_files += {'odyssey' : ['chip_data_odyssey_10.cdb']} |
| 30 | endif |
| 31 | |
| 32 | foreach chip_dir, out_files : cdb_files |
| 33 | |
| 34 | source_dir = meson.current_source_dir() + '/' + chip_dir |
| 35 | build_dir = meson.current_build_dir() |
| 36 | |
| 37 | # Get all JSON files in the chip directory. This is a bit of a workaround |
| 38 | # because meson does not allow wildcards. |
| 39 | json_list = run_command('json_list.sh', source_dir) |
| 40 | in_files = json_list.stdout().strip().split('\n') |
| 41 | |
| 42 | custom_target('build_cdb_' + chip_dir, build_by_default : true, |
| 43 | input : in_files, output : out_files, |
| 44 | command : [ build_cdb, 'bin', source_dir, build_dir ], |
| 45 | install : true, |
| 46 | install_dir : join_paths(get_option('prefix'), |
| 47 | get_option('datadir'), |
| 48 | meson.project_name())) |
| 49 | |
| 50 | endforeach |
| 51 | |