• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/python
2
3import os
4import subprocess
5import sys
6import shutil
7
8pre_dir = os.path.abspath(os.path.dirname(os.getcwd()))
9config_dir = os.path.join(os.path.dirname(pre_dir),'script')
10sys.path.append(config_dir)
11
12from config_args import linux_args
13
14build_args=[]
15build_args.extend(linux_args)
16
17def rm_build():
18    if os.path.exists("build") and os.path.isdir("build"):
19        shutil.rmtree("build")
20    while True:
21        if not os.path.exists("build"):
22            break
23
24def build_linux():
25    rm_build()
26    os.mkdir("build")
27    build_cmd = "cmake " + (" ".join(build_args))+ " .."
28    print(build_cmd)
29    subprocess.Popen(build_cmd,cwd='build',shell=True).wait()
30    subprocess.Popen('make',cwd='build',shell=True).wait()
31    rm_build()
32
33if __name__ == '__main__':
34    build_linux()
35