56 lines
1.1 KiB
Python

from dataclasses import dataclass
import enum
from typing import TYPE_CHECKING
from SCons.Script import *
if TYPE_CHECKING:
class SPPEnvironment(Environment):
def Info(self, message: str): ...
def Warn(self, message: str): ...
def Error(self, message: str): ...
else:
SPPEnvironment = Environment
@dataclass
class Module:
name: str
folder: str
description: str
cxx_namespace: str
class TargetType(enum.Enum):
PROGRAM = 0
STATIC_LIBRARY = 1
SHARED_LIBRARY = 2
MISC = 3
class Target:
name: str
target_type: TargetType
builder = None
args: list = []
kwargs: dict = {}
dependencies: list = []
target = None
module: Module = None
@dataclass(frozen=True)
class SPPInterface:
globals: dict
@property
def env(self) -> SPPEnvironment:
return self.globals['env']
@property
def targets(self) -> list[Target]:
return self.env['SPP_TARGETS']
_spp: SPPInterface
def _init_interface(**kwargs) -> None:
global _spp
_spp = SPPInterface(**kwargs)
def get_spp() -> SPPInterface:
return _spp