Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Choose your MSVC tools, Fixes LLVM download issue #49

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion inceptor/compilers/LlvmCompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ class LlvmCompiler(Compiler):
def __init__(self, args=None, aargs=None, arch="x64"):
self.config = Config()
self.vcvarsall = self.config.get_path("COMPILERS", "VCVARSALL")
self.tools_ver = self.config.get("COMPILERS", "TOOLS_VER")
super().__init__(None, args=args, aargs=aargs, sep=":", arch=arch)
self.prefix_cmd = f'"{self.vcvarsall}" {self.arch}'
self.prefix_cmd = f'"{self.vcvarsall}" {self.arch} -vcvars_ver={self.tools_ver}'

def format_libraries(self, libraries: list = None):
if not libraries or not isinstance(libraries, list):
Expand Down
1 change: 1 addition & 0 deletions inceptor/config/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ msbuildx86_compiler =
msbuildx64_compiler =
libx64_compiler =
libx86_compiler =
tools_ver =

[SIGNERS]
signtool_x86 =
Expand Down
26 changes: 22 additions & 4 deletions inceptor/update-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,29 @@ def detect_base_path():
sys.exit(1)
return available[choice]

def update_tools(base_path):
available = [t for t in os.listdir(f"{base_path}\\Community\\VC\\Tools\\MSVC")]
print(f"[*] Choose the MSVC Tools version:")
for n, ver in enumerate(available):
print(f" {n}: {ver}")
choice = -1
while not (0 <= choice < len(available)):
try:
choice = int(input("> "))
except ValueError:
continue
except KeyboardInterrupt:
sys.exit(1)
return available[choice]



def update_config():
c = Config()
base_path = detect_base_path()
print(base_path)

tool_ver = update_tools(base_path)
c.set("COMPILERS", f"TOOLS_VER", str(tool_ver))
print("[*] Checking requirements")

if not os.path.isdir(base_path):
Expand Down Expand Up @@ -139,7 +156,6 @@ def update_config():
pass
print("[+] Finished!")


def update_compilers(base_path, config: Config, commit=False):
c = config
print("[*] Checking Windows Build Tools")
Expand Down Expand Up @@ -270,7 +286,7 @@ def update_llvm_compiler(max_recurse=1):
elif choice.lower() == "y":
download = True
except:
continue
pass
if download:
max_recurse -= 1
print("[+] Downloading LLVM, the process may take minutes (~500MB)")
Expand All @@ -281,7 +297,9 @@ def update_llvm_compiler(max_recurse=1):
print(f"[+] Unpacking downloaded file into {str(destination)}")
with py7zr.SevenZipFile(path, mode='r') as z:
z.extractall(path=str(destination))
update_llvm_compiler(max_recurse=max_recurse)
else:
print("No Download")
#update_llvm_compiler(max_recurse=max_recurse)


def update_signers():
Expand Down