| 12 | import re |
| 13 | |
| 14 | def main(): |
| 15 | cxx = 'g++' |
| 16 | if 2 == len(sys.argv): |
| 17 | cxx = sys.argv[1] |
| 18 | |
| 19 | cmd = [cxx, '-E', '-x', 'c++', '-v', '/dev/null'] |
| 20 | p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 21 | stdout, stderr = p.communicate() |
| 22 | |
| 23 | m = re.findall(b'\n (/.*)', stderr) |
| 24 | |
| 25 | includes = '' |
| 26 | |
| 27 | for x in m: |
| 28 | if -1 != x.find(b'(framework directory)'): |
| 29 | continue |
| 30 | |
| 31 | includes += '-isystem%s ' % os.path.normpath(x.decode()) |
| 32 | |
| 33 | print(includes) |
| 34 | |
| 35 | return 1 |
| 36 | #------------------------------------------------------------------------------ |
| 37 | |
| 38 | sys.exit(main()) |