Gantry include paths are now relative

This commit is contained in:
Adam Magnusson 2025-03-06 15:24:37 +01:00
parent cd2c920c48
commit 6baa2fd002
2 changed files with 6 additions and 10 deletions

View File

@ -43,20 +43,16 @@ def addAllVHDLFiles(std: str, lib: str, init=False):
return -1
vhdlFiles = []
currentlyAdded = []
absWorkDir = os.path.join(os.getcwd(), "work")
cfFileId = getCfFileId(std)
## Find already present files
if not init:
cfFileName = list(filter(lambda x: ".cf" in x and lib in x and cfFileId in x, os.listdir(absWorkDir)))[0]
cfFilePath = os.path.join(absWorkDir,cfFileName)
cfFileName = list(filter(lambda x: ".cf" in x and lib in x and cfFileId in x, os.listdir("work")))[0]
cfFilePath = os.path.join("work",cfFileName)
currentlyAdded = getCurrentlyAddedFiles(cfFilePath)
print(currentlyAdded)
## Add files not added
for file in os.listdir():
print(file)
print(currentlyAdded, file, file not in currentlyAdded)
if ".vhd" in file and file not in currentlyAdded:
vhdlFiles.append(os.path.join(os.getcwd(), file))
vhdlFiles.append(file)
if len(vhdlFiles) > 0:
print(f"Detected new files. Adding {vhdlFiles}")
command = ["ghdl", "-i", "--workdir=work", f"--work={lib}", f"--std={std}"] + vhdlFiles
@ -68,5 +64,5 @@ def getCurrentlyAddedFiles(cfFilePath:str):
lines = f.readlines()
f.close()
fileLines = filter(lambda x: "file" in x, lines)
files = map(lambda x: split("\"",x)[1], fileLines)
files = map(lambda x: split("\" \"",x)[1], fileLines)
return list(files)

View File

@ -7,7 +7,7 @@ from typing import List
def generateIncludesForGHDL(includes: List[str]):
cmd = []
for inc in includes:
cmd.append(f"-P{os.path.join(os.getcwd(), f"{inc}/work")}")
cmd.append(f"-P{inc}/work")
return cmd
def elabDesign(topDef: str, arch: str, lib: str, std: str, includes: List[str]):
@ -26,7 +26,7 @@ def runDesign(topDef: str, arch: str, lib: str, std: str, includes):
print("Elaboration failed...")
return -1
os.makedirs("wave",exist_ok=True)
wavePath = os.path.join(os.getcwd(), "wave")
wavePath = "wave"
incs = generateIncludesForGHDL(includes)
command = [ ## may add -v for verbose
"ghdl", "--elab-run", f"--workdir=work", f"--work={lib}", f"--std={std}"] + incs + ["-o", f"work/{topDef}-{arch}", f"{topDef}", f"{arch}",