Skip to content

Instantly share code, notes, and snippets.

@shibukawa
Last active August 29, 2015 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shibukawa/835e45663e9b057b4123 to your computer and use it in GitHub Desktop.
Save shibukawa/835e45663e9b057b4123 to your computer and use it in GitHub Desktop.
qmakeの使える名前一覧をダンプ
import os
import sys
import re
includeMatch = re.compile(r"include\((.+?)\)")
platformMatch = re.compile(r"QMAKE_PLATFORM\s*(\+)?=\s*(.+)")
spaceMatch = re.compile(r"\s+")
class Conf(object):
def __init__(self, dirpath, filepath, name=""):
print("reading %s..." % filepath)
self.specs = []
self.platforms = set()
self.overwrite = False
self.name = name
for line in open(filepath):
match = includeMatch.match(line)
if match:
include_path = os.path.abspath(os.path.join(dirpath, match.group(1)))
self.specs.append(include_path)
else:
match = platformMatch.match(line)
if match:
self.overwrite = bool(match.group(1))
self.platforms = set(spaceMatch.split(match.group(2)))
if "$$QMAKE_PLATFORMS" in self.platforms:
self.platforms.remove("$$QMAKE_PLATFORMS")
def __repr__(self):
return "%s: %s" % (self.name, ", ".join(self.platforms))
commonconfs = {}
rootconfs = []
def main():
if len(sys.argv) != 2:
print("%s [mkspecs dir path]" % sys.argv[0])
sys.exit(1)
mkspec_path = sys.argv[1]
common_path = os.path.join(mkspec_path, "common")
print("reading common")
for root, dirs, files in os.walk(common_path):
for filename in files:
if not filename.endswith(".conf"):
continue
fullpath = os.path.join(root, filename)
commonconfs[fullpath] = Conf(root, fullpath)
print("reading mkspecs")
for dirname in os.listdir(mkspec_path):
if dirname == "common":
continue
confpath = os.path.join(mkspec_path, dirname, "qmake.conf")
if not os.path.exists(confpath):
continue
conf = Conf(os.path.join(mkspec_path, dirname), confpath, dirname)
rootconfs.append(conf)
commonconfs[confpath] = conf
platformmap = {}
for conf in rootconfs:
specs = conf.specs
while specs:
nextspecs = set()
for specname in specs:
if specname not in commonconfs:
print("read error: %s" % specname)
continue
spec = commonconfs[specname]
for nextspec in spec.specs:
nextspecs.add(nextspec)
for platform in spec.platforms:
conf.platforms.add(platform)
specs = nextspecs
print(conf)
for platform in conf.platforms:
platformmap.setdefault(platform, []).append(conf.name)
for key, values in sorted(platformmap.items()):
print("%s:" % key)
print(" %s" % ", ".join(values))
if __name__ == "__main__":
main()
aix:
aix-g++, aix-g++-64, aix-xlc, aix-xlc-64
android:
android-g++
blackberry:
blackberry-armle-v7-qcc, blackberry-armv7le-qcc, blackberry-x86-qcc
bsd:
freebsd-g++, freebsd-g++46, freebsd-icc, netbsd-g++, openbsd-g++
cygwin:
cygwin-g++
darwin:
darwin-g++, macx-clang, macx-clang-32, macx-g++, macx-g++-32, macx-g++40, macx-g++42, macx-icc, macx-ios-clang, macx-llvm
freebsd:
freebsd-g++, freebsd-g++46, freebsd-icc
hpux:
hpux-acc, hpux-acc-64, hpux-acc-o64, hpux-g++, hpux-g++-64, hpuxi-acc-32, hpuxi-acc-64, hpuxi-g++-64
hurd:
hurd-g++
ios:
macx-ios-clang
irix:
irix-cc, irix-cc-64, irix-g++, irix-g++-64
linux:
android-g++, linux-arm-gnueabi-g++, linux-clang, linux-clang-libc++, linux-cxx, linux-g++, linux-g++-32, linux-g++-64, linux-g++-maemo, linux-icc, linux-icc-32, linux-icc-64, linux-kcc, linux-llvm, linux-lsb-g++, linux-pgcc
lynxos:
lynxos-g++
mac:
darwin-g++, macx-clang, macx-clang-32, macx-g++, macx-g++-32, macx-g++40, macx-g++42, macx-icc, macx-ios-clang, macx-llvm
macx:
darwin-g++, macx-clang, macx-clang-32, macx-g++, macx-g++-32, macx-g++40, macx-g++42, macx-icc, macx-llvm
maemo:
linux-g++-maemo
mingw:
win32-g++
netbsd:
netbsd-g++
openbsd:
openbsd-g++
osx:
darwin-g++, macx-clang, macx-clang-32, macx-g++, macx-g++-32, macx-g++40, macx-g++42, macx-icc, macx-llvm
posix:
aix-g++, aix-g++-64, aix-xlc, aix-xlc-64, android-g++, blackberry-armle-v7-qcc, blackberry-armv7le-qcc, blackberry-x86-qcc, cygwin-g++, darwin-g++, freebsd-g++, freebsd-g++46, freebsd-icc, hpux-acc, hpux-acc-64, hpux-acc-o64, hpux-g++, hpux-g++-64, hpuxi-acc-32, hpuxi-acc-64, hpuxi-g++-64, hurd-g++, irix-cc, irix-cc-64, irix-g++, irix-g++-64, linux-arm-gnueabi-g++, linux-clang, linux-clang-libc++, linux-cxx, linux-g++, linux-g++-32, linux-g++-64, linux-g++-maemo, linux-icc, linux-icc-32, linux-icc-64, linux-kcc, linux-llvm, linux-lsb-g++, linux-pgcc, lynxos-g++, macx-clang, macx-clang-32, macx-g++, macx-g++-32, macx-g++40, macx-g++42, macx-icc, macx-ios-clang, macx-llvm, netbsd-g++, openbsd-g++, qnx-armle-v7-qcc, qnx-armv7le-qcc, qnx-x86-qcc, sco-cc, sco-g++, solaris-cc, solaris-cc-64, solaris-cc-64-stlport, solaris-cc-stlport, solaris-g++, solaris-g++-64, tru64-cxx, tru64-g++, unixware-cc, unixware-g++
qnx:
blackberry-armle-v7-qcc, blackberry-armv7le-qcc, blackberry-x86-qcc, qnx-armle-v7-qcc, qnx-armv7le-qcc, qnx-x86-qcc
sco:
sco-cc, sco-g++
solaris:
solaris-cc, solaris-cc-64, solaris-cc-64-stlport, solaris-cc-stlport, solaris-g++, solaris-g++-64
tru64:
tru64-cxx, tru64-g++
unix:
aix-g++, aix-g++-64, aix-xlc, aix-xlc-64, android-g++, blackberry-armle-v7-qcc, blackberry-armv7le-qcc, blackberry-x86-qcc, cygwin-g++, darwin-g++, freebsd-g++, freebsd-g++46, freebsd-icc, hpux-acc, hpux-acc-64, hpux-acc-o64, hpux-g++, hpux-g++-64, hpuxi-acc-32, hpuxi-acc-64, hpuxi-g++-64, hurd-g++, irix-cc, irix-cc-64, irix-g++, irix-g++-64, linux-arm-gnueabi-g++, linux-clang, linux-clang-libc++, linux-cxx, linux-g++, linux-g++-32, linux-g++-64, linux-g++-maemo, linux-icc, linux-icc-32, linux-icc-64, linux-kcc, linux-llvm, linux-lsb-g++, linux-pgcc, lynxos-g++, macx-clang, macx-clang-32, macx-g++, macx-g++-32, macx-g++40, macx-g++42, macx-icc, macx-ios-clang, macx-llvm, netbsd-g++, openbsd-g++, qnx-armle-v7-qcc, qnx-armv7le-qcc, qnx-x86-qcc, sco-cc, sco-g++, solaris-cc, solaris-cc-64, solaris-cc-64-stlport, solaris-cc-stlport, solaris-g++, solaris-g++-64, tru64-cxx, tru64-g++, unixware-cc, unixware-g++
unixware:
unixware-cc, unixware-g++
win32:
win32-g++, win32-icc, win32-msvc2005, win32-msvc2008, win32-msvc2010, win32-msvc2012, win32-msvc2013, wince60standard-armv4i-msvc2005, wince60standard-x86-msvc2005, wince70embedded-armv4i-msvc2008, wince70embedded-x86-msvc2008, winphone-arm-msvc2012, winphone-arm-msvc2013, winphone-x86-msvc2012, winphone-x86-msvc2013, winrt-arm-msvc2012, winrt-arm-msvc2013, winrt-x64-msvc2012, winrt-x64-msvc2013, winrt-x86-msvc2012, winrt-x86-msvc2013
wince:
wince60standard-armv4i-msvc2005, wince60standard-x86-msvc2005, wince70embedded-armv4i-msvc2008, wince70embedded-x86-msvc2008
winphone:
winphone-arm-msvc2012, winphone-arm-msvc2013, winphone-x86-msvc2012, winphone-x86-msvc2013
winrt:
winphone-arm-msvc2012, winphone-arm-msvc2013, winphone-x86-msvc2012, winphone-x86-msvc2013, winrt-arm-msvc2012, winrt-arm-msvc2013, winrt-x64-msvc2012, winrt-x64-msvc2013, winrt-x86-msvc2012, winrt-x86-msvc2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment