-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-samples.py
64 lines (51 loc) · 1.55 KB
/
run-samples.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
import os
from maker import Maker
def runOneSample():
try:
sampleDir = "samples/sample-multi-exe"
buildDir = sampleDir + "/build"
mkr = Maker()
# load source
mkr.load(sampleDir)
print("Files to convert into objects:")
mkr.printListSources()
print("Files becoming executables:")
mkr.printListExecs()
print("Folders with header files to include:")
mkr.printListIncludeFolders()
print("Dependencies for each file:")
mkr.printListDependencies()
# compile
mkr.build(buildDir, run=False, clean=True)
# create makefile
mkr.createMakefile(buildDir)
except Exception as ex:
print(ex)
def runAllSamples():
samples = [
"sample-multi-exe",
"sample-no-exe",
"sample-one-exe",
"sample-one-exe-complex"]
try:
# the maker object
mkr = Maker()
for i, sample in enumerate(samples):
print("*"*50)
print(f"{i+1}. run: {sample}")
sourceDir = f"samples/{sample}"
buildDir = f"{sourceDir}/build"
# load source
mkr.load(sourceDir)
# create makefile
mkr.createMakefile(buildDir)
# ..or build without the need of a makefile
#mkr.build(build)
# run make with that makefile
cmd = f"cd {sourceDir} && make clean && make"
print(cmd)
os.system(cmd)
except Exception as ex:
print(ex)
runAllSamples()
#runOneSample()