• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4#
5# Copyright (c) 2025 Northeastern University
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18
19from dataclasses import dataclass
20from typing import List, Dict, Any
21
22
23@dataclass
24class BuildSetting:
25    build_dir: str
26    default_toolchain: str
27    gen_input_files: List[str]
28    root_path: str
29
30    @classmethod
31    def from_dict(cls, d: Dict[str, Any]) -> "BuildSetting":
32        allowed = {f.name for f in cls.__dataclass_fields__.values()}
33        return cls(**{k: v for k, v in d.items() if k in allowed})
34