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 |
Patrick Williams | fffd983 | 2025-02-01 08:38:36 -0500 | [diff] [blame^] | 24 | cdb_files += { |
| 25 | 'explorer' : ['chip_data_explorer_11.cdb', 'chip_data_explorer_20.cdb'], |
| 26 | } |
Zane Shelley | 2215d23 | 2023-04-07 14:43:40 -0500 | [diff] [blame] | 27 | endif |
| 28 | |
| 29 | if 'odyssey' in chip_config |
| 30 | cdb_files += {'odyssey' : ['chip_data_odyssey_10.cdb']} |
| 31 | endif |
| 32 | |
| 33 | foreach chip_dir, out_files : cdb_files |
| 34 | |
| 35 | source_dir = meson.current_source_dir() + '/' + chip_dir |
Patrick Williams | fffd983 | 2025-02-01 08:38:36 -0500 | [diff] [blame^] | 36 | build_dir = meson.current_build_dir() |
Zane Shelley | 2215d23 | 2023-04-07 14:43:40 -0500 | [diff] [blame] | 37 | |
| 38 | # Get all JSON files in the chip directory. This is a bit of a workaround |
| 39 | # because meson does not allow wildcards. |
| 40 | json_list = run_command('json_list.sh', source_dir) |
| 41 | in_files = json_list.stdout().strip().split('\n') |
| 42 | |
Patrick Williams | fffd983 | 2025-02-01 08:38:36 -0500 | [diff] [blame^] | 43 | custom_target( |
| 44 | 'build_cdb_' + chip_dir, |
| 45 | build_by_default: true, |
| 46 | input: in_files, |
| 47 | output: out_files, |
| 48 | command: [build_cdb, 'bin', source_dir, build_dir], |
| 49 | install: true, |
| 50 | install_dir: join_paths( |
| 51 | get_option('prefix'), |
| 52 | get_option('datadir'), |
| 53 | meson.project_name(), |
| 54 | ), |
| 55 | ) |
Zane Shelley | 2215d23 | 2023-04-07 14:43:40 -0500 | [diff] [blame] | 56 | |
| 57 | endforeach |
| 58 | |