blob: d1d34e8e8011dcdafa5339a331c8150ca29ca7a7 [file] [log] [blame]
Zane Shelley2215d232023-04-07 14:43:40 -05001#-------------------------------------------------------------------------------
2# Chip Data Files
3#-------------------------------------------------------------------------------
4
5build_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.
14cdb_files = {}
15
16chip_config = get_option('chip_config')
17
18if 'p10' in chip_config
19 cdb_files += {'p10_10' : ['chip_data_p10_10.cdb']}
20 cdb_files += {'p10_20' : ['chip_data_p10_20.cdb']}
21endif
22
23if 'explorer' in chip_config
Patrick Williamsfffd9832025-02-01 08:38:36 -050024 cdb_files += {
25 'explorer' : ['chip_data_explorer_11.cdb', 'chip_data_explorer_20.cdb'],
26 }
Zane Shelley2215d232023-04-07 14:43:40 -050027endif
28
29if 'odyssey' in chip_config
30 cdb_files += {'odyssey' : ['chip_data_odyssey_10.cdb']}
31endif
32
33foreach chip_dir, out_files : cdb_files
34
35 source_dir = meson.current_source_dir() + '/' + chip_dir
Patrick Williamsfffd9832025-02-01 08:38:36 -050036 build_dir = meson.current_build_dir()
Zane Shelley2215d232023-04-07 14:43:40 -050037
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 Williamsfffd9832025-02-01 08:38:36 -050043 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 Shelley2215d232023-04-07 14:43:40 -050056
57endforeach
58