Browse Source

Remove gen-qtcreator-config.py

master
Aqua-sama 1 month ago
parent
commit
b5f340c464
Signed by: Aqua-sama <aqua@iserlohn-fortress.net> GPG Key ID: 5378B8349C1D5ADA
2 changed files with 0 additions and 71 deletions
  1. 0
    6
      meson.build
  2. 0
    65
      tools/gen-qtcreator-config.py

+ 0
- 6
meson.build View File

@@ -5,12 +5,6 @@ project('smolbote', 'cpp',
meson_version: '>=0.49.0'
)

# autogenerate qtcreator project files
# add_postconf_script(script_name, arg1, arg2, ...)
# will run the executable given as an argument after all project files have been generated.
# This script will have the environment variables MESON_SOURCE_ROOT and MESON_BUILD_ROOT set.
#meson.add_postconf_script('tools/gen-qtcreator-config.py', '--prefix=../smolbote', '.')

# add -DQT_NO_DEBUG to non-debug builds
if not get_option('debug')
add_project_arguments('-DQT_NO_DEBUG', language: 'cpp')

+ 0
- 65
tools/gen-qtcreator-config.py View File

@@ -1,65 +0,0 @@
#!/usr/bin/env python3

import argparse
import subprocess
import os
import json

def readable_dir(prospective_dir):
if not os.path.isdir(prospective_dir):
raise Exception("readable_dir:{0} is not a valid path".format(prospective_dir))
if os.access(prospective_dir, os.R_OK):
return prospective_dir
else:
raise Exception("readable_dir:{0} is not a readable dir".format(prospective_dir))


parser = argparse.ArgumentParser(description='Generate QtCreator profject files')
parser.add_argument('--prefix', type=str, default='project', help='Project name prefix')
parser.add_argument('builddir', type=readable_dir, default='.', help='Build directory')

args = parser.parse_args()

# get targets
targets_json = json.loads(subprocess.run(['meson', 'introspect', '--targets', args.builddir], stdout=subprocess.PIPE).stdout.decode('utf8'))

#s = json.dumps(targets_json, indent=4)
#print(s)

targets = []
for target in targets_json:
targets.append(target['id'])

# prefix.files
with open(args.prefix + '.files', 'w') as output:
for target in targets:
files_json = json.loads(subprocess.run(['meson', 'introspect', '--target-files', target, args.builddir], stdout=subprocess.PIPE).stdout.decode('utf8'))
for f in files_json:
output.write(f + '\n')

# includes
incs = set()
defs = set()

deps_json = json.loads(subprocess.run(['meson', 'introspect', '--dependencies', args.builddir], stdout=subprocess.PIPE).stdout.decode('utf8'))
for dep in deps_json:
for arg in dep['compile_args']:
if arg.startswith('-I'):
incs.add(arg)
elif arg.startswith('-D'):
defs.add(arg)

# prefix.includes
with open(args.prefix + '.includes', 'w') as output:
# dependency includes
for include in incs:
output.write(include[2:] + '\n')

# TODO: properly grab autogenerated include locations
for target in targets_json:
output.write(os.path.join(args.builddir, os.path.dirname(target['filename']), target['id']) + '\n')

# prefix.config
with open(args.prefix + '.config', 'w') as output:
for define in defs:
output.write('#define ' + define[2:] + '\n')

Loading…
Cancel
Save