forked from P2PSP/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.py
executable file
·44 lines (35 loc) · 873 Bytes
/
make.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
#!/usr/bin/env python2
import os
import sys
import shutil
import platform
bin_dir = 'bin'
build_dir = 'build'
only_cmake = False
if len(sys.argv) >= 2:
if sys.argv[1] == 'clean':
os.system('git clean -dfx')
quit()
elif sys.argv[1] == 'only-cmake':
only_cmake = True
if not os.path.exists(bin_dir):
try:
shutil.rmtree(bin_dir)
except:
pass
if not os.path.exists(build_dir):
try:
shutil.rmtree(build_dir)
except:
pass
os.makedirs(build_dir)
sys_name = platform.system()
if sys_name == 'Linux':
print '\nMaking for Linux...\n'
if os.system('cd build && cmake .. && echo') == 0:
if not only_cmake:
os.system('cd build && make')
elif sys_name == 'Darwin':
print '\nMaking for OS X...\n'
elif sys_name == 'Windows':
print '\nMaking for Windows...\n'