#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2025 Northeastern University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from dataclasses import dataclass
from typing import List, Dict, Any
@dataclass
class BuildSetting:
build_dir: str
default_toolchain: str
gen_input_files: List[str]
root_path: str
@classmethod
def from_dict(cls, d: Dict[str, Any]) -> "BuildSetting":
allowed = {f.name for f in cls.__dataclass_fields__.values()}
return cls(**{k: v for k, v in d.items() if k in allowed})