Created
February 19, 2016 07:14
-
-
Save FlandreDaisuki/d80f6e3ed9402e6400ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
import subprocess | |
import sys | |
import re | |
cflags = subprocess.getoutput('pkg-config --cflags --libs opencv') | |
# print(cflags) | |
cpp = sys.argv[1] | |
cmpl = 'g++ {} {}'.format(cpp, cflags) | |
print(cmpl) | |
cmpl_msg = subprocess.getoutput(cmpl) | |
if cmpl_msg: | |
m = re.search('cannot find\s*(\S+)', cmpl_msg) | |
if m: | |
cmpl_x = re.sub(m.group(1), '', cmpl) | |
subprocess.getoutput(cmpl_x) | |
else: | |
print(cmpl_msg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment