eide icon indicating copy to clipboard operation
eide copied to clipboard

[question] Model JSON 中如何标注互斥的编译器选项?

Open MingcongBai opened this issue 1 year ago • 1 comments

What you want to do

正在扩充 MIPS MTI GCC 类型项目的编译器选项。

Describe the problem

目前 在 mips.mti.gcc.model.json 中登记了一些额外的 MIPS MTI GCC 选项 ,但其中 -mmips16-mmicromips 两个选项是互斥的。目前在其他 Model 中没有观察到有可以标记两个选项互斥的功能。

Expected behavior

可标注 -mmips16-mmicromips 选项互斥。

MingcongBai avatar Jun 14 '23 09:06 MingcongBai

因为 UI 里没有实现这样的逻辑(不支持一个选中后另一个变灰),因此没有互斥功能

简单的做法是,将两个选项合并为一个,使用 enum 来提供组合后的选项,并提供默认值

"<名称>": {
            "type": "selectable",
            "command": {
                "mips16": "-mips16 -mno-micromips",
                "micromips": "-mmicromips -mno-mips16",
                "false": "<默认值>"
            },
            "group": [
                "c",
                "cpp",
                "asm",
                "linker"
            ],
            "location": "first"
        },

github0null avatar Jun 15 '23 04:06 github0null