Sort list (bettter for Clion)

Signed-off-by: HiFiPhile <admin@hifiphile.com>
This commit is contained in:
HiFiPhile
2025-02-09 18:40:30 +01:00
parent 09bce3532c
commit 1208f88b6e
2 changed files with 1738 additions and 1726 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -24,46 +24,57 @@ def main():
{"name": "default", {"name": "default",
"hidden": True, "hidden": True,
"description": r"Configure preset for the ${presetName} board", "description": r"Configure preset for the ${presetName} board",
"generator": "Ninja", "generator": "Ninja Multi-Config",
"binaryDir": r"${sourceDir}/build/${presetName}", "binaryDir": r"${sourceDir}/build/${presetName}",
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo", "CMAKE_DEFAULT_BUILD_TYPE": "RelWithDebInfo",
"BOARD": r"${presetName}" "BOARD": r"${presetName}"
} }}]
}]
presets['configurePresets'].extend( presets['configurePresets'].extend(
[{'name': board, 'inherits': 'default'} for board in board_list] sorted(
[
{
'name': board,
'inherits': 'default'
}
for board in board_list
], key=lambda x: x['name']
)
) )
# Build presets # Build presets
# no inheritance since 'name' doesn't support macro expansion # no inheritance since 'name' doesn't support macro expansion
presets['buildPresets'] = [ presets['buildPresets'] = sorted(
{ [
'name': board, {
'description': "Build preset for the " + board + " board", 'name': board,
'configurePreset': board 'description': "Build preset for the " + board + " board",
} 'configurePreset': board
for board in board_list }
] for board in board_list
], key=lambda x: x['name']
)
# Workflow presets # Workflow presets
presets['workflowPresets'] = [ presets['workflowPresets'] = sorted(
{ [
"name": board, {
"steps": [ "name": board,
{ "steps": [
"type": "configure", {
"name": board "type": "configure",
}, "name": board
{ },
"type": "build", {
"name": board "type": "build",
} "name": board
] }
} ]
for board in board_list }
] for board in board_list
], key=lambda x: x['name']
)
with open("hw/bsp/BoardPresets.json", "w") as f: with open("hw/bsp/BoardPresets.json", "w") as f:
f.write('{}\n'.format(json.dumps(presets, indent=2))) f.write('{}\n'.format(json.dumps(presets, indent=2)))
@@ -87,5 +98,6 @@ def main():
print('Generating presets for the following examples:') print('Generating presets for the following examples:')
print(example_list) print(example_list)
if __name__ == "__main__": if __name__ == "__main__":
main() main()