-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile_c.py
74 lines (57 loc) · 2.43 KB
/
compile_c.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/python3
# This file compiles all c files in the repository
import os
import sys
import glob
qn = str(input("Is BOOST Library installed? (yes/no) ")).lower()
if qn == "no":
opsystem = str(input("Are you on Linux or macOS? (linux/macos) ")).lower()
if opsystem == "linux":
os.system("apt-get install libboost-all-dev -y")
files = glob.glob("*/*.c")
if len(files) <= 0:
print("No c files found!")
sys.exit()
for filename in files:
if filename == "cloud.c":
filestriped = filename[:-2]
os.system(f"g++ {filename} -o {filestriped} -ltfhe-spqlios-fma -fopenmp")
filestriped = filename[:-2]
os.system(f"g++ {filename} -o {filestriped} -ltfhe-spqlios-fma")
print(f"\nCompiling {filename}")
os.system("chmod u+x */*")
print(f"\n{len(files)} files compiled. Please check for errors in compliation.")
elif opsystem == "macos":
os.system("brew install boost")
files = glob.glob("*/*.c")
if len(files) <= 0:
print("No c files found!")
sys.exit()
for filename in files:
if filename == "cloud.c":
filestriped = filename[:-2]
os.system(f"g++ {filename} -o {filestriped} -ltfhe-spqlios-fma -fopenmp")
filestriped = filename[:-2]
os.system(f"g++ {filename} -o {filestriped} -ltfhe-spqlios-fma")
print(f"\nCompiling {filename}")
os.system("chmod u+x */*")
print(f"\n{len(files)} files compiled. Please check for errors in compliation.")
else:
print("You did not specify an operating system (linux/macos). BOOST will not be installed.")
print("No action taken. Have a nice day :)")
elif qn == "yes":
files = glob.glob("*/*.c")
if len(files) <= 0:
print("No c files found!")
sys.exit()
for filename in files:
if filename == "cloud.c":
filestriped = filename[:-2]
os.system(f"g++ {filename} -o {filestriped} -ltfhe-spqlios-fma -fopenmp")
filestriped = filename[:-2]
os.system(f"g++ {filename} -o {filestriped} -ltfhe-spqlios-fma")
print(f"\nCompiling {filename}")
os.system("chmod u+x */*")
print(f"\n{len(files)} files compiled. Please check for errors in compliation.")
else:
print("No action taken. Have a nice day :)")