-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup.py
More file actions
31 lines (27 loc) · 1.18 KB
/
setup.py
File metadata and controls
31 lines (27 loc) · 1.18 KB
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
import sys
sys.path.append('scripts')
import os
from timedprocess import Command
import argparse
def main():
parser = argparse.ArgumentParser(description='Setup Project')
parser.add_argument('--cc', type=int, help='Compute Capability', default=70)
args = parser.parse_args()
async_flag = "CC{}".format(str(args.cc))
sync_flag = "CC{}".format(str(args.cc))
if args.cc >= 70:
async_flag += "_ASYNC"
sync_flag += "_SYNC"
if os.name == 'nt': # If on Windows
Command("cmake -B build -D{}=ON -DSYNC_BUILD=OFF".format(async_flag)).run()
Command("msbuild build/GPUMemoryManagers.sln /p:Configuration=Release").run()
Command("cmake -B sync_build -D{}=ON -DSYNC_BUILD=ON".format(sync_flag)).run()
Command("msbuild sync_build/GPUMemoryManagers.sln /p:Configuration=Release").run()
else: # If on Linux
Command("mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -D{}=ON -DSYNC_BUILD=OFF".format(async_flag)).run()
Command("cd build && make").run()
Command("mkdir sync_build && cd sync_build && cmake .. -DCMAKE_BUILD_TYPE=Release -D{}=ON -DSYNC_BUILD=ON".format(sync_flag)).run()
Command("cd sync_build && make").run()
print("Setup done!")
if __name__ == "__main__":
main()