hggh
gh
This commit is contained in:
commit
2a4bd61bbb
37
.vscode/tasks.json
vendored
Normal file
37
.vscode/tasks.json
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "cppbuild",
|
||||||
|
"label": "C/C++: gcc.exe build active file",
|
||||||
|
"command": "C:/mingw64/bin/gcc.exe",
|
||||||
|
"args": [
|
||||||
|
"-fdiagnostics-color=always",
|
||||||
|
"-g",
|
||||||
|
"${file}",
|
||||||
|
"-o",
|
||||||
|
"${fileDirname}\\${fileBasenameNoExtension}.exe"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"cwd": "C:/mingw64/bin"
|
||||||
|
},
|
||||||
|
"problemMatcher": [
|
||||||
|
"$gcc"
|
||||||
|
],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"detail": "Task generated by Debugger."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "Fumo build script",
|
||||||
|
"command": "python build.py",
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": "2.0.0"
|
||||||
|
}
|
28
build.py
28
build.py
|
@ -1,11 +1,28 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
|
<<<<<<< HEAD
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
GCC = "gcc"
|
GCC = "gcc"
|
||||||
ARGS = "-fdiagnostics-color -pthread -Wall -std=c17 -pedantic"
|
ARGS = "-fdiagnostics-color -pthread -Wall -std=c17 -pedantic"
|
||||||
|
=======
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def walk_source_dir(path: str) -> tuple[list[str], list[str]]:
|
||||||
|
source_paths : list[str] = []
|
||||||
|
subdirs = []
|
||||||
|
|
||||||
|
for dirpath, dirnames, filenames in os.walk(path):
|
||||||
|
source_paths += [os.path.join(dirpath, f) for f in filenames if f.endswith(".c")]
|
||||||
|
subdirs.append(dirpath)
|
||||||
|
|
||||||
|
return (source_paths, subdirs)
|
||||||
|
>>>>>>> 41f57d5ba85e72cf801e8ee91afe55d40d535701
|
||||||
|
|
||||||
|
|
||||||
SOURCE_DIR = Path("source/")
|
SOURCE_DIR = Path("source/")
|
||||||
|
@ -43,8 +60,13 @@ def disk_read_chksms(txt: Path) -> tuple[list[Path], list[str]]:
|
||||||
return (sources, chksms)
|
return (sources, chksms)
|
||||||
|
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
def disk_write_chksms(txt: Path, sources: list[Path], chksms: list[str]) -> None:
|
def disk_write_chksms(txt: Path, sources: list[Path], chksms: list[str]) -> None:
|
||||||
zipped = {str(source): chksm for source, chksm in zip(sources, chksms)}
|
zipped = {str(source): chksm for source, chksm in zip(sources, chksms)}
|
||||||
|
=======
|
||||||
|
def build(source_path, obj_path, out_path, recompile):
|
||||||
|
source_paths, subdirs = walk_source_dir(source_path)
|
||||||
|
>>>>>>> 41f57d5ba85e72cf801e8ee91afe55d40d535701
|
||||||
|
|
||||||
with open(txt, "w+") as file:
|
with open(txt, "w+") as file:
|
||||||
file.write(json.dumps(zipped))
|
file.write(json.dumps(zipped))
|
||||||
|
@ -55,6 +77,7 @@ def filter_chksms(sources, chksms, old_chksms) -> list[Path]:
|
||||||
return [sources[chksms.index(dif)] for dif in difs]
|
return [sources[chksms.index(dif)] for dif in difs]
|
||||||
|
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
def scan_sources(source_dir: Path) -> tuple[list[Path], list[Path]]:
|
def scan_sources(source_dir: Path) -> tuple[list[Path], list[Path]]:
|
||||||
sources = [source for source in source_dir.rglob("*.c")]
|
sources = [source for source in source_dir.rglob("*.c")]
|
||||||
chksms = disk_scan_chksms(sources)
|
chksms = disk_scan_chksms(sources)
|
||||||
|
@ -136,4 +159,7 @@ def build(source_dir: Path, object_dir: Path, output: Path):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
build(SOURCE_DIR, OBJECT_DIR, OUTPUT)
|
build(SOURCE_DIR, OBJECT_DIR, OUTPUT)
|
||||||
|
=======
|
||||||
|
build("source/", "objects/", "debug", True)
|
||||||
|
>>>>>>> 41f57d5ba85e72cf801e8ee91afe55d40d535701
|
||||||
|
|
Loading…
Reference in a new issue