Files
compile/util/builder/info.py

39 lines
1.3 KiB
Python

from dataclasses import dataclass, field
from enum import Enum
from typing import List
class BuildType(Enum):
DEBUG: List[str] = ["-g", "-O0", "-DLOG_LEVEL=DEBUG"]
TRACE: List[str] = ["-g", "-O0", "-DLOG_LEVEL=TRACE"]
RELEASE: List[str] = ["-O3", "-DREL_BUILD", "-DLOG_LEVEL=ERROR"]
PROFILE: List[str] = ["-O2", "-g", "-pg", "-DLOG_LEVEL=ERROR"]
RELWITHDEBINFO: List[str] = ["-O2", "-g", "-DLOG_LEVEL=DEBUG"]
FASTEST: List[str] = ["-Ofast", "-ffast-math", "-xHost", "-DLOG_LEVEL=ERROR"]
@dataclass
class PlatformInfo:
name: str
compiler: str
architecture: str
file_type: str
code_specification: str
def __str__(self):
return f"{self.name}_{self.architecture}{self.file_type}"
class Platform(Enum):
LINUX_x86_64 = PlatformInfo("linux", "clang", "x86-64", "", "-DSPEC_LINUX")
LINUX_x86 = PlatformInfo("linux", "clang", "x86", "", "-DSPEC_LINUX")
LINUX_x86_64_V4 = PlatformInfo("linux", "clang", "x86-64-v4", "", "-DSPEC_LINUX")
MACOS = PlatformInfo("macos", "gcc", "arm", "", "-DSPEC_DARWIN")
WASM = PlatformInfo("wasm", "emcc", "", "", "-DSPEC_WASM")
@dataclass
class Build:
name: str
type: BuildType
platform: PlatformInfo
definitive_name: str = field(default_factory=str)
additional_instructions: List[str] = field(default_factory=list)