build.py 921 字节
Newer Older
M
maweiye 已提交
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
#!/bin/env python

import os
import sys
import subprocess
import shutil

pre_dir = os.path.abspath(os.path.dirname(os.getcwd()))
config_dir = os.path.join(os.path.dirname(pre_dir),'script')
sys.path.append(config_dir)

from config_args import linux_args

# Add libFuzz compile options
fuzz_flags = [ "-DCMAKE_EXE_LINKER_FLAGS=-fsanitize=fuzzer" ]

build_args=[]
build_args.extend(linux_args)
# build_args.extend(fuzz_flags)

def rm_build():
    if os.path.exists("build") and os.path.isdir("build"):
        shutil.rmtree("build")
    while True:
        if not os.path.exists("build"):
            break

def build_linux():
    rm_build()
    os.mkdir("build")
    build_cmd = "cmake " + (" ".join(build_args))+ " .."
    print(build_cmd)
    subprocess.Popen(build_cmd,cwd='build',shell=True).wait()
    subprocess.Popen('make',cwd='build',shell=True).wait()
    rm_build()

if __name__ == '__main__':
    build_linux()