def find_git_root():
pipe = subprocess.Popen(['git', 'rev-parse', '--show-toplevel'],
stdout=subprocess.PIPE)
repo_dir = pipe.communicate()[0].rstrip().decode('utf-8')
return repo_dir
def gen_recursive_include_path(dir):
subdirs = [x[0] for x in os.walk(dir) if "CMake" not in x[0]]
include_path = []
for x in subdirs:
include_path.extend(['-I', x])
return include_path
flags = flags + gen_recursive_include_path(find_git_root() + '/src')
flags = flags + gen_recursive_include_path(find_git_root() + '/build/src')