| 134 | |
| 135 | |
| 136 | class ProjectConfig: |
| 137 | def __init__(self) -> None: |
| 138 | # Paths |
| 139 | self.build_dir: Path = Path("build") # Output build files |
| 140 | self.src_dir: Path = Path("src") # C/C++/asm source files |
| 141 | self.tools_dir: Path = Path("tools") # Python scripts |
| 142 | self.asm_dir: Optional[Path] = Path( |
| 143 | "asm" |
| 144 | ) # Override incomplete objects (for modding) |
| 145 | |
| 146 | # Tooling |
| 147 | self.binutils_tag: Optional[str] = None # Git tag |
| 148 | self.binutils_path: Optional[Path] = None # If None, download |
| 149 | self.dtk_tag: Optional[str] = None # Git tag |
| 150 | self.dtk_path: Optional[Path] = None # If None, download |
| 151 | self.compilers_tag: Optional[str] = None # 1 |
| 152 | self.compilers_path: Optional[Path] = None # If None, download |
| 153 | self.wibo_tag: Optional[str] = None # Git tag |
| 154 | self.wrapper: Optional[Path] = None # If None, download wibo on Linux |
| 155 | self.sjiswrap_tag: Optional[str] = None # Git tag |
| 156 | self.sjiswrap_path: Optional[Path] = None # If None, download |
| 157 | self.ninja_path: Optional[Path] = None # If None, use system PATH |
| 158 | self.objdiff_tag: Optional[str] = None # Git tag |
| 159 | self.objdiff_path: Optional[Path] = None # If None, download |
| 160 | |
| 161 | # Project config |
| 162 | self.non_matching: bool = False |
| 163 | self.build_rels: bool = True # Build REL files |
| 164 | self.check_sha_path: Optional[Path] = None # Path to version.sha1 |
| 165 | self.config_path: Optional[Path] = None # Path to config.yml |
| 166 | self.generate_map: bool = False # Generate map file(s) |
| 167 | self.asflags: Optional[List[str]] = None # Assembler flags |
| 168 | self.ldflags: Optional[List[str]] = None # Linker flags |
| 169 | self.libs: Optional[List[Library]] = None # List of libraries |
| 170 | self.precompiled_headers: Optional[List[PrecompiledHeader]] = ( |
| 171 | None # List of precompiled headers |
| 172 | ) |
| 173 | self.linker_version: Optional[str] = None # mwld version |
| 174 | self.version: Optional[str] = None # Version name |
| 175 | self.warn_missing_config: bool = False # Warn on missing unit configuration |
| 176 | self.warn_missing_source: bool = False # Warn on missing source file |
| 177 | self.rel_strip_partial: bool = True # Generate PLFs with -strip_partial |
| 178 | self.rel_empty_file: Optional[str] = ( |
| 179 | None # Object name for generating empty RELs |
| 180 | ) |
| 181 | self.shift_jis = ( |
| 182 | True # Convert source files from UTF-8 to Shift JIS automatically |
| 183 | ) |
| 184 | self.reconfig_deps: Optional[List[Path]] = ( |
| 185 | None # Additional re-configuration dependency files |
| 186 | ) |
| 187 | self.custom_build_rules: Optional[List[Dict[str, Any]]] = ( |
| 188 | None # Custom ninja build rules |
| 189 | ) |
| 190 | self.custom_build_steps: Optional[Dict[str, List[Dict[str, Any]]]] = ( |
| 191 | None # Custom build steps, types are ["pre-compile", "post-compile", "post-link", "post-build"] |
| 192 | ) |
| 193 | self.generate_compile_commands: bool = ( |